diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:54:13 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | 47d20b54f9a65b08aa602a1866c1b59a69088dfc (patch) | |
tree | e3241dd169bda79544a36248e834a4bebe298418 | |
parent | c411b485b63a671a1e276700cff025c73997233c (diff) | |
download | edk2-47d20b54f9a65b08aa602a1866c1b59a69088dfc.tar.gz edk2-47d20b54f9a65b08aa602a1866c1b59a69088dfc.tar.bz2 edk2-47d20b54f9a65b08aa602a1866c1b59a69088dfc.zip |
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>
211 files changed, 30285 insertions, 27020 deletions
diff --git a/ShellPkg/Application/AcpiViewApp/AcpiViewApp.c b/ShellPkg/Application/AcpiViewApp/AcpiViewApp.c index 2f650c9d92..031f3b9769 100644 --- a/ShellPkg/Application/AcpiViewApp/AcpiViewApp.c +++ b/ShellPkg/Application/AcpiViewApp/AcpiViewApp.c @@ -21,7 +21,7 @@ // the resource section. Thus the application can use '-?' option to show help message in
// Shell.
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_ACPIVIEW);
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_ACPIVIEW);
/**
Application Entry Point wrapper around the shell command
diff --git a/ShellPkg/Application/Shell/ConsoleLogger.c b/ShellPkg/Application/Shell/ConsoleLogger.c index 36ba3ac225..abef0a60d6 100644 --- a/ShellPkg/Application/Shell/ConsoleLogger.c +++ b/ShellPkg/Application/Shell/ConsoleLogger.c @@ -23,15 +23,16 @@ @sa InstallProtocolInterface
**/
EFI_STATUS
-ConsoleLoggerInstall(
- IN CONST UINTN ScreensToSave,
- OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo
+ConsoleLoggerInstall (
+ IN CONST UINTN ScreensToSave,
+ OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo
)
{
- EFI_STATUS Status;
- ASSERT(ConsoleInfo != NULL);
+ EFI_STATUS Status;
- (*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);
}
@@ -90,10 +91,10 @@ ConsoleLoggerInstall( //
gST->Hdr.CRC32 = 0;
gBS->CalculateCrc32 (
- (UINT8 *)&gST->Hdr,
- gST->Hdr.HeaderSize,
- &gST->Hdr.CRC32
- );
+ (UINT8 *)&gST->Hdr,
+ gST->Hdr.HeaderSize,
+ &gST->Hdr.CRC32
+ );
return (Status);
}
@@ -107,38 +108,47 @@ ConsoleLoggerInstall( @return other The operation failed. This was from UninstallProtocolInterface.
**/
EFI_STATUS
-ConsoleLoggerUninstall(
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+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;
- gST->ConOut = ConsoleInfo->OldConOut;
+ gST->ConOut = ConsoleInfo->OldConOut;
//
// Update the CRC32 in the EFI System Table header
//
gST->Hdr.CRC32 = 0;
gBS->CalculateCrc32 (
- (UINT8 *)&gST->Hdr,
- gST->Hdr.HeaderSize,
- &gST->Hdr.CRC32
- );
+ (UINT8 *)&gST->Hdr,
+ gST->Hdr.HeaderSize,
+ &gST->Hdr.CRC32
+ );
- return (gBS->UninstallProtocolInterface(gImageHandle, &gEfiSimpleTextOutProtocolGuid, (VOID*)&ConsoleInfo->OurConOut));
+ return (gBS->UninstallProtocolInterface (gImageHandle, &gEfiSimpleTextOutProtocolGuid, (VOID *)&ConsoleInfo->OurConOut));
}
/**
@@ -154,29 +164,29 @@ ConsoleLoggerUninstall( @param[in] ConsoleInfo The pointer to the instance of the console logger information.
**/
EFI_STATUS
-ConsoleLoggerDisplayHistory(
- IN CONST BOOLEAN Forward,
- IN CONST UINTN Rows,
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerDisplayHistory (
+ IN CONST BOOLEAN Forward,
+ IN CONST UINTN Rows,
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
)
{
- UINTN RowChange;
+ UINTN RowChange;
- ASSERT(ConsoleInfo != NULL);
+ ASSERT (ConsoleInfo != NULL);
//
// Calculate the row number change
//
switch (Rows) {
- case ((UINTN)(-1)):
- RowChange = ConsoleInfo->RowsPerScreen;
- break;
- case (0):
- RowChange = ConsoleInfo->RowsPerScreen / 2;
- break;
- default:
- RowChange = Rows;
- break;
+ case ((UINTN)(-1)):
+ RowChange = ConsoleInfo->RowsPerScreen;
+ break;
+ case (0):
+ RowChange = ConsoleInfo->RowsPerScreen / 2;
+ break;
+ default:
+ RowChange = Rows;
+ break;
}
//
@@ -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(
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+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,55 +265,57 @@ ConsoleLoggerStopHistory( @return other The operation failed.
**/
EFI_STATUS
-UpdateDisplayFromHistory(
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+UpdateDisplayFromHistory (
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
)
{
- EFI_STATUS Status;
- EFI_STATUS RetVal;
- CHAR16 *Screen;
- INT32 *Attributes;
- UINTN CurrentRow;
- CHAR16 TempCharHolder;
- UINTN Column;
- INT32 CurrentAttrib;
- UINTN CurrentColumn;
- CHAR16 *StringSegment;
- CHAR16 *StringSegmentEnd;
- CHAR16 StringSegmentEndChar;
- INT32 OrigAttribute;
-
- ASSERT(ConsoleInfo != NULL);
+ EFI_STATUS Status;
+ EFI_STATUS RetVal;
+ CHAR16 *Screen;
+ INT32 *Attributes;
+ UINTN CurrentRow;
+ CHAR16 TempCharHolder;
+ UINTN Column;
+ INT32 CurrentAttrib;
+ UINTN CurrentColumn;
+ CHAR16 *StringSegment;
+ CHAR16 *StringSegmentEnd;
+ CHAR16 StringSegmentEndChar;
+ INT32 OrigAttribute;
+
+ ASSERT (ConsoleInfo != NULL);
TempCharHolder = CHAR_NULL;
- RetVal = EFI_SUCCESS;
- OrigAttribute = ConsoleInfo->OldConOut->Mode->Attribute;
+ RetVal = EFI_SUCCESS;
+ OrigAttribute = ConsoleInfo->OldConOut->Mode->Attribute;
//
// Disable cursor visibility and move it to the top left corner
//
- ConsoleInfo->OldConOut->EnableCursor (ConsoleInfo->OldConOut, FALSE);
- ConsoleInfo->OldConOut->SetCursorPosition (ConsoleInfo->OldConOut, 0, 0);
+ ConsoleInfo->OldConOut->EnableCursor (ConsoleInfo->OldConOut, FALSE);
+ ConsoleInfo->OldConOut->SetCursorPosition (ConsoleInfo->OldConOut, 0, 0);
- Screen = &ConsoleInfo->Buffer[(ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->CurrentStartRow];
+ Screen = &ConsoleInfo->Buffer[(ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->CurrentStartRow];
Attributes = &ConsoleInfo->Attributes[ConsoleInfo->ColsPerScreen * ConsoleInfo->CurrentStartRow];
for ( CurrentRow = 0
- ; CurrentRow < ConsoleInfo->RowsPerScreen
- ; CurrentRow++
- , Screen += (ConsoleInfo->ColsPerScreen + 2)
- , Attributes += ConsoleInfo->ColsPerScreen
- ){
+ ; CurrentRow < ConsoleInfo->RowsPerScreen
+ ; CurrentRow++,
+ Screen += (ConsoleInfo->ColsPerScreen + 2),
+ Attributes += ConsoleInfo->ColsPerScreen
+ )
+ {
//
// dont use the last char - prevents screen scroll
//
- if (CurrentRow == (ConsoleInfo->RowsPerScreen-1)){
- TempCharHolder = Screen[ConsoleInfo->ColsPerScreen - 1];
+ if (CurrentRow == (ConsoleInfo->RowsPerScreen-1)) {
+ TempCharHolder = Screen[ConsoleInfo->ColsPerScreen - 1];
Screen[ConsoleInfo->ColsPerScreen - 1] = CHAR_NULL;
}
for ( Column = 0
- ; Column < ConsoleInfo->ColsPerScreen
- ; Column++
- ){
+ ; Column < ConsoleInfo->ColsPerScreen
+ ; Column++
+ )
+ {
if (Screen[Column] != CHAR_NULL) {
CurrentAttrib = Attributes[Column];
CurrentColumn = Column;
@@ -316,10 +328,11 @@ UpdateDisplayFromHistory( //
StringSegmentEndChar = CHAR_NULL;
for ( StringSegmentEnd = StringSegment
- ; *StringSegmentEnd != CHAR_NULL
- ; StringSegmentEnd++
- , Column++
- ){
+ ; *StringSegmentEnd != CHAR_NULL
+ ; 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;
}
@@ -346,7 +359,7 @@ UpdateDisplayFromHistory( // a segment with that new attribute
//
if (StringSegmentEndChar != CHAR_NULL) {
- *StringSegmentEnd = StringSegmentEndChar;
+ *StringSegmentEnd = StringSegmentEndChar;
StringSegmentEndChar = CHAR_NULL;
Column--;
}
@@ -358,7 +371,7 @@ UpdateDisplayFromHistory( //
if (TempCharHolder != CHAR_NULL) {
Screen[ConsoleInfo->ColsPerScreen - 1] = TempCharHolder;
- TempCharHolder = CHAR_NULL;
+ TempCharHolder = CHAR_NULL;
}
} // row for loop
@@ -368,27 +381,27 @@ UpdateDisplayFromHistory( //
if (ConsoleInfo->CurrentStartRow == ConsoleInfo->OriginalStartRow) {
ConsoleInfo->OldConOut->SetAttribute (
- ConsoleInfo->OldConOut,
- ConsoleInfo->HistoryMode.Attribute
- );
+ ConsoleInfo->OldConOut,
+ ConsoleInfo->HistoryMode.Attribute
+ );
ConsoleInfo->OldConOut->SetCursorPosition (
- ConsoleInfo->OldConOut,
- ConsoleInfo->HistoryMode.CursorColumn,
- ConsoleInfo->HistoryMode.CursorRow - ConsoleInfo->OriginalStartRow
- );
+ ConsoleInfo->OldConOut,
+ ConsoleInfo->HistoryMode.CursorColumn,
+ ConsoleInfo->HistoryMode.CursorRow - ConsoleInfo->OriginalStartRow
+ );
Status = ConsoleInfo->OldConOut->EnableCursor (
- ConsoleInfo->OldConOut,
- ConsoleInfo->HistoryMode.CursorVisible
- );
+ ConsoleInfo->OldConOut,
+ ConsoleInfo->HistoryMode.CursorVisible
+ );
if (EFI_ERROR (Status)) {
RetVal = Status;
}
} else {
ConsoleInfo->OldConOut->SetAttribute (
- ConsoleInfo->OldConOut,
- OrigAttribute
- );
+ ConsoleInfo->OldConOut,
+ OrigAttribute
+ );
}
return (RetVal);
@@ -407,13 +420,14 @@ UpdateDisplayFromHistory( EFI_STATUS
EFIAPI
ConsoleLoggerReset (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
)
{
- EFI_STATUS Status;
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
- ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
+ EFI_STATUS Status;
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+
+ ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
//
// Forward the request to the original ConOut
@@ -424,10 +438,10 @@ 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;
+ ConsoleInfo->CurrentStartRow = 0;
}
}
@@ -443,9 +457,9 @@ ConsoleLoggerReset ( @param[in] ConsoleInfo The pointer to the instance of the console logger information.
**/
EFI_STATUS
-AppendStringToHistory(
- IN CONST CHAR16 *String,
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+AppendStringToHistory (
+ IN CONST CHAR16 *String,
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
)
{
CONST CHAR16 *Walker;
@@ -453,127 +467,135 @@ AppendStringToHistory( UINTN PrintIndex;
UINTN Index;
- ASSERT(ConsoleInfo != NULL);
+ ASSERT (ConsoleInfo != NULL);
for ( Walker = String
- ; Walker != NULL && *Walker != CHAR_NULL
- ; Walker++
- ){
+ ; 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));
-
- //
- // 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(
- ConsoleInfo->Attributes,
- ConsoleInfo->Attributes + ConsoleInfo->ColsPerScreen,
- CopySize
- );
-
- for ( Index = 0
- ; Index < ConsoleInfo->ColsPerScreen
- ; Index++
- ){
- *(ConsoleInfo->Attributes + (CopySize/sizeof(ConsoleInfo->Attributes[0])) + Index) = ConsoleInfo->HistoryMode.Attribute;
+ case (CHAR_BACKSPACE):
+ if (ConsoleInfo->HistoryMode.CursorColumn > 0) {
+ ConsoleInfo->HistoryMode.CursorColumn--;
}
- //
- // scroll history buffer 'up' 1 row and set the last row to spaces (L' ')
- //
- CopySize = (ConsoleInfo->ColsPerScreen + 2)
- * ((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount) - 1)
- * sizeof(ConsoleInfo->Buffer[0]);
- ASSERT(CopySize < ConsoleInfo->BufferSize);
- CopyMem(
- ConsoleInfo->Buffer,
- ConsoleInfo->Buffer + (ConsoleInfo->ColsPerScreen + 2),
- CopySize
- );
+ 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));
+
+ //
+ // 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 (
+ ConsoleInfo->Attributes,
+ ConsoleInfo->Attributes + ConsoleInfo->ColsPerScreen,
+ CopySize
+ );
+
+ for ( Index = 0
+ ; Index < ConsoleInfo->ColsPerScreen
+ ; Index++
+ )
+ {
+ *(ConsoleInfo->Attributes + (CopySize/sizeof (ConsoleInfo->Attributes[0])) + Index) = ConsoleInfo->HistoryMode.Attribute;
+ }
- //
- // Set that last row of chars to spaces
- //
- SetMem16(((UINT8*)ConsoleInfo->Buffer)+CopySize, ConsoleInfo->ColsPerScreen*sizeof(CHAR16), L' ');
- } else {
- //
- // we are not on the last row
- //
+ //
+ // scroll history buffer 'up' 1 row and set the last row to spaces (L' ')
+ //
+ CopySize = (ConsoleInfo->ColsPerScreen + 2)
+ * ((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount) - 1)
+ * sizeof (ConsoleInfo->Buffer[0]);
+ ASSERT (CopySize < ConsoleInfo->BufferSize);
+ CopyMem (
+ ConsoleInfo->Buffer,
+ ConsoleInfo->Buffer + (ConsoleInfo->ColsPerScreen + 2),
+ CopySize
+ );
+
+ //
+ // Set that last row of chars to spaces
+ //
+ SetMem16 (((UINT8 *)ConsoleInfo->Buffer)+CopySize, ConsoleInfo->ColsPerScreen*sizeof (CHAR16), L' ');
+ } else {
+ //
+ // we are not on the last row
+ //
+
+ //
+ // We should not be scrolling history
+ //
+ ASSERT (ConsoleInfo->OriginalStartRow == ConsoleInfo->CurrentStartRow);
+ //
+ // are we at the end of a row?
+ //
+ if (ConsoleInfo->HistoryMode.CursorRow == (INT32)(ConsoleInfo->OriginalStartRow + ConsoleInfo->RowsPerScreen - 1)) {
+ ConsoleInfo->OriginalStartRow++;
+ ConsoleInfo->CurrentStartRow++;
+ }
+
+ ConsoleInfo->HistoryMode.CursorRow++;
+ }
+ break;
+ case (CHAR_CARRIAGE_RETURN):
//
- // We should not be scrolling history
+ // Move the cursor to the beginning of the current row.
//
- ASSERT (ConsoleInfo->OriginalStartRow == ConsoleInfo->CurrentStartRow);
+ ConsoleInfo->HistoryMode.CursorColumn = 0;
+ break;
+ default:
//
- // are we at the end of a row?
+ // Acrtually print characters into the history buffer
//
- if (ConsoleInfo->HistoryMode.CursorRow == (INT32) (ConsoleInfo->OriginalStartRow + ConsoleInfo->RowsPerScreen - 1)) {
- ConsoleInfo->OriginalStartRow++;
- ConsoleInfo->CurrentStartRow++;
- }
- ConsoleInfo->HistoryMode.CursorRow++;
- }
- break;
- case (CHAR_CARRIAGE_RETURN):
- //
- // Move the cursor to the beginning of the current row.
- //
- ConsoleInfo->HistoryMode.CursorColumn = 0;
- break;
- default:
- //
- // Acrtually print characters into the history buffer
- //
- 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
- ){
+ 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)
+ )
+ {
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);
- ConsoleInfo->Buffer[PrintIndex + (2*ConsoleInfo->HistoryMode.CursorRow)] = *Walker;
- ASSERT(PrintIndex < ConsoleInfo->AttribSize);
- ConsoleInfo->Attributes[PrintIndex] = ConsoleInfo->HistoryMode.Attribute;
- } // for loop
+ //
+ // The buffer is 2*CursorRow more since it has that many \r\n characters at the end of each row.
+ //
- //
- // 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);
- Walker--;
- }
+ ASSERT (PrintIndex + ConsoleInfo->HistoryMode.CursorRow < ConsoleInfo->BufferSize);
+ ConsoleInfo->Buffer[PrintIndex + (2*ConsoleInfo->HistoryMode.CursorRow)] = *Walker;
+ ASSERT (PrintIndex < ConsoleInfo->AttribSize);
+ ConsoleInfo->Attributes[PrintIndex] = ConsoleInfo->HistoryMode.Attribute;
+ } // for loop
- break;
+ //
+ // 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);
+ Walker--;
+ }
+
+ break;
} // switch for character
} // for loop
@@ -597,23 +619,23 @@ AppendStringToHistory( rendered and were skipped.
**/
EFI_STATUS
-ConsoleLoggerOutputStringSplit(
- IN CONST CHAR16 *String,
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerOutputStringSplit (
+ IN CONST CHAR16 *String,
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// 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,37 +647,40 @@ ConsoleLoggerOutputStringSplit( @return other Break was choosen
**/
EFI_STATUS
-ConsoleLoggerDoPageBreak(
+ConsoleLoggerDoPageBreak (
VOID
)
{
- SHELL_PROMPT_RESPONSE *Resp;
- EFI_STATUS Status;
+ SHELL_PROMPT_RESPONSE *Resp;
+ 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);
- ShellInfoObject.ConsoleInfo->RowCounter = 0;
-// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorRow = 0;
-// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
+ FreePool (Resp);
+ ShellInfoObject.ConsoleInfo->RowCounter = 0;
+ // ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorRow = 0;
+ // ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
return (EFI_SUCCESS);
} else if (*Resp == ShellPromptResponseQuit) {
- FreePool(Resp);
+ 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,9 +710,9 @@ ConsoleLoggerDoPageBreak( rendered and were skipped.
**/
EFI_STATUS
-ConsoleLoggerPrintWithPageBreak(
- IN CONST CHAR16 *String,
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerPrintWithPageBreak (
+ IN CONST CHAR16 *String,
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
)
{
CONST CHAR16 *Walker;
@@ -694,75 +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
- ; Walker != NULL && *Walker != CHAR_NULL
- ; Walker++
- ){
+ 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;
-
- //
- // output the string
- //
- ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo);
-
- //
- // restore the temp NULL terminator to its original character
- //
- *((CHAR16*)(Walker+1)) = TempChar;
-
- //
- // Update LineStart Variable
- //
- LineStart = Walker + 1;
-
- //
- // increment row count
- //
- ShellInfoObject.ConsoleInfo->RowCounter++;
- ConsoleInfo->OurConOut.Mode->CursorRow++;
-
- break;
- case (CHAR_CARRIAGE_RETURN):
- //
- // Move the cursor to the beginning of the current row.
- //
- ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
- break;
- default:
- //
- // increment column count
- //
- ConsoleInfo->OurConOut.Mode->CursorColumn++;
- //
- // check if that is the last column
- //
- if ((INTN)ConsoleInfo->ColsPerScreen == ConsoleInfo->OurConOut.Mode->CursorColumn + 1) {
- //
- // output a line similar to the linefeed character.
- //
+ 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;
+ TempChar = *(Walker + 1);
+ *((CHAR16 *)(Walker+1)) = CHAR_NULL;
//
// output the string
@@ -772,7 +754,7 @@ ConsoleLoggerPrintWithPageBreak( //
// restore the temp NULL terminator to its original character
//
- *((CHAR16*)(Walker+1)) = TempChar;
+ *((CHAR16 *)(Walker+1)) = TempChar;
//
// Update LineStart Variable
@@ -780,34 +762,82 @@ ConsoleLoggerPrintWithPageBreak( LineStart = Walker + 1;
//
- // increment row count and zero the column
+ // increment row count
//
ShellInfoObject.ConsoleInfo->RowCounter++;
ConsoleInfo->OurConOut.Mode->CursorRow++;
+
+ break;
+ case (CHAR_CARRIAGE_RETURN):
+ //
+ // Move the cursor to the beginning of the current row.
+ //
ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
- } // last column on line
- break;
+ break;
+ default:
+ //
+ // increment column count
+ //
+ ConsoleInfo->OurConOut.Mode->CursorColumn++;
+ //
+ // check if that is the last column
+ //
+ if ((INTN)ConsoleInfo->ColsPerScreen == ConsoleInfo->OurConOut.Mode->CursorColumn + 1) {
+ //
+ // output a line similar to the linefeed character.
+ //
+
+ //
+ // add a temp NULL terminator
+ //
+ TempChar = *(Walker + 1);
+ *((CHAR16 *)(Walker+1)) = CHAR_NULL;
+
+ //
+ // output the string
+ //
+ ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo);
+
+ //
+ // restore the temp NULL terminator to its original character
+ //
+ *((CHAR16 *)(Walker+1)) = TempChar;
+
+ //
+ // Update LineStart Variable
+ //
+ LineStart = Walker + 1;
+
+ //
+ // increment row count and zero the column
+ //
+ ShellInfoObject.ConsoleInfo->RowCounter++;
+ ConsoleInfo->OurConOut.Mode->CursorRow++;
+ ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
+ } // last column on line
+
+ break;
} // switch for character
//
// 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);
}
@@ -830,26 +860,26 @@ ConsoleLoggerPrintWithPageBreak( EFI_STATUS
EFIAPI
ConsoleLoggerOutputString (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *WString
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN CHAR16 *WString
)
{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx;
- EFI_KEY_DATA KeyData;
- UINTN EventIndex;
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx;
+ EFI_KEY_DATA KeyData;
+ 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));
}
}
@@ -898,11 +929,12 @@ EFI_STATUS EFIAPI
ConsoleLoggerTestString (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *WString
+ IN CHAR16 *WString
)
{
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
- ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+
+ ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
//
// Forward the request to the original ConOut
//
@@ -927,22 +959,23 @@ EFI_STATUS EFIAPI
ConsoleLoggerQueryMode (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
+ IN UINTN ModeNumber,
+ OUT UINTN *Columns,
+ OUT UINTN *Rows
)
{
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
- ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+
+ ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
//
// Forward the request to the original ConOut
//
return (ConsoleInfo->OldConOut->QueryMode (
- ConsoleInfo->OldConOut,
- ModeNumber,
- Columns,
- Rows
- ));
+ ConsoleInfo->OldConOut,
+ ModeNumber,
+ Columns,
+ Rows
+ ));
}
/**
@@ -960,14 +993,15 @@ ConsoleLoggerQueryMode ( EFI_STATUS
EFIAPI
ConsoleLoggerSetMode (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN UINTN ModeNumber
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
- ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+
+ ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
//
// Forward the request to the original ConOut
@@ -979,9 +1013,9 @@ ConsoleLoggerSetMode ( //
if (!EFI_ERROR (Status)) {
ConsoleInfo->OurConOut.Mode = ConsoleInfo->OldConOut->Mode;
- ConsoleLoggerResetBuffers(ConsoleInfo);
+ ConsoleLoggerResetBuffers (ConsoleInfo);
ConsoleInfo->OriginalStartRow = 0;
- ConsoleInfo->CurrentStartRow = 0;
+ ConsoleInfo->CurrentStartRow = 0;
ConsoleInfo->OurConOut.ClearScreen (&ConsoleInfo->OurConOut);
}
@@ -1006,14 +1040,15 @@ ConsoleLoggerSetMode ( EFI_STATUS
EFIAPI
ConsoleLoggerSetAttribute (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Attribute
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN UINTN Attribute
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
- ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+
+ 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;
@@ -1047,18 +1082,18 @@ ConsoleLoggerClearScreen ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
)
{
- EFI_STATUS Status;
- CHAR16 *Screen;
- INT32 *Attributes;
- UINTN Row;
- UINTN Column;
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+ EFI_STATUS Status;
+ CHAR16 *Screen;
+ INT32 *Attributes;
+ UINTN Row;
+ UINTN Column;
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
return (EFI_UNSUPPORTED);
}
- ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
+ ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
//
// Forward the request to the original ConOut
@@ -1069,26 +1104,30 @@ ConsoleLoggerClearScreen ( // Record console output history
//
if (!EFI_ERROR (Status)) {
- Screen = &ConsoleInfo->Buffer[(ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->CurrentStartRow];
+ Screen = &ConsoleInfo->Buffer[(ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->CurrentStartRow];
Attributes = &ConsoleInfo->Attributes[ConsoleInfo->ColsPerScreen * ConsoleInfo->CurrentStartRow];
for ( Row = ConsoleInfo->OriginalStartRow
- ; Row < (ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)
- ; Row++
- ){
+ ; Row < (ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)
+ ; Row++
+ )
+ {
for ( Column = 0
- ; Column < ConsoleInfo->ColsPerScreen
- ; Column++
- , Screen++
- , Attributes++
- ){
- *Screen = L' ';
+ ; Column < ConsoleInfo->ColsPerScreen
+ ; 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;
}
@@ -1113,26 +1152,26 @@ EFI_STATUS EFIAPI
ConsoleLoggerSetCursorPosition (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
+ IN UINTN Column,
+ IN UINTN Row
)
{
- EFI_STATUS Status;
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+ EFI_STATUS Status;
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
return (EFI_UNSUPPORTED);
}
- ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
+ ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
//
// Forward the request to the original ConOut
//
Status = ConsoleInfo->OldConOut->SetCursorPosition (
- ConsoleInfo->OldConOut,
- Column,
- Row
- );
+ ConsoleInfo->OldConOut,
+ Column,
+ Row
+ );
//
// Record console output history
@@ -1162,13 +1201,14 @@ EFI_STATUS EFIAPI
ConsoleLoggerEnableCursor (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN Visible
+ IN BOOLEAN Visible
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
- ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
+
+ ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
//
// Forward the request to the original ConOut
//
@@ -1193,41 +1233,42 @@ ConsoleLoggerEnableCursor ( history buffers.
**/
EFI_STATUS
-ConsoleLoggerResetBuffers(
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerResetBuffers (
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
)
{
- EFI_STATUS Status;
+ 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);
- ConsoleInfo->Buffer = NULL;
+ FreePool (ConsoleInfo->Buffer);
+ ConsoleInfo->Buffer = NULL;
return (EFI_OUT_OF_RESOURCES);
}
diff --git a/ShellPkg/Application/Shell/ConsoleLogger.h b/ShellPkg/Application/Shell/ConsoleLogger.h index 0a01bc2ca2..a9e017fcd6 100644 --- a/ShellPkg/Application/Shell/ConsoleLogger.h +++ b/ShellPkg/Application/Shell/ConsoleLogger.h @@ -12,31 +12,31 @@ #define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('c', 'o', 'P', 'D')
-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
- EFI_HANDLE OldConHandle; ///< old protocol handle
- UINTN ScreenCount; ///< How many screens worth of data to save
- CHAR16 *Buffer; ///< Buffer to save data
- UINTN BufferSize; ///< size of buffer in bytes
-
- // start row is the top of the screen
- UINTN OriginalStartRow; ///< What the originally visible start row was
- UINTN CurrentStartRow; ///< what the currently visible start row is
-
- UINTN RowsPerScreen; ///< how many rows the screen can display
- UINTN ColsPerScreen; ///< how many columns the screen can display
-
- INT32 *Attributes; ///< Buffer for Attribute to be saved for each character
- UINTN AttribSize; ///< Size of Attributes in bytes
-
- EFI_SIMPLE_TEXT_OUTPUT_MODE HistoryMode; ///< mode of the history log
- BOOLEAN Enabled; ///< Set to FALSE when a break is requested.
- UINTN RowCounter; ///< Initial row of each print job.
+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
+ EFI_HANDLE OldConHandle; ///< old protocol handle
+ UINTN ScreenCount; ///< How many screens worth of data to save
+ CHAR16 *Buffer; ///< Buffer to save data
+ UINTN BufferSize; ///< size of buffer in bytes
+
+ // start row is the top of the screen
+ UINTN OriginalStartRow; ///< What the originally visible start row was
+ UINTN CurrentStartRow; ///< what the currently visible start row is
+
+ UINTN RowsPerScreen; ///< how many rows the screen can display
+ UINTN ColsPerScreen; ///< how many columns the screen can display
+
+ INT32 *Attributes; ///< Buffer for Attribute to be saved for each character
+ UINTN AttribSize; ///< Size of Attributes in bytes
+
+ EFI_SIMPLE_TEXT_OUTPUT_MODE HistoryMode; ///< mode of the history log
+ BOOLEAN Enabled; ///< Set to FALSE when a break is requested.
+ UINTN RowCounter; ///< Initial row of each print job.
} CONSOLE_LOGGER_PRIVATE_DATA;
-#define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a) CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE)
+#define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a) CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE)
/**
Install our intermediate ConOut into the system table to
@@ -52,9 +52,9 @@ typedef struct _CONSOLE_LOGGER_PRIVATE_DATA{ @sa InstallProtocolInterface
**/
EFI_STATUS
-ConsoleLoggerInstall(
- IN CONST UINTN ScreensToSave,
- OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo
+ConsoleLoggerInstall (
+ IN CONST UINTN ScreensToSave,
+ OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo
);
/**
@@ -67,8 +67,8 @@ ConsoleLoggerInstall( @return other The operation failed. This was from UninstallProtocolInterface.
**/
EFI_STATUS
-ConsoleLoggerUninstall(
- IN OUT CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerUninstall (
+ IN OUT CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
);
/**
@@ -84,10 +84,10 @@ ConsoleLoggerUninstall( @param[in] ConsoleInfo The pointer to the instance of the console logger information.
**/
EFI_STATUS
-ConsoleLoggerDisplayHistory(
- IN CONST BOOLEAN Forward,
- IN CONST UINTN Rows,
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerDisplayHistory (
+ IN CONST BOOLEAN Forward,
+ IN CONST UINTN Rows,
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
);
/**
@@ -100,8 +100,8 @@ ConsoleLoggerDisplayHistory( @sa UpdateDisplayFromHistory
**/
EFI_STATUS
-ConsoleLoggerStopHistory(
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerStopHistory (
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
);
/**
@@ -112,8 +112,8 @@ ConsoleLoggerStopHistory( @return other The operation failed.
**/
EFI_STATUS
-UpdateDisplayFromHistory(
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+UpdateDisplayFromHistory (
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
);
/**
@@ -129,8 +129,8 @@ UpdateDisplayFromHistory( EFI_STATUS
EFIAPI
ConsoleLoggerReset (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
);
/**
@@ -151,9 +151,9 @@ ConsoleLoggerReset ( **/
EFI_STATUS
EFIAPI
-ConsoleLoggerOutputString(
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *WString
+ConsoleLoggerOutputString (
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN CHAR16 *WString
);
/**
@@ -173,8 +173,8 @@ ConsoleLoggerOutputString( EFI_STATUS
EFIAPI
ConsoleLoggerTestString (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *WString
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN CHAR16 *WString
);
/**
@@ -237,8 +237,8 @@ ConsoleLoggerSetMode ( EFI_STATUS
EFIAPI
ConsoleLoggerSetAttribute (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Attribute
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN UINTN Attribute
);
/**
@@ -275,8 +275,8 @@ EFI_STATUS EFIAPI
ConsoleLoggerSetCursorPosition (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
+ IN UINTN Column,
+ IN UINTN Row
);
/**
@@ -309,9 +309,8 @@ ConsoleLoggerEnableCursor ( history buffers.
**/
EFI_STATUS
-ConsoleLoggerResetBuffers(
- IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
+ConsoleLoggerResetBuffers (
+ IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
);
#endif //_CONSOLE_LOGGER_HEADER_
-
diff --git a/ShellPkg/Application/Shell/ConsoleWrappers.c b/ShellPkg/Application/Shell/ConsoleWrappers.c index ec340de4e1..eae11370e4 100644 --- a/ShellPkg/Application/Shell/ConsoleWrappers.c +++ b/ShellPkg/Application/Shell/ConsoleWrappers.c @@ -9,20 +9,20 @@ #include "Shell.h"
-extern BOOLEAN AsciiRedirection;
+extern BOOLEAN AsciiRedirection;
typedef struct {
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
- SHELL_FILE_HANDLE FileHandle;
- EFI_HANDLE TheHandle;
- UINT64 RemainingBytesOfInputFile;
+ EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
+ SHELL_FILE_HANDLE FileHandle;
+ EFI_HANDLE TheHandle;
+ UINT64 RemainingBytesOfInputFile;
} SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
typedef struct {
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut;
- SHELL_FILE_HANDLE FileHandle;
- EFI_HANDLE TheHandle;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalSimpleTextOut;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut;
+ SHELL_FILE_HANDLE FileHandle;
+ EFI_HANDLE TheHandle;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalSimpleTextOut;
} SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
/**
@@ -36,8 +36,8 @@ typedef struct { VOID
EFIAPI
ConInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
gBS->SignalEvent (Event);
@@ -53,9 +53,9 @@ ConInWaitForKey ( **/
EFI_STATUS
EFIAPI
-FileBasedSimpleTextInReset(
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
+FileBasedSimpleTextInReset (
+ IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
)
{
return (EFI_SUCCESS);
@@ -71,18 +71,18 @@ FileBasedSimpleTextInReset( **/
EFI_STATUS
EFIAPI
-FileBasedSimpleTextInReadKeyStroke(
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- IN OUT EFI_INPUT_KEY *Key
+FileBasedSimpleTextInReadKeyStroke (
+ IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
+ IN OUT EFI_INPUT_KEY *Key
)
{
- UINTN Size;
- UINTN CharSize;
+ UINTN Size;
+ UINTN CharSize;
//
// 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(
- ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle,
- &Size,
- &Key->UnicodeChar));
+ return (ShellInfoObject.NewEfiShellProtocol->ReadFile (
+ ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle,
+ &Size,
+ &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);
+ ShellGetFileSize (FileHandleToUse, &FileSize);
+ 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(
- &(ProtocolToReturn->TheHandle),
- &gEfiSimpleTextInProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &(ProtocolToReturn->SimpleTextIn));
- if (!EFI_ERROR(Status)) {
+
+ /// @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)) {
*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,26 +197,27 @@ CreateSimpleTextInOnFile( @retval EFI_SUCCESS The object was closed.
**/
EFI_STATUS
-CloseSimpleTextInOnFile(
+CloseSimpleTextInOnFile (
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn
)
{
- EFI_STATUS Status;
- EFI_STATUS Status1;
+ EFI_STATUS Status;
+ EFI_STATUS Status1;
if (SimpleTextIn == NULL) {
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,
- &gEfiSimpleTextInProtocolGuid,
- &(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->SimpleTextIn));
+ Status1 = gBS->UninstallProtocolInterface (
+ ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->TheHandle,
+ &gEfiSimpleTextInProtocolGuid,
+ &(((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);
@@ -230,8 +235,8 @@ CloseSimpleTextInOnFile( EFI_STATUS
EFIAPI
FileBasedSimpleTextOutReset (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN BOOLEAN ExtendedVerification
)
{
return (EFI_SUCCESS);
@@ -249,8 +254,8 @@ FileBasedSimpleTextOutReset ( EFI_STATUS
EFIAPI
FileBasedSimpleTextOutTestString (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *WString
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN CHAR16 *WString
)
{
return (EFI_SUCCESS);
@@ -270,22 +275,23 @@ FileBasedSimpleTextOutTestString ( EFI_STATUS
EFIAPI
FileBasedSimpleTextOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN UINTN ModeNumber,
+ OUT UINTN *Columns,
+ OUT UINTN *Rows
)
{
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *PassThruProtocol;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *PassThruProtocol;
PassThruProtocol = ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->OriginalSimpleTextOut;
// Pass the QueryMode call thru to the original SimpleTextOutProtocol
- return (PassThruProtocol->QueryMode(
- PassThruProtocol,
- ModeNumber,
- Columns,
- Rows));
+ return (PassThruProtocol->QueryMode (
+ PassThruProtocol,
+ ModeNumber,
+ Columns,
+ Rows
+ ));
}
/**
@@ -300,7 +306,7 @@ EFI_STATUS EFIAPI
FileBasedSimpleTextOutSetMode (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN ModeNumber
+ IN UINTN ModeNumber
)
{
return (EFI_UNSUPPORTED);
@@ -320,8 +326,8 @@ FileBasedSimpleTextOutSetMode ( EFI_STATUS
EFIAPI
FileBasedSimpleTextOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Attribute
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN UINTN Attribute
)
{
return (EFI_SUCCESS);
@@ -357,8 +363,8 @@ EFI_STATUS EFIAPI
FileBasedSimpleTextOutSetCursorPosition (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
+ IN UINTN Column,
+ IN UINTN Row
)
{
return (EFI_SUCCESS);
@@ -377,7 +383,7 @@ EFI_STATUS EFIAPI
FileBasedSimpleTextOutEnableCursor (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN BOOLEAN Visible
+ IN BOOLEAN Visible
)
{
return (EFI_SUCCESS);
@@ -402,16 +408,18 @@ FileBasedSimpleTextOutEnableCursor ( EFI_STATUS
EFIAPI
FileBasedSimpleTextOutOutputString (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
- IN CHAR16 *WString
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN CHAR16 *WString
)
{
- UINTN Size;
- Size = StrLen(WString) * sizeof(CHAR16);
- return (ShellInfoObject.NewEfiShellProtocol->WriteFile(
- ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle,
- &Size,
- WString));
+ UINTN Size;
+
+ Size = StrLen (WString) * sizeof (CHAR16);
+ return (ShellInfoObject.NewEfiShellProtocol->WriteFile (
+ ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle,
+ &Size,
+ WString
+ ));
}
/**
@@ -425,24 +433,25 @@ FileBasedSimpleTextOutOutputString ( @retval NULL There was insufficient memory available.
@return A pointer to the allocated protocol structure;
**/
-EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*
-CreateSimpleTextOutOnFile(
- IN SHELL_FILE_HANDLE FileHandleToUse,
- IN EFI_HANDLE *HandleLocation,
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol
+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *
+CreateSimpleTextOutOnFile (
+ IN SHELL_FILE_HANDLE FileHandleToUse,
+ IN EFI_HANDLE *HandleLocation,
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol
)
{
- SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ProtocolToReturn;
- EFI_STATUS Status;
+ 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(
- &(ProtocolToReturn->TheHandle),
- &gEfiSimpleTextOutProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &(ProtocolToReturn->SimpleTextOut));
- if (!EFI_ERROR(Status)) {
+ Status = gBS->InstallProtocolInterface (
+ &(ProtocolToReturn->TheHandle),
+ &gEfiSimpleTextOutProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &(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,
- &gEfiSimpleTextOutProtocolGuid,
- &(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut));
- FreePool(SimpleTextOut->Mode);
- FreePool(SimpleTextOut);
+
+ 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);
return (Status);
}
diff --git a/ShellPkg/Application/Shell/ConsoleWrappers.h b/ShellPkg/Application/Shell/ConsoleWrappers.h index 965813df49..0edbad8e6b 100644 --- a/ShellPkg/Application/Shell/ConsoleWrappers.h +++ b/ShellPkg/Application/Shell/ConsoleWrappers.h @@ -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,11 +50,11 @@ CloseSimpleTextInOnFile( @retval NULL There was insufficient memory available.
@return A pointer to the allocated protocol structure;
**/
-EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*
-CreateSimpleTextOutOnFile(
- IN SHELL_FILE_HANDLE FileHandleToUse,
- IN EFI_HANDLE *HandleLocation,
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol
+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_
-
diff --git a/ShellPkg/Application/Shell/FileHandleInternal.h b/ShellPkg/Application/Shell/FileHandleInternal.h index 09c5a8cb11..2ad2bd098f 100644 --- a/ShellPkg/Application/Shell/FileHandleInternal.h +++ b/ShellPkg/Application/Shell/FileHandleInternal.h @@ -18,9 +18,9 @@ **/
VOID
MoveCursorBackward (
- IN UINTN LineLength,
- IN OUT UINTN *Column,
- IN OUT UINTN *Row
+ IN UINTN LineLength,
+ IN OUT UINTN *Column,
+ IN OUT UINTN *Row
);
/**
@@ -33,10 +33,10 @@ MoveCursorBackward ( **/
VOID
MoveCursorForward (
- IN UINTN LineLength,
- IN UINTN TotalRow,
- IN OUT UINTN *Column,
- IN OUT UINTN *Row
+ IN UINTN LineLength,
+ IN UINTN TotalRow,
+ IN OUT UINTN *Column,
+ IN OUT UINTN *Row
);
/**
@@ -50,10 +50,9 @@ MoveCursorForward ( **/
VOID
PrintCommandHistory (
- IN CONST UINTN TotalCols,
- IN CONST UINTN TotalRows,
- IN CONST UINTN StartColumn
+ IN CONST UINTN TotalCols,
+ IN CONST UINTN TotalRows,
+ IN CONST UINTN StartColumn
);
#endif //_FILE_HANDLE_INTERNAL_HEADER_
-
diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c index a622a763f8..2ba9b3401a 100644 --- a/ShellPkg/Application/Shell/FileHandleWrappers.c +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c @@ -12,7 +12,7 @@ #include "Shell.h"
#include "FileHandleInternal.h"
-#define MEM_WRITE_REALLOC_OVERHEAD 1024
+#define MEM_WRITE_REALLOC_OVERHEAD 1024
/**
File style interface for console (Open).
@@ -27,12 +27,12 @@ **/
EFI_STATUS
EFIAPI
-FileInterfaceOpenNotFound(
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
+FileInterfaceOpenNotFound (
+ IN EFI_FILE_PROTOCOL *This,
+ OUT EFI_FILE_PROTOCOL **NewHandle,
+ IN CHAR16 *FileName,
+ IN UINT64 OpenMode,
+ IN UINT64 Attributes
)
{
return (EFI_NOT_FOUND);
@@ -47,8 +47,8 @@ FileInterfaceOpenNotFound( **/
EFI_STATUS
EFIAPI
-FileInterfaceNopGeneric(
- IN EFI_FILE_PROTOCOL *This
+FileInterfaceNopGeneric (
+ IN EFI_FILE_PROTOCOL *This
)
{
return (EFI_SUCCESS);
@@ -64,9 +64,9 @@ FileInterfaceNopGeneric( **/
EFI_STATUS
EFIAPI
-FileInterfaceNopGetPosition(
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
+FileInterfaceNopGetPosition (
+ IN EFI_FILE_PROTOCOL *This,
+ OUT UINT64 *Position
)
{
return (EFI_UNSUPPORTED);
@@ -82,9 +82,9 @@ FileInterfaceNopGetPosition( **/
EFI_STATUS
EFIAPI
-FileInterfaceNopSetPosition(
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
+FileInterfaceNopSetPosition (
+ IN EFI_FILE_PROTOCOL *This,
+ IN UINT64 Position
)
{
return (EFI_UNSUPPORTED);
@@ -102,11 +102,11 @@ FileInterfaceNopSetPosition( **/
EFI_STATUS
EFIAPI
-FileInterfaceNopGetInfo(
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceNopGetInfo (
+ IN EFI_FILE_PROTOCOL *This,
+ IN EFI_GUID *InformationType,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
return (EFI_UNSUPPORTED);
@@ -124,11 +124,11 @@ FileInterfaceNopGetInfo( **/
EFI_STATUS
EFIAPI
-FileInterfaceNopSetInfo(
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
+FileInterfaceNopSetInfo (
+ IN EFI_FILE_PROTOCOL *This,
+ IN EFI_GUID *InformationType,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
)
{
return (EFI_UNSUPPORTED);
@@ -148,19 +148,21 @@ FileInterfaceNopSetInfo( **/
EFI_STATUS
EFIAPI
-FileInterfaceStdOutWrite(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileInterfaceStdOutWrite (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
return (EFI_UNSUPPORTED);
}
+
if (*((CHAR16 *)Buffer) == gUnicodeFileTag) {
- return (gST->ConOut->OutputString(gST->ConOut, (CHAR16 *)Buffer + 1));
+ return (gST->ConOut->OutputString (gST->ConOut, (CHAR16 *)Buffer + 1));
}
- return (gST->ConOut->OutputString(gST->ConOut, Buffer));
+
+ return (gST->ConOut->OutputString (gST->ConOut, Buffer));
}
/**
@@ -174,10 +176,10 @@ FileInterfaceStdOutWrite( **/
EFI_STATUS
EFIAPI
-FileInterfaceStdInWrite(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileInterfaceStdInWrite (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
return (EFI_UNSUPPORTED);
@@ -196,13 +198,13 @@ FileInterfaceStdInWrite( **/
EFI_STATUS
EFIAPI
-FileInterfaceStdErrWrite(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileInterfaceStdErrWrite (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
- return (gST->StdErr->OutputString(gST->StdErr, Buffer));
+ return (gST->StdErr->OutputString (gST->StdErr, Buffer));
}
/**
@@ -216,10 +218,10 @@ FileInterfaceStdErrWrite( **/
EFI_STATUS
EFIAPI
-FileInterfaceStdOutRead(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceStdOutRead (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
return (EFI_UNSUPPORTED);
@@ -236,10 +238,10 @@ FileInterfaceStdOutRead( **/
EFI_STATUS
EFIAPI
-FileInterfaceStdErrRead(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceStdErrRead (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
return (EFI_UNSUPPORTED);
@@ -256,10 +258,10 @@ FileInterfaceStdErrRead( **/
EFI_STATUS
EFIAPI
-FileInterfaceNulRead(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceNulRead (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
*BufferSize = 0;
@@ -277,10 +279,10 @@ FileInterfaceNulRead( **/
EFI_STATUS
EFIAPI
-FileInterfaceNulWrite(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileInterfaceNulWrite (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
return (EFI_SUCCESS);
@@ -302,17 +304,17 @@ CreateTabCompletionList ( IN CONST UINTN BufferSize,
IN OUT EFI_SHELL_FILE_INFO **TabCompletionList,
IN OUT UINTN *TabUpdatePos
-)
+ )
{
- BOOLEAN InQuotation;
- UINTN TabPos;
- UINTN Index;
- CONST CHAR16 *Cwd;
- EFI_STATUS Status;
- CHAR16 *TabStr;
- EFI_SHELL_FILE_INFO *FileList;
- EFI_SHELL_FILE_INFO *FileInfo;
- EFI_SHELL_FILE_INFO *TempFileInfo;
+ BOOLEAN InQuotation;
+ UINTN TabPos;
+ UINTN Index;
+ CONST CHAR16 *Cwd;
+ EFI_STATUS Status;
+ CHAR16 *TabStr;
+ EFI_SHELL_FILE_INFO *FileList;
+ EFI_SHELL_FILE_INFO *FileInfo;
+ EFI_SHELL_FILE_INFO *TempFileInfo;
//
// Allocate buffers
@@ -334,28 +336,29 @@ CreateTabCompletionList ( InQuotation = FALSE;
for (Index = 0; Index < StringLen; Index++) {
switch (InputString[Index]) {
- case L'\"':
- InQuotation = (BOOLEAN) (!InQuotation);
- break;
+ case L'\"':
+ InQuotation = (BOOLEAN)(!InQuotation);
+ break;
- case L' ':
- if (!InQuotation) {
- TabPos = Index + 1;
- *TabUpdatePos = TabPos;
- }
- break;
+ case L' ':
+ if (!InQuotation) {
+ TabPos = Index + 1;
+ *TabUpdatePos = TabPos;
+ }
+
+ break;
- case L':':
+ case L':':
//
// handle the case "fs0:<TAB>"
// Update the TabUpdatePos as well.
//
- case L'\\':
- *TabUpdatePos = Index + 1;
- break;
+ case L'\\':
+ *TabUpdatePos = Index + 1;
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -382,15 +385,16 @@ CreateTabCompletionList ( }
}
}
+
StrnCatS (TabStr, (BufferSize) / sizeof (CHAR16), InputString + TabPos, StringLen - TabPos);
StrnCatS (TabStr, (BufferSize) / sizeof (CHAR16), L"*", (BufferSize) / sizeof (CHAR16) - 1 - StrLen (TabStr));
- Status = ShellInfoObject.NewEfiShellProtocol->FindFiles(TabStr, &FileList);
+ Status = ShellInfoObject.NewEfiShellProtocol->FindFiles (TabStr, &FileList);
//
// Filter out the non-directory for "CD" command
// Filter "." and ".." for all
//
- if (!EFI_ERROR (Status) && FileList != NULL) {
+ if (!EFI_ERROR (Status) && (FileList != NULL)) {
//
// Skip the spaces in the beginning
//
@@ -398,20 +402,21 @@ CreateTabCompletionList ( InputString++;
}
- for (FileInfo = (EFI_SHELL_FILE_INFO *) GetFirstNode (&FileList->Link); !IsNull (&FileList->Link, &FileInfo->Link); ) {
+ for (FileInfo = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link); !IsNull (&FileList->Link, &FileInfo->Link); ) {
if (((StrCmp (FileInfo->FileName, L".") == 0) || (StrCmp (FileInfo->FileName, L"..") == 0)) ||
- (((InputString[0] == L'c' || InputString[0] == L'C') && (InputString[1] == L'd' || InputString[1] == L'D')) &&
- (ShellIsDirectory (FileInfo->FullName) != EFI_SUCCESS))) {
+ ((((InputString[0] == L'c') || (InputString[0] == L'C')) && ((InputString[1] == L'd') || (InputString[1] == L'D'))) &&
+ (ShellIsDirectory (FileInfo->FullName) != EFI_SUCCESS)))
+ {
TempFileInfo = FileInfo;
- FileInfo = (EFI_SHELL_FILE_INFO *) RemoveEntryList (&FileInfo->Link);
+ FileInfo = (EFI_SHELL_FILE_INFO *)RemoveEntryList (&FileInfo->Link);
InternalFreeShellFileInfoNode (TempFileInfo);
} else {
- FileInfo = (EFI_SHELL_FILE_INFO *) GetNextNode (&FileList->Link, &FileInfo->Link);
+ FileInfo = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &FileInfo->Link);
}
}
}
- if (FileList != NULL && !IsListEmpty (&FileList->Link)) {
+ if ((FileList != NULL) && !IsListEmpty (&FileList->Link)) {
Status = EFI_SUCCESS;
} else {
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FileList);
@@ -450,40 +455,40 @@ CreateTabCompletionList ( **/
EFI_STATUS
EFIAPI
-FileInterfaceStdInRead(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceStdInRead (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
- CHAR16 *CurrentString;
- BOOLEAN Done;
- UINTN TabUpdatePos; // Start index of the string updated by TAB stroke
- UINTN Column; // Column of current cursor
- UINTN Row; // Row of current cursor
- UINTN StartColumn; // Column at the beginning of the line
- UINTN Update; // Line index for update
- UINTN Delete; // Num of chars to delete from console after update
- UINTN StringLen; // Total length of the line
- UINTN StringCurPos; // Line index corresponding to the cursor
- UINTN MaxStr; // Maximum possible line length
- UINTN TotalColumn; // Num of columns in the console
- UINTN TotalRow; // Num of rows in the console
- UINTN SkipLength;
- UINTN OutputLength; // Length of the update string
- UINTN TailRow; // Row of end of line
- UINTN TailColumn; // Column of end of line
- EFI_INPUT_KEY Key;
-
- BUFFER_LIST *LinePos;
- BUFFER_LIST *NewPos;
- BOOLEAN InScrolling;
- EFI_STATUS Status;
- BOOLEAN InTabScrolling; // Whether in TAB-completion state
- EFI_SHELL_FILE_INFO *TabCompleteList;
- EFI_SHELL_FILE_INFO *TabCurrent;
- UINTN EventIndex;
- CHAR16 *TabOutputStr;
+ CHAR16 *CurrentString;
+ BOOLEAN Done;
+ UINTN TabUpdatePos; // Start index of the string updated by TAB stroke
+ UINTN Column; // Column of current cursor
+ UINTN Row; // Row of current cursor
+ UINTN StartColumn; // Column at the beginning of the line
+ UINTN Update; // Line index for update
+ UINTN Delete; // Num of chars to delete from console after update
+ UINTN StringLen; // Total length of the line
+ UINTN StringCurPos; // Line index corresponding to the cursor
+ UINTN MaxStr; // Maximum possible line length
+ UINTN TotalColumn; // Num of columns in the console
+ UINTN TotalRow; // Num of rows in the console
+ UINTN SkipLength;
+ UINTN OutputLength; // Length of the update string
+ UINTN TailRow; // Row of end of line
+ UINTN TailColumn; // Column of end of line
+ EFI_INPUT_KEY Key;
+
+ BUFFER_LIST *LinePos;
+ BUFFER_LIST *NewPos;
+ BOOLEAN InScrolling;
+ EFI_STATUS Status;
+ BOOLEAN InTabScrolling; // Whether in TAB-completion state
+ EFI_SHELL_FILE_INFO *TabCompleteList;
+ EFI_SHELL_FILE_INFO *TabCurrent;
+ UINTN EventIndex;
+ CHAR16 *TabOutputStr;
//
// If buffer is not large enough to hold a CHAR16, return minimum buffer size
@@ -493,27 +498,27 @@ FileInterfaceStdInRead( return (EFI_BUFFER_TOO_SMALL);
}
- Done = FALSE;
- CurrentString = Buffer;
- StringLen = 0;
- StringCurPos = 0;
- OutputLength = 0;
- Update = 0;
- Delete = 0;
- LinePos = NewPos = (BUFFER_LIST*)(&ShellInfoObject.ViewingSettings.CommandHistory);
- InScrolling = FALSE;
- InTabScrolling = FALSE;
- Status = EFI_SUCCESS;
- TabOutputStr = NULL;
- TabUpdatePos = 0;
- TabCompleteList = NULL;
- TabCurrent = NULL;
+ Done = FALSE;
+ CurrentString = Buffer;
+ StringLen = 0;
+ StringCurPos = 0;
+ OutputLength = 0;
+ Update = 0;
+ Delete = 0;
+ LinePos = NewPos = (BUFFER_LIST *)(&ShellInfoObject.ViewingSettings.CommandHistory);
+ InScrolling = FALSE;
+ InTabScrolling = FALSE;
+ Status = EFI_SUCCESS;
+ TabOutputStr = NULL;
+ TabUpdatePos = 0;
+ TabCompleteList = NULL;
+ TabCurrent = NULL;
//
// Get the screen setting and the current cursor location
//
- Column = StartColumn = gST->ConOut->Mode->CursorColumn;
- Row = gST->ConOut->Mode->CursorRow;
+ Column = StartColumn = gST->ConOut->Mode->CursorColumn;
+ Row = gST->ConOut->Mode->CursorRow;
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &TotalColumn, &TotalRow);
//
@@ -524,6 +529,7 @@ FileInterfaceStdInRead( if (MaxStr > *BufferSize / sizeof (CHAR16)) {
MaxStr = *BufferSize / sizeof (CHAR16);
}
+
ZeroMem (CurrentString, MaxStr * sizeof (CHAR16));
do {
//
@@ -532,11 +538,11 @@ FileInterfaceStdInRead( gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
if (EFI_ERROR (Status)) {
-
- if (Status == EFI_NOT_READY)
+ if (Status == EFI_NOT_READY) {
continue;
+ }
- ZeroMem (CurrentString, MaxStr * sizeof(CHAR16));
+ ZeroMem (CurrentString, MaxStr * sizeof (CHAR16));
StringLen = 0;
break;
}
@@ -545,17 +551,17 @@ FileInterfaceStdInRead( // Press PageUp or PageDown to scroll the history screen up or down.
// Press any other key to quit scrolling.
//
- if (Key.UnicodeChar == 0 && (Key.ScanCode == SCAN_PAGE_UP || Key.ScanCode == SCAN_PAGE_DOWN)) {
+ if ((Key.UnicodeChar == 0) && ((Key.ScanCode == SCAN_PAGE_UP) || (Key.ScanCode == SCAN_PAGE_DOWN))) {
if (Key.ScanCode == SCAN_PAGE_UP) {
- ConsoleLoggerDisplayHistory(FALSE, 0, ShellInfoObject.ConsoleInfo);
+ ConsoleLoggerDisplayHistory (FALSE, 0, ShellInfoObject.ConsoleInfo);
} else if (Key.ScanCode == SCAN_PAGE_DOWN) {
- ConsoleLoggerDisplayHistory(TRUE, 0, ShellInfoObject.ConsoleInfo);
+ ConsoleLoggerDisplayHistory (TRUE, 0, ShellInfoObject.ConsoleInfo);
}
InScrolling = TRUE;
} else {
if (InScrolling) {
- ConsoleLoggerStopHistory(ShellInfoObject.ConsoleInfo);
+ ConsoleLoggerStopHistory (ShellInfoObject.ConsoleInfo);
InScrolling = FALSE;
}
}
@@ -563,206 +569,218 @@ FileInterfaceStdInRead( //
// If we are quitting TAB scrolling...
//
- if (InTabScrolling && Key.UnicodeChar != CHAR_TAB) {
+ if (InTabScrolling && (Key.UnicodeChar != CHAR_TAB)) {
if (TabCompleteList != NULL) {
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&TabCompleteList);
- DEBUG_CODE(TabCompleteList = NULL;);
+ DEBUG_CODE (
+ TabCompleteList = NULL;
+ );
}
+
InTabScrolling = FALSE;
}
switch (Key.UnicodeChar) {
- case CHAR_CARRIAGE_RETURN:
- //
- // All done, print a newline at the end of the string
- //
- TailRow = Row + (StringLen - StringCurPos + Column) / TotalColumn;
- TailColumn = (StringLen - StringCurPos + Column) % TotalColumn;
- ShellPrintEx ((INT32)TailColumn, (INT32)TailRow, L"%N\n");
- Done = TRUE;
- break;
-
- case CHAR_BACKSPACE:
- if (StringCurPos != 0) {
- //
- // If not move back beyond string beginning, move all characters behind
- // the current position one character forward
- //
- StringCurPos--;
- Update = StringCurPos;
- Delete = 1;
- CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos));
-
- //
- // Adjust the current column and row
- //
- MoveCursorBackward (TotalColumn, &Column, &Row);
- }
- break;
-
- case CHAR_TAB:
- if (!InTabScrolling) {
- TabCurrent = NULL;
- //
- // Initialize a tab complete operation.
- //
- Status = CreateTabCompletionList (CurrentString, StringLen, *BufferSize, &TabCompleteList, &TabUpdatePos);
- if (!EFI_ERROR(Status)) {
- InTabScrolling = TRUE;
- }
-
- //
- // We do not set up the replacement.
- // The next section will do that.
- //
- }
-
- if (InTabScrolling) {
+ case CHAR_CARRIAGE_RETURN:
//
- // We are in a tab complete operation.
- // set up the next replacement.
+ // All done, print a newline at the end of the string
//
- ASSERT(TabCompleteList != NULL);
- if (TabCurrent == NULL) {
- TabCurrent = (EFI_SHELL_FILE_INFO*) GetFirstNode (&TabCompleteList->Link);
- } else {
- TabCurrent = (EFI_SHELL_FILE_INFO*) GetNextNode (&TabCompleteList->Link, &TabCurrent->Link);
- }
+ TailRow = Row + (StringLen - StringCurPos + Column) / TotalColumn;
+ TailColumn = (StringLen - StringCurPos + Column) % TotalColumn;
+ ShellPrintEx ((INT32)TailColumn, (INT32)TailRow, L"%N\n");
+ Done = TRUE;
+ break;
- //
- // Skip over the empty list beginning node
- //
- if (IsNull(&TabCompleteList->Link, &TabCurrent->Link)) {
- TabCurrent = (EFI_SHELL_FILE_INFO*) GetNextNode (&TabCompleteList->Link, &TabCurrent->Link);
- }
- }
- break;
+ case CHAR_BACKSPACE:
+ if (StringCurPos != 0) {
+ //
+ // If not move back beyond string beginning, move all characters behind
+ // the current position one character forward
+ //
+ StringCurPos--;
+ Update = StringCurPos;
+ Delete = 1;
+ CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos));
- default:
- if (Key.UnicodeChar >= ' ') {
- //
- // If we are at the buffer's end, drop the key
- //
- if (StringLen == MaxStr - 1 && (ShellInfoObject.ViewingSettings.InsertMode || StringCurPos == StringLen)) {
- break;
- }
- //
- // If in insert mode, make space by moving each other character 1
- // space higher in the array
- //
- if (ShellInfoObject.ViewingSettings.InsertMode) {
- CopyMem(CurrentString + StringCurPos + 1, CurrentString + StringCurPos, (StringLen - StringCurPos)*sizeof(CurrentString[0]));
+ //
+ // Adjust the current column and row
+ //
+ MoveCursorBackward (TotalColumn, &Column, &Row);
}
- CurrentString[StringCurPos] = Key.UnicodeChar;
- Update = StringCurPos;
+ break;
- StringCurPos += 1;
- OutputLength = 1;
- }
- break;
+ case CHAR_TAB:
+ if (!InTabScrolling) {
+ TabCurrent = NULL;
+ //
+ // Initialize a tab complete operation.
+ //
+ Status = CreateTabCompletionList (CurrentString, StringLen, *BufferSize, &TabCompleteList, &TabUpdatePos);
+ if (!EFI_ERROR (Status)) {
+ InTabScrolling = TRUE;
+ }
- case 0:
- switch (Key.ScanCode) {
- case SCAN_DELETE:
- //
- // Move characters behind current position one character forward
- //
- if (StringLen != 0) {
- Update = StringCurPos;
- Delete = 1;
- CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos));
+ //
+ // We do not set up the replacement.
+ // The next section will do that.
+ //
}
- break;
- case SCAN_UP:
- //
- // Prepare to print the previous command
- //
- NewPos = (BUFFER_LIST*)GetPreviousNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
- if (IsNull(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link)) {
- NewPos = (BUFFER_LIST*)GetPreviousNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
- }
- break;
+ if (InTabScrolling) {
+ //
+ // We are in a tab complete operation.
+ // set up the next replacement.
+ //
+ ASSERT (TabCompleteList != NULL);
+ if (TabCurrent == NULL) {
+ TabCurrent = (EFI_SHELL_FILE_INFO *)GetFirstNode (&TabCompleteList->Link);
+ } else {
+ TabCurrent = (EFI_SHELL_FILE_INFO *)GetNextNode (&TabCompleteList->Link, &TabCurrent->Link);
+ }
- case SCAN_DOWN:
- //
- // Prepare to print the next command
- //
- NewPos = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
- if (NewPos == (BUFFER_LIST*)(&ShellInfoObject.ViewingSettings.CommandHistory)) {
- NewPos = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
+ //
+ // Skip over the empty list beginning node
+ //
+ if (IsNull (&TabCompleteList->Link, &TabCurrent->Link)) {
+ TabCurrent = (EFI_SHELL_FILE_INFO *)GetNextNode (&TabCompleteList->Link, &TabCurrent->Link);
+ }
}
- break;
- case SCAN_LEFT:
- //
- // Adjust current cursor position
- //
- if (StringCurPos != 0) {
- --StringCurPos;
- MoveCursorBackward (TotalColumn, &Column, &Row);
- }
break;
- case SCAN_RIGHT:
- //
- // Adjust current cursor position
- //
- if (StringCurPos < StringLen) {
- ++StringCurPos;
- MoveCursorForward (TotalColumn, TotalRow, &Column, &Row);
- }
- break;
+ default:
+ if (Key.UnicodeChar >= ' ') {
+ //
+ // If we are at the buffer's end, drop the key
+ //
+ if ((StringLen == MaxStr - 1) && (ShellInfoObject.ViewingSettings.InsertMode || (StringCurPos == StringLen))) {
+ break;
+ }
- case SCAN_HOME:
- //
- // Move current cursor position to the beginning of the command line
- //
- Row -= (StringCurPos + StartColumn) / TotalColumn;
- Column = StartColumn;
- StringCurPos = 0;
- break;
+ //
+ // If in insert mode, make space by moving each other character 1
+ // space higher in the array
+ //
+ if (ShellInfoObject.ViewingSettings.InsertMode) {
+ CopyMem (CurrentString + StringCurPos + 1, CurrentString + StringCurPos, (StringLen - StringCurPos)*sizeof (CurrentString[0]));
+ }
- case SCAN_END:
- //
- // Move current cursor position to the end of the command line
- //
- TailRow = Row + (StringLen - StringCurPos + Column) / TotalColumn;
- TailColumn = (StringLen - StringCurPos + Column) % TotalColumn;
- Row = TailRow;
- Column = TailColumn;
- StringCurPos = StringLen;
- break;
+ CurrentString[StringCurPos] = Key.UnicodeChar;
+ Update = StringCurPos;
- case SCAN_ESC:
- //
- // Prepare to clear the current command line
- //
- CurrentString[0] = 0;
- Update = 0;
- Delete = StringLen;
- Row -= (StringCurPos + StartColumn) / TotalColumn;
- Column = StartColumn;
- OutputLength = 0;
- break;
+ StringCurPos += 1;
+ OutputLength = 1;
+ }
- case SCAN_INSERT:
- //
- // Toggle the SEnvInsertMode flag
- //
- ShellInfoObject.ViewingSettings.InsertMode = (BOOLEAN)!ShellInfoObject.ViewingSettings.InsertMode;
break;
- case SCAN_F7:
- //
- // Print command history
- //
- PrintCommandHistory (TotalColumn, TotalRow, 4);
- *CurrentString = CHAR_NULL;
- Done = TRUE;
- break;
- }
+ case 0:
+ switch (Key.ScanCode) {
+ case SCAN_DELETE:
+ //
+ // Move characters behind current position one character forward
+ //
+ if (StringLen != 0) {
+ Update = StringCurPos;
+ Delete = 1;
+ CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos));
+ }
+
+ break;
+
+ case SCAN_UP:
+ //
+ // Prepare to print the previous command
+ //
+ NewPos = (BUFFER_LIST *)GetPreviousNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
+ if (IsNull (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link)) {
+ NewPos = (BUFFER_LIST *)GetPreviousNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
+ }
+
+ break;
+
+ case SCAN_DOWN:
+ //
+ // Prepare to print the next command
+ //
+ NewPos = (BUFFER_LIST *)GetNextNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
+ if (NewPos == (BUFFER_LIST *)(&ShellInfoObject.ViewingSettings.CommandHistory)) {
+ NewPos = (BUFFER_LIST *)GetNextNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
+ }
+
+ break;
+
+ case SCAN_LEFT:
+ //
+ // Adjust current cursor position
+ //
+ if (StringCurPos != 0) {
+ --StringCurPos;
+ MoveCursorBackward (TotalColumn, &Column, &Row);
+ }
+
+ break;
+
+ case SCAN_RIGHT:
+ //
+ // Adjust current cursor position
+ //
+ if (StringCurPos < StringLen) {
+ ++StringCurPos;
+ MoveCursorForward (TotalColumn, TotalRow, &Column, &Row);
+ }
+
+ break;
+
+ case SCAN_HOME:
+ //
+ // Move current cursor position to the beginning of the command line
+ //
+ Row -= (StringCurPos + StartColumn) / TotalColumn;
+ Column = StartColumn;
+ StringCurPos = 0;
+ break;
+
+ case SCAN_END:
+ //
+ // Move current cursor position to the end of the command line
+ //
+ TailRow = Row + (StringLen - StringCurPos + Column) / TotalColumn;
+ TailColumn = (StringLen - StringCurPos + Column) % TotalColumn;
+ Row = TailRow;
+ Column = TailColumn;
+ StringCurPos = StringLen;
+ break;
+
+ case SCAN_ESC:
+ //
+ // Prepare to clear the current command line
+ //
+ CurrentString[0] = 0;
+ Update = 0;
+ Delete = StringLen;
+ Row -= (StringCurPos + StartColumn) / TotalColumn;
+ Column = StartColumn;
+ OutputLength = 0;
+ break;
+
+ case SCAN_INSERT:
+ //
+ // Toggle the SEnvInsertMode flag
+ //
+ ShellInfoObject.ViewingSettings.InsertMode = (BOOLEAN) !ShellInfoObject.ViewingSettings.InsertMode;
+ break;
+
+ case SCAN_F7:
+ //
+ // Print command history
+ //
+ PrintCommandHistory (TotalColumn, TotalRow, 4);
+ *CurrentString = CHAR_NULL;
+ Done = TRUE;
+ break;
+ }
}
if (Done) {
@@ -780,19 +798,18 @@ FileInterfaceStdInRead( }
}
- if (InTabScrolling && TabOutputStr != NULL) {
-
+ if (InTabScrolling && (TabOutputStr != NULL)) {
//
// Adjust the column and row to the start of TAB-completion string.
//
- Column = (StartColumn + TabUpdatePos) % TotalColumn;
- Row -= (StartColumn + StringCurPos) / TotalColumn - (StartColumn + TabUpdatePos) / TotalColumn;
+ Column = (StartColumn + TabUpdatePos) % TotalColumn;
+ Row -= (StartColumn + StringCurPos) / TotalColumn - (StartColumn + TabUpdatePos) / TotalColumn;
OutputLength = StrLen (TabCurrent->FileName);
//
// if the output string contains blank space, quotation marks L'\"'
// should be added to the output.
//
- if (StrStr(TabCurrent->FileName, L" ") != NULL){
+ if (StrStr (TabCurrent->FileName, L" ") != NULL) {
TabOutputStr[0] = L'\"';
CopyMem (TabOutputStr + 1, TabCurrent->FileName, OutputLength * sizeof (CHAR16));
TabOutputStr[OutputLength + 1] = L'\"';
@@ -801,34 +818,35 @@ FileInterfaceStdInRead( CopyMem (TabOutputStr, TabCurrent->FileName, OutputLength * sizeof (CHAR16));
TabOutputStr[OutputLength] = CHAR_NULL;
}
+
OutputLength = StrLen (TabOutputStr) < MaxStr - 1 ? StrLen (TabOutputStr) : MaxStr - 1;
CopyMem (CurrentString + TabUpdatePos, TabOutputStr, OutputLength * sizeof (CHAR16));
CurrentString[TabUpdatePos + OutputLength] = CHAR_NULL;
- StringCurPos = TabUpdatePos + OutputLength;
- Update = TabUpdatePos;
+ StringCurPos = TabUpdatePos + OutputLength;
+ Update = TabUpdatePos;
if (StringLen > TabUpdatePos + OutputLength) {
Delete = StringLen - TabUpdatePos - OutputLength;
}
- FreePool(TabOutputStr);
+ FreePool (TabOutputStr);
}
//
// If we have a new position, we are preparing to print a previous or
// next command.
//
- if (NewPos != (BUFFER_LIST*)(&ShellInfoObject.ViewingSettings.CommandHistory)) {
+ if (NewPos != (BUFFER_LIST *)(&ShellInfoObject.ViewingSettings.CommandHistory)) {
Column = StartColumn;
- Row -= (StringCurPos + StartColumn) / TotalColumn;
+ Row -= (StringCurPos + StartColumn) / TotalColumn;
- LinePos = NewPos;
- NewPos = (BUFFER_LIST*)(&ShellInfoObject.ViewingSettings.CommandHistory);
+ LinePos = NewPos;
+ NewPos = (BUFFER_LIST *)(&ShellInfoObject.ViewingSettings.CommandHistory);
- OutputLength = StrLen (LinePos->Buffer) < MaxStr - 1 ? StrLen (LinePos->Buffer) : MaxStr - 1;
+ OutputLength = StrLen (LinePos->Buffer) < MaxStr - 1 ? StrLen (LinePos->Buffer) : MaxStr - 1;
CopyMem (CurrentString, LinePos->Buffer, OutputLength * sizeof (CHAR16));
CurrentString[OutputLength] = CHAR_NULL;
- StringCurPos = OutputLength;
+ StringCurPos = OutputLength;
//
// Draw new input string
@@ -841,10 +859,11 @@ FileInterfaceStdInRead( Delete = StringLen - OutputLength;
}
}
+
//
// If we need to update the output do so now
//
- if (Update != (UINTN) -1) {
+ if (Update != (UINTN)-1) {
ShellPrintEx ((INT32)Column, (INT32)Row, L"%s%.*s", CurrentString + Update, Delete, L"");
StringLen = StrLen (CurrentString);
@@ -856,19 +875,19 @@ FileInterfaceStdInRead( StringCurPos = StringLen;
}
- Update = (UINTN) -1;
+ Update = (UINTN)-1;
//
// After using print to reflect newly updates, if we're not using
// BACKSPACE and DELETE, we need to move the cursor position forward,
// so adjust row and column here.
//
- if (Key.UnicodeChar != CHAR_BACKSPACE && !(Key.UnicodeChar == 0 && Key.ScanCode == SCAN_DELETE)) {
+ if ((Key.UnicodeChar != CHAR_BACKSPACE) && !((Key.UnicodeChar == 0) && (Key.ScanCode == SCAN_DELETE))) {
//
// Calculate row and column of the tail of current string
//
- TailRow = Row + (StringLen - StringCurPos + Column + OutputLength) / TotalColumn;
- TailColumn = (StringLen - StringCurPos + Column + OutputLength) % TotalColumn;
+ TailRow = Row + (StringLen - StringCurPos + Column + OutputLength) / TotalColumn;
+ TailColumn = (StringLen - StringCurPos + Column + OutputLength) % TotalColumn;
//
// If the tail of string reaches screen end, screen rolls up, so if
@@ -877,9 +896,10 @@ FileInterfaceStdInRead( // (if we are recalling commands using UPPER and DOWN key, and if the
// old command is too long to fit the screen, TailColumn must be 79.
//
- if (TailColumn == 0 && TailRow >= TotalRow && Row != TailRow) {
+ if ((TailColumn == 0) && (TailRow >= TotalRow) && (Row != TailRow)) {
Row--;
}
+
//
// Calculate the cursor position after current operation. If cursor
// reaches line end, update both row and column, otherwise, only
@@ -901,17 +921,18 @@ FileInterfaceStdInRead( Delete = 0;
}
+
//
// Set the cursor position for this key
//
gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row);
} while (!Done);
- if (CurrentString != NULL && StrLen(CurrentString) > 0) {
+ if ((CurrentString != NULL) && (StrLen (CurrentString) > 0)) {
//
// add the line to the history buffer
//
- AddLineToCommandHistory(CurrentString);
+ AddLineToCommandHistory (CurrentString);
}
//
@@ -926,7 +947,8 @@ FileInterfaceStdInRead( if (TabCompleteList != NULL) {
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&TabCompleteList);
}
- ASSERT(TabCompleteList == NULL);
+
+ ASSERT (TabCompleteList == NULL);
return Status;
}
@@ -934,7 +956,7 @@ FileInterfaceStdInRead( //
// FILE style interfaces for StdIn/StdOut/StdErr
//
-EFI_FILE_PROTOCOL FileInterfaceStdIn = {
+EFI_FILE_PROTOCOL FileInterfaceStdIn = {
EFI_FILE_REVISION,
FileInterfaceOpenNotFound,
FileInterfaceNopGeneric,
@@ -948,7 +970,7 @@ EFI_FILE_PROTOCOL FileInterfaceStdIn = { FileInterfaceNopGeneric
};
-EFI_FILE_PROTOCOL FileInterfaceStdOut = {
+EFI_FILE_PROTOCOL FileInterfaceStdOut = {
EFI_FILE_REVISION,
FileInterfaceOpenNotFound,
FileInterfaceNopGeneric,
@@ -962,7 +984,7 @@ EFI_FILE_PROTOCOL FileInterfaceStdOut = { FileInterfaceNopGeneric
};
-EFI_FILE_PROTOCOL FileInterfaceStdErr = {
+EFI_FILE_PROTOCOL FileInterfaceStdErr = {
EFI_FILE_REVISION,
FileInterfaceOpenNotFound,
FileInterfaceNopGeneric,
@@ -976,7 +998,7 @@ EFI_FILE_PROTOCOL FileInterfaceStdErr = { FileInterfaceNopGeneric
};
-EFI_FILE_PROTOCOL FileInterfaceNulFile = {
+EFI_FILE_PROTOCOL FileInterfaceNulFile = {
EFI_FILE_REVISION,
FileInterfaceOpenNotFound,
FileInterfaceNopGeneric,
@@ -990,30 +1012,27 @@ EFI_FILE_PROTOCOL FileInterfaceNulFile = { FileInterfaceNopGeneric
};
-
-
-
//
// This is identical to EFI_FILE_PROTOCOL except for the additional member
// for the name.
//
typedef struct {
- UINT64 Revision;
- EFI_FILE_OPEN Open;
- EFI_FILE_CLOSE Close;
- EFI_FILE_DELETE Delete;
- EFI_FILE_READ Read;
- EFI_FILE_WRITE Write;
- EFI_FILE_GET_POSITION GetPosition;
- EFI_FILE_SET_POSITION SetPosition;
- EFI_FILE_GET_INFO GetInfo;
- EFI_FILE_SET_INFO SetInfo;
- EFI_FILE_FLUSH Flush;
- CHAR16 Name[1];
+ UINT64 Revision;
+ EFI_FILE_OPEN Open;
+ EFI_FILE_CLOSE Close;
+ EFI_FILE_DELETE Delete;
+ EFI_FILE_READ Read;
+ EFI_FILE_WRITE Write;
+ EFI_FILE_GET_POSITION GetPosition;
+ EFI_FILE_SET_POSITION SetPosition;
+ EFI_FILE_GET_INFO GetInfo;
+ EFI_FILE_SET_INFO SetInfo;
+ EFI_FILE_FLUSH Flush;
+ CHAR16 Name[1];
} EFI_FILE_PROTOCOL_ENVIRONMENT;
-//ANSI compliance helper to get size of the struct.
-#define SIZE_OF_EFI_FILE_PROTOCOL_ENVIRONMENT EFI_FIELD_OFFSET (EFI_FILE_PROTOCOL_ENVIRONMENT, Name)
+// ANSI compliance helper to get size of the struct.
+#define SIZE_OF_EFI_FILE_PROTOCOL_ENVIRONMENT EFI_FIELD_OFFSET (EFI_FILE_PROTOCOL_ENVIRONMENT, Name)
/**
File style interface for Environment Variable (Close).
@@ -1026,11 +1045,11 @@ typedef struct { **/
EFI_STATUS
EFIAPI
-FileInterfaceEnvClose(
- IN EFI_FILE_PROTOCOL *This
+FileInterfaceEnvClose (
+ IN EFI_FILE_PROTOCOL *This
)
{
- VOID* NewBuffer;
+ VOID *NewBuffer;
UINTN NewSize;
EFI_STATUS Status;
BOOLEAN Volatile;
@@ -1042,48 +1061,49 @@ FileInterfaceEnvClose( // keep this. So, before closing, strip the trailing '\r\n' from the variable
// if it exists.
//
- NewBuffer = NULL;
- NewSize = 0;
- TotalSize = 0;
+ NewBuffer = NULL;
+ NewSize = 0;
+ TotalSize = 0;
- Status = IsVolatileEnv (((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &Volatile);
+ Status = IsVolatileEnv (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &Volatile);
if (EFI_ERROR (Status)) {
return Status;
}
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
TotalSize = NewSize + sizeof (CHAR16);
NewBuffer = AllocateZeroPool (TotalSize);
if (NewBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
- }
- if (!EFI_ERROR(Status) && NewBuffer != NULL) {
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
+ }
+ if (!EFI_ERROR (Status) && (NewBuffer != NULL)) {
if (TotalSize / sizeof (CHAR16) >= 3) {
- if ( (((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 2] == CHAR_LINEFEED) &&
- (((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] == CHAR_CARRIAGE_RETURN)
- ) {
- ((CHAR16*)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] = CHAR_NULL;
+ if ((((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 2] == CHAR_LINEFEED) &&
+ (((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] == CHAR_CARRIAGE_RETURN)
+ )
+ {
+ ((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] = CHAR_NULL;
//
// If the NewBuffer end with \r\n\0, We will replace '\r' by '\0' and then update TotalSize.
//
- TotalSize -= sizeof(CHAR16) * 2;
+ TotalSize -= sizeof (CHAR16) * 2;
}
if (Volatile) {
Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
TotalSize - sizeof (CHAR16),
NewBuffer
);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = ShellAddEnvVarToList (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
NewBuffer,
TotalSize,
EFI_VARIABLE_BOOTSERVICE_ACCESS
@@ -1091,14 +1111,14 @@ FileInterfaceEnvClose( }
} else {
Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
TotalSize - sizeof (CHAR16),
NewBuffer
);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = ShellAddEnvVarToList (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
NewBuffer,
TotalSize,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS
@@ -1108,8 +1128,8 @@ FileInterfaceEnvClose( }
}
- SHELL_FREE_NON_NULL(NewBuffer);
- FreePool((EFI_FILE_PROTOCOL_ENVIRONMENT*)This);
+ SHELL_FREE_NON_NULL (NewBuffer);
+ FreePool ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This);
return (Status);
}
@@ -1122,12 +1142,12 @@ FileInterfaceEnvClose( **/
EFI_STATUS
EFIAPI
-FileInterfaceEnvDelete(
- IN EFI_FILE_PROTOCOL *This
+FileInterfaceEnvDelete (
+ IN EFI_FILE_PROTOCOL *This
)
{
- SHELL_DELETE_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name);
- return (FileInterfaceEnvClose(This));
+ SHELL_DELETE_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name);
+ return (FileInterfaceEnvClose (This));
}
/**
@@ -1141,13 +1161,13 @@ FileInterfaceEnvDelete( **/
EFI_STATUS
EFIAPI
-FileInterfaceEnvRead(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceEnvRead (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
*BufferSize = *BufferSize / sizeof (CHAR16) * sizeof (CHAR16);
if (*BufferSize != 0) {
@@ -1160,7 +1180,7 @@ FileInterfaceEnvRead( }
Status = SHELL_GET_ENVIRONMENT_VARIABLE (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
BufferSize,
Buffer
);
@@ -1170,6 +1190,7 @@ FileInterfaceEnvRead( //
*BufferSize += sizeof (gUnicodeFileTag);
}
+
return Status;
}
@@ -1186,26 +1207,26 @@ FileInterfaceEnvRead( **/
EFI_STATUS
EFIAPI
-FileInterfaceEnvVolWrite(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileInterfaceEnvVolWrite (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
- VOID* NewBuffer;
+ VOID *NewBuffer;
UINTN NewSize;
EFI_STATUS Status;
UINTN TotalSize;
- NewBuffer = NULL;
- NewSize = 0;
- TotalSize = 0;
+ NewBuffer = NULL;
+ NewSize = 0;
+ TotalSize = 0;
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
TotalSize = NewSize + *BufferSize + sizeof (CHAR16);
} else if (Status == EFI_NOT_FOUND) {
- TotalSize = *BufferSize + sizeof(CHAR16);
+ TotalSize = *BufferSize + sizeof (CHAR16);
} else {
return Status;
}
@@ -1216,40 +1237,39 @@ FileInterfaceEnvVolWrite( }
if (Status == EFI_BUFFER_TOO_SMALL) {
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
}
- if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
+ if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
FreePool (NewBuffer);
return Status;
}
- CopyMem ((UINT8*)NewBuffer + NewSize, Buffer, *BufferSize);
+ CopyMem ((UINT8 *)NewBuffer + NewSize, Buffer, *BufferSize);
Status = ShellAddEnvVarToList (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
NewBuffer,
TotalSize,
EFI_VARIABLE_BOOTSERVICE_ACCESS
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
FreePool (NewBuffer);
return Status;
}
Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
TotalSize - sizeof (CHAR16),
NewBuffer
);
- if (EFI_ERROR(Status)) {
- ShellRemvoeEnvVarFromList (((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name);
+ if (EFI_ERROR (Status)) {
+ ShellRemvoeEnvVarFromList (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name);
}
FreePool (NewBuffer);
return Status;
}
-
/**
File style interface for Non Volatile Environment Variable (Write).
This function also caches the environment variable into gShellEnvVarList.
@@ -1263,22 +1283,22 @@ FileInterfaceEnvVolWrite( **/
EFI_STATUS
EFIAPI
-FileInterfaceEnvNonVolWrite(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileInterfaceEnvNonVolWrite (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
- VOID* NewBuffer;
+ VOID *NewBuffer;
UINTN NewSize;
EFI_STATUS Status;
UINTN TotalSize;
- NewBuffer = NULL;
- NewSize = 0;
- TotalSize = 0;
+ NewBuffer = NULL;
+ NewSize = 0;
+ TotalSize = 0;
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
TotalSize = NewSize + *BufferSize + sizeof (CHAR16);
} else if (Status == EFI_NOT_FOUND) {
@@ -1293,17 +1313,17 @@ FileInterfaceEnvNonVolWrite( }
if (Status == EFI_BUFFER_TOO_SMALL) {
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
}
- if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {
+ if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
FreePool (NewBuffer);
return Status;
}
- CopyMem ((UINT8*) NewBuffer + NewSize, Buffer, *BufferSize);
+ CopyMem ((UINT8 *)NewBuffer + NewSize, Buffer, *BufferSize);
Status = ShellAddEnvVarToList (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
NewBuffer,
TotalSize,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS
@@ -1314,12 +1334,12 @@ FileInterfaceEnvNonVolWrite( }
Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV (
- ((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name,
+ ((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name,
TotalSize - sizeof (CHAR16),
NewBuffer
);
if (EFI_ERROR (Status)) {
- ShellRemvoeEnvVarFromList (((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name);
+ ShellRemvoeEnvVarFromList (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name);
}
FreePool (NewBuffer);
@@ -1335,9 +1355,9 @@ FileInterfaceEnvNonVolWrite( @retval NULL Memory could not be allocated.
@return other a pointer to an EFI_FILE_PROTOCOL structure
**/
-EFI_FILE_PROTOCOL*
-CreateFileInterfaceEnv(
- IN CONST CHAR16 *EnvName
+EFI_FILE_PROTOCOL *
+CreateFileInterfaceEnv (
+ IN CONST CHAR16 *EnvName
)
{
EFI_STATUS Status;
@@ -1357,9 +1377,9 @@ CreateFileInterfaceEnv( //
// Get some memory
//
- EnvNameSize = StrSize(EnvName);
- EnvFileInterface = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_ENVIRONMENT)+EnvNameSize);
- if (EnvFileInterface == NULL){
+ EnvNameSize = StrSize (EnvName);
+ EnvFileInterface = AllocateZeroPool (sizeof (EFI_FILE_PROTOCOL_ENVIRONMENT)+EnvNameSize);
+ if (EnvFileInterface == NULL) {
return (NULL);
}
@@ -1377,16 +1397,17 @@ CreateFileInterfaceEnv( EnvFileInterface->Delete = FileInterfaceEnvDelete;
EnvFileInterface->Read = FileInterfaceEnvRead;
- CopyMem(EnvFileInterface->Name, EnvName, EnvNameSize);
+ CopyMem (EnvFileInterface->Name, EnvName, EnvNameSize);
//
// Assign the different members for Volatile and Non-Volatile variables
//
if (Volatile) {
- EnvFileInterface->Write = FileInterfaceEnvVolWrite;
+ EnvFileInterface->Write = FileInterfaceEnvVolWrite;
} else {
- EnvFileInterface->Write = FileInterfaceEnvNonVolWrite;
+ EnvFileInterface->Write = FileInterfaceEnvNonVolWrite;
}
+
return ((EFI_FILE_PROTOCOL *)EnvFileInterface);
}
@@ -1399,9 +1420,9 @@ CreateFileInterfaceEnv( **/
VOID
MoveCursorBackward (
- IN UINTN LineLength,
- IN OUT UINTN *Column,
- IN OUT UINTN *Row
+ IN UINTN LineLength,
+ IN OUT UINTN *Column,
+ IN OUT UINTN *Row
)
{
//
@@ -1413,8 +1434,10 @@ MoveCursorBackward ( if (*Row > 0) {
(*Row)--;
}
+
return;
}
+
(*Column)--;
}
@@ -1428,10 +1451,10 @@ MoveCursorBackward ( **/
VOID
MoveCursorForward (
- IN UINTN LineLength,
- IN UINTN TotalRow,
- IN OUT UINTN *Column,
- IN OUT UINTN *Row
+ IN UINTN LineLength,
+ IN UINTN TotalRow,
+ IN OUT UINTN *Column,
+ IN OUT UINTN *Row
)
{
//
@@ -1459,70 +1482,67 @@ MoveCursorForward ( **/
VOID
PrintCommandHistory (
- IN CONST UINTN TotalCols,
- IN CONST UINTN TotalRows,
- IN CONST UINTN StartColumn
+ IN CONST UINTN TotalCols,
+ IN CONST UINTN TotalRows,
+ IN CONST UINTN StartColumn
)
{
- BUFFER_LIST *Node;
- UINTN Index;
- UINTN LineNumber;
- UINTN LineCount;
+ BUFFER_LIST *Node;
+ UINTN Index;
+ UINTN LineNumber;
+ UINTN LineCount;
ShellPrintEx (-1, -1, L"\n");
- Index = 0;
- LineNumber = 0;
+ Index = 0;
+ LineNumber = 0;
//
// go through history list...
//
- for ( Node = (BUFFER_LIST*)GetFirstNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link)
- ; !IsNull(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
- ; Node = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
- ){
+ for ( Node = (BUFFER_LIST *)GetFirstNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link)
+ ; !IsNull (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
+ ; Node = (BUFFER_LIST *)GetNextNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
+ )
+ {
Index++;
LineCount = ((StrLen (Node->Buffer) + StartColumn + 1) / TotalCols) + 1;
if (LineNumber + LineCount >= TotalRows) {
- ShellPromptForResponseHii(
+ ShellPromptForResponseHii (
ShellPromptResponseTypeEnterContinue,
STRING_TOKEN (STR_SHELL_ENTER_TO_CONT),
ShellInfoObject.HiiHandle,
NULL
- );
+ );
LineNumber = 0;
}
+
ShellPrintEx (-1, -1, L"%2d. %s\n", Index, Node->Buffer);
LineNumber += LineCount;
}
}
-
-
-
-
-
//
// This is identical to EFI_FILE_PROTOCOL except for the additional members
// for the buffer, size, and position.
//
typedef struct {
- UINT64 Revision;
- EFI_FILE_OPEN Open;
- EFI_FILE_CLOSE Close;
- EFI_FILE_DELETE Delete;
- EFI_FILE_READ Read;
- EFI_FILE_WRITE Write;
- EFI_FILE_GET_POSITION GetPosition;
- EFI_FILE_SET_POSITION SetPosition;
- EFI_FILE_GET_INFO GetInfo;
- EFI_FILE_SET_INFO SetInfo;
- EFI_FILE_FLUSH Flush;
- VOID *Buffer;
- UINT64 Position;
- UINT64 BufferSize;
- BOOLEAN Unicode;
- UINT64 FileSize;
+ UINT64 Revision;
+ EFI_FILE_OPEN Open;
+ EFI_FILE_CLOSE Close;
+ EFI_FILE_DELETE Delete;
+ EFI_FILE_READ Read;
+ EFI_FILE_WRITE Write;
+ EFI_FILE_GET_POSITION GetPosition;
+ EFI_FILE_SET_POSITION SetPosition;
+ EFI_FILE_GET_INFO GetInfo;
+ EFI_FILE_SET_INFO SetInfo;
+ EFI_FILE_FLUSH Flush;
+ VOID *Buffer;
+ UINT64 Position;
+ UINT64 BufferSize;
+ BOOLEAN Unicode;
+ UINT64 FileSize;
} EFI_FILE_PROTOCOL_MEM;
/**
@@ -1536,13 +1556,13 @@ typedef struct { **/
EFI_STATUS
EFIAPI
-FileInterfaceMemSetPosition(
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 Position
+FileInterfaceMemSetPosition (
+ IN EFI_FILE_PROTOCOL *This,
+ OUT UINT64 Position
)
{
- if (Position <= ((EFI_FILE_PROTOCOL_MEM*)This)->FileSize) {
- ((EFI_FILE_PROTOCOL_MEM*)This)->Position = Position;
+ if (Position <= ((EFI_FILE_PROTOCOL_MEM *)This)->FileSize) {
+ ((EFI_FILE_PROTOCOL_MEM *)This)->Position = Position;
return (EFI_SUCCESS);
} else {
return (EFI_INVALID_PARAMETER);
@@ -1559,12 +1579,12 @@ FileInterfaceMemSetPosition( **/
EFI_STATUS
EFIAPI
-FileInterfaceMemGetPosition(
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
+FileInterfaceMemGetPosition (
+ IN EFI_FILE_PROTOCOL *This,
+ OUT UINT64 *Position
)
{
- *Position = ((EFI_FILE_PROTOCOL_MEM*)This)->Position;
+ *Position = ((EFI_FILE_PROTOCOL_MEM *)This)->Position;
return (EFI_SUCCESS);
}
@@ -1588,27 +1608,29 @@ FileInterfaceMemGetPosition( **/
EFI_STATUS
EFIAPI
-FileInterfaceMemGetInfo(
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceMemGetInfo (
+ IN EFI_FILE_PROTOCOL *This,
+ IN EFI_GUID *InformationType,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
- EFI_FILE_INFO *FileInfo;
+ EFI_FILE_INFO *FileInfo;
if (CompareGuid (InformationType, &gEfiFileInfoGuid)) {
if (*BufferSize < sizeof (EFI_FILE_INFO)) {
*BufferSize = sizeof (EFI_FILE_INFO);
return EFI_BUFFER_TOO_SMALL;
}
+
if (Buffer == NULL) {
return EFI_INVALID_PARAMETER;
}
- FileInfo = (EFI_FILE_INFO *)Buffer;
+
+ FileInfo = (EFI_FILE_INFO *)Buffer;
FileInfo->Size = sizeof (*FileInfo);
ZeroMem (FileInfo, sizeof (*FileInfo));
- FileInfo->FileSize = ((EFI_FILE_PROTOCOL_MEM*)This)->FileSize;
+ FileInfo->FileSize = ((EFI_FILE_PROTOCOL_MEM *)This)->FileSize;
FileInfo->PhysicalSize = FileInfo->FileSize;
return EFI_SUCCESS;
}
@@ -1628,52 +1650,57 @@ FileInterfaceMemGetInfo( **/
EFI_STATUS
EFIAPI
-FileInterfaceMemWrite(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileInterfaceMemWrite (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
CHAR8 *AsciiBuffer;
EFI_FILE_PROTOCOL_MEM *MemFile;
- MemFile = (EFI_FILE_PROTOCOL_MEM *) This;
+ MemFile = (EFI_FILE_PROTOCOL_MEM *)This;
if (MemFile->Unicode) {
//
// Unicode
//
if ((UINTN)(MemFile->Position + (*BufferSize)) > (UINTN)(MemFile->BufferSize)) {
- MemFile->Buffer = ReallocatePool((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer);
- if (MemFile->Buffer == NULL){
+ MemFile->Buffer = ReallocatePool ((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer);
+ if (MemFile->Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
MemFile->BufferSize += (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD;
}
- CopyMem(((UINT8*)MemFile->Buffer) + MemFile->Position, Buffer, *BufferSize);
+
+ CopyMem (((UINT8 *)MemFile->Buffer) + MemFile->Position, Buffer, *BufferSize);
MemFile->Position += (*BufferSize);
- MemFile->FileSize = MemFile->Position;
+ MemFile->FileSize = MemFile->Position;
return (EFI_SUCCESS);
} else {
//
// Ascii
//
- AsciiBuffer = AllocateZeroPool(*BufferSize);
+ AsciiBuffer = AllocateZeroPool (*BufferSize);
if (AsciiBuffer == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- AsciiSPrint(AsciiBuffer, *BufferSize, "%S", Buffer);
- if ((UINTN)(MemFile->Position + AsciiStrSize(AsciiBuffer)) > (UINTN)(MemFile->BufferSize)) {
- MemFile->Buffer = ReallocatePool((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + AsciiStrSize(AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer);
- if (MemFile->Buffer == NULL){
- FreePool(AsciiBuffer);
+
+ AsciiSPrint (AsciiBuffer, *BufferSize, "%S", Buffer);
+ if ((UINTN)(MemFile->Position + AsciiStrSize (AsciiBuffer)) > (UINTN)(MemFile->BufferSize)) {
+ MemFile->Buffer = ReallocatePool ((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + AsciiStrSize (AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer);
+ if (MemFile->Buffer == NULL) {
+ FreePool (AsciiBuffer);
return EFI_OUT_OF_RESOURCES;
}
- MemFile->BufferSize += AsciiStrSize(AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD;
+
+ MemFile->BufferSize += AsciiStrSize (AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD;
}
- CopyMem(((UINT8*)MemFile->Buffer) + MemFile->Position, AsciiBuffer, AsciiStrSize(AsciiBuffer));
- MemFile->Position += (*BufferSize / sizeof(CHAR16));
- MemFile->FileSize = MemFile->Position;
- FreePool(AsciiBuffer);
+
+ CopyMem (((UINT8 *)MemFile->Buffer) + MemFile->Position, AsciiBuffer, AsciiStrSize (AsciiBuffer));
+ MemFile->Position += (*BufferSize / sizeof (CHAR16));
+ MemFile->FileSize = MemFile->Position;
+ FreePool (AsciiBuffer);
return (EFI_SUCCESS);
}
}
@@ -1689,19 +1716,20 @@ FileInterfaceMemWrite( **/
EFI_STATUS
EFIAPI
-FileInterfaceMemRead(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+FileInterfaceMemRead (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
EFI_FILE_PROTOCOL_MEM *MemFile;
- MemFile = (EFI_FILE_PROTOCOL_MEM *) This;
+ MemFile = (EFI_FILE_PROTOCOL_MEM *)This;
if (*BufferSize > (UINTN)((MemFile->FileSize) - (UINTN)(MemFile->Position))) {
(*BufferSize) = (UINTN)((MemFile->FileSize) - (UINTN)(MemFile->Position));
}
- CopyMem(Buffer, ((UINT8*)MemFile->Buffer) + MemFile->Position, (*BufferSize));
+
+ CopyMem (Buffer, ((UINT8 *)MemFile->Buffer) + MemFile->Position, (*BufferSize));
MemFile->Position = MemFile->Position + (*BufferSize);
return (EFI_SUCCESS);
}
@@ -1717,12 +1745,12 @@ FileInterfaceMemRead( **/
EFI_STATUS
EFIAPI
-FileInterfaceMemClose(
- IN EFI_FILE_PROTOCOL *This
+FileInterfaceMemClose (
+ IN EFI_FILE_PROTOCOL *This
)
{
- SHELL_FREE_NON_NULL(((EFI_FILE_PROTOCOL_MEM*)This)->Buffer);
- SHELL_FREE_NON_NULL(This);
+ SHELL_FREE_NON_NULL (((EFI_FILE_PROTOCOL_MEM *)This)->Buffer);
+ SHELL_FREE_NON_NULL (This);
return (EFI_SUCCESS);
}
@@ -1735,9 +1763,9 @@ FileInterfaceMemClose( @retval NULL Memory could not be allocated.
@return other A pointer to an EFI_FILE_PROTOCOL structure.
**/
-EFI_FILE_PROTOCOL*
-CreateFileInterfaceMem(
- IN CONST BOOLEAN Unicode
+EFI_FILE_PROTOCOL *
+CreateFileInterfaceMem (
+ IN CONST BOOLEAN Unicode
)
{
EFI_FILE_PROTOCOL_MEM *FileInterface;
@@ -1745,8 +1773,8 @@ CreateFileInterfaceMem( //
// Get some memory
//
- FileInterface = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_MEM));
- if (FileInterface == NULL){
+ FileInterface = AllocateZeroPool (sizeof (EFI_FILE_PROTOCOL_MEM));
+ if (FileInterface == NULL) {
return (NULL);
}
@@ -1766,38 +1794,39 @@ CreateFileInterfaceMem( FileInterface->Write = FileInterfaceMemWrite;
FileInterface->Unicode = Unicode;
- ASSERT(FileInterface->Buffer == NULL);
- ASSERT(FileInterface->BufferSize == 0);
- ASSERT(FileInterface->Position == 0);
+ ASSERT (FileInterface->Buffer == NULL);
+ ASSERT (FileInterface->BufferSize == 0);
+ ASSERT (FileInterface->Position == 0);
if (Unicode) {
- FileInterface->Buffer = AllocateZeroPool(sizeof(gUnicodeFileTag));
+ FileInterface->Buffer = AllocateZeroPool (sizeof (gUnicodeFileTag));
if (FileInterface->Buffer == NULL) {
FreePool (FileInterface);
return NULL;
}
- *((CHAR16 *) (FileInterface->Buffer)) = EFI_UNICODE_BYTE_ORDER_MARK;
- FileInterface->BufferSize = 2;
- FileInterface->Position = 2;
+
+ *((CHAR16 *)(FileInterface->Buffer)) = EFI_UNICODE_BYTE_ORDER_MARK;
+ FileInterface->BufferSize = 2;
+ FileInterface->Position = 2;
}
return ((EFI_FILE_PROTOCOL *)FileInterface);
}
typedef struct {
- UINT64 Revision;
- EFI_FILE_OPEN Open;
- EFI_FILE_CLOSE Close;
- EFI_FILE_DELETE Delete;
- EFI_FILE_READ Read;
- EFI_FILE_WRITE Write;
- EFI_FILE_GET_POSITION GetPosition;
- EFI_FILE_SET_POSITION SetPosition;
- EFI_FILE_GET_INFO GetInfo;
- EFI_FILE_SET_INFO SetInfo;
- EFI_FILE_FLUSH Flush;
- BOOLEAN Unicode;
- EFI_FILE_PROTOCOL *Orig;
+ UINT64 Revision;
+ EFI_FILE_OPEN Open;
+ EFI_FILE_CLOSE Close;
+ EFI_FILE_DELETE Delete;
+ EFI_FILE_READ Read;
+ EFI_FILE_WRITE Write;
+ EFI_FILE_GET_POSITION GetPosition;
+ EFI_FILE_SET_POSITION SetPosition;
+ EFI_FILE_GET_INFO GetInfo;
+ EFI_FILE_SET_INFO SetInfo;
+ EFI_FILE_FLUSH Flush;
+ BOOLEAN Unicode;
+ EFI_FILE_PROTOCOL *Orig;
} EFI_FILE_PROTOCOL_FILE;
/**
@@ -1812,12 +1841,12 @@ typedef struct { **/
EFI_STATUS
EFIAPI
-FileInterfaceFileSetPosition(
- IN EFI_FILE_PROTOCOL *This,
- IN UINT64 Position
+FileInterfaceFileSetPosition (
+ IN EFI_FILE_PROTOCOL *This,
+ IN UINT64 Position
)
{
- return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->SetPosition(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, Position);
+ return ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->SetPosition (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, Position);
}
/**
@@ -1832,12 +1861,12 @@ FileInterfaceFileSetPosition( **/
EFI_STATUS
EFIAPI
-FileInterfaceFileGetPosition(
- IN EFI_FILE_PROTOCOL *This,
- OUT UINT64 *Position
+FileInterfaceFileGetPosition (
+ IN EFI_FILE_PROTOCOL *This,
+ OUT UINT64 *Position
)
{
- return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->GetPosition(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, Position);
+ return ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->GetPosition (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, Position);
}
/**
@@ -1860,14 +1889,14 @@ FileInterfaceFileGetPosition( **/
EFI_STATUS
EFIAPI
-FileInterfaceFileGetInfo(
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceFileGetInfo (
+ IN EFI_FILE_PROTOCOL *This,
+ IN EFI_GUID *InformationType,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
- return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->GetInfo(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, InformationType, BufferSize, Buffer);
+ return ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->GetInfo (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, InformationType, BufferSize, Buffer);
}
/**
@@ -1889,14 +1918,14 @@ FileInterfaceFileGetInfo( **/
EFI_STATUS
EFIAPI
-FileInterfaceFileSetInfo(
- IN EFI_FILE_PROTOCOL *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
+FileInterfaceFileSetInfo (
+ IN EFI_FILE_PROTOCOL *This,
+ IN EFI_GUID *InformationType,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
)
{
- return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->SetInfo(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, InformationType, BufferSize, Buffer);
+ return ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->SetInfo (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, InformationType, BufferSize, Buffer);
}
/**
@@ -1916,11 +1945,11 @@ FileInterfaceFileSetInfo( **/
EFI_STATUS
EFIAPI
-FileInterfaceFileFlush(
+FileInterfaceFileFlush (
IN EFI_FILE_PROTOCOL *This
)
{
- return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Flush(((EFI_FILE_PROTOCOL_FILE*)This)->Orig);
+ return ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Flush (((EFI_FILE_PROTOCOL_FILE *)This)->Orig);
}
/**
@@ -1939,10 +1968,10 @@ FileInterfaceFileFlush( **/
EFI_STATUS
EFIAPI
-FileInterfaceFileRead(
- IN EFI_FILE_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+FileInterfaceFileRead (
+ IN EFI_FILE_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
EFI_STATUS Status;
@@ -1950,13 +1979,14 @@ FileInterfaceFileRead( CHAR8 *AsciiStrBuffer;
CHAR16 *UscStrBuffer;
UINTN Size;
- if (((EFI_FILE_PROTOCOL_FILE*)This)->Unicode) {
+
+ if (((EFI_FILE_PROTOCOL_FILE *)This)->Unicode) {
//
// Unicode
// There might be different file tag for the Unicode file. We cannot unconditionally insert the \xFEFF.
// So we choose to leave the file content as is.
//
- return (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Read(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, BufferSize, Buffer));
+ return (((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Read (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, BufferSize, Buffer));
} else {
//
// Ascii
@@ -1965,35 +1995,41 @@ FileInterfaceFileRead( if (*BufferSize == 0) {
return EFI_SUCCESS;
}
- Status = ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->GetPosition (((EFI_FILE_PROTOCOL_FILE*)This)->Orig, &Position);
+
+ Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->GetPosition (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, &Position);
if (EFI_ERROR (Status)) {
return Status;
}
+
if (Position == 0) {
//
// First two bytes in Buffer is for the Unicode file tag.
//
*(CHAR16 *)Buffer = gUnicodeFileTag;
- Buffer = (CHAR16 *)Buffer + 1;
- Size = *BufferSize / sizeof (CHAR16) - 1;
+ Buffer = (CHAR16 *)Buffer + 1;
+ Size = *BufferSize / sizeof (CHAR16) - 1;
} else {
- Size = *BufferSize / sizeof (CHAR16);
+ Size = *BufferSize / sizeof (CHAR16);
}
+
AsciiStrBuffer = AllocateZeroPool (Size + 1);
if (AsciiStrBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- UscStrBuffer = AllocateZeroPool ((Size + 1) * sizeof(CHAR16));
- if (UscStrBuffer== NULL) {
- SHELL_FREE_NON_NULL(AsciiStrBuffer);
+
+ UscStrBuffer = AllocateZeroPool ((Size + 1) * sizeof (CHAR16));
+ if (UscStrBuffer == NULL) {
+ SHELL_FREE_NON_NULL (AsciiStrBuffer);
return EFI_OUT_OF_RESOURCES;
}
- Status = ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Read (((EFI_FILE_PROTOCOL_FILE*)This)->Orig, &Size, AsciiStrBuffer);
- if (!EFI_ERROR(Status)) {
+
+ Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Read (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, &Size, AsciiStrBuffer);
+ if (!EFI_ERROR (Status)) {
AsciiStrToUnicodeStrS (AsciiStrBuffer, UscStrBuffer, Size + 1);
*BufferSize = Size * sizeof (CHAR16);
CopyMem (Buffer, UscStrBuffer, *BufferSize);
}
+
SHELL_FREE_NON_NULL (AsciiStrBuffer);
SHELL_FREE_NON_NULL (UscStrBuffer);
return Status;
@@ -2022,14 +2058,14 @@ FileInterfaceFileRead( EFI_STATUS
EFIAPI
FileInterfaceFileOpen (
- IN EFI_FILE_PROTOCOL *This,
- OUT EFI_FILE_PROTOCOL **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
+ IN EFI_FILE_PROTOCOL *This,
+ OUT EFI_FILE_PROTOCOL **NewHandle,
+ IN CHAR16 *FileName,
+ IN UINT64 OpenMode,
+ IN UINT64 Attributes
)
{
- return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Open(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, NewHandle, FileName, OpenMode, Attributes);
+ return ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Open (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, NewHandle, FileName, OpenMode, Attributes);
}
/**
@@ -2043,13 +2079,14 @@ FileInterfaceFileOpen ( **/
EFI_STATUS
EFIAPI
-FileInterfaceFileDelete(
+FileInterfaceFileDelete (
IN EFI_FILE_PROTOCOL *This
)
{
- EFI_STATUS Status;
- Status = ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Delete(((EFI_FILE_PROTOCOL_FILE*)This)->Orig);
- FreePool(This);
+ EFI_STATUS Status;
+
+ Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Delete (((EFI_FILE_PROTOCOL_FILE *)This)->Orig);
+ FreePool (This);
return (Status);
}
@@ -2062,13 +2099,14 @@ FileInterfaceFileDelete( **/
EFI_STATUS
EFIAPI
-FileInterfaceFileClose(
- IN EFI_FILE_PROTOCOL *This
+FileInterfaceFileClose (
+ IN EFI_FILE_PROTOCOL *This
)
{
- EFI_STATUS Status;
- Status = ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Close(((EFI_FILE_PROTOCOL_FILE*)This)->Orig);
- FreePool(This);
+ EFI_STATUS Status;
+
+ Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Close (((EFI_FILE_PROTOCOL_FILE *)This)->Orig);
+ FreePool (This);
return (Status);
}
@@ -2086,7 +2124,7 @@ FileInterfaceFileClose( **/
EFI_STATUS
EFIAPI
-FileInterfaceFileWrite(
+FileInterfaceFileWrite (
IN EFI_FILE_PROTOCOL *This,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
@@ -2095,20 +2133,21 @@ FileInterfaceFileWrite( CHAR8 *AsciiBuffer;
UINTN Size;
EFI_STATUS Status;
- if (((EFI_FILE_PROTOCOL_FILE*)This)->Unicode) {
+
+ if (((EFI_FILE_PROTOCOL_FILE *)This)->Unicode) {
//
// Unicode
//
- return (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Write(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, BufferSize, Buffer));
+ return (((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Write (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, BufferSize, Buffer));
} else {
//
// Ascii
//
- AsciiBuffer = AllocateZeroPool(*BufferSize);
- AsciiSPrint(AsciiBuffer, *BufferSize, "%S", Buffer);
- Size = AsciiStrSize(AsciiBuffer) - 1; // (we dont need the null terminator)
- Status = (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Write(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, &Size, AsciiBuffer));
- FreePool(AsciiBuffer);
+ AsciiBuffer = AllocateZeroPool (*BufferSize);
+ AsciiSPrint (AsciiBuffer, *BufferSize, "%S", Buffer);
+ Size = AsciiStrSize (AsciiBuffer) - 1; // (we dont need the null terminator)
+ Status = (((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Write (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, &Size, AsciiBuffer));
+ FreePool (AsciiBuffer);
return (Status);
}
}
@@ -2124,19 +2163,20 @@ FileInterfaceFileWrite( @return a new EFI_FILE_PROTOCOL object to be used instead of the template.
**/
-EFI_FILE_PROTOCOL*
-CreateFileInterfaceFile(
+EFI_FILE_PROTOCOL *
+CreateFileInterfaceFile (
IN CONST EFI_FILE_PROTOCOL *Template,
IN CONST BOOLEAN Unicode
)
{
- EFI_FILE_PROTOCOL_FILE *NewOne;
+ EFI_FILE_PROTOCOL_FILE *NewOne;
- NewOne = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_FILE));
+ NewOne = AllocateZeroPool (sizeof (EFI_FILE_PROTOCOL_FILE));
if (NewOne == NULL) {
return (NULL);
}
- CopyMem(NewOne, Template, sizeof(EFI_FILE_PROTOCOL_FILE));
+
+ CopyMem (NewOne, Template, sizeof (EFI_FILE_PROTOCOL_FILE));
NewOne->Orig = (EFI_FILE_PROTOCOL *)Template;
NewOne->Unicode = Unicode;
NewOne->Open = FileInterfaceFileOpen;
diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.h b/ShellPkg/Application/Shell/FileHandleWrappers.h index 5d58bfb2f4..178b24bd5c 100644 --- a/ShellPkg/Application/Shell/FileHandleWrappers.h +++ b/ShellPkg/Application/Shell/FileHandleWrappers.h @@ -10,34 +10,34 @@ #define _SHELL_FILE_HANDLE_WRAPPERS_HEADER_
typedef struct {
- LIST_ENTRY Link;
- CHAR16* Buffer;
+ LIST_ENTRY Link;
+ CHAR16 *Buffer;
} SHELL_LINE_LIST;
typedef struct {
- UINTN LogCount;
- SHELL_LINE_LIST *Log;
+ UINTN LogCount;
+ SHELL_LINE_LIST *Log;
} SHELL_LINE_LOG;
///
/// FILE styte interfaces for StdIn.
///
-extern EFI_FILE_PROTOCOL FileInterfaceStdIn;
+extern EFI_FILE_PROTOCOL FileInterfaceStdIn;
///
/// FILE styte interfaces for StdOut.
///
-extern EFI_FILE_PROTOCOL FileInterfaceStdOut;
+extern EFI_FILE_PROTOCOL FileInterfaceStdOut;
///
/// FILE styte interfaces for StdErr.
///
-extern EFI_FILE_PROTOCOL FileInterfaceStdErr;
+extern EFI_FILE_PROTOCOL FileInterfaceStdErr;
///
/// FILE style interface for NUL file.
///
-extern EFI_FILE_PROTOCOL FileInterfaceNulFile;
+extern EFI_FILE_PROTOCOL FileInterfaceNulFile;
/**
Creates a EFI_FILE_PROTOCOL (almost) object for using to access
@@ -48,9 +48,9 @@ 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(
- CONST CHAR16 *EnvName
+EFI_FILE_PROTOCOL *
+CreateFileInterfaceEnv (
+ CONST CHAR16 *EnvName
);
/**
@@ -62,9 +62,9 @@ CreateFileInterfaceEnv( @retval NULL Memory could not be allocated.
@return other a pointer to an EFI_FILE_PROTOCOL structure
**/
-EFI_FILE_PROTOCOL*
-CreateFileInterfaceMem(
- IN CONST BOOLEAN Unicode
+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_
-
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index a556307097..df00adfdfa 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -13,31 +13,37 @@ //
// Initialize the global structure
//
-SHELL_INFO ShellInfoObject = {
+SHELL_INFO ShellInfoObject = {
NULL,
NULL,
FALSE,
FALSE,
{
- {{
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }},
+ {
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ }
+ },
0,
NULL,
NULL
},
- {{NULL, NULL}, NULL},
{
- {{NULL, NULL}, NULL},
+ { NULL,NULL }, NULL
+ },
+ {
+ {
+ { NULL,NULL }, NULL
+ },
0,
0,
TRUE
@@ -49,8 +55,12 @@ SHELL_INFO ShellInfoObject = { NULL,
NULL,
NULL,
- {{NULL, NULL}, NULL, NULL},
- {{NULL, NULL}, NULL, NULL},
+ {
+ { NULL,NULL }, NULL, NULL
+ },
+ {
+ { NULL,NULL }, NULL, NULL
+ },
NULL,
NULL,
NULL,
@@ -62,12 +72,12 @@ SHELL_INFO ShellInfoObject = { FALSE
};
-STATIC CONST CHAR16 mScriptExtension[] = L".NSH";
-STATIC CONST CHAR16 mExecutableExtensions[] = L".NSH;.EFI";
-STATIC CONST CHAR16 mStartupScript[] = L"startup.nsh";
-CONST CHAR16 mNoNestingEnvVarName[] = L"nonesting";
-CONST CHAR16 mNoNestingTrue[] = L"True";
-CONST CHAR16 mNoNestingFalse[] = L"False";
+STATIC CONST CHAR16 mScriptExtension[] = L".NSH";
+STATIC CONST CHAR16 mExecutableExtensions[] = L".NSH;.EFI";
+STATIC CONST CHAR16 mStartupScript[] = L"startup.nsh";
+CONST CHAR16 mNoNestingEnvVarName[] = L"nonesting";
+CONST CHAR16 mNoNestingTrue[] = L"True";
+CONST CHAR16 mNoNestingFalse[] = L"False";
/**
Cleans off leading and trailing spaces and tabs.
@@ -75,24 +85,24 @@ CONST CHAR16 mNoNestingFalse[] = L"False"; @param[in] String pointer to the string to trim them off.
**/
EFI_STATUS
-TrimSpaces(
- IN CHAR16 **String
+TrimSpaces (
+ IN CHAR16 **String
)
{
- ASSERT(String != NULL);
- ASSERT(*String!= NULL);
+ ASSERT (String != NULL);
+ ASSERT (*String != NULL);
//
// Remove any spaces and tabs at the beginning of the (*String).
//
while (((*String)[0] == L' ') || ((*String)[0] == L'\t')) {
- CopyMem((*String), (*String)+1, StrSize((*String)) - sizeof((*String)[0]));
+ CopyMem ((*String), (*String)+1, StrSize ((*String)) - sizeof ((*String)[0]));
}
//
// Remove any spaces and tabs at the end of the (*String).
//
- while ((StrLen (*String) > 0) && (((*String)[StrLen((*String))-1] == L' ') || ((*String)[StrLen((*String))-1] == L'\t'))) {
- (*String)[StrLen((*String))-1] = CHAR_NULL;
+ while ((StrLen (*String) > 0) && (((*String)[StrLen ((*String))-1] == L' ') || ((*String)[StrLen ((*String))-1] == L'\t'))) {
+ (*String)[StrLen ((*String))-1] = CHAR_NULL;
}
return (EFI_SUCCESS);
@@ -106,31 +116,33 @@ TrimSpaces( @param[in] FindString The string to look for
@param[in] CheckForEscapeCharacter TRUE to skip escaped instances of FinfString, otherwise will return even escaped instances
**/
-CHAR16*
-FindNextInstance(
+CHAR16 *
+FindNextInstance (
IN CONST CHAR16 *SourceString,
IN CONST CHAR16 *FindString,
IN CONST BOOLEAN CheckForEscapeCharacter
)
{
- CHAR16 *Temp;
+ CHAR16 *Temp;
+
if (SourceString == NULL) {
return (NULL);
}
- Temp = StrStr(SourceString, FindString);
+
+ Temp = StrStr (SourceString, FindString);
//
// If nothing found, or we don't care about escape characters
//
- if (Temp == NULL || !CheckForEscapeCharacter) {
+ if ((Temp == NULL) || !CheckForEscapeCharacter) {
return (Temp);
}
//
// If we found an escaped character, try again on the remainder of the string
//
- if ((Temp > (SourceString)) && *(Temp-1) == L'^') {
- return FindNextInstance(Temp+1, FindString, CheckForEscapeCharacter);
+ if ((Temp > (SourceString)) && (*(Temp-1) == L'^')) {
+ return FindNextInstance (Temp+1, FindString, CheckForEscapeCharacter);
}
//
@@ -149,12 +161,12 @@ FindNextInstance( @retval FALSE is NOT a valid environment variable name.
**/
BOOLEAN
-IsValidEnvironmentVariableName(
- IN CONST CHAR16 *BeginPercent,
- IN CONST CHAR16 *EndPercent
+IsValidEnvironmentVariableName (
+ IN CONST CHAR16 *BeginPercent,
+ IN CONST CHAR16 *EndPercent
)
{
- CONST CHAR16 *Walker;
+ CONST CHAR16 *Walker;
Walker = NULL;
@@ -168,12 +180,13 @@ IsValidEnvironmentVariableName( for (Walker = BeginPercent + 1; Walker < EndPercent; Walker++) {
if (
- (*Walker >= L'0' && *Walker <= L'9') ||
- (*Walker >= L'A' && *Walker <= L'Z') ||
- (*Walker >= L'a' && *Walker <= L'z') ||
+ ((*Walker >= L'0') && (*Walker <= L'9')) ||
+ ((*Walker >= L'A') && (*Walker <= L'Z')) ||
+ ((*Walker >= L'a') && (*Walker <= L'z')) ||
(*Walker == L'_')
- ) {
- if (Walker == BeginPercent + 1 && (*Walker >= L'0' && *Walker <= L'9')) {
+ )
+ {
+ if ((Walker == BeginPercent + 1) && ((*Walker >= L'0') && (*Walker <= L'9'))) {
return FALSE;
} else {
continue;
@@ -195,45 +208,48 @@ IsValidEnvironmentVariableName( @retval FALSE CmdLine does not have a valid split.
**/
BOOLEAN
-ContainsSplit(
- IN CONST CHAR16 *CmdLine
+ContainsSplit (
+ IN CONST CHAR16 *CmdLine
)
{
- CONST CHAR16 *TempSpot;
- CONST CHAR16 *FirstQuote;
- CONST CHAR16 *SecondQuote;
-
- FirstQuote = FindNextInstance (CmdLine, L"\"", TRUE);
- SecondQuote = NULL;
- TempSpot = FindFirstCharacter(CmdLine, L"|", L'^');
-
- if (FirstQuote == NULL ||
- TempSpot == NULL ||
- TempSpot == CHAR_NULL ||
- FirstQuote > TempSpot
- ) {
- return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
+ CONST CHAR16 *TempSpot;
+ CONST CHAR16 *FirstQuote;
+ CONST CHAR16 *SecondQuote;
+
+ FirstQuote = FindNextInstance (CmdLine, L"\"", TRUE);
+ SecondQuote = NULL;
+ TempSpot = FindFirstCharacter (CmdLine, L"|", L'^');
+
+ if ((FirstQuote == NULL) ||
+ (TempSpot == NULL) ||
+ (TempSpot == CHAR_NULL) ||
+ (FirstQuote > TempSpot)
+ )
+ {
+ return (BOOLEAN)((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
}
while ((TempSpot != NULL) && (*TempSpot != CHAR_NULL)) {
- if (FirstQuote == NULL || FirstQuote > TempSpot) {
+ if ((FirstQuote == NULL) || (FirstQuote > TempSpot)) {
break;
}
+
SecondQuote = FindNextInstance (FirstQuote + 1, L"\"", TRUE);
if (SecondQuote == NULL) {
break;
}
+
if (SecondQuote < TempSpot) {
FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);
continue;
} else {
FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);
- TempSpot = FindFirstCharacter(TempSpot + 1, L"|", L'^');
+ TempSpot = FindFirstCharacter (TempSpot + 1, L"|", L'^');
continue;
}
}
- return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
+ return (BOOLEAN)((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
}
/**
@@ -244,28 +260,30 @@ ContainsSplit( @retval EFI_OUT_OF_RESOURCES There is not enough memory available.
**/
EFI_STATUS
-InternalEfiShellStartCtrlSMonitor(
+InternalEfiShellStartCtrlSMonitor (
VOID
)
{
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
- EFI_KEY_DATA KeyData;
- EFI_STATUS Status;
-
- Status = gBS->OpenProtocol(
- gST->ConsoleInHandle,
- &gEfiSimpleTextInputExProtocolGuid,
- (VOID**)&SimpleEx,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
+ EFI_KEY_DATA KeyData;
+ EFI_STATUS Status;
+
+ Status = gBS->OpenProtocol (
+ gST->ConsoleInHandle,
+ &gEfiSimpleTextInputExProtocolGuid,
+ (VOID **)&SimpleEx,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_SHELL_NO_IN_EX),
- ShellInfoObject.HiiHandle);
+ ShellInfoObject.HiiHandle
+ );
return (EFI_SUCCESS);
}
@@ -274,42 +292,47 @@ InternalEfiShellStartCtrlSMonitor( KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
KeyData.Key.UnicodeChar = L's';
- Status = SimpleEx->RegisterKeyNotify(
- SimpleEx,
- &KeyData,
- NotificationFunction,
- &ShellInfoObject.CtrlSNotifyHandle1);
+ Status = SimpleEx->RegisterKeyNotify (
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &ShellInfoObject.CtrlSNotifyHandle1
+ );
- KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
- if (!EFI_ERROR(Status)) {
- Status = SimpleEx->RegisterKeyNotify(
- SimpleEx,
- &KeyData,
- NotificationFunction,
- &ShellInfoObject.CtrlSNotifyHandle2);
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->RegisterKeyNotify (
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &ShellInfoObject.CtrlSNotifyHandle2
+ );
}
- KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
- KeyData.Key.UnicodeChar = 19;
-
- if (!EFI_ERROR(Status)) {
- Status = SimpleEx->RegisterKeyNotify(
- SimpleEx,
- &KeyData,
- NotificationFunction,
- &ShellInfoObject.CtrlSNotifyHandle3);
- }
- KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
- if (!EFI_ERROR(Status)) {
- Status = SimpleEx->RegisterKeyNotify(
- SimpleEx,
- &KeyData,
- NotificationFunction,
- &ShellInfoObject.CtrlSNotifyHandle4);
+
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
+ KeyData.Key.UnicodeChar = 19;
+
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->RegisterKeyNotify (
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &ShellInfoObject.CtrlSNotifyHandle3
+ );
}
- return (Status);
-}
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->RegisterKeyNotify (
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &ShellInfoObject.CtrlSNotifyHandle4
+ );
+ }
+ return (Status);
+}
/**
The entry point for the application.
@@ -335,46 +358,47 @@ UefiMain ( EFI_SIMPLE_TEXT_INPUT_PROTOCOL *OldConIn;
SPLIT_LIST *Split;
- if (PcdGet8(PcdShellSupportLevel) > 3) {
+ if (PcdGet8 (PcdShellSupportLevel) > 3) {
return (EFI_UNSUPPORTED);
}
//
// Clear the screen
//
- Status = gST->ConOut->ClearScreen(gST->ConOut);
- if (EFI_ERROR(Status)) {
+ Status = gST->ConOut->ClearScreen (gST->ConOut);
+ if (EFI_ERROR (Status)) {
return (Status);
}
//
// Populate the global structure from PCDs
//
- ShellInfoObject.ImageDevPath = NULL;
- ShellInfoObject.FileDevPath = NULL;
- ShellInfoObject.PageBreakEnabled = PcdGetBool(PcdShellPageBreakDefault);
- ShellInfoObject.ViewingSettings.InsertMode = PcdGetBool(PcdShellInsertModeDefault);
- ShellInfoObject.LogScreenCount = PcdGet8 (PcdShellScreenLogCount );
+ ShellInfoObject.ImageDevPath = NULL;
+ ShellInfoObject.FileDevPath = NULL;
+ ShellInfoObject.PageBreakEnabled = PcdGetBool (PcdShellPageBreakDefault);
+ ShellInfoObject.ViewingSettings.InsertMode = PcdGetBool (PcdShellInsertModeDefault);
+ ShellInfoObject.LogScreenCount = PcdGet8 (PcdShellScreenLogCount);
//
// verify we dont allow for spec violation
//
- ASSERT(ShellInfoObject.LogScreenCount >= 3);
+ ASSERT (ShellInfoObject.LogScreenCount >= 3);
//
// Initialize the LIST ENTRY objects...
//
- InitializeListHead(&ShellInfoObject.BufferToFreeList.Link);
- InitializeListHead(&ShellInfoObject.ViewingSettings.CommandHistory.Link);
- InitializeListHead(&ShellInfoObject.SplitList.Link);
+ InitializeListHead (&ShellInfoObject.BufferToFreeList.Link);
+ InitializeListHead (&ShellInfoObject.ViewingSettings.CommandHistory.Link);
+ InitializeListHead (&ShellInfoObject.SplitList.Link);
//
// Check PCDs for optional features that are not implemented yet.
//
- if ( PcdGetBool(PcdShellSupportOldProtocols)
- || !FeaturePcdGet(PcdShellRequireHiiPlatform)
- || FeaturePcdGet(PcdShellSupportFrameworkHii)
- ) {
+ if ( PcdGetBool (PcdShellSupportOldProtocols)
+ || !FeaturePcdGet (PcdShellRequireHiiPlatform)
+ || FeaturePcdGet (PcdShellSupportFrameworkHii)
+ )
+ {
return (EFI_UNSUPPORTED);
}
@@ -386,8 +410,8 @@ UefiMain ( //
// install our console logger. This will keep a log of the output for back-browsing
//
- Status = ConsoleLoggerInstall(ShellInfoObject.LogScreenCount, &ShellInfoObject.ConsoleInfo);
- if (!EFI_ERROR(Status)) {
+ Status = ConsoleLoggerInstall (ShellInfoObject.LogScreenCount, &ShellInfoObject.ConsoleInfo);
+ if (!EFI_ERROR (Status)) {
//
// Enable the cursor to be visible
//
@@ -398,16 +422,17 @@ UefiMain ( // only do this if PcdShellRequireHiiPlatform == FALSE
//
// remove EFI_UNSUPPORTED check above when complete.
- ///@todo add support for Framework HII
+ /// @todo add support for Framework HII
//
// install our (solitary) HII package
//
ShellInfoObject.HiiHandle = HiiAddPackages (&gEfiCallerIdGuid, gImageHandle, ShellStrings, NULL);
if (ShellInfoObject.HiiHandle == NULL) {
- if (PcdGetBool(PcdShellSupportFrameworkHii)) {
- ///@todo Add our package into Framework HII
+ if (PcdGetBool (PcdShellSupportFrameworkHii)) {
+ /// @todo Add our package into Framework HII
}
+
if (ShellInfoObject.HiiHandle == NULL) {
Status = EFI_NOT_STARTED;
goto FreeResources;
@@ -417,25 +442,25 @@ UefiMain ( //
// create and install the EfiShellParametersProtocol
//
- Status = CreatePopulateInstallShellParametersProtocol(&ShellInfoObject.NewShellParametersProtocol, &ShellInfoObject.RootShellInstance);
- ASSERT_EFI_ERROR(Status);
- ASSERT(ShellInfoObject.NewShellParametersProtocol != NULL);
+ Status = CreatePopulateInstallShellParametersProtocol (&ShellInfoObject.NewShellParametersProtocol, &ShellInfoObject.RootShellInstance);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (ShellInfoObject.NewShellParametersProtocol != NULL);
//
// create and install the EfiShellProtocol
//
- Status = CreatePopulateInstallShellProtocol(&ShellInfoObject.NewEfiShellProtocol);
- ASSERT_EFI_ERROR(Status);
- ASSERT(ShellInfoObject.NewEfiShellProtocol != NULL);
+ Status = CreatePopulateInstallShellProtocol (&ShellInfoObject.NewEfiShellProtocol);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (ShellInfoObject.NewEfiShellProtocol != NULL);
//
// Now initialize the shell library (it requires Shell Parameters protocol)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
Status = ShellInitEnvVarList ();
@@ -450,39 +475,44 @@ UefiMain ( //
// If shell support level is >= 1 create the mappings and paths
//
- if (PcdGet8(PcdShellSupportLevel) >= 1) {
- Status = ShellCommandCreateInitialMappingsAndPaths();
+ if (PcdGet8 (PcdShellSupportLevel) >= 1) {
+ Status = ShellCommandCreateInitialMappingsAndPaths ();
}
//
// Set the environment variable for nesting support
//
- Size = 0;
+ Size = 0;
TempString = NULL;
if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest) {
//
// No change. require nesting in Shell Protocol Execute()
//
- StrnCatGrow(&TempString,
- &Size,
- L"False",
- 0);
+ StrnCatGrow (
+ &TempString,
+ &Size,
+ L"False",
+ 0
+ );
} else {
- StrnCatGrow(&TempString,
- &Size,
- mNoNestingTrue,
- 0);
+ StrnCatGrow (
+ &TempString,
+ &Size,
+ mNoNestingTrue,
+ 0
+ );
}
- Status = InternalEfiShellSetEnv(mNoNestingEnvVarName, TempString, TRUE);
- SHELL_FREE_NON_NULL(TempString);
+
+ Status = InternalEfiShellSetEnv (mNoNestingEnvVarName, TempString, TRUE);
+ SHELL_FREE_NON_NULL (TempString);
Size = 0;
//
// save the device path for the loaded image and the device path for the filepath (under loaded image)
// These are where to look for the startup.nsh file
//
- Status = GetDevicePathsForImageAndFile(&ShellInfoObject.ImageDevPath, &ShellInfoObject.FileDevPath);
- ASSERT_EFI_ERROR(Status);
+ Status = GetDevicePathsForImageAndFile (&ShellInfoObject.ImageDevPath, &ShellInfoObject.FileDevPath);
+ ASSERT_EFI_ERROR (Status);
//
// Display the version
@@ -494,10 +524,10 @@ UefiMain ( NULL,
STRING_TOKEN (STR_VER_OUTPUT_MAIN_SHELL),
ShellInfoObject.HiiHandle,
- SupportLevel[PcdGet8(PcdShellSupportLevel)],
+ SupportLevel[PcdGet8 (PcdShellSupportLevel)],
gEfiShellProtocol->MajorVersion,
gEfiShellProtocol->MinorVersion
- );
+ );
ShellPrintHiiEx (
-1,
@@ -505,8 +535,8 @@ UefiMain ( NULL,
STRING_TOKEN (STR_VER_OUTPUT_MAIN_SUPPLIER),
ShellInfoObject.HiiHandle,
- (CHAR16 *) PcdGetPtr (PcdShellSupplier)
- );
+ (CHAR16 *)PcdGetPtr (PcdShellSupplier)
+ );
ShellPrintHiiEx (
-1,
@@ -518,83 +548,83 @@ UefiMain ( (gST->Hdr.Revision&0x0000ffff),
gST->FirmwareVendor,
gST->FirmwareRevision
- );
+ );
}
//
// Display the mapping
//
- if (PcdGet8(PcdShellSupportLevel) >= 2 && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap) {
- Status = RunCommand(L"map");
- ASSERT_EFI_ERROR(Status);
+ if ((PcdGet8 (PcdShellSupportLevel) >= 2) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap) {
+ Status = RunCommand (L"map");
+ ASSERT_EFI_ERROR (Status);
}
//
// init all the built in alias'
//
- Status = SetBuiltInAlias();
- ASSERT_EFI_ERROR(Status);
+ Status = SetBuiltInAlias ();
+ ASSERT_EFI_ERROR (Status);
//
// Initialize environment variables
//
- if (ShellCommandGetProfileList() != NULL) {
- Status = InternalEfiShellSetEnv(L"profiles", ShellCommandGetProfileList(), TRUE);
- ASSERT_EFI_ERROR(Status);
+ if (ShellCommandGetProfileList () != NULL) {
+ Status = InternalEfiShellSetEnv (L"profiles", ShellCommandGetProfileList (), TRUE);
+ ASSERT_EFI_ERROR (Status);
}
- Size = 100;
- TempString = AllocateZeroPool(Size);
+ Size = 100;
+ TempString = AllocateZeroPool (Size);
- UnicodeSPrint(TempString, Size, L"%d", PcdGet8(PcdShellSupportLevel));
- Status = InternalEfiShellSetEnv(L"uefishellsupport", TempString, TRUE);
- ASSERT_EFI_ERROR(Status);
+ UnicodeSPrint (TempString, Size, L"%d", PcdGet8 (PcdShellSupportLevel));
+ Status = InternalEfiShellSetEnv (L"uefishellsupport", TempString, TRUE);
+ ASSERT_EFI_ERROR (Status);
- UnicodeSPrint(TempString, Size, L"%d.%d", ShellInfoObject.NewEfiShellProtocol->MajorVersion, ShellInfoObject.NewEfiShellProtocol->MinorVersion);
- Status = InternalEfiShellSetEnv(L"uefishellversion", TempString, TRUE);
- ASSERT_EFI_ERROR(Status);
+ UnicodeSPrint (TempString, Size, L"%d.%d", ShellInfoObject.NewEfiShellProtocol->MajorVersion, ShellInfoObject.NewEfiShellProtocol->MinorVersion);
+ Status = InternalEfiShellSetEnv (L"uefishellversion", TempString, TRUE);
+ ASSERT_EFI_ERROR (Status);
- UnicodeSPrint(TempString, Size, L"%d.%d", (gST->Hdr.Revision & 0xFFFF0000) >> 16, gST->Hdr.Revision & 0x0000FFFF);
- Status = InternalEfiShellSetEnv(L"uefiversion", TempString, TRUE);
- ASSERT_EFI_ERROR(Status);
+ UnicodeSPrint (TempString, Size, L"%d.%d", (gST->Hdr.Revision & 0xFFFF0000) >> 16, gST->Hdr.Revision & 0x0000FFFF);
+ Status = InternalEfiShellSetEnv (L"uefiversion", TempString, TRUE);
+ ASSERT_EFI_ERROR (Status);
- FreePool(TempString);
+ FreePool (TempString);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoInterrupt) {
//
// Set up the event for CTRL-C monitoring...
//
- Status = InernalEfiShellStartMonitor();
+ Status = InernalEfiShellStartMonitor ();
}
- if (!EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
+ if (!EFI_ERROR (Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
//
// Set up the event for CTRL-S monitoring...
//
- Status = InternalEfiShellStartCtrlSMonitor();
+ Status = InternalEfiShellStartCtrlSMonitor ();
}
- if (!EFI_ERROR(Status) && ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
+ if (!EFI_ERROR (Status) && ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
//
// close off the gST->ConIn
//
- OldConIn = gST->ConIn;
- ConInHandle = gST->ConsoleInHandle;
- gST->ConIn = CreateSimpleTextInOnFile((SHELL_FILE_HANDLE)&FileInterfaceNulFile, &gST->ConsoleInHandle);
+ OldConIn = gST->ConIn;
+ ConInHandle = gST->ConsoleInHandle;
+ gST->ConIn = CreateSimpleTextInOnFile ((SHELL_FILE_HANDLE)&FileInterfaceNulFile, &gST->ConsoleInHandle);
} else {
- OldConIn = NULL;
- ConInHandle = NULL;
+ OldConIn = NULL;
+ ConInHandle = NULL;
}
- if (!EFI_ERROR(Status) && PcdGet8(PcdShellSupportLevel) >= 1) {
+ if (!EFI_ERROR (Status) && (PcdGet8 (PcdShellSupportLevel) >= 1)) {
//
// process the startup script or launch the called app.
//
- Status = DoStartupScript(ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
+ Status = DoStartupScript (ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
}
- if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
+ if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit () && ((PcdGet8 (PcdShellSupportLevel) >= 3) || PcdGetBool (PcdShellForceConsole)) && !EFI_ERROR (Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
//
// begin the UI waiting loop
//
@@ -603,14 +633,14 @@ UefiMain ( // clean out all the memory allocated for CONST <something> * return values
// between each shell prompt presentation
//
- if (!IsListEmpty(&ShellInfoObject.BufferToFreeList.Link)){
- FreeBufferList(&ShellInfoObject.BufferToFreeList);
+ if (!IsListEmpty (&ShellInfoObject.BufferToFreeList.Link)) {
+ FreeBufferList (&ShellInfoObject.BufferToFreeList);
}
//
// Reset page break back to default.
//
- ShellInfoObject.PageBreakEnabled = PcdGetBool(PcdShellPageBreakDefault);
+ ShellInfoObject.PageBreakEnabled = PcdGetBool (PcdShellPageBreakDefault);
ASSERT (ShellInfoObject.ConsoleInfo != NULL);
ShellInfoObject.ConsoleInfo->Enabled = TRUE;
ShellInfoObject.ConsoleInfo->RowCounter = 0;
@@ -618,13 +648,14 @@ UefiMain ( //
// Display Prompt
//
- Status = DoShellPrompt();
- } while (!ShellCommandGetExit());
+ Status = DoShellPrompt ();
+ } while (!ShellCommandGetExit ());
}
- if (OldConIn != NULL && ConInHandle != NULL) {
+
+ if ((OldConIn != NULL) && (ConInHandle != NULL)) {
CloseSimpleTextInOnFile (gST->ConIn);
- gST->ConIn = OldConIn;
- gST->ConsoleInHandle = ConInHandle;
+ gST->ConIn = OldConIn;
+ gST->ConsoleInHandle = ConInHandle;
}
}
}
@@ -634,78 +665,105 @@ FreeResources: // uninstall protocols / free memory / etc...
//
if (ShellInfoObject.UserBreakTimer != NULL) {
- gBS->CloseEvent(ShellInfoObject.UserBreakTimer);
- DEBUG_CODE(ShellInfoObject.UserBreakTimer = NULL;);
+ gBS->CloseEvent (ShellInfoObject.UserBreakTimer);
+ DEBUG_CODE (
+ ShellInfoObject.UserBreakTimer = NULL;
+ );
}
+
if (ShellInfoObject.ImageDevPath != NULL) {
- FreePool(ShellInfoObject.ImageDevPath);
- DEBUG_CODE(ShellInfoObject.ImageDevPath = NULL;);
+ FreePool (ShellInfoObject.ImageDevPath);
+ DEBUG_CODE (
+ ShellInfoObject.ImageDevPath = NULL;
+ );
}
+
if (ShellInfoObject.FileDevPath != NULL) {
- FreePool(ShellInfoObject.FileDevPath);
- DEBUG_CODE(ShellInfoObject.FileDevPath = NULL;);
+ FreePool (ShellInfoObject.FileDevPath);
+ DEBUG_CODE (
+ ShellInfoObject.FileDevPath = NULL;
+ );
}
+
if (ShellInfoObject.NewShellParametersProtocol != NULL) {
- CleanUpShellParametersProtocol(ShellInfoObject.NewShellParametersProtocol);
- DEBUG_CODE(ShellInfoObject.NewShellParametersProtocol = NULL;);
+ CleanUpShellParametersProtocol (ShellInfoObject.NewShellParametersProtocol);
+ DEBUG_CODE (
+ ShellInfoObject.NewShellParametersProtocol = NULL;
+ );
}
- if (ShellInfoObject.NewEfiShellProtocol != NULL){
- if (ShellInfoObject.NewEfiShellProtocol->IsRootShell()){
- InternalEfiShellSetEnv(L"cwd", NULL, TRUE);
+
+ if (ShellInfoObject.NewEfiShellProtocol != NULL) {
+ if (ShellInfoObject.NewEfiShellProtocol->IsRootShell ()) {
+ InternalEfiShellSetEnv (L"cwd", NULL, TRUE);
}
+
CleanUpShellEnvironment (ShellInfoObject.NewEfiShellProtocol);
- DEBUG_CODE(ShellInfoObject.NewEfiShellProtocol = NULL;);
+ DEBUG_CODE (
+ ShellInfoObject.NewEfiShellProtocol = NULL;
+ );
}
- if (!IsListEmpty(&ShellInfoObject.BufferToFreeList.Link)){
- FreeBufferList(&ShellInfoObject.BufferToFreeList);
+ if (!IsListEmpty (&ShellInfoObject.BufferToFreeList.Link)) {
+ FreeBufferList (&ShellInfoObject.BufferToFreeList);
}
- if (!IsListEmpty(&ShellInfoObject.SplitList.Link)){
- ASSERT(FALSE); ///@todo finish this de-allocation (free SplitStdIn/Out when needed).
+ if (!IsListEmpty (&ShellInfoObject.SplitList.Link)) {
+ ASSERT (FALSE); /// @todo finish this de-allocation (free SplitStdIn/Out when needed).
- for ( Split = (SPLIT_LIST*)GetFirstNode (&ShellInfoObject.SplitList.Link)
- ; !IsNull (&ShellInfoObject.SplitList.Link, &Split->Link)
- ; Split = (SPLIT_LIST *)GetNextNode (&ShellInfoObject.SplitList.Link, &Split->Link)
- ) {
+ for ( Split = (SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link)
+ ; !IsNull (&ShellInfoObject.SplitList.Link, &Split->Link)
+ ; Split = (SPLIT_LIST *)GetNextNode (&ShellInfoObject.SplitList.Link, &Split->Link)
+ )
+ {
RemoveEntryList (&Split->Link);
FreePool (Split);
}
- DEBUG_CODE (InitializeListHead (&ShellInfoObject.SplitList.Link););
+ DEBUG_CODE (
+ InitializeListHead (&ShellInfoObject.SplitList.Link);
+ );
}
if (ShellInfoObject.ShellInitSettings.FileName != NULL) {
- FreePool(ShellInfoObject.ShellInitSettings.FileName);
- DEBUG_CODE(ShellInfoObject.ShellInitSettings.FileName = NULL;);
+ FreePool (ShellInfoObject.ShellInitSettings.FileName);
+ DEBUG_CODE (
+ ShellInfoObject.ShellInitSettings.FileName = NULL;
+ );
}
if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) {
- FreePool(ShellInfoObject.ShellInitSettings.FileOptions);
- DEBUG_CODE(ShellInfoObject.ShellInitSettings.FileOptions = NULL;);
+ FreePool (ShellInfoObject.ShellInitSettings.FileOptions);
+ DEBUG_CODE (
+ ShellInfoObject.ShellInitSettings.FileOptions = NULL;
+ );
}
if (ShellInfoObject.HiiHandle != NULL) {
- HiiRemovePackages(ShellInfoObject.HiiHandle);
- DEBUG_CODE(ShellInfoObject.HiiHandle = NULL;);
+ HiiRemovePackages (ShellInfoObject.HiiHandle);
+ DEBUG_CODE (
+ ShellInfoObject.HiiHandle = NULL;
+ );
}
- if (!IsListEmpty(&ShellInfoObject.ViewingSettings.CommandHistory.Link)){
- FreeBufferList(&ShellInfoObject.ViewingSettings.CommandHistory);
+ if (!IsListEmpty (&ShellInfoObject.ViewingSettings.CommandHistory.Link)) {
+ FreeBufferList (&ShellInfoObject.ViewingSettings.CommandHistory);
}
- ASSERT(ShellInfoObject.ConsoleInfo != NULL);
+ ASSERT (ShellInfoObject.ConsoleInfo != NULL);
if (ShellInfoObject.ConsoleInfo != NULL) {
- ConsoleLoggerUninstall(ShellInfoObject.ConsoleInfo);
- FreePool(ShellInfoObject.ConsoleInfo);
- DEBUG_CODE(ShellInfoObject.ConsoleInfo = NULL;);
+ ConsoleLoggerUninstall (ShellInfoObject.ConsoleInfo);
+ FreePool (ShellInfoObject.ConsoleInfo);
+ DEBUG_CODE (
+ ShellInfoObject.ConsoleInfo = NULL;
+ );
}
ShellFreeEnvVarList ();
- if (ShellCommandGetExit()) {
- return ((EFI_STATUS)ShellCommandGetExitCode());
+ if (ShellCommandGetExit ()) {
+ return ((EFI_STATUS)ShellCommandGetExitCode ());
}
+
return (Status);
}
@@ -715,32 +773,34 @@ FreeResources: @retval EFI_SUCCESS all init commands were run successfully.
**/
EFI_STATUS
-SetBuiltInAlias(
+SetBuiltInAlias (
VOID
)
{
- EFI_STATUS Status;
- CONST ALIAS_LIST *List;
- ALIAS_LIST *Node;
+ EFI_STATUS Status;
+ CONST ALIAS_LIST *List;
+ ALIAS_LIST *Node;
//
// Get all the commands we want to run
//
- List = ShellCommandGetInitAliasList();
+ List = ShellCommandGetInitAliasList ();
//
// for each command in the List
//
- for ( Node = (ALIAS_LIST*)GetFirstNode(&List->Link)
- ; !IsNull (&List->Link, &Node->Link)
- ; Node = (ALIAS_LIST *)GetNextNode(&List->Link, &Node->Link)
- ){
+ for ( Node = (ALIAS_LIST *)GetFirstNode (&List->Link)
+ ; !IsNull (&List->Link, &Node->Link)
+ ; Node = (ALIAS_LIST *)GetNextNode (&List->Link, &Node->Link)
+ )
+ {
//
// install the alias'
//
- Status = InternalSetAlias(Node->CommandString, Node->Alias, TRUE);
- ASSERT_EFI_ERROR(Status);
+ Status = InternalSetAlias (Node->CommandString, Node->Alias, TRUE);
+ ASSERT_EFI_ERROR (Status);
}
+
return (EFI_SUCCESS);
}
@@ -754,14 +814,15 @@ SetBuiltInAlias( @retval FALSE The 2 command names are not the same.
**/
BOOLEAN
-IsCommand(
- IN CONST CHAR16 *Command1,
- IN CONST CHAR16 *Command2
+IsCommand (
+ IN CONST CHAR16 *Command1,
+ IN CONST CHAR16 *Command2
)
{
- if (StringNoCaseCompare(&Command1, &Command2) == 0) {
+ if (StringNoCaseCompare (&Command1, &Command2) == 0) {
return (TRUE);
}
+
return (FALSE);
}
@@ -774,18 +835,20 @@ IsCommand( @retval FALSE The command is not a script only command.
**/
BOOLEAN
-IsScriptOnlyCommand(
- IN CONST CHAR16 *CommandName
+IsScriptOnlyCommand (
+ IN CONST CHAR16 *CommandName
)
{
- if (IsCommand(CommandName, L"for")
- ||IsCommand(CommandName, L"endfor")
- ||IsCommand(CommandName, L"if")
- ||IsCommand(CommandName, L"else")
- ||IsCommand(CommandName, L"endif")
- ||IsCommand(CommandName, L"goto")) {
+ if ( IsCommand (CommandName, L"for")
+ || IsCommand (CommandName, L"endfor")
+ || IsCommand (CommandName, L"if")
+ || IsCommand (CommandName, L"else")
+ || IsCommand (CommandName, L"endif")
+ || IsCommand (CommandName, L"goto"))
+ {
return (TRUE);
}
+
return (FALSE);
}
@@ -805,49 +868,53 @@ IsScriptOnlyCommand( **/
EFI_STATUS
GetDevicePathsForImageAndFile (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath,
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath
)
{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
- ASSERT(DevPath != NULL);
- ASSERT(FilePath != NULL);
+ ASSERT (DevPath != NULL);
+ ASSERT (FilePath != NULL);
Status = gBS->OpenProtocol (
- gImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**)&LoadedImage,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->OpenProtocol (
- LoadedImage->DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&ImageDevicePath,
+ gImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage,
gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ LoadedImage->DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&ImageDevicePath,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
*DevPath = DuplicateDevicePath (ImageDevicePath);
*FilePath = DuplicateDevicePath (LoadedImage->FilePath);
- gBS->CloseProtocol(
- LoadedImage->DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- gImageHandle,
- NULL);
- }
- gBS->CloseProtocol(
- gImageHandle,
- &gEfiLoadedImageProtocolGuid,
- gImageHandle,
- NULL);
+ gBS->CloseProtocol (
+ LoadedImage->DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ gImageHandle,
+ NULL
+ );
+ }
+
+ gBS->CloseProtocol (
+ gImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ gImageHandle,
+ NULL
+ );
}
+
return (Status);
}
@@ -879,7 +946,7 @@ GetDevicePathsForImageAndFile ( @retval EFI_SUCCESS The variable is initialized.
**/
EFI_STATUS
-ProcessCommandLine(
+ProcessCommandLine (
VOID
)
{
@@ -899,13 +966,13 @@ ProcessCommandLine( Status = gBS->LocateProtocol (
&gEfiUnicodeCollation2ProtocolGuid,
NULL,
- (VOID **) &UnicodeCollation
+ (VOID **)&UnicodeCollation
);
if (EFI_ERROR (Status)) {
Status = gBS->LocateProtocol (
&gEfiUnicodeCollationProtocolGuid,
NULL,
- (VOID **) &UnicodeCollation
+ (VOID **)&UnicodeCollation
);
if (EFI_ERROR (Status)) {
return Status;
@@ -923,7 +990,7 @@ ProcessCommandLine( ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = FALSE;
ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = FALSE;
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest = FALSE;
- ShellInfoObject.ShellInitSettings.Delay = 5;
+ ShellInfoObject.ShellInitSettings.Delay = 5;
//
// Start LoopVar at 0 to parse only optional arguments at Argv[0]
@@ -931,86 +998,92 @@ ProcessCommandLine( // UEFI Shell boot option is created, and OptionalData is provided
// that starts with shell command-line options.
//
- for (LoopVar = 0 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
+ for (LoopVar = 0; LoopVar < gEfiShellParametersProtocol->Argc; LoopVar++) {
CurrentArg = gEfiShellParametersProtocol->Argv[LoopVar];
if (UnicodeCollation->StriColl (
UnicodeCollation,
L"-startup",
CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup = TRUE;
- }
- else if (UnicodeCollation->StriColl (
- UnicodeCollation,
- L"-nostartup",
- CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup = TRUE;
- }
- else if (UnicodeCollation->StriColl (
- UnicodeCollation,
- L"-noconsoleout",
- CurrentArg
- ) == 0) {
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup = TRUE;
+ } else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
+ L"-nostartup",
+ CurrentArg
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup = TRUE;
+ } else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
+ L"-noconsoleout",
+ CurrentArg
+ ) == 0)
+ {
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut = TRUE;
- }
- else if (UnicodeCollation->StriColl (
- UnicodeCollation,
- L"-noconsolein",
- CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn = TRUE;
- }
- else if (UnicodeCollation->StriColl (
- UnicodeCollation,
- L"-nointerrupt",
- CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoInterrupt = TRUE;
- }
- else if (UnicodeCollation->StriColl (
- UnicodeCollation,
- L"-nomap",
- CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap = TRUE;
- }
- else if (UnicodeCollation->StriColl (
- UnicodeCollation,
- L"-noversion",
- CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion = TRUE;
- }
- else if (UnicodeCollation->StriColl (
- UnicodeCollation,
- L"-nonest",
- CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest = TRUE;
- }
- else if (UnicodeCollation->StriColl (
- UnicodeCollation,
- L"-delay",
- CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = TRUE;
+ } else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
+ L"-noconsolein",
+ CurrentArg
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn = TRUE;
+ } else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
+ L"-nointerrupt",
+ CurrentArg
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoInterrupt = TRUE;
+ } else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
+ L"-nomap",
+ CurrentArg
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap = TRUE;
+ } else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
+ L"-noversion",
+ CurrentArg
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion = TRUE;
+ } else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
+ L"-nonest",
+ CurrentArg
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest = TRUE;
+ } else if (UnicodeCollation->StriColl (
+ UnicodeCollation,
+ L"-delay",
+ CurrentArg
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = TRUE;
// Check for optional delay value following "-delay"
if ((LoopVar + 1) >= gEfiShellParametersProtocol->Argc) {
DelayValueStr = NULL;
} else {
DelayValueStr = gEfiShellParametersProtocol->Argv[LoopVar + 1];
}
- if (DelayValueStr != NULL){
+
+ if (DelayValueStr != NULL) {
if (*DelayValueStr == L':') {
DelayValueStr++;
}
- if (!EFI_ERROR(ShellConvertStringToUint64 (
- DelayValueStr,
- &DelayValue,
- FALSE,
- FALSE
- ))) {
+
+ if (!EFI_ERROR (
+ ShellConvertStringToUint64 (
+ DelayValueStr,
+ &DelayValue,
+ FALSE,
+ FALSE
+ )
+ ))
+ {
ShellInfoObject.ShellInitSettings.Delay = (UINTN)DelayValue;
LoopVar++;
}
@@ -1019,11 +1092,15 @@ ProcessCommandLine( UnicodeCollation,
L"-exit",
CurrentArg
- ) == 0) {
- ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = TRUE;
+ ) == 0)
+ {
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = TRUE;
} else if (StrnCmp (L"-", CurrentArg, 1) == 0) {
// Unrecognized option
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_GEN_PROBLEM),
ShellInfoObject.HiiHandle,
CurrentArg
@@ -1038,29 +1115,32 @@ ProcessCommandLine( }
ShellInfoObject.ShellInitSettings.FileName = NULL;
- Size = 0;
+ Size = 0;
//
// If first argument contains a space, then add double quotes before the argument
//
if (StrStr (CurrentArg, L" ") != NULL) {
- StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, L"\"", 0);
+ StrnCatGrow (&ShellInfoObject.ShellInitSettings.FileName, &Size, L"\"", 0);
if (ShellInfoObject.ShellInitSettings.FileName == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
}
- StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, CurrentArg, 0);
+
+ StrnCatGrow (&ShellInfoObject.ShellInitSettings.FileName, &Size, CurrentArg, 0);
if (ShellInfoObject.ShellInitSettings.FileName == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
+
//
// If first argument contains a space, then add double quotes after the argument
//
if (StrStr (CurrentArg, L" ") != NULL) {
- StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, L"\"", 0);
+ StrnCatGrow (&ShellInfoObject.ShellInitSettings.FileName, &Size, L"\"", 0);
if (ShellInfoObject.ShellInitSettings.FileName == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
}
+
//
// We found `file-name`.
//
@@ -1068,49 +1148,58 @@ ProcessCommandLine( LoopVar++;
// Add `file-name-options`
- for (Size = 0 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
- ASSERT((ShellInfoObject.ShellInitSettings.FileOptions == NULL && Size == 0) || (ShellInfoObject.ShellInitSettings.FileOptions != NULL));
+ for (Size = 0; LoopVar < gEfiShellParametersProtocol->Argc; LoopVar++) {
+ ASSERT ((ShellInfoObject.ShellInitSettings.FileOptions == NULL && Size == 0) || (ShellInfoObject.ShellInitSettings.FileOptions != NULL));
//
// Add a space between arguments
//
if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) {
- StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions, &Size, L" ", 0);
+ StrnCatGrow (&ShellInfoObject.ShellInitSettings.FileOptions, &Size, L" ", 0);
if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) {
- SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName);
+ SHELL_FREE_NON_NULL (ShellInfoObject.ShellInitSettings.FileName);
return (EFI_OUT_OF_RESOURCES);
}
}
+
//
// If an argument contains a space, then add double quotes before the argument
//
if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L" ") != NULL) {
- StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions,
- &Size,
- L"\"",
- 0);
+ StrnCatGrow (
+ &ShellInfoObject.ShellInitSettings.FileOptions,
+ &Size,
+ L"\"",
+ 0
+ );
if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) {
- SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName);
+ SHELL_FREE_NON_NULL (ShellInfoObject.ShellInitSettings.FileName);
return (EFI_OUT_OF_RESOURCES);
}
}
- StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions,
- &Size,
- gEfiShellParametersProtocol->Argv[LoopVar],
- 0);
+
+ StrnCatGrow (
+ &ShellInfoObject.ShellInitSettings.FileOptions,
+ &Size,
+ gEfiShellParametersProtocol->Argv[LoopVar],
+ 0
+ );
if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) {
- SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName);
+ SHELL_FREE_NON_NULL (ShellInfoObject.ShellInitSettings.FileName);
return (EFI_OUT_OF_RESOURCES);
}
+
//
// If an argument contains a space, then add double quotes after the argument
//
if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L" ") != NULL) {
- StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions,
- &Size,
- L"\"",
- 0);
+ StrnCatGrow (
+ &ShellInfoObject.ShellInitSettings.FileOptions,
+ &Size,
+ L"\"",
+ 0
+ );
if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) {
- SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName);
+ SHELL_FREE_NON_NULL (ShellInfoObject.ShellInitSettings.FileName);
return (EFI_OUT_OF_RESOURCES);
}
}
@@ -1139,14 +1228,14 @@ ProcessCommandLine( **/
CHAR16 *
LocateStartupScript (
- IN EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *FileDevicePath
+ IN EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *FileDevicePath
)
{
- CHAR16 *StartupScriptPath;
- CHAR16 *TempSpot;
- CONST CHAR16 *MapName;
- UINTN Size;
+ CHAR16 *StartupScriptPath;
+ CHAR16 *TempSpot;
+ CONST CHAR16 *MapName;
+ UINTN Size;
StartupScriptPath = NULL;
Size = 0;
@@ -1163,12 +1252,13 @@ LocateStartupScript ( //
return NULL;
}
+
TempSpot = StrStr (StartupScriptPath, L";");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
- InternalEfiShellSetEnv(L"homefilesystem", StartupScriptPath, TRUE);
+ InternalEfiShellSetEnv (L"homefilesystem", StartupScriptPath, TRUE);
StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, ((FILEPATH_DEVICE_PATH *)FileDevicePath)->PathName, 0);
PathRemoveLastItem (StartupScriptPath);
@@ -1197,91 +1287,98 @@ LocateStartupScript ( @retval EFI_SUCCESS the variable is initialized.
**/
EFI_STATUS
-DoStartupScript(
- IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+DoStartupScript (
+ IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
- EFI_STATUS Status;
- EFI_STATUS CalleeStatus;
- UINTN Delay;
- EFI_INPUT_KEY Key;
- CHAR16 *FileStringPath;
- CHAR16 *FullFileStringPath;
- UINTN NewSize;
+ EFI_STATUS Status;
+ EFI_STATUS CalleeStatus;
+ UINTN Delay;
+ EFI_INPUT_KEY Key;
+ CHAR16 *FileStringPath;
+ CHAR16 *FullFileStringPath;
+ UINTN NewSize;
Key.UnicodeChar = CHAR_NULL;
Key.ScanCode = 0;
- if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup && ShellInfoObject.ShellInitSettings.FileName != NULL) {
+ if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup && (ShellInfoObject.ShellInitSettings.FileName != NULL)) {
//
// launch something else instead
//
- NewSize = StrSize(ShellInfoObject.ShellInitSettings.FileName);
+ NewSize = StrSize (ShellInfoObject.ShellInitSettings.FileName);
if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) {
- NewSize += StrSize(ShellInfoObject.ShellInitSettings.FileOptions) + sizeof(CHAR16);
+ NewSize += StrSize (ShellInfoObject.ShellInitSettings.FileOptions) + sizeof (CHAR16);
}
- FileStringPath = AllocateZeroPool(NewSize);
+
+ FileStringPath = AllocateZeroPool (NewSize);
if (FileStringPath == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- StrCpyS(FileStringPath, NewSize/sizeof(CHAR16), ShellInfoObject.ShellInitSettings.FileName);
+
+ StrCpyS (FileStringPath, NewSize/sizeof (CHAR16), ShellInfoObject.ShellInitSettings.FileName);
if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) {
- StrnCatS(FileStringPath, NewSize/sizeof(CHAR16), L" ", NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);
- StrnCatS(FileStringPath, NewSize/sizeof(CHAR16), ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);
+ StrnCatS (FileStringPath, NewSize/sizeof (CHAR16), L" ", NewSize/sizeof (CHAR16) - StrLen (FileStringPath) -1);
+ StrnCatS (FileStringPath, NewSize/sizeof (CHAR16), ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof (CHAR16) - StrLen (FileStringPath) -1);
}
- Status = RunShellCommand(FileStringPath, &CalleeStatus);
+
+ Status = RunShellCommand (FileStringPath, &CalleeStatus);
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit == TRUE) {
- ShellCommandRegisterExit(gEfiShellProtocol->BatchIsActive(), (UINT64)CalleeStatus);
+ ShellCommandRegisterExit (gEfiShellProtocol->BatchIsActive (), (UINT64)CalleeStatus);
}
- FreePool(FileStringPath);
- return (Status);
+ FreePool (FileStringPath);
+ return (Status);
}
//
// for shell level 0 we do no scripts
// Without the Startup bit overriding we allow for nostartup to prevent scripts
//
- if ( (PcdGet8(PcdShellSupportLevel) < 1)
- || (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup)
- ){
+ if ( (PcdGet8 (PcdShellSupportLevel) < 1)
+ || (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup)
+ )
+ {
return (EFI_SUCCESS);
}
- gST->ConOut->EnableCursor(gST->ConOut, FALSE);
+ gST->ConOut->EnableCursor (gST->ConOut, FALSE);
//
// print out our warning and see if they press a key
//
for ( Status = EFI_UNSUPPORTED, Delay = ShellInfoObject.ShellInitSettings.Delay
- ; Delay != 0 && EFI_ERROR(Status)
- ; Delay--
- ){
- ShellPrintHiiEx(0, gST->ConOut->Mode->CursorRow, NULL, STRING_TOKEN (STR_SHELL_STARTUP_QUESTION), ShellInfoObject.HiiHandle, Delay);
+ ; Delay != 0 && EFI_ERROR (Status)
+ ; Delay--
+ )
+ {
+ ShellPrintHiiEx (0, gST->ConOut->Mode->CursorRow, NULL, STRING_TOKEN (STR_SHELL_STARTUP_QUESTION), ShellInfoObject.HiiHandle, Delay);
gBS->Stall (1000000);
if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
}
}
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_CRLF), ShellInfoObject.HiiHandle);
- gST->ConOut->EnableCursor(gST->ConOut, TRUE);
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_CRLF), ShellInfoObject.HiiHandle);
+ gST->ConOut->EnableCursor (gST->ConOut, TRUE);
//
// ESC was pressed
//
- if (Status == EFI_SUCCESS && Key.UnicodeChar == 0 && Key.ScanCode == SCAN_ESC) {
+ if ((Status == EFI_SUCCESS) && (Key.UnicodeChar == 0) && (Key.ScanCode == SCAN_ESC)) {
return (EFI_SUCCESS);
}
FileStringPath = LocateStartupScript (ImagePath, FilePath);
if (FileStringPath != NULL) {
- FullFileStringPath = FullyQualifyPath(FileStringPath);
+ FullFileStringPath = FullyQualifyPath (FileStringPath);
if (FullFileStringPath == NULL) {
Status = RunScriptFile (FileStringPath, NULL, FileStringPath, ShellInfoObject.NewShellParametersProtocol);
} else {
Status = RunScriptFile (FullFileStringPath, NULL, FullFileStringPath, ShellInfoObject.NewShellParametersProtocol);
- FreePool(FullFileStringPath);
+ FreePool (FullFileStringPath);
}
+
FreePool (FileStringPath);
} else {
//
@@ -1314,36 +1411,36 @@ DoShellPrompt ( EFI_STATUS Status;
LIST_ENTRY OldBufferList;
- CurDir = NULL;
+ CurDir = NULL;
//
// Get screen setting to decide size of the command line buffer
//
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &Column, &Row);
- BufferSize = Column * Row * sizeof (CHAR16);
- CmdLine = AllocateZeroPool (BufferSize);
+ BufferSize = Column * Row * sizeof (CHAR16);
+ CmdLine = AllocateZeroPool (BufferSize);
if (CmdLine == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- SaveBufferList(&OldBufferList);
- CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd");
+ SaveBufferList (&OldBufferList);
+ CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv (L"cwd");
//
// Prompt for input
//
gST->ConOut->SetCursorPosition (gST->ConOut, 0, gST->ConOut->Mode->CursorRow);
- if (CurDir != NULL && StrLen(CurDir) > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_CURDIR), ShellInfoObject.HiiHandle, CurDir);
+ if ((CurDir != NULL) && (StrLen (CurDir) > 1)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_CURDIR), ShellInfoObject.HiiHandle, CurDir);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_SHELL), ShellInfoObject.HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_SHELL), ShellInfoObject.HiiHandle);
}
//
// Read a line from the console
//
- Status = ShellInfoObject.NewEfiShellProtocol->ReadFile(ShellInfoObject.NewShellParametersProtocol->StdIn, &BufferSize, CmdLine);
+ Status = ShellInfoObject.NewEfiShellProtocol->ReadFile (ShellInfoObject.NewShellParametersProtocol->StdIn, &BufferSize, CmdLine);
//
// Null terminate the string and parse it
@@ -1355,13 +1452,13 @@ DoShellPrompt ( Status = gBS->CheckEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak);
CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL;
- Status = RunCommand(CmdLine);
+ Status = RunCommand (CmdLine);
}
//
// Done with this command
//
- RestoreBufferList(&OldBufferList);
+ RestoreBufferList (&OldBufferList);
FreePool (CmdLine);
return Status;
}
@@ -1372,12 +1469,12 @@ DoShellPrompt ( @param Buffer Something to pass to FreePool when the shell is exiting.
**/
-VOID*
+VOID *
AddBufferToFreeList (
- VOID *Buffer
+ VOID *Buffer
)
{
- BUFFER_LIST *BufferListEntry;
+ BUFFER_LIST *BufferListEntry;
if (Buffer == NULL) {
return (NULL);
@@ -1393,7 +1490,6 @@ AddBufferToFreeList ( return (Buffer);
}
-
/**
Create a new buffer list and stores the old one to OldBufferList
@@ -1401,7 +1497,7 @@ AddBufferToFreeList ( **/
VOID
SaveBufferList (
- OUT LIST_ENTRY *OldBufferList
+ OUT LIST_ENTRY *OldBufferList
)
{
CopyMem (OldBufferList, &ShellInfoObject.BufferToFreeList.Link, sizeof (LIST_ENTRY));
@@ -1415,38 +1511,36 @@ SaveBufferList ( **/
VOID
RestoreBufferList (
- IN OUT LIST_ENTRY *OldBufferList
+ IN OUT LIST_ENTRY *OldBufferList
)
{
FreeBufferList (&ShellInfoObject.BufferToFreeList);
CopyMem (&ShellInfoObject.BufferToFreeList.Link, OldBufferList, sizeof (LIST_ENTRY));
}
-
/**
Add a buffer to the Line History List
@param Buffer The line buffer to add.
**/
VOID
-AddLineToCommandHistory(
- IN CONST CHAR16 *Buffer
+AddLineToCommandHistory (
+ IN CONST CHAR16 *Buffer
)
{
- BUFFER_LIST *Node;
- BUFFER_LIST *Walker;
+ BUFFER_LIST *Node;
+ BUFFER_LIST *Walker;
UINT16 MaxHistoryCmdCount;
UINT16 Count;
- Count = 0;
- MaxHistoryCmdCount = PcdGet16(PcdShellMaxHistoryCommandCount);
+ Count = 0;
+ MaxHistoryCmdCount = PcdGet16 (PcdShellMaxHistoryCommandCount);
if (MaxHistoryCmdCount == 0) {
- return ;
+ return;
}
-
- Node = AllocateZeroPool(sizeof(BUFFER_LIST));
+ Node = AllocateZeroPool (sizeof (BUFFER_LIST));
if (Node == NULL) {
return;
}
@@ -1457,22 +1551,25 @@ AddLineToCommandHistory( return;
}
- for ( Walker = (BUFFER_LIST*)GetFirstNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link)
- ; !IsNull(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Walker->Link)
- ; Walker = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Walker->Link)
- ){
+ for ( Walker = (BUFFER_LIST *)GetFirstNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link)
+ ; !IsNull (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Walker->Link)
+ ; Walker = (BUFFER_LIST *)GetNextNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Walker->Link)
+ )
+ {
Count++;
}
- if (Count < MaxHistoryCmdCount){
- InsertTailList(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link);
+
+ if (Count < MaxHistoryCmdCount) {
+ InsertTailList (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link);
} else {
- Walker = (BUFFER_LIST*)GetFirstNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link);
- RemoveEntryList(&Walker->Link);
+ Walker = (BUFFER_LIST *)GetFirstNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link);
+ RemoveEntryList (&Walker->Link);
if (Walker->Buffer != NULL) {
- FreePool(Walker->Buffer);
+ FreePool (Walker->Buffer);
}
- FreePool(Walker);
- InsertTailList(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link);
+
+ FreePool (Walker);
+ InsertTailList (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link);
}
}
@@ -1490,21 +1587,23 @@ AddLineToCommandHistory( @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
-ShellConvertAlias(
- IN OUT CHAR16 **CommandString
+ShellConvertAlias (
+ IN OUT CHAR16 **CommandString
)
{
CONST CHAR16 *NewString;
- NewString = ShellInfoObject.NewEfiShellProtocol->GetAlias(*CommandString, NULL);
+ NewString = ShellInfoObject.NewEfiShellProtocol->GetAlias (*CommandString, NULL);
if (NewString == NULL) {
return (EFI_SUCCESS);
}
- FreePool(*CommandString);
- *CommandString = AllocateCopyPool(StrSize(NewString), NewString);
+
+ FreePool (*CommandString);
+ *CommandString = AllocateCopyPool (StrSize (NewString), NewString);
if (*CommandString == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
+
return (EFI_SUCCESS);
}
@@ -1514,29 +1613,29 @@ ShellConvertAlias( @param[in,out] CmdLine The command line to update.
**/
EFI_STATUS
-StripUnreplacedEnvironmentVariables(
- IN OUT CHAR16 *CmdLine
+StripUnreplacedEnvironmentVariables (
+ IN OUT CHAR16 *CmdLine
)
{
- CHAR16 *FirstPercent;
- CHAR16 *FirstQuote;
- CHAR16 *SecondPercent;
- CHAR16 *SecondQuote;
- CHAR16 *CurrentLocator;
-
- for (CurrentLocator = CmdLine ; CurrentLocator != NULL ; ) {
- FirstQuote = FindNextInstance(CurrentLocator, L"\"", TRUE);
- FirstPercent = FindNextInstance(CurrentLocator, L"%", TRUE);
- SecondPercent = FirstPercent!=NULL?FindNextInstance(FirstPercent+1, L"%", TRUE):NULL;
- if (FirstPercent == NULL || SecondPercent == NULL) {
+ CHAR16 *FirstPercent;
+ CHAR16 *FirstQuote;
+ CHAR16 *SecondPercent;
+ CHAR16 *SecondQuote;
+ CHAR16 *CurrentLocator;
+
+ for (CurrentLocator = CmdLine; CurrentLocator != NULL; ) {
+ FirstQuote = FindNextInstance (CurrentLocator, L"\"", TRUE);
+ FirstPercent = FindNextInstance (CurrentLocator, L"%", TRUE);
+ SecondPercent = FirstPercent != NULL ? FindNextInstance (FirstPercent+1, L"%", TRUE) : NULL;
+ if ((FirstPercent == NULL) || (SecondPercent == NULL)) {
//
// If we ever don't have 2 % we are done.
//
break;
}
- if (FirstQuote!= NULL && FirstQuote < FirstPercent) {
- SecondQuote = FindNextInstance(FirstQuote+1, L"\"", TRUE);
+ if ((FirstQuote != NULL) && (FirstQuote < FirstPercent)) {
+ SecondQuote = FindNextInstance (FirstQuote+1, L"\"", TRUE);
//
// Quote is first found
//
@@ -1546,31 +1645,36 @@ StripUnreplacedEnvironmentVariables( // restart after the pair of "
//
CurrentLocator = SecondQuote + 1;
- } else /* FirstPercent < SecondQuote */{
+ } else {
+ /* FirstPercent < SecondQuote */
//
// Restart on the first percent
//
CurrentLocator = FirstPercent;
}
+
continue;
}
- if (FirstQuote == NULL || SecondPercent < FirstQuote) {
- if (IsValidEnvironmentVariableName(FirstPercent, SecondPercent)) {
+ if ((FirstQuote == NULL) || (SecondPercent < FirstQuote)) {
+ if (IsValidEnvironmentVariableName (FirstPercent, SecondPercent)) {
//
// We need to remove from FirstPercent to SecondPercent
//
- CopyMem(FirstPercent, SecondPercent + 1, StrSize(SecondPercent + 1));
+ CopyMem (FirstPercent, SecondPercent + 1, StrSize (SecondPercent + 1));
//
// don't need to update the locator. both % characters are gone.
//
} else {
CurrentLocator = SecondPercent + 1;
}
+
continue;
}
+
CurrentLocator = FirstQuote;
}
+
return (EFI_SUCCESS);
}
@@ -1585,69 +1689,75 @@ StripUnreplacedEnvironmentVariables( @retval NULL An error occurred.
@return The new command line with no environment variables present.
**/
-CHAR16*
+CHAR16 *
ShellConvertVariables (
- IN CONST CHAR16 *OriginalCommandLine
+ IN CONST CHAR16 *OriginalCommandLine
)
{
- CONST CHAR16 *MasterEnvList;
- UINTN NewSize;
- CHAR16 *NewCommandLine1;
- CHAR16 *NewCommandLine2;
- CHAR16 *Temp;
- UINTN ItemSize;
- CHAR16 *ItemTemp;
- SCRIPT_FILE *CurrentScriptFile;
- ALIAS_LIST *AliasListNode;
-
- ASSERT(OriginalCommandLine != NULL);
+ CONST CHAR16 *MasterEnvList;
+ UINTN NewSize;
+ CHAR16 *NewCommandLine1;
+ CHAR16 *NewCommandLine2;
+ CHAR16 *Temp;
+ UINTN ItemSize;
+ CHAR16 *ItemTemp;
+ SCRIPT_FILE *CurrentScriptFile;
+ ALIAS_LIST *AliasListNode;
+
+ ASSERT (OriginalCommandLine != NULL);
ItemSize = 0;
- NewSize = StrSize(OriginalCommandLine);
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
+ NewSize = StrSize (OriginalCommandLine);
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
Temp = NULL;
- ///@todo update this to handle the %0 - %9 for scripting only (borrow from line 1256 area) ? ? ?
+ /// @todo update this to handle the %0 - %9 for scripting only (borrow from line 1256 area) ? ? ?
//
// calculate the size required for the post-conversion string...
//
if (CurrentScriptFile != NULL) {
- for (AliasListNode = (ALIAS_LIST*)GetFirstNode(&CurrentScriptFile->SubstList)
- ; !IsNull(&CurrentScriptFile->SubstList, &AliasListNode->Link)
- ; AliasListNode = (ALIAS_LIST*)GetNextNode(&CurrentScriptFile->SubstList, &AliasListNode->Link)
- ){
- for (Temp = StrStr(OriginalCommandLine, AliasListNode->Alias)
- ; Temp != NULL
- ; Temp = StrStr(Temp+1, AliasListNode->Alias)
- ){
+ for (AliasListNode = (ALIAS_LIST *)GetFirstNode (&CurrentScriptFile->SubstList)
+ ; !IsNull (&CurrentScriptFile->SubstList, &AliasListNode->Link)
+ ; AliasListNode = (ALIAS_LIST *)GetNextNode (&CurrentScriptFile->SubstList, &AliasListNode->Link)
+ )
+ {
+ for (Temp = StrStr (OriginalCommandLine, AliasListNode->Alias)
+ ; Temp != NULL
+ ; Temp = StrStr (Temp+1, AliasListNode->Alias)
+ )
+ {
//
// we need a preceding and if there is space no ^ preceding (if no space ignore)
//
- if ((((Temp-OriginalCommandLine)>2) && *(Temp-2) != L'^') || ((Temp-OriginalCommandLine)<=2)) {
- NewSize += StrSize(AliasListNode->CommandString);
+ if ((((Temp-OriginalCommandLine) > 2) && (*(Temp-2) != L'^')) || ((Temp-OriginalCommandLine) <= 2)) {
+ NewSize += StrSize (AliasListNode->CommandString);
}
}
}
}
- for (MasterEnvList = EfiShellGetEnv(NULL)
- ; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL //&& *(MasterEnvList+1) != CHAR_NULL
- ; MasterEnvList += StrLen(MasterEnvList) + 1
- ){
- if (StrSize(MasterEnvList) > ItemSize) {
- ItemSize = StrSize(MasterEnvList);
+ for (MasterEnvList = EfiShellGetEnv (NULL)
+ ; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL // && *(MasterEnvList+1) != CHAR_NULL
+ ; MasterEnvList += StrLen (MasterEnvList) + 1
+ )
+ {
+ if (StrSize (MasterEnvList) > ItemSize) {
+ ItemSize = StrSize (MasterEnvList);
}
- for (Temp = StrStr(OriginalCommandLine, MasterEnvList)
- ; Temp != NULL
- ; Temp = StrStr(Temp+1, MasterEnvList)
- ){
+
+ for (Temp = StrStr (OriginalCommandLine, MasterEnvList)
+ ; Temp != NULL
+ ; Temp = StrStr (Temp+1, MasterEnvList)
+ )
+ {
//
// we need a preceding and following % and if there is space no ^ preceding (if no space ignore)
//
- if (*(Temp-1) == L'%' && *(Temp+StrLen(MasterEnvList)) == L'%' &&
- ((((Temp-OriginalCommandLine)>2) && *(Temp-2) != L'^') || ((Temp-OriginalCommandLine)<=2))) {
- NewSize+=StrSize(EfiShellGetEnv(MasterEnvList));
+ if ((*(Temp-1) == L'%') && (*(Temp+StrLen (MasterEnvList)) == L'%') &&
+ ((((Temp-OriginalCommandLine) > 2) && (*(Temp-2) != L'^')) || ((Temp-OriginalCommandLine) <= 2)))
+ {
+ NewSize += StrSize (EfiShellGetEnv (MasterEnvList));
}
}
}
@@ -1656,58 +1766,65 @@ ShellConvertVariables ( // now do the replacements...
//
NewCommandLine1 = AllocateZeroPool (NewSize);
- NewCommandLine2 = AllocateZeroPool(NewSize);
- ItemTemp = AllocateZeroPool(ItemSize+(2*sizeof(CHAR16)));
- if (NewCommandLine1 == NULL || NewCommandLine2 == NULL || ItemTemp == NULL) {
- SHELL_FREE_NON_NULL(NewCommandLine1);
- SHELL_FREE_NON_NULL(NewCommandLine2);
- SHELL_FREE_NON_NULL(ItemTemp);
+ NewCommandLine2 = AllocateZeroPool (NewSize);
+ ItemTemp = AllocateZeroPool (ItemSize+(2*sizeof (CHAR16)));
+ if ((NewCommandLine1 == NULL) || (NewCommandLine2 == NULL) || (ItemTemp == NULL)) {
+ SHELL_FREE_NON_NULL (NewCommandLine1);
+ SHELL_FREE_NON_NULL (NewCommandLine2);
+ SHELL_FREE_NON_NULL (ItemTemp);
return (NULL);
}
+
CopyMem (NewCommandLine1, OriginalCommandLine, StrSize (OriginalCommandLine));
- for (MasterEnvList = EfiShellGetEnv(NULL)
- ; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL
- ; MasterEnvList += StrLen(MasterEnvList) + 1
- ){
- StrCpyS( ItemTemp,
- ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
- L"%"
- );
- StrCatS( ItemTemp,
- ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
- MasterEnvList
- );
- StrCatS( ItemTemp,
- ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
- L"%"
- );
- ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, ItemTemp, EfiShellGetEnv(MasterEnvList), TRUE, FALSE);
- StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2);
+ for (MasterEnvList = EfiShellGetEnv (NULL)
+ ; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL
+ ; MasterEnvList += StrLen (MasterEnvList) + 1
+ )
+ {
+ StrCpyS (
+ ItemTemp,
+ ((ItemSize+(2*sizeof (CHAR16)))/sizeof (CHAR16)),
+ L"%"
+ );
+ StrCatS (
+ ItemTemp,
+ ((ItemSize+(2*sizeof (CHAR16)))/sizeof (CHAR16)),
+ MasterEnvList
+ );
+ StrCatS (
+ ItemTemp,
+ ((ItemSize+(2*sizeof (CHAR16)))/sizeof (CHAR16)),
+ L"%"
+ );
+ ShellCopySearchAndReplace (NewCommandLine1, NewCommandLine2, NewSize, ItemTemp, EfiShellGetEnv (MasterEnvList), TRUE, FALSE);
+ StrCpyS (NewCommandLine1, NewSize/sizeof (CHAR16), NewCommandLine2);
}
+
if (CurrentScriptFile != NULL) {
- for (AliasListNode = (ALIAS_LIST*)GetFirstNode(&CurrentScriptFile->SubstList)
- ; !IsNull(&CurrentScriptFile->SubstList, &AliasListNode->Link)
- ; AliasListNode = (ALIAS_LIST*)GetNextNode(&CurrentScriptFile->SubstList, &AliasListNode->Link)
- ){
- ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, AliasListNode->Alias, AliasListNode->CommandString, TRUE, FALSE);
- StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2);
+ for (AliasListNode = (ALIAS_LIST *)GetFirstNode (&CurrentScriptFile->SubstList)
+ ; !IsNull (&CurrentScriptFile->SubstList, &AliasListNode->Link)
+ ; AliasListNode = (ALIAS_LIST *)GetNextNode (&CurrentScriptFile->SubstList, &AliasListNode->Link)
+ )
+ {
+ ShellCopySearchAndReplace (NewCommandLine1, NewCommandLine2, NewSize, AliasListNode->Alias, AliasListNode->CommandString, TRUE, FALSE);
+ StrCpyS (NewCommandLine1, NewSize/sizeof (CHAR16), NewCommandLine2);
}
}
//
// Remove non-existent environment variables
//
- StripUnreplacedEnvironmentVariables(NewCommandLine1);
+ StripUnreplacedEnvironmentVariables (NewCommandLine1);
//
// Now cleanup any straggler intentionally ignored "%" characters
//
- ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, L"^%", L"%", TRUE, FALSE);
- StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2);
+ ShellCopySearchAndReplace (NewCommandLine1, NewCommandLine2, NewSize, L"^%", L"%", TRUE, FALSE);
+ StrCpyS (NewCommandLine1, NewSize/sizeof (CHAR16), NewCommandLine2);
- FreePool(NewCommandLine2);
- FreePool(ItemTemp);
+ FreePool (NewCommandLine2);
+ FreePool (ItemTemp);
return (NewCommandLine1);
}
@@ -1723,24 +1840,24 @@ ShellConvertVariables ( @retval other Some error occurs when executing the split command.
**/
EFI_STATUS
-RunSplitCommand(
+RunSplitCommand (
IN CONST CHAR16 *CmdLine,
IN SHELL_FILE_HANDLE StdIn,
IN SHELL_FILE_HANDLE StdOut
)
{
- EFI_STATUS Status;
- CHAR16 *NextCommandLine;
- CHAR16 *OurCommandLine;
- UINTN Size1;
- UINTN Size2;
- SPLIT_LIST *Split;
- SHELL_FILE_HANDLE TempFileHandle;
- BOOLEAN Unicode;
+ EFI_STATUS Status;
+ CHAR16 *NextCommandLine;
+ CHAR16 *OurCommandLine;
+ UINTN Size1;
+ UINTN Size2;
+ SPLIT_LIST *Split;
+ SHELL_FILE_HANDLE TempFileHandle;
+ BOOLEAN Unicode;
- ASSERT(StdOut == NULL);
+ ASSERT (StdOut == NULL);
- ASSERT(StrStr(CmdLine, L"|") != NULL);
+ ASSERT (StrStr (CmdLine, L"|") != NULL);
Status = EFI_SUCCESS;
NextCommandLine = NULL;
@@ -1748,70 +1865,74 @@ RunSplitCommand( Size1 = 0;
Size2 = 0;
- NextCommandLine = StrnCatGrow(&NextCommandLine, &Size1, StrStr(CmdLine, L"|")+1, 0);
- OurCommandLine = StrnCatGrow(&OurCommandLine , &Size2, CmdLine , StrStr(CmdLine, L"|") - CmdLine);
+ NextCommandLine = StrnCatGrow (&NextCommandLine, &Size1, StrStr (CmdLine, L"|")+1, 0);
+ OurCommandLine = StrnCatGrow (&OurCommandLine, &Size2, CmdLine, StrStr (CmdLine, L"|") - CmdLine);
- if (NextCommandLine == NULL || OurCommandLine == NULL) {
- SHELL_FREE_NON_NULL(OurCommandLine);
- SHELL_FREE_NON_NULL(NextCommandLine);
+ if ((NextCommandLine == NULL) || (OurCommandLine == NULL)) {
+ SHELL_FREE_NON_NULL (OurCommandLine);
+ SHELL_FREE_NON_NULL (NextCommandLine);
return (EFI_OUT_OF_RESOURCES);
- } else if (StrStr(OurCommandLine, L"|") != NULL || Size1 == 0 || Size2 == 0) {
- SHELL_FREE_NON_NULL(OurCommandLine);
- SHELL_FREE_NON_NULL(NextCommandLine);
+ } else if ((StrStr (OurCommandLine, L"|") != NULL) || (Size1 == 0) || (Size2 == 0)) {
+ SHELL_FREE_NON_NULL (OurCommandLine);
+ SHELL_FREE_NON_NULL (NextCommandLine);
return (EFI_INVALID_PARAMETER);
- } else if (NextCommandLine[0] == L'a' &&
- (NextCommandLine[1] == L' ' || NextCommandLine[1] == CHAR_NULL)
- ){
- CopyMem(NextCommandLine, NextCommandLine+1, StrSize(NextCommandLine) - sizeof(NextCommandLine[0]));
+ } else if ((NextCommandLine[0] == L'a') &&
+ ((NextCommandLine[1] == L' ') || (NextCommandLine[1] == CHAR_NULL))
+ )
+ {
+ CopyMem (NextCommandLine, NextCommandLine+1, StrSize (NextCommandLine) - sizeof (NextCommandLine[0]));
while (NextCommandLine[0] == L' ') {
- CopyMem(NextCommandLine, NextCommandLine+1, StrSize(NextCommandLine) - sizeof(NextCommandLine[0]));
+ CopyMem (NextCommandLine, NextCommandLine+1, StrSize (NextCommandLine) - sizeof (NextCommandLine[0]));
}
+
if (NextCommandLine[0] == CHAR_NULL) {
- SHELL_FREE_NON_NULL(OurCommandLine);
- SHELL_FREE_NON_NULL(NextCommandLine);
+ SHELL_FREE_NON_NULL (OurCommandLine);
+ SHELL_FREE_NON_NULL (NextCommandLine);
return (EFI_INVALID_PARAMETER);
}
+
Unicode = FALSE;
} else {
Unicode = TRUE;
}
-
//
// make a SPLIT_LIST item and add to list
//
- Split = AllocateZeroPool(sizeof(SPLIT_LIST));
+ Split = AllocateZeroPool (sizeof (SPLIT_LIST));
if (Split == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Split->SplitStdIn = StdIn;
- Split->SplitStdOut = ConvertEfiFileProtocolToShellHandle(CreateFileInterfaceMem(Unicode), NULL);
- ASSERT(Split->SplitStdOut != NULL);
- InsertHeadList(&ShellInfoObject.SplitList.Link, &Split->Link);
- Status = RunCommand(OurCommandLine);
+ Split->SplitStdIn = StdIn;
+ Split->SplitStdOut = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (Unicode), NULL);
+ ASSERT (Split->SplitStdOut != NULL);
+ InsertHeadList (&ShellInfoObject.SplitList.Link, &Split->Link);
+
+ Status = RunCommand (OurCommandLine);
//
// move the output from the first to the in to the second.
//
- TempFileHandle = Split->SplitStdOut;
+ TempFileHandle = Split->SplitStdOut;
if (Split->SplitStdIn == StdIn) {
Split->SplitStdOut = NULL;
} else {
- Split->SplitStdOut = Split->SplitStdIn;
+ Split->SplitStdOut = Split->SplitStdIn;
}
- Split->SplitStdIn = TempFileHandle;
+
+ Split->SplitStdIn = TempFileHandle;
ShellInfoObject.NewEfiShellProtocol->SetFilePosition (Split->SplitStdIn, 0);
- if (!EFI_ERROR(Status)) {
- Status = RunCommand(NextCommandLine);
+ if (!EFI_ERROR (Status)) {
+ Status = RunCommand (NextCommandLine);
}
//
// remove the top level from the ScriptList
//
- ASSERT((SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link) == Split);
- RemoveEntryList(&Split->Link);
+ ASSERT ((SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link) == Split);
+ RemoveEntryList (&Split->Link);
//
// Note that the original StdIn is now the StdOut...
@@ -1819,13 +1940,14 @@ RunSplitCommand( if (Split->SplitStdOut != NULL) {
ShellInfoObject.NewEfiShellProtocol->CloseFile (Split->SplitStdOut);
}
+
if (Split->SplitStdIn != NULL) {
ShellInfoObject.NewEfiShellProtocol->CloseFile (Split->SplitStdIn);
}
- FreePool(Split);
- FreePool(NextCommandLine);
- FreePool(OurCommandLine);
+ FreePool (Split);
+ FreePool (NextCommandLine);
+ FreePool (OurCommandLine);
return (Status);
}
@@ -1840,16 +1962,18 @@ RunSplitCommand( @retval EFI_OUT_OF_RESOURCES a memory allocation failed.
**/
EFI_STATUS
-ShellSubstituteVariables(
- IN CHAR16 **CmdLine
+ShellSubstituteVariables (
+ IN CHAR16 **CmdLine
)
{
- CHAR16 *NewCmdLine;
- NewCmdLine = ShellConvertVariables(*CmdLine);
- SHELL_FREE_NON_NULL(*CmdLine);
+ CHAR16 *NewCmdLine;
+
+ NewCmdLine = ShellConvertVariables (*CmdLine);
+ SHELL_FREE_NON_NULL (*CmdLine);
if (NewCmdLine == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
+
*CmdLine = NewCmdLine;
return (EFI_SUCCESS);
}
@@ -1864,56 +1988,58 @@ ShellSubstituteVariables( @retval EFI_OUT_OF_RESOURCES a memory allocation failed.
**/
EFI_STATUS
-ShellSubstituteAliases(
- IN CHAR16 **CmdLine
+ShellSubstituteAliases (
+ IN CHAR16 **CmdLine
)
{
CHAR16 *NewCmdLine;
CHAR16 *CommandName;
EFI_STATUS Status;
UINTN PostAliasSize;
- ASSERT(CmdLine != NULL);
- ASSERT(*CmdLine!= NULL);
+ ASSERT (CmdLine != NULL);
+ ASSERT (*CmdLine != NULL);
CommandName = NULL;
- if (StrStr((*CmdLine), L" ") == NULL){
- StrnCatGrow(&CommandName, NULL, (*CmdLine), 0);
+ if (StrStr ((*CmdLine), L" ") == NULL) {
+ StrnCatGrow (&CommandName, NULL, (*CmdLine), 0);
} else {
- StrnCatGrow(&CommandName, NULL, (*CmdLine), StrStr((*CmdLine), L" ") - (*CmdLine));
+ StrnCatGrow (&CommandName, NULL, (*CmdLine), StrStr ((*CmdLine), L" ") - (*CmdLine));
}
//
// This cannot happen 'inline' since the CmdLine can need extra space.
//
NewCmdLine = NULL;
- if (!ShellCommandIsCommandOnList(CommandName)) {
+ if (!ShellCommandIsCommandOnList (CommandName)) {
//
// Convert via alias
//
- Status = ShellConvertAlias(&CommandName);
- if (EFI_ERROR(Status)){
+ Status = ShellConvertAlias (&CommandName);
+ if (EFI_ERROR (Status)) {
return (Status);
}
+
PostAliasSize = 0;
- NewCmdLine = StrnCatGrow(&NewCmdLine, &PostAliasSize, CommandName, 0);
+ NewCmdLine = StrnCatGrow (&NewCmdLine, &PostAliasSize, CommandName, 0);
if (NewCmdLine == NULL) {
- SHELL_FREE_NON_NULL(CommandName);
- SHELL_FREE_NON_NULL(*CmdLine);
+ SHELL_FREE_NON_NULL (CommandName);
+ SHELL_FREE_NON_NULL (*CmdLine);
return (EFI_OUT_OF_RESOURCES);
}
- NewCmdLine = StrnCatGrow(&NewCmdLine, &PostAliasSize, StrStr((*CmdLine), L" "), 0);
+
+ NewCmdLine = StrnCatGrow (&NewCmdLine, &PostAliasSize, StrStr ((*CmdLine), L" "), 0);
if (NewCmdLine == NULL) {
- SHELL_FREE_NON_NULL(CommandName);
- SHELL_FREE_NON_NULL(*CmdLine);
+ SHELL_FREE_NON_NULL (CommandName);
+ SHELL_FREE_NON_NULL (*CmdLine);
return (EFI_OUT_OF_RESOURCES);
}
} else {
- NewCmdLine = StrnCatGrow(&NewCmdLine, NULL, (*CmdLine), 0);
+ NewCmdLine = StrnCatGrow (&NewCmdLine, NULL, (*CmdLine), 0);
}
- SHELL_FREE_NON_NULL(*CmdLine);
- SHELL_FREE_NON_NULL(CommandName);
+ SHELL_FREE_NON_NULL (*CmdLine);
+ SHELL_FREE_NON_NULL (CommandName);
//
// re-assign the passed in double pointer to point to our newly allocated buffer
@@ -1935,46 +2061,48 @@ ShellSubstituteAliases( @retval Efi_Application the name is an application (.EFI).
**/
SHELL_OPERATION_TYPES
-GetOperationType(
- IN CONST CHAR16 *CmdName
+GetOperationType (
+ IN CONST CHAR16 *CmdName
)
{
- CHAR16* FileWithPath;
- CONST CHAR16* TempLocation;
- CONST CHAR16* TempLocation2;
+ CHAR16 *FileWithPath;
+ CONST CHAR16 *TempLocation;
+ CONST CHAR16 *TempLocation2;
FileWithPath = NULL;
//
// test for an internal command.
//
- if (ShellCommandIsCommandOnList(CmdName)) {
+ if (ShellCommandIsCommandOnList (CmdName)) {
return (Internal_Command);
}
//
// Test for file system change request. anything ending with first : and cant have spaces.
//
- if (CmdName[(StrLen(CmdName)-1)] == L':') {
- if ( StrStr(CmdName, L" ") != NULL
- || StrLen(StrStr(CmdName, L":")) > 1
- ) {
+ if (CmdName[(StrLen (CmdName)-1)] == L':') {
+ if ( (StrStr (CmdName, L" ") != NULL)
+ || (StrLen (StrStr (CmdName, L":")) > 1)
+ )
+ {
return (Unknown_Invalid);
}
+
return (File_Sys_Change);
}
//
// Test for a file
//
- if ((FileWithPath = ShellFindFilePathEx(CmdName, mExecutableExtensions)) != NULL) {
+ if ((FileWithPath = ShellFindFilePathEx (CmdName, mExecutableExtensions)) != NULL) {
//
// See if that file has a script file extension
//
- if (StrLen(FileWithPath) > 4) {
- TempLocation = FileWithPath+StrLen(FileWithPath)-4;
+ if (StrLen (FileWithPath) > 4) {
+ TempLocation = FileWithPath+StrLen (FileWithPath)-4;
TempLocation2 = mScriptExtension;
- if (StringNoCaseCompare((VOID*)(&TempLocation), (VOID*)(&TempLocation2)) == 0) {
- SHELL_FREE_NON_NULL(FileWithPath);
+ if (StringNoCaseCompare ((VOID *)(&TempLocation), (VOID *)(&TempLocation2)) == 0) {
+ SHELL_FREE_NON_NULL (FileWithPath);
return (Script_File_Name);
}
}
@@ -1982,11 +2110,11 @@ GetOperationType( //
// Was a file, but not a script. we treat this as an application.
//
- SHELL_FREE_NON_NULL(FileWithPath);
+ SHELL_FREE_NON_NULL (FileWithPath);
return (Efi_Application);
}
- SHELL_FREE_NON_NULL(FileWithPath);
+ SHELL_FREE_NON_NULL (FileWithPath);
//
// No clue what this is... return invalid flag...
//
@@ -2003,23 +2131,23 @@ GetOperationType( @retval EFI_NOT_FOUND The operation type is unknown or invalid.
**/
EFI_STATUS
-IsValidSplit(
- IN CONST CHAR16 *CmdLine
+IsValidSplit (
+ IN CONST CHAR16 *CmdLine
)
{
- CHAR16 *Temp;
- CHAR16 *FirstParameter;
- CHAR16 *TempWalker;
- EFI_STATUS Status;
+ CHAR16 *Temp;
+ CHAR16 *FirstParameter;
+ CHAR16 *TempWalker;
+ EFI_STATUS Status;
- Temp = NULL;
+ Temp = NULL;
- Temp = StrnCatGrow(&Temp, NULL, CmdLine, 0);
+ Temp = StrnCatGrow (&Temp, NULL, CmdLine, 0);
if (Temp == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- FirstParameter = StrStr(Temp, L"|");
+ FirstParameter = StrStr (Temp, L"|");
if (FirstParameter != NULL) {
*FirstParameter = CHAR_NULL;
}
@@ -2029,26 +2157,27 @@ IsValidSplit( //
// Process the command line
//
- Status = ProcessCommandLineToFinal(&Temp);
+ Status = ProcessCommandLineToFinal (&Temp);
- if (!EFI_ERROR(Status)) {
- FirstParameter = AllocateZeroPool(StrSize(CmdLine));
+ if (!EFI_ERROR (Status)) {
+ FirstParameter = AllocateZeroPool (StrSize (CmdLine));
if (FirstParameter == NULL) {
- SHELL_FREE_NON_NULL(Temp);
+ SHELL_FREE_NON_NULL (Temp);
return (EFI_OUT_OF_RESOURCES);
}
- TempWalker = (CHAR16*)Temp;
- if (!EFI_ERROR(GetNextParameter(&TempWalker, &FirstParameter, StrSize(CmdLine), TRUE))) {
- if (GetOperationType(FirstParameter) == Unknown_Invalid) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
- SetLastError(SHELL_NOT_FOUND);
+
+ TempWalker = (CHAR16 *)Temp;
+ if (!EFI_ERROR (GetNextParameter (&TempWalker, &FirstParameter, StrSize (CmdLine), TRUE))) {
+ if (GetOperationType (FirstParameter) == Unknown_Invalid) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
+ SetLastError (SHELL_NOT_FOUND);
Status = EFI_NOT_FOUND;
}
}
}
- SHELL_FREE_NON_NULL(Temp);
- SHELL_FREE_NON_NULL(FirstParameter);
+ SHELL_FREE_NON_NULL (Temp);
+ SHELL_FREE_NON_NULL (FirstParameter);
return Status;
}
@@ -2061,8 +2190,8 @@ IsValidSplit( @retval EFI_ABORTED CmdLine has at least one invalid command or application.
**/
EFI_STATUS
-VerifySplit(
- IN CONST CHAR16 *CmdLine
+VerifySplit (
+ IN CONST CHAR16 *CmdLine
)
{
CONST CHAR16 *TempSpot;
@@ -2071,30 +2200,31 @@ VerifySplit( //
// If this was the only item, then get out
//
- if (!ContainsSplit(CmdLine)) {
+ if (!ContainsSplit (CmdLine)) {
return (EFI_SUCCESS);
}
//
// Verify up to the pipe or end character
//
- Status = IsValidSplit(CmdLine);
- if (EFI_ERROR(Status)) {
+ Status = IsValidSplit (CmdLine);
+ if (EFI_ERROR (Status)) {
return (Status);
}
//
// recurse to verify the next item
//
- TempSpot = FindFirstCharacter(CmdLine, L"|", L'^') + 1;
- if (*TempSpot == L'a' &&
- (*(TempSpot + 1) == L' ' || *(TempSpot + 1) == CHAR_NULL)
- ) {
+ TempSpot = FindFirstCharacter (CmdLine, L"|", L'^') + 1;
+ if ((*TempSpot == L'a') &&
+ ((*(TempSpot + 1) == L' ') || (*(TempSpot + 1) == CHAR_NULL))
+ )
+ {
// If it's an ASCII pipe '|a'
TempSpot += 1;
}
- return (VerifySplit(TempSpot));
+ return (VerifySplit (TempSpot));
}
/**
@@ -2106,15 +2236,15 @@ VerifySplit( @return an error occurred.
**/
EFI_STATUS
-ProcessNewSplitCommandLine(
- IN CONST CHAR16 *CmdLine
+ProcessNewSplitCommandLine (
+ IN CONST CHAR16 *CmdLine
)
{
- SPLIT_LIST *Split;
- EFI_STATUS Status;
+ SPLIT_LIST *Split;
+ EFI_STATUS Status;
- Status = VerifySplit(CmdLine);
- if (EFI_ERROR(Status)) {
+ Status = VerifySplit (CmdLine);
+ if (EFI_ERROR (Status)) {
return (Status);
}
@@ -2123,18 +2253,20 @@ ProcessNewSplitCommandLine( //
// are we in an existing split???
//
- if (!IsListEmpty(&ShellInfoObject.SplitList.Link)) {
- Split = (SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link);
+ if (!IsListEmpty (&ShellInfoObject.SplitList.Link)) {
+ Split = (SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link);
}
if (Split == NULL) {
- Status = RunSplitCommand(CmdLine, NULL, NULL);
+ Status = RunSplitCommand (CmdLine, NULL, NULL);
} else {
- Status = RunSplitCommand(CmdLine, Split->SplitStdIn, Split->SplitStdOut);
+ Status = RunSplitCommand (CmdLine, Split->SplitStdIn, Split->SplitStdOut);
}
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), ShellInfoObject.HiiHandle, CmdLine);
+
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), ShellInfoObject.HiiHandle, CmdLine);
}
+
return (Status);
}
@@ -2146,28 +2278,29 @@ ProcessNewSplitCommandLine( @retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
-ChangeMappedDrive(
- IN CONST CHAR16 *CmdLine
+ChangeMappedDrive (
+ IN CONST CHAR16 *CmdLine
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
Status = EFI_SUCCESS;
//
// make sure we are the right operation
//
- ASSERT(CmdLine[(StrLen(CmdLine)-1)] == L':' && StrStr(CmdLine, L" ") == NULL);
+ ASSERT (CmdLine[(StrLen (CmdLine)-1)] == L':' && StrStr (CmdLine, L" ") == NULL);
//
// Call the protocol API to do the work
//
- Status = ShellInfoObject.NewEfiShellProtocol->SetCurDir(NULL, CmdLine);
+ Status = ShellInfoObject.NewEfiShellProtocol->SetCurDir (NULL, CmdLine);
//
// Report any errors
//
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_MAPPING), ShellInfoObject.HiiHandle, CmdLine);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_MAPPING), ShellInfoObject.HiiHandle, CmdLine);
}
return (Status);
@@ -2181,31 +2314,31 @@ ChangeMappedDrive( @param[in,out] CmdLine pointer to the command line to update
**/
EFI_STATUS
-DoHelpUpdate(
- IN OUT CHAR16 **CmdLine
+DoHelpUpdate (
+ IN OUT CHAR16 **CmdLine
)
{
- CHAR16 *CurrentParameter;
- CHAR16 *Walker;
- CHAR16 *NewCommandLine;
- EFI_STATUS Status;
- UINTN NewCmdLineSize;
+ CHAR16 *CurrentParameter;
+ CHAR16 *Walker;
+ CHAR16 *NewCommandLine;
+ EFI_STATUS Status;
+ UINTN NewCmdLineSize;
Status = EFI_SUCCESS;
- CurrentParameter = AllocateZeroPool(StrSize(*CmdLine));
+ CurrentParameter = AllocateZeroPool (StrSize (*CmdLine));
if (CurrentParameter == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
Walker = *CmdLine;
- while(Walker != NULL && *Walker != CHAR_NULL) {
- if (!EFI_ERROR(GetNextParameter(&Walker, &CurrentParameter, StrSize(*CmdLine), TRUE))) {
- if (StrStr(CurrentParameter, L"-?") == CurrentParameter) {
+ while (Walker != NULL && *Walker != CHAR_NULL) {
+ if (!EFI_ERROR (GetNextParameter (&Walker, &CurrentParameter, StrSize (*CmdLine), TRUE))) {
+ if (StrStr (CurrentParameter, L"-?") == CurrentParameter) {
CurrentParameter[0] = L' ';
CurrentParameter[1] = L' ';
- NewCmdLineSize = StrSize(L"help ") + StrSize(*CmdLine);
- NewCommandLine = AllocateZeroPool(NewCmdLineSize);
+ NewCmdLineSize = StrSize (L"help ") + StrSize (*CmdLine);
+ NewCommandLine = AllocateZeroPool (NewCmdLineSize);
if (NewCommandLine == NULL) {
Status = EFI_OUT_OF_RESOURCES;
break;
@@ -2214,16 +2347,16 @@ DoHelpUpdate( //
// We know the space is sufficient since we just calculated it.
//
- StrnCpyS(NewCommandLine, NewCmdLineSize/sizeof(CHAR16), L"help ", 5);
- StrnCatS(NewCommandLine, NewCmdLineSize/sizeof(CHAR16), *CmdLine, StrLen(*CmdLine));
- SHELL_FREE_NON_NULL(*CmdLine);
+ StrnCpyS (NewCommandLine, NewCmdLineSize/sizeof (CHAR16), L"help ", 5);
+ StrnCatS (NewCommandLine, NewCmdLineSize/sizeof (CHAR16), *CmdLine, StrLen (*CmdLine));
+ SHELL_FREE_NON_NULL (*CmdLine);
*CmdLine = NewCommandLine;
break;
}
}
}
- SHELL_FREE_NON_NULL(CurrentParameter);
+ SHELL_FREE_NON_NULL (CurrentParameter);
return (Status);
}
@@ -2234,18 +2367,22 @@ DoHelpUpdate( @param[in] ErrorCode the error code to put into lasterror.
**/
EFI_STATUS
-SetLastError(
- IN CONST SHELL_STATUS ErrorCode
+SetLastError (
+ IN CONST SHELL_STATUS ErrorCode
)
{
- CHAR16 LeString[19];
- if (sizeof(EFI_STATUS) == sizeof(UINT64)) {
- UnicodeSPrint(LeString, sizeof(LeString), L"0x%Lx", ErrorCode);
+ CHAR16 LeString[19];
+
+ if (sizeof (EFI_STATUS) == sizeof (UINT64)) {
+ UnicodeSPrint (LeString, sizeof (LeString), L"0x%Lx", ErrorCode);
} else {
- UnicodeSPrint(LeString, sizeof(LeString), L"0x%x", ErrorCode);
+ UnicodeSPrint (LeString, sizeof (LeString), L"0x%x", ErrorCode);
}
- DEBUG_CODE(InternalEfiShellSetEnv(L"debuglasterror", LeString, TRUE););
- InternalEfiShellSetEnv(L"lasterror", LeString, TRUE);
+
+ DEBUG_CODE (
+ InternalEfiShellSetEnv (L"debuglasterror", LeString, TRUE);
+ );
+ InternalEfiShellSetEnv (L"lasterror", LeString, TRUE);
return (EFI_SUCCESS);
}
@@ -2260,40 +2397,42 @@ SetLastError( @return some other error occurred
**/
EFI_STATUS
-ProcessCommandLineToFinal(
- IN OUT CHAR16 **CmdLine
+ProcessCommandLineToFinal (
+ IN OUT CHAR16 **CmdLine
)
{
- EFI_STATUS Status;
- TrimSpaces(CmdLine);
+ EFI_STATUS Status;
+
+ TrimSpaces (CmdLine);
- Status = ShellSubstituteAliases(CmdLine);
- if (EFI_ERROR(Status)) {
+ Status = ShellSubstituteAliases (CmdLine);
+ if (EFI_ERROR (Status)) {
return (Status);
}
- TrimSpaces(CmdLine);
+ TrimSpaces (CmdLine);
- Status = ShellSubstituteVariables(CmdLine);
- if (EFI_ERROR(Status)) {
+ Status = ShellSubstituteVariables (CmdLine);
+ if (EFI_ERROR (Status)) {
return (Status);
}
+
ASSERT (*CmdLine != NULL);
- TrimSpaces(CmdLine);
+ TrimSpaces (CmdLine);
//
// update for help parsing
//
- if (StrStr(*CmdLine, L"?") != NULL) {
+ if (StrStr (*CmdLine, L"?") != NULL) {
//
// This may do nothing if the ? does not indicate help.
// Save all the details for in the API below.
//
- Status = DoHelpUpdate(CmdLine);
+ Status = DoHelpUpdate (CmdLine);
}
- TrimSpaces(CmdLine);
+ TrimSpaces (CmdLine);
return (EFI_SUCCESS);
}
@@ -2312,43 +2451,43 @@ ProcessCommandLineToFinal( @retval EFI_ABORTED The command's operation was aborted.
**/
EFI_STATUS
-RunInternalCommand(
+RunInternalCommand (
IN CONST CHAR16 *CmdLine,
IN CHAR16 *FirstParameter,
IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
OUT EFI_STATUS *CommandStatus
-)
+ )
{
- EFI_STATUS Status;
- UINTN Argc;
- CHAR16 **Argv;
- SHELL_STATUS CommandReturnedStatus;
- BOOLEAN LastError;
- CHAR16 *Walker;
- CHAR16 *NewCmdLine;
+ EFI_STATUS Status;
+ UINTN Argc;
+ CHAR16 **Argv;
+ SHELL_STATUS CommandReturnedStatus;
+ BOOLEAN LastError;
+ CHAR16 *Walker;
+ CHAR16 *NewCmdLine;
NewCmdLine = AllocateCopyPool (StrSize (CmdLine), CmdLine);
if (NewCmdLine == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL ; Walker++) {
- if (*Walker == L'^' && *(Walker+1) == L'#') {
- CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0]));
+ for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL; Walker++) {
+ if ((*Walker == L'^') && (*(Walker+1) == L'#')) {
+ CopyMem (Walker, Walker+1, StrSize (Walker) - sizeof (Walker[0]));
}
}
//
// get the argc and argv updated for internal commands
//
- Status = UpdateArgcArgv(ParamProtocol, NewCmdLine, Internal_Command, &Argv, &Argc);
- if (!EFI_ERROR(Status)) {
+ Status = UpdateArgcArgv (ParamProtocol, NewCmdLine, Internal_Command, &Argv, &Argc);
+ if (!EFI_ERROR (Status)) {
//
// Run the internal command.
//
- Status = ShellCommandRunCommandHandler(FirstParameter, &CommandReturnedStatus, &LastError);
+ Status = ShellCommandRunCommandHandler (FirstParameter, &CommandReturnedStatus, &LastError);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
if (CommandStatus != NULL) {
if (CommandReturnedStatus != SHELL_SUCCESS) {
*CommandStatus = (EFI_STATUS)(CommandReturnedStatus | MAX_BIT);
@@ -2362,23 +2501,23 @@ RunInternalCommand( // some commands do not update last error.
//
if (LastError) {
- SetLastError(CommandReturnedStatus);
+ SetLastError (CommandReturnedStatus);
}
//
// Pass thru the exitcode from the app.
//
- if (ShellCommandGetExit()) {
+ if (ShellCommandGetExit ()) {
//
// An Exit was requested ("exit" command), pass its value up.
//
Status = CommandReturnedStatus;
- } else if (CommandReturnedStatus != SHELL_SUCCESS && IsScriptOnlyCommand(FirstParameter)) {
+ } else if ((CommandReturnedStatus != SHELL_SUCCESS) && IsScriptOnlyCommand (FirstParameter)) {
//
// Always abort when a script only command fails for any reason
//
Status = EFI_ABORTED;
- } else if (ShellCommandGetCurrentScriptFile() != NULL && CommandReturnedStatus == SHELL_ABORTED) {
+ } else if ((ShellCommandGetCurrentScriptFile () != NULL) && (CommandReturnedStatus == SHELL_ABORTED)) {
//
// Abort when in a script and a command aborted
//
@@ -2391,7 +2530,7 @@ RunInternalCommand( // This is guaranteed to be called after UpdateArgcArgv no matter what else happened.
// This is safe even if the update API failed. In this case, it may be a no-op.
//
- RestoreArgcArgv(ParamProtocol, &Argv, &Argc);
+ RestoreArgcArgv (ParamProtocol, &Argv, &Argc);
//
// If a script is running and the command is not a script only command, then
@@ -2400,10 +2539,11 @@ RunInternalCommand( // Script only commands have to be able halt the script since the script will
// not operate if they are failing.
//
- if ( ShellCommandGetCurrentScriptFile() != NULL
- && !IsScriptOnlyCommand(FirstParameter)
- && Status != EFI_ABORTED
- ) {
+ if ( (ShellCommandGetCurrentScriptFile () != NULL)
+ && !IsScriptOnlyCommand (FirstParameter)
+ && (Status != EFI_ABORTED)
+ )
+ {
Status = EFI_SUCCESS;
}
@@ -2424,13 +2564,13 @@ RunInternalCommand( @retval EFI_ABORTED The command's operation was aborted.
**/
EFI_STATUS
-RunCommandOrFile(
+RunCommandOrFile (
IN SHELL_OPERATION_TYPES Type,
IN CONST CHAR16 *CmdLine,
IN CHAR16 *FirstParameter,
IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
OUT EFI_STATUS *CommandStatus
-)
+ )
{
EFI_STATUS Status;
EFI_STATUS StartStatus;
@@ -2439,24 +2579,24 @@ RunCommandOrFile( EFI_DEVICE_PATH_PROTOCOL *DevPath;
SHELL_STATUS CalleeExitStatus;
- Status = EFI_SUCCESS;
- CommandWithPath = NULL;
- DevPath = NULL;
- CalleeExitStatus = SHELL_INVALID_PARAMETER;
+ Status = EFI_SUCCESS;
+ CommandWithPath = NULL;
+ DevPath = NULL;
+ CalleeExitStatus = SHELL_INVALID_PARAMETER;
switch (Type) {
- case Internal_Command:
- Status = RunInternalCommand(CmdLine, FirstParameter, ParamProtocol, CommandStatus);
+ case Internal_Command:
+ Status = RunInternalCommand (CmdLine, FirstParameter, ParamProtocol, CommandStatus);
break;
- case Script_File_Name:
- case Efi_Application:
+ case Script_File_Name:
+ case Efi_Application:
//
// Process a fully qualified path
//
- if (StrStr(FirstParameter, L":") != NULL) {
+ if (StrStr (FirstParameter, L":") != NULL) {
ASSERT (CommandWithPath == NULL);
- if (ShellIsFile(FirstParameter) == EFI_SUCCESS) {
- CommandWithPath = StrnCatGrow(&CommandWithPath, NULL, FirstParameter, 0);
+ if (ShellIsFile (FirstParameter) == EFI_SUCCESS) {
+ CommandWithPath = StrnCatGrow (&CommandWithPath, NULL, FirstParameter, 0);
}
}
@@ -2464,37 +2604,39 @@ RunCommandOrFile( // Process a relative path and also check in the path environment variable
//
if (CommandWithPath == NULL) {
- CommandWithPath = ShellFindFilePathEx(FirstParameter, mExecutableExtensions);
+ CommandWithPath = ShellFindFilePathEx (FirstParameter, mExecutableExtensions);
}
//
// This should be impossible now.
//
- ASSERT(CommandWithPath != NULL);
+ ASSERT (CommandWithPath != NULL);
//
// Make sure that path is not just a directory (or not found)
//
- if (!EFI_ERROR(ShellIsDirectory(CommandWithPath))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
- SetLastError(SHELL_NOT_FOUND);
+ if (!EFI_ERROR (ShellIsDirectory (CommandWithPath))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
+ SetLastError (SHELL_NOT_FOUND);
}
+
switch (Type) {
- case Script_File_Name:
- FullCommandWithPath = FullyQualifyPath(CommandWithPath);
+ case Script_File_Name:
+ FullCommandWithPath = FullyQualifyPath (CommandWithPath);
if (FullCommandWithPath == NULL) {
Status = RunScriptFile (CommandWithPath, NULL, CmdLine, ParamProtocol);
} else {
Status = RunScriptFile (FullCommandWithPath, NULL, CmdLine, ParamProtocol);
- FreePool(FullCommandWithPath);
+ FreePool (FullCommandWithPath);
}
+
break;
- case Efi_Application:
+ case Efi_Application:
//
// Get the device path of the application image
//
- DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath(CommandWithPath);
- if (DevPath == NULL){
+ DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath (CommandWithPath);
+ if (DevPath == NULL) {
Status = EFI_OUT_OF_RESOURCES;
break;
}
@@ -2502,20 +2644,20 @@ RunCommandOrFile( //
// Execute the device path
//
- Status = InternalShellExecuteDevicePath(
- &gImageHandle,
- DevPath,
- CmdLine,
- NULL,
- &StartStatus
- );
-
- SHELL_FREE_NON_NULL(DevPath);
-
- if(EFI_ERROR (Status)) {
- CalleeExitStatus = (SHELL_STATUS) (Status & (~MAX_BIT));
+ Status = InternalShellExecuteDevicePath (
+ &gImageHandle,
+ DevPath,
+ CmdLine,
+ NULL,
+ &StartStatus
+ );
+
+ SHELL_FREE_NON_NULL (DevPath);
+
+ if (EFI_ERROR (Status)) {
+ CalleeExitStatus = (SHELL_STATUS)(Status & (~MAX_BIT));
} else {
- CalleeExitStatus = (SHELL_STATUS) StartStatus;
+ CalleeExitStatus = (SHELL_STATUS)StartStatus;
}
if (CommandStatus != NULL) {
@@ -2526,7 +2668,7 @@ RunCommandOrFile( // Update last error status.
//
// Status is an EFI_STATUS. Clear top bit to convert to SHELL_STATUS
- SetLastError(CalleeExitStatus);
+ SetLastError (CalleeExitStatus);
break;
default:
//
@@ -2534,6 +2676,7 @@ RunCommandOrFile( //
break;
}
+
break;
default:
//
@@ -2542,7 +2685,7 @@ RunCommandOrFile( break;
}
- SHELL_FREE_NON_NULL(CommandWithPath);
+ SHELL_FREE_NON_NULL (CommandWithPath);
return (Status);
}
@@ -2560,51 +2703,51 @@ RunCommandOrFile( @retval EFI_ABORTED The command's operation was aborted.
**/
EFI_STATUS
-SetupAndRunCommandOrFile(
+SetupAndRunCommandOrFile (
IN SHELL_OPERATION_TYPES Type,
IN CHAR16 *CmdLine,
IN CHAR16 *FirstParameter,
IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol,
OUT EFI_STATUS *CommandStatus
-)
+ )
{
- EFI_STATUS Status;
- SHELL_FILE_HANDLE OriginalStdIn;
- SHELL_FILE_HANDLE OriginalStdOut;
- SHELL_FILE_HANDLE OriginalStdErr;
- SYSTEM_TABLE_INFO OriginalSystemTableInfo;
- CONST SCRIPT_FILE *ConstScriptFile;
+ EFI_STATUS Status;
+ SHELL_FILE_HANDLE OriginalStdIn;
+ SHELL_FILE_HANDLE OriginalStdOut;
+ SHELL_FILE_HANDLE OriginalStdErr;
+ SYSTEM_TABLE_INFO OriginalSystemTableInfo;
+ CONST SCRIPT_FILE *ConstScriptFile;
//
// Update the StdIn, StdOut, and StdErr for redirection to environment variables, files, etc... unicode and ASCII
//
- Status = UpdateStdInStdOutStdErr(ParamProtocol, CmdLine, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo);
+ Status = UpdateStdInStdOutStdErr (ParamProtocol, CmdLine, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo);
//
// The StdIn, StdOut, and StdErr are set up.
// Now run the command, script, or application
//
- if (!EFI_ERROR(Status)) {
- TrimSpaces(&CmdLine);
- Status = RunCommandOrFile(Type, CmdLine, FirstParameter, ParamProtocol, CommandStatus);
+ if (!EFI_ERROR (Status)) {
+ TrimSpaces (&CmdLine);
+ Status = RunCommandOrFile (Type, CmdLine, FirstParameter, ParamProtocol, CommandStatus);
}
//
// Now print errors
//
- if (EFI_ERROR(Status)) {
- ConstScriptFile = ShellCommandGetCurrentScriptFile();
- if (ConstScriptFile == NULL || ConstScriptFile->CurrentCommand == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID*)(Status));
+ if (EFI_ERROR (Status)) {
+ ConstScriptFile = ShellCommandGetCurrentScriptFile ();
+ if ((ConstScriptFile == NULL) || (ConstScriptFile->CurrentCommand == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID *)(Status));
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), ConstScriptFile->CurrentCommand->Line);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID *)(Status), ConstScriptFile->CurrentCommand->Line);
}
}
//
// put back the original StdIn, StdOut, and StdErr
//
- RestoreStdInStdOutStdErr(ParamProtocol, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo);
+ RestoreStdInStdOutStdErr (ParamProtocol, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo);
return (Status);
}
@@ -2622,32 +2765,32 @@ SetupAndRunCommandOrFile( @retval EFI_ABORTED The command's operation was aborted.
**/
EFI_STATUS
-RunShellCommand(
- IN CONST CHAR16 *CmdLine,
- OUT EFI_STATUS *CommandStatus
+RunShellCommand (
+ IN CONST CHAR16 *CmdLine,
+ OUT EFI_STATUS *CommandStatus
)
{
- EFI_STATUS Status;
- CHAR16 *CleanOriginal;
- CHAR16 *FirstParameter;
- CHAR16 *TempWalker;
- SHELL_OPERATION_TYPES Type;
- CONST CHAR16 *CurDir;
-
- ASSERT(CmdLine != NULL);
- if (StrLen(CmdLine) == 0) {
+ EFI_STATUS Status;
+ CHAR16 *CleanOriginal;
+ CHAR16 *FirstParameter;
+ CHAR16 *TempWalker;
+ SHELL_OPERATION_TYPES Type;
+ CONST CHAR16 *CurDir;
+
+ ASSERT (CmdLine != NULL);
+ if (StrLen (CmdLine) == 0) {
return (EFI_SUCCESS);
}
- Status = EFI_SUCCESS;
- CleanOriginal = NULL;
+ Status = EFI_SUCCESS;
+ CleanOriginal = NULL;
- CleanOriginal = StrnCatGrow(&CleanOriginal, NULL, CmdLine, 0);
+ CleanOriginal = StrnCatGrow (&CleanOriginal, NULL, CmdLine, 0);
if (CleanOriginal == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- TrimSpaces(&CleanOriginal);
+ TrimSpaces (&CleanOriginal);
//
// NULL out comments (leveraged from RunScriptFileHandle() ).
@@ -2665,71 +2808,73 @@ RunShellCommand( }
}
- TrimSpaces(&CleanOriginal);
+ TrimSpaces (&CleanOriginal);
//
// Handle case that passed in command line is just 1 or more " " characters.
//
if (StrLen (CleanOriginal) == 0) {
- SHELL_FREE_NON_NULL(CleanOriginal);
+ SHELL_FREE_NON_NULL (CleanOriginal);
return (EFI_SUCCESS);
}
- Status = ProcessCommandLineToFinal(&CleanOriginal);
- if (EFI_ERROR(Status)) {
- SHELL_FREE_NON_NULL(CleanOriginal);
+ Status = ProcessCommandLineToFinal (&CleanOriginal);
+ if (EFI_ERROR (Status)) {
+ SHELL_FREE_NON_NULL (CleanOriginal);
return (Status);
}
//
// We don't do normal processing with a split command line (output from one command input to another)
//
- if (ContainsSplit(CleanOriginal)) {
- Status = ProcessNewSplitCommandLine(CleanOriginal);
- SHELL_FREE_NON_NULL(CleanOriginal);
+ if (ContainsSplit (CleanOriginal)) {
+ Status = ProcessNewSplitCommandLine (CleanOriginal);
+ SHELL_FREE_NON_NULL (CleanOriginal);
return (Status);
}
//
// We need the first parameter information so we can determine the operation type
//
- FirstParameter = AllocateZeroPool(StrSize(CleanOriginal));
+ FirstParameter = AllocateZeroPool (StrSize (CleanOriginal));
if (FirstParameter == NULL) {
- SHELL_FREE_NON_NULL(CleanOriginal);
+ SHELL_FREE_NON_NULL (CleanOriginal);
return (EFI_OUT_OF_RESOURCES);
}
+
TempWalker = CleanOriginal;
- if (!EFI_ERROR(GetNextParameter(&TempWalker, &FirstParameter, StrSize(CleanOriginal), TRUE))) {
+ if (!EFI_ERROR (GetNextParameter (&TempWalker, &FirstParameter, StrSize (CleanOriginal), TRUE))) {
//
// Depending on the first parameter we change the behavior
//
- switch (Type = GetOperationType(FirstParameter)) {
- case File_Sys_Change:
+ switch (Type = GetOperationType (FirstParameter)) {
+ case File_Sys_Change:
Status = ChangeMappedDrive (FirstParameter);
break;
- case Internal_Command:
- case Script_File_Name:
- case Efi_Application:
- Status = SetupAndRunCommandOrFile(Type, CleanOriginal, FirstParameter, ShellInfoObject.NewShellParametersProtocol, CommandStatus);
+ case Internal_Command:
+ case Script_File_Name:
+ case Efi_Application:
+ Status = SetupAndRunCommandOrFile (Type, CleanOriginal, FirstParameter, ShellInfoObject.NewShellParametersProtocol, CommandStatus);
break;
default:
//
// Whatever was typed, it was invalid.
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
- SetLastError(SHELL_NOT_FOUND);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
+ SetLastError (SHELL_NOT_FOUND);
break;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
- SetLastError(SHELL_NOT_FOUND);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
+ SetLastError (SHELL_NOT_FOUND);
}
+
//
// Check whether the current file system still exists. If not exist, we need update "cwd" and gShellCurMapping.
//
CurDir = EfiShellGetCurDir (NULL);
if (CurDir != NULL) {
- if (EFI_ERROR(ShellFileExists (CurDir))) {
+ if (EFI_ERROR (ShellFileExists (CurDir))) {
//
// EfiShellSetCurDir() cannot set current directory to NULL.
// EfiShellSetEnv() is not allowed to set the "cwd" variable.
@@ -2740,8 +2885,8 @@ RunShellCommand( }
}
- SHELL_FREE_NON_NULL(CleanOriginal);
- SHELL_FREE_NON_NULL(FirstParameter);
+ SHELL_FREE_NON_NULL (CleanOriginal);
+ SHELL_FREE_NON_NULL (FirstParameter);
return (Status);
}
@@ -2758,11 +2903,11 @@ RunShellCommand( @retval EFI_ABORTED The command's operation was aborted.
**/
EFI_STATUS
-RunCommand(
- IN CONST CHAR16 *CmdLine
+RunCommand (
+ IN CONST CHAR16 *CmdLine
)
{
- return (RunShellCommand(CmdLine, NULL));
+ return (RunShellCommand (CmdLine, NULL));
}
/**
@@ -2779,28 +2924,28 @@ RunScriptFileHandle ( IN CONST CHAR16 *Name
)
{
- EFI_STATUS Status;
- SCRIPT_FILE *NewScriptFile;
- UINTN LoopVar;
- UINTN PrintBuffSize;
- CHAR16 *CommandLine;
- CHAR16 *CommandLine2;
- CHAR16 *CommandLine3;
- SCRIPT_COMMAND_LIST *LastCommand;
- BOOLEAN Ascii;
- BOOLEAN PreScriptEchoState;
- BOOLEAN PreCommandEchoState;
- CONST CHAR16 *CurDir;
- UINTN LineCount;
- CHAR16 LeString[50];
- LIST_ENTRY OldBufferList;
-
- ASSERT(!ShellCommandGetScriptExit());
-
- PreScriptEchoState = ShellCommandGetEchoState();
- PrintBuffSize = PcdGet16(PcdShellPrintBufferSize);
-
- NewScriptFile = (SCRIPT_FILE*)AllocateZeroPool(sizeof(SCRIPT_FILE));
+ EFI_STATUS Status;
+ SCRIPT_FILE *NewScriptFile;
+ UINTN LoopVar;
+ UINTN PrintBuffSize;
+ CHAR16 *CommandLine;
+ CHAR16 *CommandLine2;
+ CHAR16 *CommandLine3;
+ SCRIPT_COMMAND_LIST *LastCommand;
+ BOOLEAN Ascii;
+ BOOLEAN PreScriptEchoState;
+ BOOLEAN PreCommandEchoState;
+ CONST CHAR16 *CurDir;
+ UINTN LineCount;
+ CHAR16 LeString[50];
+ LIST_ENTRY OldBufferList;
+
+ ASSERT (!ShellCommandGetScriptExit ());
+
+ PreScriptEchoState = ShellCommandGetEchoState ();
+ PrintBuffSize = PcdGet16 (PcdShellPrintBufferSize);
+
+ NewScriptFile = (SCRIPT_FILE *)AllocateZeroPool (sizeof (SCRIPT_FILE));
if (NewScriptFile == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
@@ -2808,10 +2953,10 @@ RunScriptFileHandle ( //
// Set up the name
//
- ASSERT(NewScriptFile->ScriptName == NULL);
- NewScriptFile->ScriptName = StrnCatGrow(&NewScriptFile->ScriptName, NULL, Name, 0);
+ ASSERT (NewScriptFile->ScriptName == NULL);
+ NewScriptFile->ScriptName = StrnCatGrow (&NewScriptFile->ScriptName, NULL, Name, 0);
if (NewScriptFile->ScriptName == NULL) {
- DeleteScriptFileStruct(NewScriptFile);
+ DeleteScriptFileStruct (NewScriptFile);
return (EFI_OUT_OF_RESOURCES);
}
@@ -2820,21 +2965,22 @@ RunScriptFileHandle ( //
NewScriptFile->Argc = ShellInfoObject.NewShellParametersProtocol->Argc;
if (NewScriptFile->Argc != 0) {
- NewScriptFile->Argv = (CHAR16**)AllocateZeroPool(NewScriptFile->Argc * sizeof(CHAR16*));
+ NewScriptFile->Argv = (CHAR16 **)AllocateZeroPool (NewScriptFile->Argc * sizeof (CHAR16 *));
if (NewScriptFile->Argv == NULL) {
- DeleteScriptFileStruct(NewScriptFile);
+ DeleteScriptFileStruct (NewScriptFile);
return (EFI_OUT_OF_RESOURCES);
}
+
//
// Put the full path of the script file into Argv[0] as required by section
// 3.6.2 of version 2.2 of the shell specification.
//
- NewScriptFile->Argv[0] = StrnCatGrow(&NewScriptFile->Argv[0], NULL, NewScriptFile->ScriptName, 0);
- for (LoopVar = 1 ; LoopVar < 10 && LoopVar < NewScriptFile->Argc; LoopVar++) {
- ASSERT(NewScriptFile->Argv[LoopVar] == NULL);
- NewScriptFile->Argv[LoopVar] = StrnCatGrow(&NewScriptFile->Argv[LoopVar], NULL, ShellInfoObject.NewShellParametersProtocol->Argv[LoopVar], 0);
+ NewScriptFile->Argv[0] = StrnCatGrow (&NewScriptFile->Argv[0], NULL, NewScriptFile->ScriptName, 0);
+ for (LoopVar = 1; LoopVar < 10 && LoopVar < NewScriptFile->Argc; LoopVar++) {
+ ASSERT (NewScriptFile->Argv[LoopVar] == NULL);
+ NewScriptFile->Argv[LoopVar] = StrnCatGrow (&NewScriptFile->Argv[LoopVar], NULL, ShellInfoObject.NewShellParametersProtocol->Argv[LoopVar], 0);
if (NewScriptFile->Argv[LoopVar] == NULL) {
- DeleteScriptFileStruct(NewScriptFile);
+ DeleteScriptFileStruct (NewScriptFile);
return (EFI_OUT_OF_RESOURCES);
}
}
@@ -2842,24 +2988,25 @@ RunScriptFileHandle ( NewScriptFile->Argv = NULL;
}
- InitializeListHead(&NewScriptFile->CommandList);
- InitializeListHead(&NewScriptFile->SubstList);
+ InitializeListHead (&NewScriptFile->CommandList);
+ InitializeListHead (&NewScriptFile->SubstList);
//
// Now build the list of all script commands.
//
LineCount = 0;
- while(!ShellFileHandleEof(Handle)) {
- CommandLine = ShellFileHandleReturnLine(Handle, &Ascii);
+ while (!ShellFileHandleEof (Handle)) {
+ CommandLine = ShellFileHandleReturnLine (Handle, &Ascii);
LineCount++;
- if (CommandLine == NULL || StrLen(CommandLine) == 0 || CommandLine[0] == '#') {
- SHELL_FREE_NON_NULL(CommandLine);
+ if ((CommandLine == NULL) || (StrLen (CommandLine) == 0) || (CommandLine[0] == '#')) {
+ SHELL_FREE_NON_NULL (CommandLine);
continue;
}
- NewScriptFile->CurrentCommand = AllocateZeroPool(sizeof(SCRIPT_COMMAND_LIST));
+
+ NewScriptFile->CurrentCommand = AllocateZeroPool (sizeof (SCRIPT_COMMAND_LIST));
if (NewScriptFile->CurrentCommand == NULL) {
- SHELL_FREE_NON_NULL(CommandLine);
- DeleteScriptFileStruct(NewScriptFile);
+ SHELL_FREE_NON_NULL (CommandLine);
+ DeleteScriptFileStruct (NewScriptFile);
return (EFI_OUT_OF_RESOURCES);
}
@@ -2867,7 +3014,7 @@ RunScriptFileHandle ( NewScriptFile->CurrentCommand->Data = NULL;
NewScriptFile->CurrentCommand->Line = LineCount;
- InsertTailList(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link);
+ InsertTailList (&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link);
}
//
@@ -2878,38 +3025,41 @@ RunScriptFileHandle ( //
// Now enumerate through the commands and run each one.
//
- CommandLine = AllocateZeroPool(PrintBuffSize);
+ CommandLine = AllocateZeroPool (PrintBuffSize);
if (CommandLine == NULL) {
- DeleteScriptFileStruct(NewScriptFile);
+ DeleteScriptFileStruct (NewScriptFile);
return (EFI_OUT_OF_RESOURCES);
}
- CommandLine2 = AllocateZeroPool(PrintBuffSize);
+
+ CommandLine2 = AllocateZeroPool (PrintBuffSize);
if (CommandLine2 == NULL) {
- FreePool(CommandLine);
- DeleteScriptFileStruct(NewScriptFile);
+ FreePool (CommandLine);
+ DeleteScriptFileStruct (NewScriptFile);
return (EFI_OUT_OF_RESOURCES);
}
- for ( NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode(&NewScriptFile->CommandList)
- ; !IsNull(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link)
- ; // conditional increment in the body of the loop
- ){
- ASSERT(CommandLine2 != NULL);
- StrnCpyS( CommandLine2,
- PrintBuffSize/sizeof(CHAR16),
- NewScriptFile->CurrentCommand->Cl,
- PrintBuffSize/sizeof(CHAR16) - 1
- );
+ for ( NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode (&NewScriptFile->CommandList)
+ ; !IsNull (&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link)
+ ; // conditional increment in the body of the loop
+ )
+ {
+ ASSERT (CommandLine2 != NULL);
+ StrnCpyS (
+ CommandLine2,
+ PrintBuffSize/sizeof (CHAR16),
+ NewScriptFile->CurrentCommand->Cl,
+ PrintBuffSize/sizeof (CHAR16) - 1
+ );
- SaveBufferList(&OldBufferList);
+ SaveBufferList (&OldBufferList);
//
// NULL out comments
//
- for (CommandLine3 = CommandLine2 ; CommandLine3 != NULL && *CommandLine3 != CHAR_NULL ; CommandLine3++) {
+ for (CommandLine3 = CommandLine2; CommandLine3 != NULL && *CommandLine3 != CHAR_NULL; CommandLine3++) {
if (*CommandLine3 == L'^') {
if ( *(CommandLine3+1) == L':') {
- CopyMem(CommandLine3, CommandLine3+1, StrSize(CommandLine3) - sizeof(CommandLine3[0]));
+ CopyMem (CommandLine3, CommandLine3+1, StrSize (CommandLine3) - sizeof (CommandLine3[0]));
} else if (*(CommandLine3+1) == L'#') {
CommandLine3++;
}
@@ -2918,15 +3068,16 @@ RunScriptFileHandle ( }
}
- if (CommandLine2 != NULL && StrLen(CommandLine2) >= 1) {
+ if ((CommandLine2 != NULL) && (StrLen (CommandLine2) >= 1)) {
//
// Due to variability in starting the find and replace action we need to have both buffers the same.
//
- StrnCpyS( CommandLine,
- PrintBuffSize/sizeof(CHAR16),
- CommandLine2,
- PrintBuffSize/sizeof(CHAR16) - 1
- );
+ StrnCpyS (
+ CommandLine,
+ PrintBuffSize/sizeof (CHAR16),
+ CommandLine2,
+ PrintBuffSize/sizeof (CHAR16) - 1
+ );
//
// Remove the %0 to %9 from the command line (if we have some arguments)
@@ -2934,154 +3085,167 @@ RunScriptFileHandle ( if (NewScriptFile->Argv != NULL) {
switch (NewScriptFile->Argc) {
default:
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%9", NewScriptFile->Argv[9], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%9", NewScriptFile->Argv[9], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 9:
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%8", NewScriptFile->Argv[8], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%8", NewScriptFile->Argv[8], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 8:
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%7", NewScriptFile->Argv[7], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%7", NewScriptFile->Argv[7], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 7:
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%6", NewScriptFile->Argv[6], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%6", NewScriptFile->Argv[6], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 6:
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%5", NewScriptFile->Argv[5], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%5", NewScriptFile->Argv[5], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 5:
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%4", NewScriptFile->Argv[4], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%4", NewScriptFile->Argv[4], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 4:
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%3", NewScriptFile->Argv[3], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%3", NewScriptFile->Argv[3], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 3:
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%2", NewScriptFile->Argv[2], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%2", NewScriptFile->Argv[2], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 2:
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%1", NewScriptFile->Argv[1], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%1", NewScriptFile->Argv[1], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
case 1:
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%0", NewScriptFile->Argv[0], FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%0", NewScriptFile->Argv[0], FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
break;
case 0:
break;
}
}
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%1", L"\"\"", FALSE, FALSE);
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%2", L"\"\"", FALSE, FALSE);
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%3", L"\"\"", FALSE, FALSE);
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%4", L"\"\"", FALSE, FALSE);
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%5", L"\"\"", FALSE, FALSE);
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%6", L"\"\"", FALSE, FALSE);
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%7", L"\"\"", FALSE, FALSE);
- Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%8", L"\"\"", FALSE, FALSE);
- Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%9", L"\"\"", FALSE, FALSE);
-
- StrnCpyS( CommandLine2,
- PrintBuffSize/sizeof(CHAR16),
- CommandLine,
- PrintBuffSize/sizeof(CHAR16) - 1
- );
+
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%1", L"\"\"", FALSE, FALSE);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%2", L"\"\"", FALSE, FALSE);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%3", L"\"\"", FALSE, FALSE);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%4", L"\"\"", FALSE, FALSE);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%5", L"\"\"", FALSE, FALSE);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%6", L"\"\"", FALSE, FALSE);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%7", L"\"\"", FALSE, FALSE);
+ Status = ShellCopySearchAndReplace (CommandLine, CommandLine2, PrintBuffSize, L"%8", L"\"\"", FALSE, FALSE);
+ Status = ShellCopySearchAndReplace (CommandLine2, CommandLine, PrintBuffSize, L"%9", L"\"\"", FALSE, FALSE);
+
+ StrnCpyS (
+ CommandLine2,
+ PrintBuffSize/sizeof (CHAR16),
+ CommandLine,
+ PrintBuffSize/sizeof (CHAR16) - 1
+ );
LastCommand = NewScriptFile->CurrentCommand;
- for (CommandLine3 = CommandLine2 ; CommandLine3[0] == L' ' ; CommandLine3++);
+ for (CommandLine3 = CommandLine2; CommandLine3[0] == L' '; CommandLine3++) {
+ }
- if (CommandLine3 != NULL && CommandLine3[0] == L':' ) {
+ if ((CommandLine3 != NULL) && (CommandLine3[0] == L':')) {
//
// This line is a goto target / label
//
} else {
- if (CommandLine3 != NULL && StrLen(CommandLine3) > 0) {
+ if ((CommandLine3 != NULL) && (StrLen (CommandLine3) > 0)) {
if (CommandLine3[0] == L'@') {
//
// We need to save the current echo state
// and disable echo for just this command.
//
- PreCommandEchoState = ShellCommandGetEchoState();
- ShellCommandSetEchoState(FALSE);
- Status = RunCommand(CommandLine3+1);
+ PreCommandEchoState = ShellCommandGetEchoState ();
+ ShellCommandSetEchoState (FALSE);
+ Status = RunCommand (CommandLine3+1);
//
// If command was "@echo -off" or "@echo -on" then don't restore echo state
//
- if (StrCmp (L"@echo -off", CommandLine3) != 0 &&
- StrCmp (L"@echo -on", CommandLine3) != 0) {
+ if ((StrCmp (L"@echo -off", CommandLine3) != 0) &&
+ (StrCmp (L"@echo -on", CommandLine3) != 0))
+ {
//
// Now restore the pre-'@' echo state.
//
- ShellCommandSetEchoState(PreCommandEchoState);
+ ShellCommandSetEchoState (PreCommandEchoState);
}
} else {
- if (ShellCommandGetEchoState()) {
- CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd");
- if (CurDir != NULL && StrLen(CurDir) > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_CURDIR), ShellInfoObject.HiiHandle, CurDir);
+ if (ShellCommandGetEchoState ()) {
+ CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv (L"cwd");
+ if ((CurDir != NULL) && (StrLen (CurDir) > 1)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_CURDIR), ShellInfoObject.HiiHandle, CurDir);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_SHELL), ShellInfoObject.HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_SHELL), ShellInfoObject.HiiHandle);
}
- ShellPrintEx(-1, -1, L"%s\r\n", CommandLine2);
+
+ ShellPrintEx (-1, -1, L"%s\r\n", CommandLine2);
}
- Status = RunCommand(CommandLine3);
+
+ Status = RunCommand (CommandLine3);
}
}
- if (ShellCommandGetScriptExit()) {
+ if (ShellCommandGetScriptExit ()) {
//
// ShellCommandGetExitCode() always returns a UINT64
//
- UnicodeSPrint(LeString, sizeof(LeString), L"0x%Lx", ShellCommandGetExitCode());
- DEBUG_CODE(InternalEfiShellSetEnv(L"debuglasterror", LeString, TRUE););
- InternalEfiShellSetEnv(L"lasterror", LeString, TRUE);
+ UnicodeSPrint (LeString, sizeof (LeString), L"0x%Lx", ShellCommandGetExitCode ());
+ DEBUG_CODE (
+ InternalEfiShellSetEnv (L"debuglasterror", LeString, TRUE);
+ );
+ InternalEfiShellSetEnv (L"lasterror", LeString, TRUE);
- ShellCommandRegisterExit(FALSE, 0);
+ ShellCommandRegisterExit (FALSE, 0);
Status = EFI_SUCCESS;
- RestoreBufferList(&OldBufferList);
+ RestoreBufferList (&OldBufferList);
break;
}
- if (ShellGetExecutionBreakFlag()) {
- RestoreBufferList(&OldBufferList);
+
+ if (ShellGetExecutionBreakFlag ()) {
+ RestoreBufferList (&OldBufferList);
break;
}
- if (EFI_ERROR(Status)) {
- RestoreBufferList(&OldBufferList);
+
+ if (EFI_ERROR (Status)) {
+ RestoreBufferList (&OldBufferList);
break;
}
- if (ShellCommandGetExit()) {
- RestoreBufferList(&OldBufferList);
+
+ if (ShellCommandGetExit ()) {
+ RestoreBufferList (&OldBufferList);
break;
}
}
+
//
// If that commend did not update the CurrentCommand then we need to advance it...
//
if (LastCommand == NewScriptFile->CurrentCommand) {
- NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link);
- if (!IsNull(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link)) {
+ NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode (&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link);
+ if (!IsNull (&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link)) {
NewScriptFile->CurrentCommand->Reset = TRUE;
}
}
} else {
- NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link);
- if (!IsNull(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link)) {
+ NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode (&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link);
+ if (!IsNull (&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link)) {
NewScriptFile->CurrentCommand->Reset = TRUE;
}
}
- RestoreBufferList(&OldBufferList);
- }
+ RestoreBufferList (&OldBufferList);
+ }
- FreePool(CommandLine);
- FreePool(CommandLine2);
+ FreePool (CommandLine);
+ FreePool (CommandLine2);
ShellCommandSetNewScript (NULL);
//
// Only if this was the last script reset the state.
//
- if (ShellCommandGetCurrentScriptFile()==NULL) {
- ShellCommandSetEchoState(PreScriptEchoState);
+ if (ShellCommandGetCurrentScriptFile () == NULL) {
+ ShellCommandSetEchoState (PreScriptEchoState);
}
+
return (EFI_SUCCESS);
}
@@ -3103,39 +3267,38 @@ RunScriptFile ( IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol
)
{
- EFI_STATUS Status;
- SHELL_FILE_HANDLE FileHandle;
- UINTN Argc;
- CHAR16 **Argv;
+ EFI_STATUS Status;
+ SHELL_FILE_HANDLE FileHandle;
+ UINTN Argc;
+ CHAR16 **Argv;
- if (ShellIsFile(ScriptPath) != EFI_SUCCESS) {
+ if (ShellIsFile (ScriptPath) != EFI_SUCCESS) {
return (EFI_INVALID_PARAMETER);
}
//
// get the argc and argv updated for scripts
//
- Status = UpdateArgcArgv(ParamProtocol, CmdLine, Script_File_Name, &Argv, &Argc);
- if (!EFI_ERROR(Status)) {
-
+ Status = UpdateArgcArgv (ParamProtocol, CmdLine, Script_File_Name, &Argv, &Argc);
+ if (!EFI_ERROR (Status)) {
if (Handle == NULL) {
//
// open the file
//
- Status = ShellOpenFileByName(ScriptPath, &FileHandle, EFI_FILE_MODE_READ, 0);
- if (!EFI_ERROR(Status)) {
+ Status = ShellOpenFileByName (ScriptPath, &FileHandle, EFI_FILE_MODE_READ, 0);
+ if (!EFI_ERROR (Status)) {
//
// run it
//
- Status = RunScriptFileHandle(FileHandle, ScriptPath);
+ Status = RunScriptFileHandle (FileHandle, ScriptPath);
//
// now close the file
//
- ShellCloseFile(&FileHandle);
+ ShellCloseFile (&FileHandle);
}
} else {
- Status = RunScriptFileHandle(Handle, ScriptPath);
+ Status = RunScriptFileHandle (Handle, ScriptPath);
}
}
@@ -3143,7 +3306,7 @@ RunScriptFile ( // This is guaranteed to be called after UpdateArgcArgv no matter what else happened.
// This is safe even if the update API failed. In this case, it may be a no-op.
//
- RestoreArgcArgv(ParamProtocol, &Argv, &Argc);
+ RestoreArgcArgv (ParamProtocol, &Argv, &Argc);
return (Status);
}
@@ -3158,26 +3321,28 @@ 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(
- IN CONST CHAR16 *String,
- IN CONST CHAR16 *CharacterList,
- IN CONST CHAR16 EscapeCharacter
+CONST CHAR16 *
+FindFirstCharacter (
+ IN CONST CHAR16 *String,
+ IN CONST CHAR16 *CharacterList,
+ IN CONST CHAR16 EscapeCharacter
)
{
- UINT32 WalkChar;
- UINT32 WalkStr;
+ UINT32 WalkChar;
+ UINT32 WalkStr;
- for (WalkStr = 0; WalkStr < StrLen(String); WalkStr++) {
+ for (WalkStr = 0; WalkStr < StrLen (String); WalkStr++) {
if (String[WalkStr] == EscapeCharacter) {
WalkStr++;
continue;
}
- for (WalkChar = 0; WalkChar < StrLen(CharacterList); WalkChar++) {
+
+ for (WalkChar = 0; WalkChar < StrLen (CharacterList); WalkChar++) {
if (String[WalkStr] == CharacterList[WalkChar]) {
return (&String[WalkStr]);
}
}
}
- return (String + StrLen(String));
+
+ return (String + StrLen (String));
}
diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h index e6eb150f57..89b4ac6b02 100644 --- a/ShellPkg/Application/Shell/Shell.h +++ b/ShellPkg/Application/Shell/Shell.h @@ -51,75 +51,75 @@ #include "ConsoleWrappers.h"
#include "FileHandleWrappers.h"
-extern CONST CHAR16 mNoNestingEnvVarName[];
-extern CONST CHAR16 mNoNestingTrue[];
-extern CONST CHAR16 mNoNestingFalse[];
+extern CONST CHAR16 mNoNestingEnvVarName[];
+extern CONST CHAR16 mNoNestingTrue[];
+extern CONST CHAR16 mNoNestingFalse[];
typedef struct {
- LIST_ENTRY Link; ///< Standard linked list handler.
- SHELL_FILE_HANDLE SplitStdOut; ///< ConsoleOut for use in the split.
- SHELL_FILE_HANDLE SplitStdIn; ///< ConsoleIn for use in the split.
+ LIST_ENTRY Link; ///< Standard linked list handler.
+ SHELL_FILE_HANDLE SplitStdOut; ///< ConsoleOut for use in the split.
+ SHELL_FILE_HANDLE SplitStdIn; ///< ConsoleIn for use in the split.
} 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 {
- SHELL_BITS Bits;
- UINT16 AllBits;
+ SHELL_BITS Bits;
+ UINT16 AllBits;
} SHELL_BIT_UNION;
typedef struct {
- SHELL_BIT_UNION BitUnion;
- UINTN Delay; ///< Seconds of delay default:5.
- CHAR16 *FileName; ///< Filename to run upon successful initialization.
- CHAR16 *FileOptions; ///< Options to pass to FileName.
+ SHELL_BIT_UNION BitUnion;
+ UINTN Delay; ///< Seconds of delay default:5.
+ CHAR16 *FileName; ///< Filename to run upon successful initialization.
+ CHAR16 *FileOptions; ///< Options to pass to FileName.
} SHELL_INIT_SETTINGS;
typedef struct {
- BUFFER_LIST CommandHistory;
- UINTN VisibleRowNumber;
- UINTN OriginalVisibleRowNumber;
- BOOLEAN InsertMode; ///< Is the current typing mode insert (FALSE = overwrite).
+ BUFFER_LIST CommandHistory;
+ UINTN VisibleRowNumber;
+ UINTN OriginalVisibleRowNumber;
+ BOOLEAN InsertMode; ///< Is the current typing mode insert (FALSE = overwrite).
} SHELL_VIEWING_SETTINGS;
typedef struct {
- EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParametersProtocol;
- EFI_SHELL_PROTOCOL *NewEfiShellProtocol;
- BOOLEAN PageBreakEnabled;
- BOOLEAN RootShellInstance;
- SHELL_INIT_SETTINGS ShellInitSettings;
- BUFFER_LIST BufferToFreeList; ///< List of buffers that were returned to the user to free.
- SHELL_VIEWING_SETTINGS ViewingSettings;
- EFI_HII_HANDLE HiiHandle; ///< Handle from HiiLib.
- UINTN LogScreenCount; ///< How many screens of log information to save.
- EFI_EVENT UserBreakTimer; ///< Timer event for polling for CTRL-C.
- EFI_DEVICE_PATH_PROTOCOL *ImageDevPath; ///< DevicePath for ourselves.
- EFI_DEVICE_PATH_PROTOCOL *FileDevPath; ///< DevicePath for ourselves.
- CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; ///< Pointer for ConsoleInformation.
- EFI_SHELL_PARAMETERS_PROTOCOL *OldShellParameters; ///< old shell parameters to reinstall upon exiting.
- SHELL_PROTOCOL_HANDLE_LIST OldShellList; ///< List of other instances to reinstall when closing.
- SPLIT_LIST SplitList; ///< List of Splits in FILO stack.
- VOID *CtrlCNotifyHandle1; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
- VOID *CtrlCNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
- VOID *CtrlCNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
- VOID *CtrlCNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
- VOID *CtrlSNotifyHandle1; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
- VOID *CtrlSNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
- VOID *CtrlSNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
- VOID *CtrlSNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
- BOOLEAN HaltOutput; ///< TRUE to start a CTRL-S halt.
+ EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParametersProtocol;
+ EFI_SHELL_PROTOCOL *NewEfiShellProtocol;
+ BOOLEAN PageBreakEnabled;
+ BOOLEAN RootShellInstance;
+ SHELL_INIT_SETTINGS ShellInitSettings;
+ BUFFER_LIST BufferToFreeList; ///< List of buffers that were returned to the user to free.
+ SHELL_VIEWING_SETTINGS ViewingSettings;
+ EFI_HII_HANDLE HiiHandle; ///< Handle from HiiLib.
+ UINTN LogScreenCount; ///< How many screens of log information to save.
+ EFI_EVENT UserBreakTimer; ///< Timer event for polling for CTRL-C.
+ EFI_DEVICE_PATH_PROTOCOL *ImageDevPath; ///< DevicePath for ourselves.
+ EFI_DEVICE_PATH_PROTOCOL *FileDevPath; ///< DevicePath for ourselves.
+ CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo; ///< Pointer for ConsoleInformation.
+ EFI_SHELL_PARAMETERS_PROTOCOL *OldShellParameters; ///< old shell parameters to reinstall upon exiting.
+ SHELL_PROTOCOL_HANDLE_LIST OldShellList; ///< List of other instances to reinstall when closing.
+ SPLIT_LIST SplitList; ///< List of Splits in FILO stack.
+ VOID *CtrlCNotifyHandle1; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+ VOID *CtrlCNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+ VOID *CtrlCNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+ VOID *CtrlCNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+ VOID *CtrlSNotifyHandle1; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+ VOID *CtrlSNotifyHandle2; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+ VOID *CtrlSNotifyHandle3; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+ VOID *CtrlSNotifyHandle4; ///< The NotifyHandle returned from SimpleTextInputEx.RegisterKeyNotify.
+ BOOLEAN HaltOutput; ///< TRUE to start a CTRL-S halt.
} SHELL_INFO;
#pragma pack(1)
@@ -127,12 +127,12 @@ typedef struct { /// HII specific Vendor Device Path definition.
///
typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
} SHELL_MAN_HII_VENDOR_DEVICE_PATH;
#pragma pack()
-extern SHELL_INFO ShellInfoObject;
+extern SHELL_INFO ShellInfoObject;
/**
Converts the command line to its post-processed form. this replaces variables and alias' per UEFI Shell spec.
@@ -144,8 +144,8 @@ extern SHELL_INFO ShellInfoObject; @return some other error occurred
**/
EFI_STATUS
-ProcessCommandLineToFinal(
- IN OUT CHAR16 **CmdLine
+ProcessCommandLineToFinal (
+ IN OUT CHAR16 **CmdLine
);
/**
@@ -154,8 +154,8 @@ ProcessCommandLineToFinal( @param[in] ErrorCode the error code to put into lasterror
**/
EFI_STATUS
-SetLastError(
- IN CONST SHELL_STATUS ErrorCode
+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
);
@@ -184,8 +184,8 @@ SetBuiltInAlias( **/
EFI_STATUS
GetDevicePathsForImageAndFile (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath,
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath
);
/**
@@ -216,7 +216,7 @@ GetDevicePathsForImageAndFile ( @retval EFI_SUCCESS the variable is initialized.
**/
EFI_STATUS
-ProcessCommandLine(
+ProcessCommandLine (
VOID
);
@@ -231,9 +231,9 @@ ProcessCommandLine( @retval EFI_SUCCESS The variable is initialized.
**/
EFI_STATUS
-DoStartupScript(
- IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+DoStartupScript (
+ IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
);
/**
@@ -255,9 +255,9 @@ DoShellPrompt ( @param Buffer Something to pass to FreePool when the shell is exiting.
**/
-VOID*
-AddBufferToFreeList(
- VOID *Buffer
+VOID *
+AddBufferToFreeList (
+ VOID *Buffer
);
/**
@@ -266,8 +266,8 @@ AddBufferToFreeList( @param Buffer[in] The line buffer to add.
**/
VOID
-AddLineToCommandHistory(
- IN CONST CHAR16 *Buffer
+AddLineToCommandHistory (
+ IN CONST CHAR16 *Buffer
);
/**
@@ -281,8 +281,8 @@ AddLineToCommandHistory( @retval EFI_ABORTED the command's operation was aborted
**/
EFI_STATUS
-RunCommand(
- IN CONST CHAR16 *CmdLine
+RunCommand (
+ IN CONST CHAR16 *CmdLine
);
/**
@@ -298,12 +298,11 @@ RunCommand( @retval EFI_ABORTED The command's operation was aborted.
**/
EFI_STATUS
-RunShellCommand(
- IN CONST CHAR16 *CmdLine,
- OUT EFI_STATUS *CommandStatus
+RunShellCommand (
+ IN CONST CHAR16 *CmdLine,
+ OUT EFI_STATUS *CommandStatus
);
-
/**
Function to process a NSH script file via SHELL_FILE_HANDLE.
@@ -346,11 +345,11 @@ 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(
- IN CONST CHAR16 *String,
- IN CONST CHAR16 *CharacterList,
- IN CONST CHAR16 EscapeCharacter
+CONST CHAR16 *
+FindFirstCharacter (
+ IN CONST CHAR16 *String,
+ IN CONST CHAR16 *CharacterList,
+ IN CONST CHAR16 EscapeCharacter
);
/**
@@ -359,8 +358,8 @@ FindFirstCharacter( @param[in] String pointer to the string to trim them off.
**/
EFI_STATUS
-TrimSpaces(
- IN CHAR16 **String
+TrimSpaces (
+ IN CHAR16 **String
);
/**
@@ -371,7 +370,7 @@ TrimSpaces( **/
VOID
SaveBufferList (
- OUT LIST_ENTRY *OldBufferList
+ OUT LIST_ENTRY *OldBufferList
);
/**
@@ -381,10 +380,7 @@ SaveBufferList ( **/
VOID
RestoreBufferList (
- IN OUT LIST_ENTRY *OldBufferList
+ IN OUT LIST_ENTRY *OldBufferList
);
-
-
#endif //_SHELL_INTERNAL_HEADER_
-
diff --git a/ShellPkg/Application/Shell/ShellEnvVar.c b/ShellPkg/Application/Shell/ShellEnvVar.c index 04fed3bf91..b97cfe91b9 100644 --- a/ShellPkg/Application/Shell/ShellEnvVar.c +++ b/ShellPkg/Application/Shell/ShellEnvVar.c @@ -14,7 +14,7 @@ //
// The list is used to cache the environment variables.
//
-ENV_VAR_LIST gShellEnvVarList;
+ENV_VAR_LIST gShellEnvVarList;
/**
Reports whether an environment variable is Volatile or Non-Volatile.
@@ -27,8 +27,8 @@ ENV_VAR_LIST gShellEnvVarList; **/
EFI_STATUS
IsVolatileEnv (
- IN CONST CHAR16 *EnvVarName,
- OUT BOOLEAN *Volatile
+ IN CONST CHAR16 *EnvVarName,
+ OUT BOOLEAN *Volatile
)
{
EFI_STATUS Status;
@@ -38,29 +38,35 @@ IsVolatileEnv ( ASSERT (Volatile != NULL);
- Size = 0;
+ Size = 0;
Buffer = NULL;
//
// get the variable
//
- Status = gRT->GetVariable((CHAR16*)EnvVarName,
- &gShellVariableGuid,
- &Attribs,
- &Size,
- Buffer);
+ Status = gRT->GetVariable (
+ (CHAR16 *)EnvVarName,
+ &gShellVariableGuid,
+ &Attribs,
+ &Size,
+ 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,
- &gShellVariableGuid,
- &Attribs,
- &Size,
- Buffer);
- FreePool(Buffer);
+
+ Status = gRT->GetVariable (
+ (CHAR16 *)EnvVarName,
+ &gShellVariableGuid,
+ &Attribs,
+ &Size,
+ 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,30 +92,33 @@ IsVolatileEnv ( @param[in] List The pointer to pointer to list.
**/
VOID
-FreeEnvironmentVariableList(
- IN LIST_ENTRY *List
+FreeEnvironmentVariableList (
+ IN LIST_ENTRY *List
)
{
- ENV_VAR_LIST *Node;
+ ENV_VAR_LIST *Node;
ASSERT (List != NULL);
if (List == NULL) {
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,18 +131,18 @@ FreeEnvironmentVariableList( @retval EFI_SUCCESS the list was created successfully.
**/
EFI_STATUS
-GetEnvironmentVariableList(
- IN OUT LIST_ENTRY *ListHead
+GetEnvironmentVariableList (
+ IN OUT LIST_ENTRY *ListHead
)
{
- CHAR16 *VariableName;
- UINTN NameSize;
- UINTN NameBufferSize;
- EFI_STATUS Status;
- EFI_GUID Guid;
- UINTN ValSize;
- UINTN ValBufferSize;
- ENV_VAR_LIST *VarList;
+ CHAR16 *VariableName;
+ UINTN NameSize;
+ UINTN NameBufferSize;
+ EFI_STATUS Status;
+ EFI_GUID Guid;
+ UINTN ValSize;
+ UINTN ValBufferSize;
+ ENV_VAR_LIST *VarList;
if (ListHead == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -140,34 +150,36 @@ GetEnvironmentVariableList( Status = EFI_SUCCESS;
- ValBufferSize = INIT_DATA_BUFFER_SIZE;
+ 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);
- Status = EFI_OUT_OF_RESOURCES;
- break;
+ 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,51 +251,56 @@ GetEnvironmentVariableList( @retval EFI_SUCCESS the list was Set successfully.
**/
EFI_STATUS
-SetEnvironmentVariableList(
- IN LIST_ENTRY *ListHead
+SetEnvironmentVariableList (
+ IN LIST_ENTRY *ListHead
)
{
- ENV_VAR_LIST VarList;
- ENV_VAR_LIST *Node;
- EFI_STATUS Status;
- UINTN Size;
+ ENV_VAR_LIST VarList;
+ ENV_VAR_LIST *Node;
+ 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);
-
- for ( Node = (ENV_VAR_LIST*)GetFirstNode(&VarList.Link)
- ; !IsNull(&VarList.Link, &Node->Link)
- ; Node = (ENV_VAR_LIST*)GetNextNode(&VarList.Link, &Node->Link)
- ){
+ 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)
+ )
+ {
if (Node->Key != NULL) {
- Status = SHELL_DELETE_ENVIRONMENT_VARIABLE(Node->Key);
+ Status = SHELL_DELETE_ENVIRONMENT_VARIABLE (Node->Key);
}
- ASSERT_EFI_ERROR(Status);
+
+ ASSERT_EFI_ERROR (Status);
}
- FreeEnvironmentVariableList(&VarList.Link);
+ 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,8 +319,8 @@ SetEnvironmentVariableList( @sa SetEnvironmentVariableList
**/
EFI_STATUS
-SetEnvironmentVariables(
- IN CONST CHAR16 **Environment
+SetEnvironmentVariables (
+ IN CONST CHAR16 **Environment
)
{
CONST CHAR16 *CurrentString;
@@ -318,61 +338,65 @@ SetEnvironmentVariables( // Build a list identical to the ones used for get/set list functions above
//
for ( CurrentCount = 0
- ;
- ; CurrentCount++
- ){
+ ;
+ ; 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,
- CurrentString,
- StrStr(CurrentString, L"=") - CurrentString
- );
+ StrnCpyS (
+ Node->Key,
+ StrStr (CurrentString, L"=") - CurrentString + 1,
+ 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);
+
+ InitializeListHead (&VarList->Link);
}
- InsertTailList(&VarList->Link, &Node->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));
}
/**
@@ -400,28 +424,30 @@ SetEnvironmentVariables( **/
EFI_STATUS
ShellFindEnvVarInList (
- IN CONST CHAR16 *Key,
- OUT CHAR16 **Value,
- OUT UINTN *ValueSize,
- OUT UINT32 *Atts OPTIONAL
+ IN CONST CHAR16 *Key,
+ OUT CHAR16 **Value,
+ OUT UINTN *ValueSize,
+ OUT UINT32 *Atts OPTIONAL
)
{
- ENV_VAR_LIST *Node;
+ ENV_VAR_LIST *Node;
- if (Key == NULL || Value == NULL || ValueSize == NULL) {
+ if ((Key == NULL) || (Value == NULL) || (ValueSize == NULL)) {
return SHELL_INVALID_PARAMETER;
}
- 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;
}
}
@@ -444,17 +470,17 @@ ShellFindEnvVarInList ( **/
EFI_STATUS
ShellAddEnvVarToList (
- IN CONST CHAR16 *Key,
- IN CONST CHAR16 *Value,
- IN UINTN ValueSize,
- IN UINT32 Atts
+ IN CONST CHAR16 *Key,
+ IN CONST CHAR16 *Value,
+ IN UINTN ValueSize,
+ IN UINT32 Atts
)
{
- ENV_VAR_LIST *Node;
- CHAR16 *LocalKey;
- CHAR16 *LocalValue;
+ ENV_VAR_LIST *Node;
+ CHAR16 *LocalKey;
+ CHAR16 *LocalValue;
- if (Key == NULL || Value == NULL || ValueSize == 0) {
+ if ((Key == NULL) || (Value == NULL) || (ValueSize == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -466,14 +492,15 @@ 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);
- Node->Val = LocalValue;
+ 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->Key = LocalKey;
+ Node->Val = LocalValue;
Node->Atts = Atts;
- InsertTailList(&gShellEnvVarList.Link, &Node->Link);
+ InsertTailList (&gShellEnvVarList.Link, &Node->Link);
return EFI_SUCCESS;
}
@@ -512,24 +541,25 @@ ShellAddEnvVarToList ( **/
EFI_STATUS
ShellRemvoeEnvVarFromList (
- IN CONST CHAR16 *Key
+ IN CONST CHAR16 *Key
)
{
- ENV_VAR_LIST *Node;
+ ENV_VAR_LIST *Node;
if (Key == NULL) {
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;
}
}
@@ -547,9 +577,9 @@ ShellInitEnvVarList ( VOID
)
{
- EFI_STATUS Status;
+ 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;
}
-
diff --git a/ShellPkg/Application/Shell/ShellEnvVar.h b/ShellPkg/Application/Shell/ShellEnvVar.h index 6c8552ee64..2eeecfce32 100644 --- a/ShellPkg/Application/Shell/ShellEnvVar.h +++ b/ShellPkg/Application/Shell/ShellEnvVar.h @@ -15,17 +15,16 @@ #define _SHELL_ENVIRONMENT_VARIABLE_HEADER_
typedef struct {
- LIST_ENTRY Link;
- CHAR16 *Key;
- CHAR16 *Val;
- UINT32 Atts;
+ LIST_ENTRY Link;
+ CHAR16 *Key;
+ CHAR16 *Val;
+ UINT32 Atts;
} ENV_VAR_LIST;
//
// The list is used to cache the environment variables.
//
-extern ENV_VAR_LIST gShellEnvVarList;
-
+extern ENV_VAR_LIST gShellEnvVarList;
/**
Reports whether an environment variable is Volatile or Non-Volatile.
@@ -38,8 +37,8 @@ extern ENV_VAR_LIST gShellEnvVarList; **/
EFI_STATUS
IsVolatileEnv (
- IN CONST CHAR16 *EnvVarName,
- OUT BOOLEAN *Volatile
+ IN CONST CHAR16 *EnvVarName,
+ OUT BOOLEAN *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,8 +149,8 @@ IsVolatileEnv ( @retval EFI_SUCCESS the list was created successfully.
**/
EFI_STATUS
-GetEnvironmentVariableList(
- IN OUT LIST_ENTRY *List
+GetEnvironmentVariableList (
+ IN OUT LIST_ENTRY *List
);
/**
@@ -167,8 +166,8 @@ GetEnvironmentVariableList( @retval EFI_SUCCESS The list was Set successfully.
**/
EFI_STATUS
-SetEnvironmentVariableList(
- IN LIST_ENTRY *List
+SetEnvironmentVariableList (
+ IN LIST_ENTRY *List
);
/**
@@ -187,8 +186,8 @@ SetEnvironmentVariableList( @sa SetEnvironmentVariableList
**/
EFI_STATUS
-SetEnvironmentVariables(
- IN CONST CHAR16 **Environment
+SetEnvironmentVariables (
+ IN CONST CHAR16 **Environment
);
/**
@@ -197,8 +196,8 @@ SetEnvironmentVariables( @param[in] List The pointer to pointer to list.
**/
VOID
-FreeEnvironmentVariableList(
- IN LIST_ENTRY *List
+FreeEnvironmentVariableList (
+ IN LIST_ENTRY *List
);
/**
@@ -218,10 +217,10 @@ FreeEnvironmentVariableList( **/
EFI_STATUS
ShellFindEnvVarInList (
- IN CONST CHAR16 *Key,
- OUT CHAR16 **Value,
- OUT UINTN *ValueSize,
- OUT UINT32 *Atts OPTIONAL
+ IN CONST CHAR16 *Key,
+ OUT CHAR16 **Value,
+ OUT UINTN *ValueSize,
+ OUT UINT32 *Atts OPTIONAL
);
/**
@@ -239,10 +238,10 @@ ShellFindEnvVarInList ( **/
EFI_STATUS
ShellAddEnvVarToList (
- IN CONST CHAR16 *Key,
- IN CONST CHAR16 *Value,
- IN UINTN ValueSize,
- IN UINT32 Atts
+ IN CONST CHAR16 *Key,
+ IN CONST CHAR16 *Value,
+ IN UINTN ValueSize,
+ IN UINT32 Atts
);
/**
@@ -256,7 +255,7 @@ ShellAddEnvVarToList ( **/
EFI_STATUS
ShellRemvoeEnvVarFromList (
- IN CONST CHAR16 *Key
+ IN CONST CHAR16 *Key
);
/**
@@ -279,4 +278,3 @@ ShellFreeEnvVarList ( );
#endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_
-
diff --git a/ShellPkg/Application/Shell/ShellManParser.c b/ShellPkg/Application/Shell/ShellManParser.c index d5a85cb8cc..5c823cd7f5 100644 --- a/ShellPkg/Application/Shell/ShellManParser.c +++ b/ShellPkg/Application/Shell/ShellManParser.c @@ -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)
}
}
};
@@ -52,11 +51,12 @@ SHELL_MAN_HII_VENDOR_DEVICE_PATH mShellManHiiDevicePath = { **/
CHAR16 *
GetExecuatableFileName (
- IN CONST CHAR16 *NameString
+ IN CONST CHAR16 *NameString
)
{
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),
- NameString,
- StrLen(NameString)
- );
- StrnCatS( Buffer,
- (StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16),
- L".efi",
- StrLen(L".efi")
- );
+ StrnCpyS (
+ Buffer,
+ (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
+ NameString,
+ StrLen (NameString)
+ );
+ StrnCatS (
+ Buffer,
+ (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
+ 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(
- IN CONST CHAR16 *ManFileName
+GetManFileName (
+ IN CONST CHAR16 *ManFileName
)
{
- CHAR16 *Buffer;
+ 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),
- ManFileName,
- StrLen(ManFileName)
- );
- StrnCatS( Buffer,
- (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16),
- L".man",
- 4
- );
+ StrnCpyS (
+ Buffer,
+ (StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
+ ManFileName,
+ StrLen (ManFileName)
+ );
+ StrnCatS (
+ Buffer,
+ (StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
+ L".man",
+ 4
+ );
}
}
+
return (Buffer);
}
@@ -149,22 +156,23 @@ GetManFileName( @retval EFI_NOT_FOUND The file was not found.
**/
EFI_STATUS
-SearchPathForFile(
- IN CONST CHAR16 *FileName,
- OUT SHELL_FILE_HANDLE *Handle
+SearchPathForFile (
+ IN CONST CHAR16 *FileName,
+ OUT SHELL_FILE_HANDLE *Handle
)
{
- CHAR16 *FullFileName;
- EFI_STATUS Status;
+ 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,
@@ -205,75 +213,84 @@ ManFileFindSections( IN BOOLEAN Ascii
)
{
- EFI_STATUS Status;
- CHAR16 *ReadLine;
- UINTN Size;
- BOOLEAN CurrentlyReading;
- CHAR16 *SectionName;
- UINTN SectionLen;
- BOOLEAN Found;
-
- if ( Handle == NULL
- || HelpText == NULL
- || HelpSize == NULL
- ){
+ EFI_STATUS Status;
+ CHAR16 *ReadLine;
+ UINTN Size;
+ BOOLEAN CurrentlyReading;
+ CHAR16 *SectionName;
+ UINTN SectionLen;
+ BOOLEAN Found;
+
+ if ( (Handle == NULL)
+ || (HelpText == NULL)
+ || (HelpSize == NULL)
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
- Status = EFI_SUCCESS;
- CurrentlyReading = FALSE;
- Size = 1024;
- Found = FALSE;
+ Status = EFI_SUCCESS;
+ CurrentlyReading = FALSE;
+ 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 == L' '
+ ; 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,12 +334,12 @@ ManFileFindSections( @retval FALSE Line did not contain the Title Header
**/
BOOLEAN
-IsTitleHeader(
- IN CONST CHAR16 *Command,
- IN CHAR16 *Line,
- OUT CHAR16 **BriefDesc OPTIONAL,
- OUT UINTN *BriefSize OPTIONAL,
- OUT BOOLEAN *Found
+IsTitleHeader (
+ IN CONST CHAR16 *Command,
+ IN CHAR16 *Line,
+ OUT CHAR16 **BriefDesc OPTIONAL,
+ OUT UINTN *BriefSize OPTIONAL,
+ OUT BOOLEAN *Found
)
{
// The states of a simple state machine used to recognize a title header line
@@ -334,86 +353,84 @@ IsTitleHeader( BOOLEAN ReturnValue; // TRUE if this the Title Header line of *some* MAN file.
BOOLEAN ReturnFound; // TRUE if this the Title Header line of *the desired* MAN file.
- ReturnValue = FALSE;
- ReturnFound = FALSE;
+ ReturnValue = FALSE;
+ ReturnFound = FALSE;
CommandIndex = 0;
- State = LookForThMacro;
+ 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;
+
+ break;
// Handle "\s*"
// Eat any "extra" whitespace after the title header macro (we have already seen
// 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;
+ State = CompareCommands;
// Do not increment Line; it points to the first character of the command
// name on the title header line.
}
- break;
+
+ break;
// Handle "(\S)\s"
// Compare Command to the title header command name, ignoring case. When we
// 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++))) {
+ State = (BriefDesc == NULL) ? Final : GetBriefDescription;
+ } else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {
State = Final;
}
+
Line++;
- break;
+ break;
// Handle "[\s01]*(.*)$"
// 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;
+ break;
default:
- break;
+ 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,18 +472,19 @@ 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);
}
- Status = EFI_SUCCESS;
- Size = 1024;
- Found = FALSE;
+ Status = EFI_SUCCESS;
+ 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)
- && (*(Command + Start - 1) != L'\\')
- && (*(Command + Start - 1) != L'/')
- && (*(Command + Start - 1) != L':')) {
+ Start = StrLen (Command);
+ while ( (Start != 0)
+ && (*(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,32 +552,33 @@ ManFileFindTitleSection( @retval EFI_NOT_FOUND There is no help text available for Command.
**/
EFI_STATUS
-ProcessManFile(
- IN CONST CHAR16 *ManFileName,
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Sections OPTIONAL,
- OUT CHAR16 **BriefDesc OPTIONAL,
- OUT CHAR16 **HelpText
+ProcessManFile (
+ IN CONST CHAR16 *ManFileName,
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Sections OPTIONAL,
+ OUT CHAR16 **BriefDesc OPTIONAL,
+ OUT CHAR16 **HelpText
)
{
- CHAR16 *TempString;
- SHELL_FILE_HANDLE FileHandle;
- EFI_HANDLE CmdFileImgHandle;
- EFI_STATUS Status;
- UINTN HelpSize;
- UINTN BriefSize;
- UINTN StringIdWalker;
- BOOLEAN Ascii;
- CHAR16 *CmdFileName;
- CHAR16 *CmdFilePathName;
- EFI_DEVICE_PATH_PROTOCOL *FileDevPath;
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
- EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
-
- if ( ManFileName == NULL
- || Command == NULL
- || HelpText == NULL
- ){
+ CHAR16 *TempString;
+ SHELL_FILE_HANDLE FileHandle;
+ EFI_HANDLE CmdFileImgHandle;
+ EFI_STATUS Status;
+ UINTN HelpSize;
+ UINTN BriefSize;
+ UINTN StringIdWalker;
+ BOOLEAN Ascii;
+ CHAR16 *CmdFileName;
+ CHAR16 *CmdFilePathName;
+ EFI_DEVICE_PATH_PROTOCOL *FileDevPath;
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
+
+ if ( (ManFileName == NULL)
+ || (Command == NULL)
+ || (HelpText == NULL)
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
@@ -577,47 +597,49 @@ 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);
+ 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);
} else {
//
// If the image is a external app, check .MAN file first.
//
- FileHandle = NULL;
- TempString = GetManFileName(ManFileName);
+ FileHandle = NULL;
+ TempString = GetManFileName (ManFileName);
if (TempString == NULL) {
return (EFI_INVALID_PARAMETER);
}
- 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 = 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);
}
- 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,60 +705,62 @@ ProcessManFile( EFI_NATIVE_INTERFACE,
&mShellManHiiDevicePath
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto Done;
}
Status = gHiiDatabase->NewPackageList (
- gHiiDatabase,
- PackageListHeader,
- mShellManDriverHandle,
- &mShellManHiiHandle
- );
+ gHiiDatabase,
+ PackageListHeader,
+ mShellManDriverHandle,
+ &mShellManHiiHandle
+ );
if (EFI_ERROR (Status)) {
goto Done;
}
StringIdWalker = 1;
do {
- SHELL_FREE_NON_NULL(TempString);
- if (BriefDesc != NULL) {
- 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);
- }
- ShellCloseFile (&FileHandle);
- if (!EFI_ERROR(Status)){
- //
- // Found what we need and return
- //
- goto Done;
- }
+ SHELL_FREE_NON_NULL (TempString);
+ if (BriefDesc != NULL) {
+ SHELL_FREE_NON_NULL (*BriefDesc);
+ }
- StringIdWalker += 1;
- } while (StringIdWalker < 0xFFFF && TempString != NULL);
+ 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);
+ }
+
+ ShellCloseFile (&FileHandle);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Found what we need and return
+ //
+ goto Done;
+ }
+
+ StringIdWalker += 1;
+ } while (StringIdWalker < 0xFFFF && TempString != NULL);
}
Done:
if (mShellManDriverHandle != NULL) {
gBS->UninstallProtocolInterface (
- mShellManDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mShellManHiiDevicePath
+ mShellManDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mShellManHiiDevicePath
);
mShellManDriverHandle = NULL;
}
@@ -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);
}
-
diff --git a/ShellPkg/Application/Shell/ShellManParser.h b/ShellPkg/Application/Shell/ShellManParser.h index 04031e007f..388ae2aad9 100644 --- a/ShellPkg/Application/Shell/ShellManParser.h +++ b/ShellPkg/Application/Shell/ShellManParser.h @@ -39,12 +39,12 @@ @retval EFI_NOT_FOUND There is no help text available for Command.
**/
EFI_STATUS
-ProcessManFile(
- IN CONST CHAR16 *ManFileName,
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Sections OPTIONAL,
- OUT CHAR16 **BriefDesc,
- OUT CHAR16 **HelpText
+ProcessManFile (
+ IN CONST CHAR16 *ManFileName,
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Sections OPTIONAL,
+ OUT CHAR16 **BriefDesc,
+ OUT CHAR16 **HelpText
);
/**
@@ -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_
-
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c index 7e0c8ce42e..64d67d9f13 100644 --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c @@ -12,22 +12,22 @@ #include "Shell.h"
-BOOLEAN AsciiRedirection = FALSE;
+BOOLEAN AsciiRedirection = FALSE;
/**
Return the next parameter's end from a command line string.
@param[in] String the string to parse
**/
-CONST CHAR16*
-FindEndOfParameter(
- IN CONST CHAR16 *String
+CONST CHAR16 *
+FindEndOfParameter (
+ IN CONST CHAR16 *String
)
{
- CONST CHAR16 *First;
- CONST CHAR16 *CloseQuote;
+ CONST CHAR16 *First;
+ CONST CHAR16 *CloseQuote;
- First = FindFirstCharacter(String, L" \"", L'^');
+ First = FindFirstCharacter (String, L" \"", L'^');
//
// nothing, all one parameter remaining
@@ -79,51 +79,51 @@ FindEndOfParameter( @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,
IN BOOLEAN StripQuotation
)
{
- CONST CHAR16 *NextDelim;
-
- if (Walker == NULL
- ||*Walker == NULL
- ||TempParameter == NULL
- ||*TempParameter == NULL
- ){
+ CONST CHAR16 *NextDelim;
+
+ if ( (Walker == NULL)
+ || (*Walker == NULL)
+ || (TempParameter == NULL)
+ || (*TempParameter == NULL)
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
-
//
// make sure we dont have any leading spaces
//
while ((*Walker)[0] == L' ') {
- (*Walker)++;
+ (*Walker)++;
}
//
// make sure we still have some params now...
//
- if (StrLen(*Walker) == 0) {
-DEBUG_CODE_BEGIN();
- *Walker = NULL;
-DEBUG_CODE_END();
+ if (StrLen (*Walker) == 0) {
+ DEBUG_CODE_BEGIN ();
+ *Walker = NULL;
+ DEBUG_CODE_END ();
return (EFI_INVALID_PARAMETER);
}
- NextDelim = FindEndOfParameter(*Walker);
+ NextDelim = FindEndOfParameter (*Walker);
- if (NextDelim == NULL){
-DEBUG_CODE_BEGIN();
- *Walker = NULL;
-DEBUG_CODE_END();
+ if (NextDelim == NULL) {
+ DEBUG_CODE_BEGIN ();
+ *Walker = NULL;
+ DEBUG_CODE_END ();
return (EFI_NOT_FOUND);
}
- StrnCpyS(*TempParameter, Length / sizeof(CHAR16), (*Walker), NextDelim - *Walker);
+ StrnCpyS (*TempParameter, Length / sizeof (CHAR16), (*Walker), NextDelim - *Walker);
//
// Add a CHAR_NULL if we didn't get one via the copy
@@ -135,33 +135,32 @@ DEBUG_CODE_END(); //
// Update Walker for the next iteration through the function
//
- *Walker = (CHAR16*)NextDelim;
+ *Walker = (CHAR16 *)NextDelim;
//
// Remove any non-escaped quotes in the string
// Remove any remaining escape characters in the string
//
- for (NextDelim = FindFirstCharacter(*TempParameter, L"\"^", CHAR_NULL)
- ; *NextDelim != CHAR_NULL
- ; NextDelim = FindFirstCharacter(NextDelim, L"\"^", CHAR_NULL)
- ) {
+ for (NextDelim = FindFirstCharacter (*TempParameter, L"\"^", CHAR_NULL)
+ ; *NextDelim != CHAR_NULL
+ ; NextDelim = FindFirstCharacter (NextDelim, L"\"^", CHAR_NULL)
+ )
+ {
if (*NextDelim == L'^') {
-
//
// eliminate the escape ^
//
- CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));
+ CopyMem ((CHAR16 *)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));
NextDelim++;
} else if (*NextDelim == L'\"') {
-
//
// eliminate the unescaped quote
//
if (StripQuotation) {
- CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));
- } else{
+ CopyMem ((CHAR16 *)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));
+ } else {
NextDelim++;
- }
+ }
}
}
@@ -189,11 +188,11 @@ DEBUG_CODE_END(); @return EFI_OUT_OF_RESOURCES a memory allocation failed.
**/
EFI_STATUS
-ParseCommandLineToArgs(
- IN CONST CHAR16 *CommandLine,
- IN BOOLEAN StripQuotation,
- IN OUT CHAR16 ***Argv,
- IN OUT UINTN *Argc
+ParseCommandLineToArgs (
+ IN CONST CHAR16 *CommandLine,
+ IN BOOLEAN StripQuotation,
+ IN OUT CHAR16 ***Argv,
+ IN OUT UINTN *Argc
)
{
UINTN Count;
@@ -204,34 +203,35 @@ ParseCommandLineToArgs( UINTN Size;
EFI_STATUS Status;
- ASSERT(Argc != NULL);
- ASSERT(Argv != NULL);
+ ASSERT (Argc != NULL);
+ ASSERT (Argv != NULL);
- if (CommandLine == NULL || StrLen(CommandLine)==0) {
+ if ((CommandLine == NULL) || (StrLen (CommandLine) == 0)) {
(*Argc) = 0;
(*Argv) = NULL;
return (EFI_SUCCESS);
}
- NewCommandLine = AllocateCopyPool(StrSize(CommandLine), CommandLine);
- if (NewCommandLine == NULL){
+ NewCommandLine = AllocateCopyPool (StrSize (CommandLine), CommandLine);
+ if (NewCommandLine == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- TrimSpaces(&NewCommandLine);
- Size = StrSize(NewCommandLine);
- TempParameter = AllocateZeroPool(Size);
+ TrimSpaces (&NewCommandLine);
+ Size = StrSize (NewCommandLine);
+ TempParameter = AllocateZeroPool (Size);
if (TempParameter == NULL) {
- SHELL_FREE_NON_NULL(NewCommandLine);
+ SHELL_FREE_NON_NULL (NewCommandLine);
return (EFI_OUT_OF_RESOURCES);
}
- for ( Count = 0
- , Walker = (CHAR16*)NewCommandLine
- ; Walker != NULL && *Walker != CHAR_NULL
- ; Count++
- ) {
- if (EFI_ERROR(GetNextParameter(&Walker, &TempParameter, Size, TRUE))) {
+ for ( Count = 0,
+ Walker = (CHAR16 *)NewCommandLine
+ ; Walker != NULL && *Walker != CHAR_NULL
+ ; Count++
+ )
+ {
+ if (EFI_ERROR (GetNextParameter (&Walker, &TempParameter, Size, TRUE))) {
break;
}
}
@@ -239,35 +239,37 @@ ParseCommandLineToArgs( //
// lets allocate the pointer array
//
- (*Argv) = AllocateZeroPool((Count)*sizeof(CHAR16*));
+ (*Argv) = AllocateZeroPool ((Count)*sizeof (CHAR16 *));
if (*Argv == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
- *Argc = 0;
- Walker = (CHAR16*)NewCommandLine;
- while(Walker != NULL && *Walker != CHAR_NULL) {
- SetMem16(TempParameter, Size, CHAR_NULL);
- if (EFI_ERROR(GetNextParameter(&Walker, &TempParameter, Size, StripQuotation))) {
+ *Argc = 0;
+ Walker = (CHAR16 *)NewCommandLine;
+ while (Walker != NULL && *Walker != CHAR_NULL) {
+ SetMem16 (TempParameter, Size, CHAR_NULL);
+ if (EFI_ERROR (GetNextParameter (&Walker, &TempParameter, Size, StripQuotation))) {
Status = EFI_INVALID_PARAMETER;
goto Done;
}
- NewParam = AllocateCopyPool(StrSize(TempParameter), TempParameter);
- if (NewParam == NULL){
+ NewParam = AllocateCopyPool (StrSize (TempParameter), TempParameter);
+ if (NewParam == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
- ((CHAR16**)(*Argv))[(*Argc)] = NewParam;
+
+ ((CHAR16 **)(*Argv))[(*Argc)] = NewParam;
(*Argc)++;
}
- ASSERT(Count >= (*Argc));
+
+ ASSERT (Count >= (*Argc));
Status = EFI_SUCCESS;
Done:
- SHELL_FREE_NON_NULL(TempParameter);
- SHELL_FREE_NON_NULL(NewCommandLine);
+ SHELL_FREE_NON_NULL (TempParameter);
+ SHELL_FREE_NON_NULL (NewCommandLine);
return (Status);
}
@@ -293,32 +295,32 @@ CreatePopulateInstallShellParametersProtocol ( IN OUT BOOLEAN *RootShellInstance
)
{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- CHAR16 *FullCommandLine;
- UINTN Size;
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ CHAR16 *FullCommandLine;
+ UINTN Size;
- Size = 0;
+ Size = 0;
FullCommandLine = NULL;
- LoadedImage = NULL;
+ LoadedImage = NULL;
//
// Assert for valid parameters
//
- ASSERT(NewShellParameters != NULL);
- ASSERT(RootShellInstance != NULL);
+ ASSERT (NewShellParameters != NULL);
+ ASSERT (RootShellInstance != NULL);
//
// See if we have a shell parameters placed on us
//
Status = gBS->OpenProtocol (
- gImageHandle,
- &gEfiShellParametersProtocolGuid,
- (VOID **) &ShellInfoObject.OldShellParameters,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ gImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ (VOID **)&ShellInfoObject.OldShellParameters,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
//
// if we don't then we must be the root shell (error is expected)
//
@@ -329,7 +331,7 @@ CreatePopulateInstallShellParametersProtocol ( //
// Allocate the new structure
//
- *NewShellParameters = AllocateZeroPool(sizeof(EFI_SHELL_PARAMETERS_PROTOCOL));
+ *NewShellParameters = AllocateZeroPool (sizeof (EFI_SHELL_PARAMETERS_PROTOCOL));
if ((*NewShellParameters) == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
@@ -338,52 +340,57 @@ CreatePopulateInstallShellParametersProtocol ( // get loaded image protocol
//
Status = gBS->OpenProtocol (
- gImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **) &LoadedImage,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- ASSERT_EFI_ERROR(Status);
+ gImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ ASSERT_EFI_ERROR (Status);
//
// Build the full command line
//
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(L"ShellOpt", &Size, FullCommandLine);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (L"ShellOpt", &Size, FullCommandLine);
if (Status == EFI_BUFFER_TOO_SMALL) {
- FullCommandLine = AllocateZeroPool(Size + LoadedImage->LoadOptionsSize);
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(L"ShellOpt", &Size, FullCommandLine);
+ FullCommandLine = AllocateZeroPool (Size + LoadedImage->LoadOptionsSize);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (L"ShellOpt", &Size, FullCommandLine);
}
+
if (Status == EFI_NOT_FOUND) {
//
// no parameters via environment... ok
//
} else {
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return (Status);
}
}
- if (Size == 0 && LoadedImage->LoadOptionsSize != 0) {
- ASSERT(FullCommandLine == NULL);
+
+ if ((Size == 0) && (LoadedImage->LoadOptionsSize != 0)) {
+ ASSERT (FullCommandLine == NULL);
//
// Now we need to include a NULL terminator in the size.
//
- Size = LoadedImage->LoadOptionsSize + sizeof(FullCommandLine[0]);
- FullCommandLine = AllocateZeroPool(Size);
+ Size = LoadedImage->LoadOptionsSize + sizeof (FullCommandLine[0]);
+ FullCommandLine = AllocateZeroPool (Size);
}
+
if (FullCommandLine != NULL) {
CopyMem (FullCommandLine, LoadedImage->LoadOptions, LoadedImage->LoadOptionsSize);
//
// Populate Argc and Argv
//
- Status = ParseCommandLineToArgs(FullCommandLine,
- TRUE,
- &(*NewShellParameters)->Argv,
- &(*NewShellParameters)->Argc);
+ Status = ParseCommandLineToArgs (
+ FullCommandLine,
+ TRUE,
+ &(*NewShellParameters)->Argv,
+ &(*NewShellParameters)->Argc
+ );
- FreePool(FullCommandLine);
+ FreePool (FullCommandLine);
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
} else {
(*NewShellParameters)->Argv = NULL;
(*NewShellParameters)->Argc = 0;
@@ -396,10 +403,12 @@ CreatePopulateInstallShellParametersProtocol ( (*NewShellParameters)->StdIn = &FileInterfaceStdIn;
(*NewShellParameters)->StdOut = &FileInterfaceStdOut;
(*NewShellParameters)->StdErr = &FileInterfaceStdErr;
- Status = gBS->InstallProtocolInterface(&gImageHandle,
+ Status = gBS->InstallProtocolInterface (
+ &gImageHandle,
&gEfiShellParametersProtocolGuid,
EFI_NATIVE_INTERFACE,
- (VOID*)(*NewShellParameters));
+ (VOID *)(*NewShellParameters)
+ );
} else {
//
// copy from the existing ones
@@ -407,10 +416,12 @@ CreatePopulateInstallShellParametersProtocol ( (*NewShellParameters)->StdIn = ShellInfoObject.OldShellParameters->StdIn;
(*NewShellParameters)->StdOut = ShellInfoObject.OldShellParameters->StdOut;
(*NewShellParameters)->StdErr = ShellInfoObject.OldShellParameters->StdErr;
- Status = gBS->ReinstallProtocolInterface(gImageHandle,
- &gEfiShellParametersProtocolGuid,
- (VOID*)ShellInfoObject.OldShellParameters,
- (VOID*)(*NewShellParameters));
+ Status = gBS->ReinstallProtocolInterface (
+ gImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ (VOID *)ShellInfoObject.OldShellParameters,
+ (VOID *)(*NewShellParameters)
+ );
}
return (Status);
@@ -433,36 +444,46 @@ CleanUpShellParametersProtocol ( IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParameters
)
{
- EFI_STATUS Status;
- UINTN LoopCounter;
+ EFI_STATUS Status;
+ UINTN LoopCounter;
//
// If the old exists we need to restore it
//
if (ShellInfoObject.OldShellParameters != NULL) {
- Status = gBS->ReinstallProtocolInterface(gImageHandle,
- &gEfiShellParametersProtocolGuid,
- (VOID*)NewShellParameters,
- (VOID*)ShellInfoObject.OldShellParameters);
- DEBUG_CODE(ShellInfoObject.OldShellParameters = NULL;);
+ Status = gBS->ReinstallProtocolInterface (
+ gImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ (VOID *)NewShellParameters,
+ (VOID *)ShellInfoObject.OldShellParameters
+ );
+ DEBUG_CODE (
+ ShellInfoObject.OldShellParameters = NULL;
+ );
} else {
//
// No old one, just uninstall us...
//
- Status = gBS->UninstallProtocolInterface(gImageHandle,
- &gEfiShellParametersProtocolGuid,
- (VOID*)NewShellParameters);
+ Status = gBS->UninstallProtocolInterface (
+ gImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ (VOID *)NewShellParameters
+ );
}
+
if (NewShellParameters->Argv != NULL) {
for ( LoopCounter = 0
- ; LoopCounter < NewShellParameters->Argc
- ; LoopCounter++
- ){
- FreePool(NewShellParameters->Argv[LoopCounter]);
+ ; LoopCounter < NewShellParameters->Argc
+ ; LoopCounter++
+ )
+ {
+ FreePool (NewShellParameters->Argv[LoopCounter]);
}
- FreePool(NewShellParameters->Argv);
+
+ FreePool (NewShellParameters->Argv);
}
- FreePool(NewShellParameters);
+
+ FreePool (NewShellParameters);
return (Status);
}
@@ -475,29 +496,31 @@ CleanUpShellParametersProtocol ( @return An error upon failure.
**/
EFI_STATUS
-IsUnicodeFile(
- IN CONST CHAR16 *FileName
+IsUnicodeFile (
+ IN CONST CHAR16 *FileName
)
{
- SHELL_FILE_HANDLE Handle;
- EFI_STATUS Status;
- UINT64 OriginalFilePosition;
- UINTN CharSize;
- CHAR16 CharBuffer;
-
- Status = gEfiShellProtocol->OpenFileByName(FileName, &Handle, EFI_FILE_MODE_READ);
- if (EFI_ERROR(Status)) {
+ SHELL_FILE_HANDLE Handle;
+ EFI_STATUS Status;
+ UINT64 OriginalFilePosition;
+ UINTN CharSize;
+ CHAR16 CharBuffer;
+
+ Status = gEfiShellProtocol->OpenFileByName (FileName, &Handle, EFI_FILE_MODE_READ);
+ if (EFI_ERROR (Status)) {
return (Status);
}
- gEfiShellProtocol->GetFilePosition(Handle, &OriginalFilePosition);
- gEfiShellProtocol->SetFilePosition(Handle, 0);
- CharSize = sizeof(CHAR16);
- Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer);
- if (EFI_ERROR(Status) || CharBuffer != gUnicodeFileTag) {
+
+ gEfiShellProtocol->GetFilePosition (Handle, &OriginalFilePosition);
+ gEfiShellProtocol->SetFilePosition (Handle, 0);
+ CharSize = sizeof (CHAR16);
+ Status = gEfiShellProtocol->ReadFile (Handle, &CharSize, &CharBuffer);
+ if (EFI_ERROR (Status) || (CharBuffer != gUnicodeFileTag)) {
Status = EFI_BUFFER_TOO_SMALL;
}
- gEfiShellProtocol->SetFilePosition(Handle, OriginalFilePosition);
- gEfiShellProtocol->CloseFile(Handle);
+
+ gEfiShellProtocol->SetFilePosition (Handle, OriginalFilePosition);
+ gEfiShellProtocol->CloseFile (Handle);
return (Status);
}
@@ -510,16 +533,16 @@ IsUnicodeFile( **/
VOID
StripQuotes (
- IN OUT CHAR16 *TheString
+ IN OUT CHAR16 *TheString
)
{
- BOOLEAN RemoveNow;
+ BOOLEAN RemoveNow;
- for (RemoveNow = FALSE ; TheString != NULL && *TheString != CHAR_NULL ; TheString++) {
- if (*TheString == L'^' && *(TheString + 1) == L'\"') {
+ for (RemoveNow = FALSE; TheString != NULL && *TheString != CHAR_NULL; TheString++) {
+ if ((*TheString == L'^') && (*(TheString + 1) == L'\"')) {
TheString++;
} else if (*TheString == L'\"') {
- RemoveNow = (BOOLEAN)!RemoveNow;
+ RemoveNow = (BOOLEAN) !RemoveNow;
} else if (RemoveNow) {
*TheString = L' ';
}
@@ -535,10 +558,10 @@ StripQuotes ( **/
VOID
CalculateEfiHdrCrc (
- IN OUT EFI_TABLE_HEADER *Hdr
+ IN OUT EFI_TABLE_HEADER *Hdr
)
{
- UINT32 Crc;
+ UINT32 Crc;
Hdr->CRC32 = 0;
@@ -559,9 +582,9 @@ CalculateEfiHdrCrc ( @retval NULL FileName was invalid.
@return The modified FileName.
**/
-CHAR16*
+CHAR16 *
FixFileName (
- IN CHAR16 *FileName
+ IN CHAR16 *FileName
)
{
CHAR16 *Copy;
@@ -573,15 +596,16 @@ FixFileName ( if (FileName[0] == L'\"') {
Copy = FileName+1;
- if ((TempLocation = StrStr(Copy , L"\"")) != NULL) {
+ if ((TempLocation = StrStr (Copy, L"\"")) != NULL) {
TempLocation[0] = CHAR_NULL;
}
} else {
Copy = FileName;
- while(Copy[0] == L' ') {
+ while (Copy[0] == L' ') {
Copy++;
}
- if ((TempLocation = StrStr(Copy , L" ")) != NULL) {
+
+ if ((TempLocation = StrStr (Copy, L" ")) != NULL) {
TempLocation[0] = CHAR_NULL;
}
}
@@ -601,9 +625,9 @@ FixFileName ( @retval NULL FileName was invalid.
@return The modified FileName.
**/
-CHAR16*
+CHAR16 *
FixVarName (
- IN CHAR16 *FileName
+ IN CHAR16 *FileName
)
{
CHAR16 *Copy;
@@ -613,15 +637,14 @@ FixVarName ( if (FileName[0] == L'%') {
Copy = FileName+1;
- if ((TempLocation = StrStr(Copy , L"%")) != NULL) {
+ if ((TempLocation = StrStr (Copy, L"%")) != NULL) {
TempLocation[0] = CHAR_NULL;
}
}
- return (FixFileName(Copy));
+ return (FixFileName (Copy));
}
-
/**
Write the unicode file tag to the specified file.
@@ -635,22 +658,24 @@ FixVarName ( **/
EFI_STATUS
WriteFileTag (
- IN SHELL_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
)
{
- CHAR16 FileTag;
- UINTN Size;
- EFI_STATUS Status;
+ CHAR16 FileTag;
+ UINTN Size;
+ EFI_STATUS Status;
FileTag = gUnicodeFileTag;
- Size = sizeof FileTag;
- Status = ShellInfoObject.NewEfiShellProtocol->WriteFile (FileHandle, &Size,
- &FileTag);
+ Size = sizeof FileTag;
+ Status = ShellInfoObject.NewEfiShellProtocol->WriteFile (
+ FileHandle,
+ &Size,
+ &FileTag
+ );
ASSERT (EFI_ERROR (Status) || Size == sizeof FileTag);
return Status;
}
-
/**
Function will replace the current StdIn and StdOut in the ShellParameters protocol
structure by parsing NewCommandLine. The current values are returned to the
@@ -669,7 +694,7 @@ WriteFileTag ( @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,
@@ -678,323 +703,353 @@ UpdateStdInStdOutStdErr( OUT SYSTEM_TABLE_INFO *SystemTableInfo
)
{
- CHAR16 *CommandLineCopy;
- CHAR16 *CommandLineWalker;
- CHAR16 *StdErrFileName;
- CHAR16 *StdOutFileName;
- CHAR16 *StdInFileName;
- CHAR16 *StdInVarName;
- CHAR16 *StdOutVarName;
- CHAR16 *StdErrVarName;
- EFI_STATUS Status;
- SHELL_FILE_HANDLE TempHandle;
- UINT64 FileSize;
- BOOLEAN OutUnicode;
- BOOLEAN InUnicode;
- BOOLEAN ErrUnicode;
- BOOLEAN OutAppend;
- BOOLEAN ErrAppend;
- UINTN Size;
- SPLIT_LIST *Split;
- CHAR16 *FirstLocation;
- BOOLEAN Volatile;
-
- OutUnicode = TRUE;
- InUnicode = TRUE;
+ CHAR16 *CommandLineCopy;
+ CHAR16 *CommandLineWalker;
+ CHAR16 *StdErrFileName;
+ CHAR16 *StdOutFileName;
+ CHAR16 *StdInFileName;
+ CHAR16 *StdInVarName;
+ CHAR16 *StdOutVarName;
+ CHAR16 *StdErrVarName;
+ EFI_STATUS Status;
+ SHELL_FILE_HANDLE TempHandle;
+ UINT64 FileSize;
+ BOOLEAN OutUnicode;
+ BOOLEAN InUnicode;
+ BOOLEAN ErrUnicode;
+ BOOLEAN OutAppend;
+ BOOLEAN ErrAppend;
+ UINTN Size;
+ SPLIT_LIST *Split;
+ CHAR16 *FirstLocation;
+ BOOLEAN Volatile;
+
+ OutUnicode = TRUE;
+ InUnicode = TRUE;
AsciiRedirection = FALSE;
- ErrUnicode = TRUE;
- StdInVarName = NULL;
- StdOutVarName = NULL;
- StdErrVarName = NULL;
- StdErrFileName = NULL;
- StdInFileName = NULL;
- StdOutFileName = NULL;
- ErrAppend = FALSE;
- OutAppend = FALSE;
- CommandLineCopy = NULL;
- FirstLocation = NULL;
-
- if (ShellParameters == NULL || SystemTableInfo == NULL || OldStdIn == NULL || OldStdOut == NULL || OldStdErr == NULL) {
+ ErrUnicode = TRUE;
+ StdInVarName = NULL;
+ StdOutVarName = NULL;
+ StdErrVarName = NULL;
+ StdErrFileName = NULL;
+ StdInFileName = NULL;
+ StdOutFileName = NULL;
+ ErrAppend = FALSE;
+ OutAppend = FALSE;
+ CommandLineCopy = NULL;
+ FirstLocation = NULL;
+
+ if ((ShellParameters == NULL) || (SystemTableInfo == NULL) || (OldStdIn == NULL) || (OldStdOut == NULL) || (OldStdErr == NULL)) {
return (EFI_INVALID_PARAMETER);
}
- SystemTableInfo->ConIn = gST->ConIn;
- SystemTableInfo->ConInHandle = gST->ConsoleInHandle;
- SystemTableInfo->ConOut = gST->ConOut;
- SystemTableInfo->ConOutHandle = gST->ConsoleOutHandle;
- SystemTableInfo->ErrOut = gST->StdErr;
- SystemTableInfo->ErrOutHandle = gST->StandardErrorHandle;
- *OldStdIn = ShellParameters->StdIn;
- *OldStdOut = ShellParameters->StdOut;
- *OldStdErr = ShellParameters->StdErr;
+ SystemTableInfo->ConIn = gST->ConIn;
+ SystemTableInfo->ConInHandle = gST->ConsoleInHandle;
+ SystemTableInfo->ConOut = gST->ConOut;
+ SystemTableInfo->ConOutHandle = gST->ConsoleOutHandle;
+ SystemTableInfo->ErrOut = gST->StdErr;
+ SystemTableInfo->ErrOutHandle = gST->StandardErrorHandle;
+ *OldStdIn = ShellParameters->StdIn;
+ *OldStdOut = ShellParameters->StdOut;
+ *OldStdErr = ShellParameters->StdErr;
if (NewCommandLine == NULL) {
return (EFI_SUCCESS);
}
- CommandLineCopy = StrnCatGrow(&CommandLineCopy, NULL, NewCommandLine, 0);
+ CommandLineCopy = StrnCatGrow (&CommandLineCopy, NULL, NewCommandLine, 0);
if (CommandLineCopy == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- Status = EFI_SUCCESS;
- Split = NULL;
- FirstLocation = CommandLineCopy + StrLen(CommandLineCopy);
- StripQuotes(CommandLineCopy);
+ Status = EFI_SUCCESS;
+ Split = NULL;
+ FirstLocation = CommandLineCopy + StrLen (CommandLineCopy);
+
+ StripQuotes (CommandLineCopy);
- if (!IsListEmpty(&ShellInfoObject.SplitList.Link)) {
- Split = (SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link);
- if (Split != NULL && Split->SplitStdIn != NULL) {
- ShellParameters->StdIn = Split->SplitStdIn;
+ if (!IsListEmpty (&ShellInfoObject.SplitList.Link)) {
+ Split = (SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link);
+ if ((Split != NULL) && (Split->SplitStdIn != NULL)) {
+ ShellParameters->StdIn = Split->SplitStdIn;
}
- if (Split != NULL && Split->SplitStdOut != NULL) {
+
+ if ((Split != NULL) && (Split->SplitStdOut != NULL)) {
ShellParameters->StdOut = Split->SplitStdOut;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>>v ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 12, L' ');
- StdErrVarName = CommandLineWalker += 6;
- ErrAppend = TRUE;
- if (StrStr(CommandLineWalker, L" 2>>v ") != NULL) {
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2>>v ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 12, L' ');
+ StdErrVarName = CommandLineWalker += 6;
+ ErrAppend = TRUE;
+ if (StrStr (CommandLineWalker, L" 2>>v ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>>v ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 12, L' ');
- StdOutVarName = CommandLineWalker += 6;
- OutAppend = TRUE;
- if (StrStr(CommandLineWalker, L" 1>>v ") != NULL) {
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>>v ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 12, L' ');
+ StdOutVarName = CommandLineWalker += 6;
+ OutAppend = TRUE;
+ if (StrStr (CommandLineWalker, L" 1>>v ") != NULL) {
Status = EFI_NOT_FOUND;
}
- } else if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >>v ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 10, L' ');
- StdOutVarName = CommandLineWalker += 5;
- OutAppend = TRUE;
- if (StrStr(CommandLineWalker, L" >>v ") != NULL) {
+ } else if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >>v ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 10, L' ');
+ StdOutVarName = CommandLineWalker += 5;
+ OutAppend = TRUE;
+ if (StrStr (CommandLineWalker, L" >>v ") != NULL) {
Status = EFI_NOT_FOUND;
}
- } else if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >v ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 8, L' ');
- StdOutVarName = CommandLineWalker += 4;
- OutAppend = FALSE;
- if (StrStr(CommandLineWalker, L" >v ") != NULL) {
+ } else if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >v ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 8, L' ');
+ StdOutVarName = CommandLineWalker += 4;
+ OutAppend = FALSE;
+ if (StrStr (CommandLineWalker, L" >v ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>>a ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 12, L' ');
- StdOutFileName = CommandLineWalker += 6;
- OutAppend = TRUE;
- OutUnicode = FALSE;
- if (StrStr(CommandLineWalker, L" 1>>a ") != NULL) {
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>>a ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 12, L' ');
+ StdOutFileName = CommandLineWalker += 6;
+ OutAppend = TRUE;
+ OutUnicode = FALSE;
+ if (StrStr (CommandLineWalker, L" 1>>a ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>> ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 10, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>> ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 10, L' ');
if (StdOutFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdOutFileName = CommandLineWalker += 5;
- OutAppend = TRUE;
+ StdOutFileName = CommandLineWalker += 5;
+ OutAppend = TRUE;
}
- if (StrStr(CommandLineWalker, L" 1>> ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" 1>> ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >> ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 8, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >> ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 8, L' ');
if (StdOutFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdOutFileName = CommandLineWalker += 4;
- OutAppend = TRUE;
+ StdOutFileName = CommandLineWalker += 4;
+ OutAppend = TRUE;
}
- if (StrStr(CommandLineWalker, L" >> ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" >> ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >>a ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 10, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >>a ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 10, L' ');
if (StdOutFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdOutFileName = CommandLineWalker += 5;
- OutAppend = TRUE;
- OutUnicode = FALSE;
+ StdOutFileName = CommandLineWalker += 5;
+ OutAppend = TRUE;
+ OutUnicode = FALSE;
}
- if (StrStr(CommandLineWalker, L" >>a ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" >>a ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>a ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 10, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>a ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 10, L' ');
if (StdOutFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdOutFileName = CommandLineWalker += 5;
- OutAppend = FALSE;
- OutUnicode = FALSE;
+ StdOutFileName = CommandLineWalker += 5;
+ OutAppend = FALSE;
+ OutUnicode = FALSE;
}
- if (StrStr(CommandLineWalker, L" 1>a ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" 1>a ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >a ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 8, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >a ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 8, L' ');
if (StdOutFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdOutFileName = CommandLineWalker += 4;
- OutAppend = FALSE;
- OutUnicode = FALSE;
+ StdOutFileName = CommandLineWalker += 4;
+ OutAppend = FALSE;
+ OutUnicode = FALSE;
}
- if (StrStr(CommandLineWalker, L" >a ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" >a ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>> ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 10, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2>> ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 10, L' ');
if (StdErrFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdErrFileName = CommandLineWalker += 5;
- ErrAppend = TRUE;
+ StdErrFileName = CommandLineWalker += 5;
+ ErrAppend = TRUE;
}
- if (StrStr(CommandLineWalker, L" 2>> ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" 2>> ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>v ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 10, L' ');
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2>v ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 10, L' ');
if (StdErrVarName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdErrVarName = CommandLineWalker += 5;
- ErrAppend = FALSE;
+ StdErrVarName = CommandLineWalker += 5;
+ ErrAppend = FALSE;
}
- if (StrStr(CommandLineWalker, L" 2>v ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" 2>v ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>v ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 10, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>v ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 10, L' ');
if (StdOutVarName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdOutVarName = CommandLineWalker += 5;
- OutAppend = FALSE;
+ StdOutVarName = CommandLineWalker += 5;
+ OutAppend = FALSE;
}
- if (StrStr(CommandLineWalker, L" 1>v ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" 1>v ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>a ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 10, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2>a ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 10, L' ');
if (StdErrFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdErrFileName = CommandLineWalker += 5;
- ErrAppend = FALSE;
- ErrUnicode = FALSE;
+ StdErrFileName = CommandLineWalker += 5;
+ ErrAppend = FALSE;
+ ErrUnicode = FALSE;
}
- if (StrStr(CommandLineWalker, L" 2>a ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" 2>a ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2> ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 8, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2> ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 8, L' ');
if (StdErrFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdErrFileName = CommandLineWalker += 4;
- ErrAppend = FALSE;
+ StdErrFileName = CommandLineWalker += 4;
+ ErrAppend = FALSE;
}
- if (StrStr(CommandLineWalker, L" 2> ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" 2> ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1> ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 8, L' ');
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1> ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 8, L' ');
if (StdOutFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdOutFileName = CommandLineWalker += 4;
- OutAppend = FALSE;
+ StdOutFileName = CommandLineWalker += 4;
+ OutAppend = FALSE;
}
- if (StrStr(CommandLineWalker, L" 1> ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" 1> ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" > ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 6, L' ');
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" > ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 6, L' ');
if (StdOutFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdOutFileName = CommandLineWalker += 3;
- OutAppend = FALSE;
+ StdOutFileName = CommandLineWalker += 3;
+ OutAppend = FALSE;
}
- if (StrStr(CommandLineWalker, L" > ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" > ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" < ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 6, L' ');
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" < ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 6, L' ');
if (StdInFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdInFileName = CommandLineWalker += 3;
+ StdInFileName = CommandLineWalker += 3;
}
- if (StrStr(CommandLineWalker, L" < ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" < ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" <a ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 8, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" <a ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 8, L' ');
if (StdInFileName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdInFileName = CommandLineWalker += 4;
- InUnicode = FALSE;
+ StdInFileName = CommandLineWalker += 4;
+ InUnicode = FALSE;
AsciiRedirection = TRUE;
}
- if (StrStr(CommandLineWalker, L" <a ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" <a ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
- if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" <v ")) != NULL) {
- FirstLocation = MIN(CommandLineWalker, FirstLocation);
- SetMem16(CommandLineWalker, 8, L' ');
+
+ if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" <v ")) != NULL)) {
+ FirstLocation = MIN (CommandLineWalker, FirstLocation);
+ SetMem16 (CommandLineWalker, 8, L' ');
if (StdInVarName != NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- StdInVarName = CommandLineWalker += 4;
+ StdInVarName = CommandLineWalker += 4;
}
- if (StrStr(CommandLineWalker, L" <v ") != NULL) {
+
+ if (StrStr (CommandLineWalker, L" <v ") != NULL) {
Status = EFI_NOT_FOUND;
}
}
@@ -1002,43 +1057,48 @@ UpdateStdInStdOutStdErr( //
// re-populate the string to support any filenames that were in quotes.
//
- StrnCpyS(CommandLineCopy, StrSize(CommandLineCopy)/sizeof(CHAR16), NewCommandLine, StrLen(NewCommandLine));
+ StrnCpyS (CommandLineCopy, StrSize (CommandLineCopy)/sizeof (CHAR16), NewCommandLine, StrLen (NewCommandLine));
- if (FirstLocation != CommandLineCopy + StrLen(CommandLineCopy)
- && (((UINTN)FirstLocation - (UINTN)CommandLineCopy)/sizeof(CHAR16) < StrLen(NewCommandLine))
- ){
- *(NewCommandLine + ((UINTN)FirstLocation - (UINTN)CommandLineCopy)/sizeof(CHAR16)) = CHAR_NULL;
+ if ( (FirstLocation != CommandLineCopy + StrLen (CommandLineCopy))
+ && (((UINTN)FirstLocation - (UINTN)CommandLineCopy)/sizeof (CHAR16) < StrLen (NewCommandLine))
+ )
+ {
+ *(NewCommandLine + ((UINTN)FirstLocation - (UINTN)CommandLineCopy)/sizeof (CHAR16)) = CHAR_NULL;
}
- if (!EFI_ERROR(Status)) {
-
+ if (!EFI_ERROR (Status)) {
if (StdErrFileName != NULL) {
- if ((StdErrFileName = FixFileName(StdErrFileName)) == NULL) {
+ if ((StdErrFileName = FixFileName (StdErrFileName)) == NULL) {
Status = EFI_INVALID_PARAMETER;
}
}
+
if (StdOutFileName != NULL) {
- if ((StdOutFileName = FixFileName(StdOutFileName)) == NULL) {
+ if ((StdOutFileName = FixFileName (StdOutFileName)) == NULL) {
Status = EFI_INVALID_PARAMETER;
}
}
+
if (StdInFileName != NULL) {
- if ((StdInFileName = FixFileName(StdInFileName)) == NULL) {
+ if ((StdInFileName = FixFileName (StdInFileName)) == NULL) {
Status = EFI_INVALID_PARAMETER;
}
}
+
if (StdErrVarName != NULL) {
- if ((StdErrVarName = FixVarName(StdErrVarName)) == NULL) {
+ if ((StdErrVarName = FixVarName (StdErrVarName)) == NULL) {
Status = EFI_INVALID_PARAMETER;
}
}
+
if (StdOutVarName != NULL) {
- if ((StdOutVarName = FixVarName(StdOutVarName)) == NULL) {
+ if ((StdOutVarName = FixVarName (StdOutVarName)) == NULL) {
Status = EFI_INVALID_PARAMETER;
}
}
+
if (StdInVarName != NULL) {
- if ((StdInVarName = FixVarName(StdInVarName)) == NULL) {
+ if ((StdInVarName = FixVarName (StdInVarName)) == NULL) {
Status = EFI_INVALID_PARAMETER;
}
}
@@ -1047,52 +1107,53 @@ UpdateStdInStdOutStdErr( // Verify not the same and not duplicating something from a split
//
if (
- //
- // Check that no 2 filenames are the same
- //
- (StdErrFileName != NULL && StdOutFileName!= NULL && StringNoCaseCompare(&StdErrFileName, &StdOutFileName) == 0)
- ||(StdErrFileName != NULL && StdInFileName != NULL && StringNoCaseCompare(&StdErrFileName, &StdInFileName ) == 0)
- ||(StdOutFileName != NULL && StdInFileName != NULL && StringNoCaseCompare(&StdOutFileName, &StdInFileName ) == 0)
- //
- // Check that no 2 variable names are the same
- //
- ||(StdErrVarName != NULL && StdInVarName != NULL && StringNoCaseCompare(&StdErrVarName , &StdInVarName ) == 0)
- ||(StdOutVarName != NULL && StdInVarName != NULL && StringNoCaseCompare(&StdOutVarName , &StdInVarName ) == 0)
- ||(StdErrVarName != NULL && StdOutVarName != NULL && StringNoCaseCompare(&StdErrVarName , &StdOutVarName ) == 0)
- //
- // When a split (using | operator) is in place some are not allowed
- //
- ||(Split != NULL && Split->SplitStdIn != NULL && (StdInVarName != NULL || StdInFileName != NULL))
- ||(Split != NULL && Split->SplitStdOut != NULL && (StdOutVarName != NULL || StdOutFileName != NULL))
- //
- // Check that nothing is trying to be output to 2 locations.
- //
- ||(StdErrFileName != NULL && StdErrVarName != NULL)
- ||(StdOutFileName != NULL && StdOutVarName != NULL)
- ||(StdInFileName != NULL && StdInVarName != NULL)
- //
- // Check for no volatile environment variables
- //
- ||(StdErrVarName != NULL && !EFI_ERROR (IsVolatileEnv (StdErrVarName, &Volatile)) && !Volatile)
- ||(StdOutVarName != NULL && !EFI_ERROR (IsVolatileEnv (StdOutVarName, &Volatile)) && !Volatile)
- //
- // Cant redirect during a reconnect operation.
- //
- ||(StrStr(NewCommandLine, L"connect -r") != NULL
- && (StdOutVarName != NULL || StdOutFileName != NULL || StdErrFileName != NULL || StdErrVarName != NULL))
- //
- // Check that filetypes (Unicode/Ascii) do not change during an append
- //
- ||(StdOutFileName != NULL && OutUnicode && OutAppend && (!EFI_ERROR(ShellFileExists(StdOutFileName)) && EFI_ERROR(IsUnicodeFile(StdOutFileName))))
- ||(StdErrFileName != NULL && ErrUnicode && ErrAppend && (!EFI_ERROR(ShellFileExists(StdErrFileName)) && EFI_ERROR(IsUnicodeFile(StdErrFileName))))
- ||(StdOutFileName != NULL && !OutUnicode && OutAppend && (!EFI_ERROR(ShellFileExists(StdOutFileName)) && !EFI_ERROR(IsUnicodeFile(StdOutFileName))))
- ||(StdErrFileName != NULL && !ErrUnicode && ErrAppend && (!EFI_ERROR(ShellFileExists(StdErrFileName)) && !EFI_ERROR(IsUnicodeFile(StdErrFileName))))
- ){
- Status = EFI_INVALID_PARAMETER;
+ //
+ // Check that no 2 filenames are the same
+ //
+ ((StdErrFileName != NULL) && (StdOutFileName != NULL) && (StringNoCaseCompare (&StdErrFileName, &StdOutFileName) == 0))
+ || ((StdErrFileName != NULL) && (StdInFileName != NULL) && (StringNoCaseCompare (&StdErrFileName, &StdInFileName) == 0))
+ || ((StdOutFileName != NULL) && (StdInFileName != NULL) && (StringNoCaseCompare (&StdOutFileName, &StdInFileName) == 0))
+ //
+ // Check that no 2 variable names are the same
+ //
+ || ((StdErrVarName != NULL) && (StdInVarName != NULL) && (StringNoCaseCompare (&StdErrVarName, &StdInVarName) == 0))
+ || ((StdOutVarName != NULL) && (StdInVarName != NULL) && (StringNoCaseCompare (&StdOutVarName, &StdInVarName) == 0))
+ || ((StdErrVarName != NULL) && (StdOutVarName != NULL) && (StringNoCaseCompare (&StdErrVarName, &StdOutVarName) == 0))
+ //
+ // When a split (using | operator) is in place some are not allowed
+ //
+ || ((Split != NULL) && (Split->SplitStdIn != NULL) && ((StdInVarName != NULL) || (StdInFileName != NULL)))
+ || ((Split != NULL) && (Split->SplitStdOut != NULL) && ((StdOutVarName != NULL) || (StdOutFileName != NULL)))
+ //
+ // Check that nothing is trying to be output to 2 locations.
+ //
+ || ((StdErrFileName != NULL) && (StdErrVarName != NULL))
+ || ((StdOutFileName != NULL) && (StdOutVarName != NULL))
+ || ((StdInFileName != NULL) && (StdInVarName != NULL))
+ //
+ // Check for no volatile environment variables
+ //
+ || ((StdErrVarName != NULL) && !EFI_ERROR (IsVolatileEnv (StdErrVarName, &Volatile)) && !Volatile)
+ || ((StdOutVarName != NULL) && !EFI_ERROR (IsVolatileEnv (StdOutVarName, &Volatile)) && !Volatile)
+ //
+ // Cant redirect during a reconnect operation.
+ //
+ || ( (StrStr (NewCommandLine, L"connect -r") != NULL)
+ && ((StdOutVarName != NULL) || (StdOutFileName != NULL) || (StdErrFileName != NULL) || (StdErrVarName != NULL)))
+ //
+ // Check that filetypes (Unicode/Ascii) do not change during an append
+ //
+ || ((StdOutFileName != NULL) && OutUnicode && OutAppend && (!EFI_ERROR (ShellFileExists (StdOutFileName)) && EFI_ERROR (IsUnicodeFile (StdOutFileName))))
+ || ((StdErrFileName != NULL) && ErrUnicode && ErrAppend && (!EFI_ERROR (ShellFileExists (StdErrFileName)) && EFI_ERROR (IsUnicodeFile (StdErrFileName))))
+ || ((StdOutFileName != NULL) && !OutUnicode && OutAppend && (!EFI_ERROR (ShellFileExists (StdOutFileName)) && !EFI_ERROR (IsUnicodeFile (StdOutFileName))))
+ || ((StdErrFileName != NULL) && !ErrUnicode && ErrAppend && (!EFI_ERROR (ShellFileExists (StdErrFileName)) && !EFI_ERROR (IsUnicodeFile (StdErrFileName))))
+ )
+ {
+ Status = EFI_INVALID_PARAMETER;
ShellParameters->StdIn = *OldStdIn;
ShellParameters->StdOut = *OldStdOut;
ShellParameters->StdErr = *OldStdErr;
- } else if (!EFI_ERROR(Status)){
+ } else if (!EFI_ERROR (Status)) {
//
// Open the Std<Whatever> and we should not have conflicts here...
//
@@ -1105,62 +1166,69 @@ UpdateStdInStdOutStdErr( //
// delete existing file.
//
- ShellInfoObject.NewEfiShellProtocol->DeleteFileByName(StdErrFileName);
+ ShellInfoObject.NewEfiShellProtocol->DeleteFileByName (StdErrFileName);
}
- Status = ShellOpenFileByName(StdErrFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE,0);
- if (!ErrAppend && ErrUnicode && !EFI_ERROR(Status)) {
+
+ Status = ShellOpenFileByName (StdErrFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, 0);
+ if (!ErrAppend && ErrUnicode && !EFI_ERROR (Status)) {
Status = WriteFileTag (TempHandle);
}
- if (!ErrUnicode && !EFI_ERROR(Status)) {
- TempHandle = CreateFileInterfaceFile(TempHandle, FALSE);
- ASSERT(TempHandle != NULL);
+
+ if (!ErrUnicode && !EFI_ERROR (Status)) {
+ TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
+ ASSERT (TempHandle != NULL);
}
- if (!EFI_ERROR(Status)) {
+
+ if (!EFI_ERROR (Status)) {
ShellParameters->StdErr = TempHandle;
- gST->StdErr = CreateSimpleTextOutOnFile(TempHandle, &gST->StandardErrorHandle, gST->StdErr);
+ gST->StdErr = CreateSimpleTextOutOnFile (TempHandle, &gST->StandardErrorHandle, gST->StdErr);
}
}
//
// StdOut to a file
//
- if (!EFI_ERROR(Status) && StdOutFileName != NULL) {
+ if (!EFI_ERROR (Status) && (StdOutFileName != NULL)) {
if (!OutAppend) {
//
// delete existing file.
//
- ShellInfoObject.NewEfiShellProtocol->DeleteFileByName(StdOutFileName);
+ ShellInfoObject.NewEfiShellProtocol->DeleteFileByName (StdOutFileName);
}
- Status = ShellOpenFileByName(StdOutFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE,0);
+
+ Status = ShellOpenFileByName (StdOutFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, 0);
if (TempHandle == NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
if (gUnicodeCollation->MetaiMatch (gUnicodeCollation, StdOutFileName, L"NUL")) {
- //no-op
- } else if (!OutAppend && OutUnicode && !EFI_ERROR(Status)) {
+ // no-op
+ } else if (!OutAppend && OutUnicode && !EFI_ERROR (Status)) {
Status = WriteFileTag (TempHandle);
} else if (OutAppend) {
- Status = ShellInfoObject.NewEfiShellProtocol->GetFileSize(TempHandle, &FileSize);
- if (!EFI_ERROR(Status)) {
+ Status = ShellInfoObject.NewEfiShellProtocol->GetFileSize (TempHandle, &FileSize);
+ if (!EFI_ERROR (Status)) {
//
// When appending to a new unicode file, write the file tag.
// Otherwise (ie. when appending to a new ASCII file, or an
// existent file with any encoding), just seek to the end.
//
Status = (FileSize == 0 && OutUnicode) ?
- WriteFileTag (TempHandle) :
- ShellInfoObject.NewEfiShellProtocol->SetFilePosition (
- TempHandle,
- FileSize);
+ WriteFileTag (TempHandle) :
+ ShellInfoObject.NewEfiShellProtocol->SetFilePosition (
+ TempHandle,
+ FileSize
+ );
}
}
- if (!OutUnicode && !EFI_ERROR(Status)) {
- TempHandle = CreateFileInterfaceFile(TempHandle, FALSE);
- ASSERT(TempHandle != NULL);
+
+ if (!OutUnicode && !EFI_ERROR (Status)) {
+ TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
+ ASSERT (TempHandle != NULL);
}
- if (!EFI_ERROR(Status)) {
+
+ if (!EFI_ERROR (Status)) {
ShellParameters->StdOut = TempHandle;
- gST->ConOut = CreateSimpleTextOutOnFile(TempHandle, &gST->ConsoleOutHandle, gST->ConOut);
+ gST->ConOut = CreateSimpleTextOutOnFile (TempHandle, &gST->ConsoleOutHandle, gST->ConOut);
}
}
}
@@ -1168,52 +1236,55 @@ UpdateStdInStdOutStdErr( //
// StdOut to a var
//
- if (!EFI_ERROR(Status) && StdOutVarName != NULL) {
+ if (!EFI_ERROR (Status) && (StdOutVarName != NULL)) {
if (!OutAppend) {
//
// delete existing variable.
//
- SHELL_SET_ENVIRONMENT_VARIABLE_V(StdOutVarName, 0, L"");
+ SHELL_SET_ENVIRONMENT_VARIABLE_V (StdOutVarName, 0, L"");
}
- TempHandle = CreateFileInterfaceEnv(StdOutVarName);
- ASSERT(TempHandle != NULL);
+
+ TempHandle = CreateFileInterfaceEnv (StdOutVarName);
+ ASSERT (TempHandle != NULL);
ShellParameters->StdOut = TempHandle;
- gST->ConOut = CreateSimpleTextOutOnFile(TempHandle, &gST->ConsoleOutHandle, gST->ConOut);
+ gST->ConOut = CreateSimpleTextOutOnFile (TempHandle, &gST->ConsoleOutHandle, gST->ConOut);
}
//
// StdErr to a var
//
- if (!EFI_ERROR(Status) && StdErrVarName != NULL) {
+ if (!EFI_ERROR (Status) && (StdErrVarName != NULL)) {
if (!ErrAppend) {
//
// delete existing variable.
//
- SHELL_SET_ENVIRONMENT_VARIABLE_V(StdErrVarName, 0, L"");
+ SHELL_SET_ENVIRONMENT_VARIABLE_V (StdErrVarName, 0, L"");
}
- TempHandle = CreateFileInterfaceEnv(StdErrVarName);
- ASSERT(TempHandle != NULL);
+
+ TempHandle = CreateFileInterfaceEnv (StdErrVarName);
+ ASSERT (TempHandle != NULL);
ShellParameters->StdErr = TempHandle;
- gST->StdErr = CreateSimpleTextOutOnFile(TempHandle, &gST->StandardErrorHandle, gST->StdErr);
+ gST->StdErr = CreateSimpleTextOutOnFile (TempHandle, &gST->StandardErrorHandle, gST->StdErr);
}
//
// StdIn from a var
//
- if (!EFI_ERROR(Status) && StdInVarName != NULL) {
- TempHandle = CreateFileInterfaceEnv(StdInVarName);
+ if (!EFI_ERROR (Status) && (StdInVarName != NULL)) {
+ TempHandle = CreateFileInterfaceEnv (StdInVarName);
if (TempHandle == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
if (!InUnicode) {
- TempHandle = CreateFileInterfaceFile(TempHandle, FALSE);
+ TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
}
+
Size = 0;
- if (TempHandle == NULL || ((EFI_FILE_PROTOCOL*)TempHandle)->Read(TempHandle, &Size, NULL) != EFI_BUFFER_TOO_SMALL) {
+ if ((TempHandle == NULL) || (((EFI_FILE_PROTOCOL *)TempHandle)->Read (TempHandle, &Size, NULL) != EFI_BUFFER_TOO_SMALL)) {
Status = EFI_INVALID_PARAMETER;
} else {
ShellParameters->StdIn = TempHandle;
- gST->ConIn = CreateSimpleTextInOnFile(TempHandle, &gST->ConsoleInHandle);
+ gST->ConIn = CreateSimpleTextInOnFile (TempHandle, &gST->ConsoleInHandle);
}
}
}
@@ -1221,37 +1292,40 @@ UpdateStdInStdOutStdErr( //
// StdIn from a file
//
- if (!EFI_ERROR(Status) && StdInFileName != NULL) {
- Status = ShellOpenFileByName(
- StdInFileName,
- &TempHandle,
- EFI_FILE_MODE_READ,
- 0);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status) && (StdInFileName != NULL)) {
+ Status = ShellOpenFileByName (
+ StdInFileName,
+ &TempHandle,
+ EFI_FILE_MODE_READ,
+ 0
+ );
+ if (!EFI_ERROR (Status)) {
if (!InUnicode) {
//
// Create the ASCII->Unicode conversion layer
//
- TempHandle = CreateFileInterfaceFile(TempHandle, FALSE);
+ TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
}
+
ShellParameters->StdIn = TempHandle;
- gST->ConIn = CreateSimpleTextInOnFile(TempHandle, &gST->ConsoleInHandle);
+ gST->ConIn = CreateSimpleTextInOnFile (TempHandle, &gST->ConsoleInHandle);
}
}
}
}
- FreePool(CommandLineCopy);
- CalculateEfiHdrCrc(&gST->Hdr);
+ FreePool (CommandLineCopy);
+
+ CalculateEfiHdrCrc (&gST->Hdr);
- if (gST->ConIn == NULL ||gST->ConOut == NULL) {
+ if ((gST->ConIn == NULL) || (gST->ConOut == NULL)) {
Status = EFI_OUT_OF_RESOURCES;
}
if (Status == EFI_NOT_FOUND) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_REDUNDA_REDIR), ShellInfoObject.HiiHandle);
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_REDIR), ShellInfoObject.HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_REDUNDA_REDIR), ShellInfoObject.HiiHandle);
+ } else if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_REDIR), ShellInfoObject.HiiHandle);
}
return (Status);
@@ -1276,57 +1350,67 @@ RestoreStdInStdOutStdErr ( IN SYSTEM_TABLE_INFO *SystemTableInfo
)
{
- SPLIT_LIST *Split;
-
- if (ShellParameters == NULL
- ||OldStdIn == NULL
- ||OldStdOut == NULL
- ||OldStdErr == NULL
- ||SystemTableInfo == NULL) {
+ SPLIT_LIST *Split;
+
+ if ( (ShellParameters == NULL)
+ || (OldStdIn == NULL)
+ || (OldStdOut == NULL)
+ || (OldStdErr == NULL)
+ || (SystemTableInfo == NULL))
+ {
return (EFI_INVALID_PARAMETER);
}
- if (!IsListEmpty(&ShellInfoObject.SplitList.Link)) {
- Split = (SPLIT_LIST*)GetFirstNode(&ShellInfoObject.SplitList.Link);
+
+ if (!IsListEmpty (&ShellInfoObject.SplitList.Link)) {
+ Split = (SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link);
} else {
Split = NULL;
}
+
if (ShellParameters->StdIn != *OldStdIn) {
- if ((Split != NULL && Split->SplitStdIn != ShellParameters->StdIn) || Split == NULL) {
- gEfiShellProtocol->CloseFile(ShellParameters->StdIn);
+ if (((Split != NULL) && (Split->SplitStdIn != ShellParameters->StdIn)) || (Split == NULL)) {
+ gEfiShellProtocol->CloseFile (ShellParameters->StdIn);
}
+
ShellParameters->StdIn = *OldStdIn;
}
+
if (ShellParameters->StdOut != *OldStdOut) {
- if ((Split != NULL && Split->SplitStdOut != ShellParameters->StdOut) || Split == NULL) {
- gEfiShellProtocol->CloseFile(ShellParameters->StdOut);
+ if (((Split != NULL) && (Split->SplitStdOut != ShellParameters->StdOut)) || (Split == NULL)) {
+ gEfiShellProtocol->CloseFile (ShellParameters->StdOut);
}
+
ShellParameters->StdOut = *OldStdOut;
}
+
if (ShellParameters->StdErr != *OldStdErr) {
- gEfiShellProtocol->CloseFile(ShellParameters->StdErr);
+ gEfiShellProtocol->CloseFile (ShellParameters->StdErr);
ShellParameters->StdErr = *OldStdErr;
}
if (gST->ConIn != SystemTableInfo->ConIn) {
- CloseSimpleTextInOnFile(gST->ConIn);
- gST->ConIn = SystemTableInfo->ConIn;
- gST->ConsoleInHandle = SystemTableInfo->ConInHandle;
+ CloseSimpleTextInOnFile (gST->ConIn);
+ gST->ConIn = SystemTableInfo->ConIn;
+ gST->ConsoleInHandle = SystemTableInfo->ConInHandle;
}
+
if (gST->ConOut != SystemTableInfo->ConOut) {
- CloseSimpleTextOutOnFile(gST->ConOut);
- gST->ConOut = SystemTableInfo->ConOut;
- gST->ConsoleOutHandle = SystemTableInfo->ConOutHandle;
+ CloseSimpleTextOutOnFile (gST->ConOut);
+ gST->ConOut = SystemTableInfo->ConOut;
+ gST->ConsoleOutHandle = SystemTableInfo->ConOutHandle;
}
+
if (gST->StdErr != SystemTableInfo->ErrOut) {
- CloseSimpleTextOutOnFile(gST->StdErr);
- gST->StdErr = SystemTableInfo->ErrOut;
- gST->StandardErrorHandle = SystemTableInfo->ErrOutHandle;
+ CloseSimpleTextOutOnFile (gST->StdErr);
+ gST->StdErr = SystemTableInfo->ErrOut;
+ gST->StandardErrorHandle = SystemTableInfo->ErrOutHandle;
}
- CalculateEfiHdrCrc(&gST->Hdr);
+ CalculateEfiHdrCrc (&gST->Hdr);
return (EFI_SUCCESS);
}
+
/**
Function will replace the current Argc and Argv in the ShellParameters protocol
structure by parsing NewCommandLine. The current values are returned to the
@@ -1346,7 +1430,7 @@ RestoreStdInStdOutStdErr ( @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,
@@ -1354,14 +1438,15 @@ UpdateArgcArgv( OUT UINTN *OldArgc OPTIONAL
)
{
- BOOLEAN StripParamQuotation;
+ BOOLEAN StripParamQuotation;
- ASSERT(ShellParameters != NULL);
+ ASSERT (ShellParameters != NULL);
StripParamQuotation = TRUE;
if (OldArgc != NULL) {
*OldArgc = ShellParameters->Argc;
}
+
if (OldArgc != NULL) {
*OldArgv = ShellParameters->Argv;
}
@@ -1370,11 +1455,12 @@ UpdateArgcArgv( StripParamQuotation = FALSE;
}
- return ParseCommandLineToArgs( NewCommandLine,
- StripParamQuotation,
- &(ShellParameters->Argv),
- &(ShellParameters->Argc)
- );
+ return ParseCommandLineToArgs (
+ NewCommandLine,
+ StripParamQuotation,
+ &(ShellParameters->Argv),
+ &(ShellParameters->Argc)
+ );
}
/**
@@ -1387,28 +1473,32 @@ 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
)
{
- UINTN LoopCounter;
- ASSERT(ShellParameters != NULL);
- ASSERT(OldArgv != NULL);
- ASSERT(OldArgc != NULL);
+ UINTN LoopCounter;
+
+ ASSERT (ShellParameters != NULL);
+ ASSERT (OldArgv != NULL);
+ ASSERT (OldArgc != NULL);
if (ShellParameters->Argv != NULL) {
for ( LoopCounter = 0
- ; LoopCounter < ShellParameters->Argc
- ; LoopCounter++
- ){
- FreePool(ShellParameters->Argv[LoopCounter]);
+ ; LoopCounter < ShellParameters->Argc
+ ; LoopCounter++
+ )
+ {
+ FreePool (ShellParameters->Argv[LoopCounter]);
}
- FreePool(ShellParameters->Argv);
+
+ FreePool (ShellParameters->Argv);
}
+
ShellParameters->Argv = *OldArgv;
- *OldArgv = NULL;
+ *OldArgv = NULL;
ShellParameters->Argc = *OldArgc;
- *OldArgc = 0;
+ *OldArgc = 0;
}
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.h b/ShellPkg/Application/Shell/ShellParametersProtocol.h index c50250696a..2d12fa90b3 100644 --- a/ShellPkg/Application/Shell/ShellParametersProtocol.h +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.h @@ -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,19 +93,19 @@ 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
);
typedef struct {
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
- EFI_HANDLE ConInHandle;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
- EFI_HANDLE ConOutHandle;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ErrOut;
- EFI_HANDLE ErrOutHandle;
+ EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
+ EFI_HANDLE ConInHandle;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
+ EFI_HANDLE ConOutHandle;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ErrOut;
+ EFI_HANDLE ErrOutHandle;
} SYSTEM_TABLE_INFO;
/**
@@ -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,11 +172,11 @@ RestoreStdInStdOutStdErr ( @return EFI_OUT_OF_RESOURCES a memory allocation failed.
**/
EFI_STATUS
-ParseCommandLineToArgs(
- IN CONST CHAR16 *CommandLine,
- IN BOOLEAN StripQuotation,
- IN OUT CHAR16 ***Argv,
- IN OUT UINTN *Argc
+ParseCommandLineToArgs (
+ IN CONST CHAR16 *CommandLine,
+ IN BOOLEAN StripQuotation,
+ IN OUT CHAR16 ***Argv,
+ IN OUT UINTN *Argc
);
/**
@@ -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_
-
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index e79c39058b..509eb60e40 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -27,11 +27,11 @@ EFI_STATUS
EFIAPI
EfiShellClose (
- IN SHELL_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
)
{
- ShellFileHandleRemove(FileHandle);
- return (FileHandleClose(ConvertShellHandleToEfiFileProtocol(FileHandle)));
+ ShellFileHandleRemove (FileHandle);
+ return (FileHandleClose (ConvertShellHandleToEfiFileProtocol (FileHandle)));
}
/**
@@ -44,8 +44,8 @@ EfiShellClose ( @retval FALSE gEfiBlockIoProtocolGuid was not found.
**/
BOOLEAN
-InternalShellProtocolIsBlockIoPresent(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+InternalShellProtocolIsBlockIoPresent (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy;
@@ -54,12 +54,13 @@ InternalShellProtocolIsBlockIoPresent( Handle = NULL;
- DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL*)DevicePath;
- Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &DevicePathCopy, &Handle);
+ DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL *)DevicePath;
+ Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DevicePathCopy, &Handle);
- if ((Handle != NULL) && (!EFI_ERROR(Status))) {
+ if ((Handle != NULL) && (!EFI_ERROR (Status))) {
return (TRUE);
}
+
return (FALSE);
}
@@ -73,8 +74,8 @@ InternalShellProtocolIsBlockIoPresent( @retval FALSE gEfiSimpleFileSystemProtocolGuid was not found.
**/
BOOLEAN
-InternalShellProtocolIsSimpleFileSystemPresent(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+InternalShellProtocolIsSimpleFileSystemPresent (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy;
@@ -83,16 +84,16 @@ InternalShellProtocolIsSimpleFileSystemPresent( Handle = NULL;
- DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL*)DevicePath;
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle);
+ DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL *)DevicePath;
+ Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle);
- if ((Handle != NULL) && (!EFI_ERROR(Status))) {
+ if ((Handle != NULL) && (!EFI_ERROR (Status))) {
return (TRUE);
}
+
return (FALSE);
}
-
/**
This function creates a mapping for a device path.
@@ -114,19 +115,19 @@ InternalShellProtocolIsSimpleFileSystemPresent( **/
EFI_STATUS
EFIAPI
-EfiShellSetMap(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL,
- IN CONST CHAR16 *Mapping
+EfiShellSetMap (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL,
+ IN CONST CHAR16 *Mapping
)
{
EFI_STATUS Status;
SHELL_MAP_LIST *MapListNode;
- if (Mapping == NULL){
+ if (Mapping == NULL) {
return (EFI_INVALID_PARAMETER);
}
- if (Mapping[StrLen(Mapping)-1] != ':') {
+ if (Mapping[StrLen (Mapping)-1] != ':') {
return (EFI_INVALID_PARAMETER);
}
@@ -134,21 +135,23 @@ EfiShellSetMap( // Delete the mapping
//
if (DevicePath == NULL) {
- if (IsListEmpty(&gShellMapList.Link)) {
+ if (IsListEmpty (&gShellMapList.Link)) {
return (EFI_NOT_FOUND);
}
- for ( MapListNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
- ; !IsNull(&gShellMapList.Link, &MapListNode->Link)
- ; MapListNode = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &MapListNode->Link)
- ){
- if (StringNoCaseCompare(&MapListNode->MapName, &Mapping) == 0) {
- RemoveEntryList(&MapListNode->Link);
- SHELL_FREE_NON_NULL(MapListNode->DevicePath);
- SHELL_FREE_NON_NULL(MapListNode->MapName);
- SHELL_FREE_NON_NULL(MapListNode->CurrentDirectoryPath);
- FreePool(MapListNode);
- return (EFI_SUCCESS);
- }
+
+ for ( MapListNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
+ ; !IsNull (&gShellMapList.Link, &MapListNode->Link)
+ ; MapListNode = (SHELL_MAP_LIST *)GetNextNode (&gShellMapList.Link, &MapListNode->Link)
+ )
+ {
+ if (StringNoCaseCompare (&MapListNode->MapName, &Mapping) == 0) {
+ RemoveEntryList (&MapListNode->Link);
+ SHELL_FREE_NON_NULL (MapListNode->DevicePath);
+ SHELL_FREE_NON_NULL (MapListNode->MapName);
+ SHELL_FREE_NON_NULL (MapListNode->CurrentDirectoryPath);
+ FreePool (MapListNode);
+ return (EFI_SUCCESS);
+ }
} // for loop
//
@@ -160,16 +163,17 @@ EfiShellSetMap( //
// make sure this is a valid to add device path
//
- ///@todo add BlockIo to this test...
- if (!InternalShellProtocolIsSimpleFileSystemPresent(DevicePath)
- && !InternalShellProtocolIsBlockIoPresent(DevicePath)) {
+ /// @todo add BlockIo to this test...
+ if ( !InternalShellProtocolIsSimpleFileSystemPresent (DevicePath)
+ && !InternalShellProtocolIsBlockIoPresent (DevicePath))
+ {
return (EFI_INVALID_PARAMETER);
}
//
// First make sure there is no old mapping
//
- Status = EfiShellSetMap(NULL, Mapping);
+ Status = EfiShellSetMap (NULL, Mapping);
if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_FOUND)) {
return (Status);
}
@@ -177,9 +181,9 @@ EfiShellSetMap( //
// now add the new one.
//
- Status = ShellCommandAddMapItemAndUpdatePath(Mapping, DevicePath, 0, FALSE);
+ Status = ShellCommandAddMapItemAndUpdatePath (Mapping, DevicePath, 0, FALSE);
- return(Status);
+ return (Status);
}
/**
@@ -197,8 +201,8 @@ EfiShellSetMap( **/
CONST EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
-EfiShellGetDevicePathFromMap(
- IN CONST CHAR16 *Mapping
+EfiShellGetDevicePathFromMap (
+ IN CONST CHAR16 *Mapping
)
{
SHELL_MAP_LIST *MapListItem;
@@ -208,19 +212,20 @@ EfiShellGetDevicePathFromMap( NewName = NULL;
Size = 0;
- StrnCatGrow(&NewName, &Size, Mapping, 0);
- if (Mapping[StrLen(Mapping)-1] != L':') {
- StrnCatGrow(&NewName, &Size, L":", 0);
+ StrnCatGrow (&NewName, &Size, Mapping, 0);
+ if (Mapping[StrLen (Mapping)-1] != L':') {
+ StrnCatGrow (&NewName, &Size, L":", 0);
}
- MapListItem = ShellCommandFindMapItem(NewName);
+ MapListItem = ShellCommandFindMapItem (NewName);
- FreePool(NewName);
+ FreePool (NewName);
if (MapListItem != NULL) {
return (MapListItem->DevicePath);
}
- return(NULL);
+
+ return (NULL);
}
/**
@@ -245,103 +250,109 @@ EfiShellGetDevicePathFromMap( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetMapFromDevicePath(
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+EfiShellGetMapFromDevicePath (
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
)
{
- SHELL_MAP_LIST *Node;
- CHAR16 *PathForReturn;
- UINTN PathSize;
-// EFI_HANDLE PathHandle;
-// EFI_HANDLE MapHandle;
-// EFI_STATUS Status;
-// EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy;
-// EFI_DEVICE_PATH_PROTOCOL *MapPathCopy;
-
- if (DevicePath == NULL || *DevicePath == NULL) {
+ SHELL_MAP_LIST *Node;
+ CHAR16 *PathForReturn;
+ UINTN PathSize;
+
+ // EFI_HANDLE PathHandle;
+ // EFI_HANDLE MapHandle;
+ // EFI_STATUS Status;
+ // EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy;
+ // EFI_DEVICE_PATH_PROTOCOL *MapPathCopy;
+
+ if ((DevicePath == NULL) || (*DevicePath == NULL)) {
return (NULL);
}
PathForReturn = NULL;
PathSize = 0;
- for ( Node = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
- ; !IsNull(&gShellMapList.Link, &Node->Link)
- ; Node = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &Node->Link)
- ){
+ for ( Node = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
+ ; !IsNull (&gShellMapList.Link, &Node->Link)
+ ; Node = (SHELL_MAP_LIST *)GetNextNode (&gShellMapList.Link, &Node->Link)
+ )
+ {
//
// check for exact match
//
- if (DevicePathCompare(DevicePath, &Node->DevicePath) == 0) {
- ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));
+ if (DevicePathCompare (DevicePath, &Node->DevicePath) == 0) {
+ ASSERT ((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));
if (PathSize != 0) {
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L";", 0);
+ PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L";", 0);
}
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, Node->MapName, 0);
+
+ PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, Node->MapName, 0);
}
}
+
if (PathForReturn != NULL) {
while (!IsDevicePathEndType (*DevicePath)) {
*DevicePath = NextDevicePathNode (*DevicePath);
}
+
SetDevicePathEndNode (*DevicePath);
}
-/*
- ///@todo finish code for inexact matches.
- if (PathForReturn == NULL) {
- PathSize = 0;
- DevicePathCopy = DuplicateDevicePath(*DevicePath);
- ASSERT(DevicePathCopy != NULL);
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &PathHandle);
- ASSERT_EFI_ERROR(Status);
- //
- // check each of the device paths we have to get the root of the path for consist mappings
- //
- for ( Node = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
- ; !IsNull(&gShellMapList.Link, &Node->Link)
- ; Node = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &Node->Link)
- ){
- if ((Node->Flags & SHELL_MAP_FLAGS_CONSIST) == 0) {
- continue;
- }
- MapPathCopy = DuplicateDevicePath(Node->DevicePath);
- ASSERT(MapPathCopy != NULL);
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle);
- if (MapHandle == PathHandle) {
+ /*
+ ///@todo finish code for inexact matches.
+ if (PathForReturn == NULL) {
+ PathSize = 0;
+
+ DevicePathCopy = DuplicateDevicePath(*DevicePath);
+ ASSERT(DevicePathCopy != NULL);
+ Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &PathHandle);
+ ASSERT_EFI_ERROR(Status);
+ //
+ // check each of the device paths we have to get the root of the path for consist mappings
+ //
+ for ( Node = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
+ ; !IsNull(&gShellMapList.Link, &Node->Link)
+ ; Node = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &Node->Link)
+ ){
+ if ((Node->Flags & SHELL_MAP_FLAGS_CONSIST) == 0) {
+ continue;
+ }
+ MapPathCopy = DuplicateDevicePath(Node->DevicePath);
+ ASSERT(MapPathCopy != NULL);
+ Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle);
+ if (MapHandle == PathHandle) {
- *DevicePath = DevicePathCopy;
+ *DevicePath = DevicePathCopy;
- MapPathCopy = NULL;
- DevicePathCopy = NULL;
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, Node->MapName, 0);
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L";", 0);
- break;
- }
- }
- //
- // now add on the non-consistent mappings
- //
- for ( Node = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
- ; !IsNull(&gShellMapList.Link, &Node->Link)
- ; Node = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &Node->Link)
- ){
- if ((Node->Flags & SHELL_MAP_FLAGS_CONSIST) != 0) {
- continue;
+ MapPathCopy = NULL;
+ DevicePathCopy = NULL;
+ PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, Node->MapName, 0);
+ PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L";", 0);
+ break;
+ }
}
- MapPathCopy = Node->DevicePath;
- ASSERT(MapPathCopy != NULL);
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle);
- if (MapHandle == PathHandle) {
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, Node->MapName, 0);
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L";", 0);
- break;
+ //
+ // now add on the non-consistent mappings
+ //
+ for ( Node = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
+ ; !IsNull(&gShellMapList.Link, &Node->Link)
+ ; Node = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &Node->Link)
+ ){
+ if ((Node->Flags & SHELL_MAP_FLAGS_CONSIST) != 0) {
+ continue;
+ }
+ MapPathCopy = Node->DevicePath;
+ ASSERT(MapPathCopy != NULL);
+ Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle);
+ if (MapHandle == PathHandle) {
+ PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, Node->MapName, 0);
+ PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L";", 0);
+ break;
+ }
}
}
- }
-*/
+ */
- return (AddBufferToFreeList(PathForReturn));
+ return (AddBufferToFreeList (PathForReturn));
}
/**
@@ -359,71 +370,76 @@ EfiShellGetMapFromDevicePath( **/
CHAR16 *
EFIAPI
-EfiShellGetFilePathFromDevicePath(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
+EfiShellGetFilePathFromDevicePath (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePathCopy;
- EFI_DEVICE_PATH_PROTOCOL *MapPathCopy;
- SHELL_MAP_LIST *MapListItem;
- CHAR16 *PathForReturn;
- UINTN PathSize;
- EFI_HANDLE PathHandle;
- EFI_HANDLE MapHandle;
- EFI_STATUS Status;
- FILEPATH_DEVICE_PATH *FilePath;
- FILEPATH_DEVICE_PATH *AlignedNode;
+ EFI_DEVICE_PATH_PROTOCOL *MapPathCopy;
+ SHELL_MAP_LIST *MapListItem;
+ CHAR16 *PathForReturn;
+ UINTN PathSize;
+ EFI_HANDLE PathHandle;
+ EFI_HANDLE MapHandle;
+ EFI_STATUS Status;
+ FILEPATH_DEVICE_PATH *FilePath;
+ FILEPATH_DEVICE_PATH *AlignedNode;
PathForReturn = NULL;
- PathSize = 0;
+ PathSize = 0;
- DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL*)Path;
- ASSERT(DevicePathCopy != NULL);
+ DevicePathCopy = (EFI_DEVICE_PATH_PROTOCOL *)Path;
+ ASSERT (DevicePathCopy != NULL);
if (DevicePathCopy == NULL) {
return (NULL);
}
- ///@todo BlockIo?
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &PathHandle);
- if (EFI_ERROR(Status)) {
+ /// @todo BlockIo?
+ Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &PathHandle);
+
+ if (EFI_ERROR (Status)) {
return (NULL);
}
+
//
// check each of the device paths we have to get the root of the path
//
- for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
- ; !IsNull(&gShellMapList.Link, &MapListItem->Link)
- ; MapListItem = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &MapListItem->Link)
- ){
- MapPathCopy = (EFI_DEVICE_PATH_PROTOCOL*)MapListItem->DevicePath;
- ASSERT(MapPathCopy != NULL);
- ///@todo BlockIo?
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle);
+ for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
+ ; !IsNull (&gShellMapList.Link, &MapListItem->Link)
+ ; MapListItem = (SHELL_MAP_LIST *)GetNextNode (&gShellMapList.Link, &MapListItem->Link)
+ )
+ {
+ MapPathCopy = (EFI_DEVICE_PATH_PROTOCOL *)MapListItem->DevicePath;
+ ASSERT (MapPathCopy != NULL);
+ /// @todo BlockIo?
+ Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &MapPathCopy, &MapHandle);
if (MapHandle == PathHandle) {
- ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, MapListItem->MapName, 0);
+ ASSERT ((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));
+ PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, MapListItem->MapName, 0);
//
// go through all the remaining nodes in the device path
//
- for ( FilePath = (FILEPATH_DEVICE_PATH*)DevicePathCopy
- ; !IsDevicePathEnd (&FilePath->Header)
- ; FilePath = (FILEPATH_DEVICE_PATH*)NextDevicePathNode (&FilePath->Header)
- ){
+ for ( FilePath = (FILEPATH_DEVICE_PATH *)DevicePathCopy
+ ; !IsDevicePathEnd (&FilePath->Header)
+ ; FilePath = (FILEPATH_DEVICE_PATH *)NextDevicePathNode (&FilePath->Header)
+ )
+ {
//
// If any node is not a file path node, then the conversion can not be completed
//
- if ((DevicePathType(&FilePath->Header) != MEDIA_DEVICE_PATH) ||
- (DevicePathSubType(&FilePath->Header) != MEDIA_FILEPATH_DP)) {
- FreePool(PathForReturn);
+ if ((DevicePathType (&FilePath->Header) != MEDIA_DEVICE_PATH) ||
+ (DevicePathSubType (&FilePath->Header) != MEDIA_FILEPATH_DP))
+ {
+ FreePool (PathForReturn);
return NULL;
}
//
// append the path part onto the filepath.
//
- ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));
+ ASSERT ((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));
- AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath), FilePath);
+ AlignedNode = AllocateCopyPool (DevicePathNodeLength (FilePath), FilePath);
if (AlignedNode == NULL) {
FreePool (PathForReturn);
return NULL;
@@ -438,19 +454,22 @@ EfiShellGetFilePathFromDevicePath( if ((PathSize != 0) &&
(PathForReturn != NULL) &&
(PathForReturn[PathSize / sizeof (CHAR16) - 1] != L'\\') &&
- (AlignedNode->PathName[0] != L'\\')) {
+ (AlignedNode->PathName[0] != L'\\'))
+ {
PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L"\\", 1);
}
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, AlignedNode->PathName, 0);
- FreePool(AlignedNode);
+ PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, AlignedNode->PathName, 0);
+ FreePool (AlignedNode);
} // for loop of remaining nodes
}
+
if (PathForReturn != NULL) {
break;
}
} // for loop of paths to check
- return(PathForReturn);
+
+ return (PathForReturn);
}
/**
@@ -468,8 +487,8 @@ EfiShellGetFilePathFromDevicePath( **/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
-EfiShellGetDevicePathFromFilePath(
- IN CONST CHAR16 *Path
+EfiShellGetDevicePathFromFilePath (
+ IN CONST CHAR16 *Path
)
{
CHAR16 *MapName;
@@ -490,25 +509,29 @@ EfiShellGetDevicePathFromFilePath( MapName = NULL;
NewPath = NULL;
- if (StrStr(Path, L":") == NULL) {
- Cwd = EfiShellGetCurDir(NULL);
+ if (StrStr (Path, L":") == NULL) {
+ Cwd = EfiShellGetCurDir (NULL);
if (Cwd == NULL) {
return (NULL);
}
- Size = StrSize(Cwd) + StrSize(Path);
- NewPath = AllocateZeroPool(Size);
+
+ Size = StrSize (Cwd) + StrSize (Path);
+ NewPath = AllocateZeroPool (Size);
if (NewPath == NULL) {
return (NULL);
}
- StrCpyS(NewPath, Size/sizeof(CHAR16), Cwd);
- StrCatS(NewPath, Size/sizeof(CHAR16), L"\\");
+
+ StrCpyS (NewPath, Size/sizeof (CHAR16), Cwd);
+ StrCatS (NewPath, Size/sizeof (CHAR16), L"\\");
if (*Path == L'\\') {
Path++;
- while (PathRemoveLastItem(NewPath)) ;
+ while (PathRemoveLastItem (NewPath)) {
+ }
}
- StrCatS(NewPath, Size/sizeof(CHAR16), Path);
- DevicePathForReturn = EfiShellGetDevicePathFromFilePath(NewPath);
- FreePool(NewPath);
+
+ StrCatS (NewPath, Size/sizeof (CHAR16), Path);
+ DevicePathForReturn = EfiShellGetDevicePathFromFilePath (NewPath);
+ FreePool (NewPath);
return (DevicePathForReturn);
}
@@ -516,16 +539,16 @@ EfiShellGetDevicePathFromFilePath( //
// find the part before (but including) the : for the map name
//
- ASSERT((MapName == NULL && Size == 0) || (MapName != NULL));
- MapName = StrnCatGrow(&MapName, &Size, Path, (StrStr(Path, L":")-Path+1));
- if (MapName == NULL || MapName[StrLen(MapName)-1] != L':') {
+ ASSERT ((MapName == NULL && Size == 0) || (MapName != NULL));
+ MapName = StrnCatGrow (&MapName, &Size, Path, (StrStr (Path, L":")-Path+1));
+ if ((MapName == NULL) || (MapName[StrLen (MapName)-1] != L':')) {
return (NULL);
}
//
// look up the device path in the map
//
- DevicePath = EfiShellGetDevicePathFromMap(MapName);
+ DevicePath = EfiShellGetDevicePathFromMap (MapName);
if (DevicePath == NULL) {
//
// Must have been a bad Mapname
@@ -536,38 +559,40 @@ EfiShellGetDevicePathFromFilePath( //
// make a copy for LocateDevicePath to modify (also save a pointer to call FreePool with)
//
- DevicePathCopyForFree = DevicePathCopy = DuplicateDevicePath(DevicePath);
+ DevicePathCopyForFree = DevicePathCopy = DuplicateDevicePath (DevicePath);
if (DevicePathCopy == NULL) {
- FreePool(MapName);
+ FreePool (MapName);
return (NULL);
}
//
// get the handle
//
- ///@todo BlockIo?
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle);
- if (EFI_ERROR(Status)) {
+ /// @todo BlockIo?
+ Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathCopy, &Handle);
+ if (EFI_ERROR (Status)) {
if (DevicePathCopyForFree != NULL) {
- FreePool(DevicePathCopyForFree);
+ FreePool (DevicePathCopyForFree);
}
- FreePool(MapName);
+
+ FreePool (MapName);
return (NULL);
}
//
// build the full device path
//
- if ((*(Path+StrLen(MapName)) != CHAR_NULL) &&
- (*(Path+StrLen(MapName)+1) == CHAR_NULL)) {
- DevicePathForReturn = FileDevicePath(Handle, L"\\");
+ if ((*(Path+StrLen (MapName)) != CHAR_NULL) &&
+ (*(Path+StrLen (MapName)+1) == CHAR_NULL))
+ {
+ DevicePathForReturn = FileDevicePath (Handle, L"\\");
} else {
- DevicePathForReturn = FileDevicePath(Handle, Path+StrLen(MapName));
+ DevicePathForReturn = FileDevicePath (Handle, Path+StrLen (MapName));
}
- FreePool(MapName);
+ FreePool (MapName);
if (DevicePathCopyForFree != NULL) {
- FreePool(DevicePathCopyForFree);
+ FreePool (DevicePathCopyForFree);
}
return (DevicePathForReturn);
@@ -611,29 +636,30 @@ EfiShellGetDevicePathFromFilePath( **/
EFI_STATUS
EFIAPI
-EfiShellGetDeviceName(
- IN EFI_HANDLE DeviceHandle,
- IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
- IN CHAR8 *Language,
- OUT CHAR16 **BestDeviceName
+EfiShellGetDeviceName (
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
+ IN CHAR8 *Language,
+ OUT CHAR16 **BestDeviceName
)
{
- EFI_STATUS Status;
- EFI_COMPONENT_NAME2_PROTOCOL *CompName2;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_HANDLE *HandleList;
- UINTN HandleCount;
- UINTN LoopVar;
- CHAR16 *DeviceNameToReturn;
- CHAR8 *Lang;
- UINTN ParentControllerCount;
- EFI_HANDLE *ParentControllerBuffer;
- UINTN ParentDriverCount;
- EFI_HANDLE *ParentDriverBuffer;
-
- if (BestDeviceName == NULL ||
- DeviceHandle == NULL
- ){
+ EFI_STATUS Status;
+ EFI_COMPONENT_NAME2_PROTOCOL *CompName2;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_HANDLE *HandleList;
+ UINTN HandleCount;
+ UINTN LoopVar;
+ CHAR16 *DeviceNameToReturn;
+ CHAR8 *Lang;
+ UINTN ParentControllerCount;
+ EFI_HANDLE *ParentControllerBuffer;
+ UINTN ParentDriverCount;
+ EFI_HANDLE *ParentDriverBuffer;
+
+ if ((BestDeviceName == NULL) ||
+ (DeviceHandle == NULL)
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
@@ -641,133 +667,145 @@ EfiShellGetDeviceName( // make sure one of the 2 supported bits is on
//
if (((Flags & EFI_DEVICE_NAME_USE_COMPONENT_NAME) == 0) &&
- ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) == 0)) {
+ ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) == 0))
+ {
return (EFI_INVALID_PARAMETER);
}
- DeviceNameToReturn = NULL;
- *BestDeviceName = NULL;
- HandleList = NULL;
- HandleCount = 0;
- Lang = NULL;
+ DeviceNameToReturn = NULL;
+ *BestDeviceName = NULL;
+ HandleList = NULL;
+ HandleCount = 0;
+ Lang = NULL;
if ((Flags & EFI_DEVICE_NAME_USE_COMPONENT_NAME) != 0) {
- Status = ParseHandleDatabaseByRelationship(
- NULL,
- DeviceHandle,
- HR_DRIVER_BINDING_HANDLE|HR_DEVICE_DRIVER,
- &HandleCount,
- &HandleList);
- for (LoopVar = 0; LoopVar < HandleCount ; LoopVar++){
+ Status = ParseHandleDatabaseByRelationship (
+ NULL,
+ DeviceHandle,
+ HR_DRIVER_BINDING_HANDLE|HR_DEVICE_DRIVER,
+ &HandleCount,
+ &HandleList
+ );
+ for (LoopVar = 0; LoopVar < HandleCount; LoopVar++) {
//
// Go through those handles until we get one that passes for GetComponentName
//
- Status = gBS->OpenProtocol(
- HandleList[LoopVar],
- &gEfiComponentName2ProtocolGuid,
- (VOID**)&CompName2,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (EFI_ERROR(Status)) {
- Status = gBS->OpenProtocol(
- HandleList[LoopVar],
- &gEfiComponentNameProtocolGuid,
- (VOID**)&CompName2,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ Status = gBS->OpenProtocol (
+ HandleList[LoopVar],
+ &gEfiComponentName2ProtocolGuid,
+ (VOID **)&CompName2,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ HandleList[LoopVar],
+ &gEfiComponentNameProtocolGuid,
+ (VOID **)&CompName2,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
}
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
continue;
}
- Lang = GetBestLanguageForDriver(CompName2->SupportedLanguages, Language, FALSE);
- Status = CompName2->GetControllerName(CompName2, DeviceHandle, NULL, Lang, &DeviceNameToReturn);
- FreePool(Lang);
+
+ Lang = GetBestLanguageForDriver (CompName2->SupportedLanguages, Language, FALSE);
+ Status = CompName2->GetControllerName (CompName2, DeviceHandle, NULL, Lang, &DeviceNameToReturn);
+ FreePool (Lang);
Lang = NULL;
- if (!EFI_ERROR(Status) && DeviceNameToReturn != NULL) {
+ if (!EFI_ERROR (Status) && (DeviceNameToReturn != NULL)) {
break;
}
}
+
if (HandleList != NULL) {
- FreePool(HandleList);
+ FreePool (HandleList);
}
//
// Now check the parent controller using this as the child.
//
- if (DeviceNameToReturn == NULL){
- PARSE_HANDLE_DATABASE_PARENTS(DeviceHandle, &ParentControllerCount, &ParentControllerBuffer);
- for (LoopVar = 0 ; LoopVar < ParentControllerCount ; LoopVar++) {
- PARSE_HANDLE_DATABASE_UEFI_DRIVERS(ParentControllerBuffer[LoopVar], &ParentDriverCount, &ParentDriverBuffer);
- for (HandleCount = 0 ; HandleCount < ParentDriverCount ; HandleCount++) {
+ if (DeviceNameToReturn == NULL) {
+ PARSE_HANDLE_DATABASE_PARENTS (DeviceHandle, &ParentControllerCount, &ParentControllerBuffer);
+ for (LoopVar = 0; LoopVar < ParentControllerCount; LoopVar++) {
+ PARSE_HANDLE_DATABASE_UEFI_DRIVERS (ParentControllerBuffer[LoopVar], &ParentDriverCount, &ParentDriverBuffer);
+ for (HandleCount = 0; HandleCount < ParentDriverCount; HandleCount++) {
//
// try using that driver's component name with controller and our driver as the child.
//
- Status = gBS->OpenProtocol(
- ParentDriverBuffer[HandleCount],
- &gEfiComponentName2ProtocolGuid,
- (VOID**)&CompName2,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (EFI_ERROR(Status)) {
- Status = gBS->OpenProtocol(
- ParentDriverBuffer[HandleCount],
- &gEfiComponentNameProtocolGuid,
- (VOID**)&CompName2,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ Status = gBS->OpenProtocol (
+ ParentDriverBuffer[HandleCount],
+ &gEfiComponentName2ProtocolGuid,
+ (VOID **)&CompName2,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ ParentDriverBuffer[HandleCount],
+ &gEfiComponentNameProtocolGuid,
+ (VOID **)&CompName2,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
}
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
continue;
}
- Lang = GetBestLanguageForDriver(CompName2->SupportedLanguages, Language, FALSE);
- Status = CompName2->GetControllerName(CompName2, ParentControllerBuffer[LoopVar], DeviceHandle, Lang, &DeviceNameToReturn);
- FreePool(Lang);
+
+ Lang = GetBestLanguageForDriver (CompName2->SupportedLanguages, Language, FALSE);
+ Status = CompName2->GetControllerName (CompName2, ParentControllerBuffer[LoopVar], DeviceHandle, Lang, &DeviceNameToReturn);
+ FreePool (Lang);
Lang = NULL;
- if (!EFI_ERROR(Status) && DeviceNameToReturn != NULL) {
+ if (!EFI_ERROR (Status) && (DeviceNameToReturn != NULL)) {
break;
}
-
-
-
}
- SHELL_FREE_NON_NULL(ParentDriverBuffer);
- if (!EFI_ERROR(Status) && DeviceNameToReturn != NULL) {
+
+ SHELL_FREE_NON_NULL (ParentDriverBuffer);
+ if (!EFI_ERROR (Status) && (DeviceNameToReturn != NULL)) {
break;
}
}
- SHELL_FREE_NON_NULL(ParentControllerBuffer);
+
+ SHELL_FREE_NON_NULL (ParentControllerBuffer);
}
+
//
// dont return on fail since we will try device path if that bit is on
//
- if (DeviceNameToReturn != NULL){
- ASSERT(BestDeviceName != NULL);
- StrnCatGrow(BestDeviceName, NULL, DeviceNameToReturn, 0);
+ if (DeviceNameToReturn != NULL) {
+ ASSERT (BestDeviceName != NULL);
+ StrnCatGrow (BestDeviceName, NULL, DeviceNameToReturn, 0);
return (EFI_SUCCESS);
}
}
+
if ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) != 0) {
- Status = gBS->OpenProtocol(
- DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&DevicePath,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status)) {
+ Status = gBS->OpenProtocol (
+ DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&DevicePath,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
//
// use device path to text on the device path
//
- *BestDeviceName = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
+ *BestDeviceName = ConvertDevicePathToText (DevicePath, TRUE, TRUE);
return (EFI_SUCCESS);
}
}
+
//
// none of the selected bits worked.
//
@@ -792,47 +830,52 @@ EfiShellGetDeviceName( **/
EFI_STATUS
EFIAPI
-EfiShellOpenRootByHandle(
- IN EFI_HANDLE DeviceHandle,
- OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellOpenRootByHandle (
+ IN EFI_HANDLE DeviceHandle,
+ OUT SHELL_FILE_HANDLE *FileHandle
)
{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- EFI_FILE_PROTOCOL *RealFileHandle;
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
+ EFI_STATUS Status;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
+ EFI_FILE_PROTOCOL *RealFileHandle;
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;
//
// get the simple file system interface
//
- Status = gBS->OpenProtocol(DeviceHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID**)&SimpleFileSystem,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (EFI_ERROR(Status)) {
+ Status = gBS->OpenProtocol (
+ DeviceHandle,
+ &gEfiSimpleFileSystemProtocolGuid,
+ (VOID **)&SimpleFileSystem,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
return (EFI_NOT_FOUND);
}
- Status = gBS->OpenProtocol(DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&DevPath,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (EFI_ERROR(Status)) {
+ Status = gBS->OpenProtocol (
+ DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&DevPath,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
return (EFI_NOT_FOUND);
}
+
//
// Open the root volume now...
//
- Status = SimpleFileSystem->OpenVolume(SimpleFileSystem, &RealFileHandle);
- if (EFI_ERROR(Status)) {
+ Status = SimpleFileSystem->OpenVolume (SimpleFileSystem, &RealFileHandle);
+ if (EFI_ERROR (Status)) {
return Status;
}
- *FileHandle = ConvertEfiFileProtocolToShellHandle(RealFileHandle, EfiShellGetMapFromDevicePath(&DevPath));
+ *FileHandle = ConvertEfiFileProtocolToShellHandle (RealFileHandle, EfiShellGetMapFromDevicePath (&DevPath));
return (EFI_SUCCESS);
}
@@ -855,13 +898,13 @@ EfiShellOpenRootByHandle( **/
EFI_STATUS
EFIAPI
-EfiShellOpenRoot(
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellOpenRoot (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ OUT SHELL_FILE_HANDLE *FileHandle
)
{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
if (FileHandle == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -870,15 +913,17 @@ EfiShellOpenRoot( //
// find the handle of the device with that device handle and the file system
//
- ///@todo BlockIo?
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid,
- &DevicePath,
- &Handle);
- if (EFI_ERROR(Status)) {
+ /// @todo BlockIo?
+ Status = gBS->LocateDevicePath (
+ &gEfiSimpleFileSystemProtocolGuid,
+ &DevicePath,
+ &Handle
+ );
+ if (EFI_ERROR (Status)) {
return (EFI_NOT_FOUND);
}
- return (EfiShellOpenRootByHandle(Handle, FileHandle));
+ return (EfiShellOpenRootByHandle (Handle, FileHandle));
}
/**
@@ -894,9 +939,10 @@ EfiShellBatchIsActive ( VOID
)
{
- if (ShellCommandGetCurrentScriptFile() == NULL) {
+ if (ShellCommandGetCurrentScriptFile () == NULL) {
return (FALSE);
}
+
return (TRUE);
}
@@ -914,62 +960,67 @@ EfiShellBatchIsActive ( @retval other an error occurred.
**/
EFI_STATUS
-InternalOpenFileDevicePath(
- IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT SHELL_FILE_HANDLE *FileHandle,
- IN UINT64 OpenMode,
- IN UINT64 Attributes OPTIONAL
+InternalOpenFileDevicePath (
+ IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ OUT SHELL_FILE_HANDLE *FileHandle,
+ IN UINT64 OpenMode,
+ IN UINT64 Attributes OPTIONAL
)
{
- EFI_STATUS Status;
- FILEPATH_DEVICE_PATH *FilePathNode;
- EFI_HANDLE Handle;
- SHELL_FILE_HANDLE ShellHandle;
- EFI_FILE_PROTOCOL *Handle1;
- EFI_FILE_PROTOCOL *Handle2;
- FILEPATH_DEVICE_PATH *AlignedNode;
+ EFI_STATUS Status;
+ FILEPATH_DEVICE_PATH *FilePathNode;
+ EFI_HANDLE Handle;
+ SHELL_FILE_HANDLE ShellHandle;
+ EFI_FILE_PROTOCOL *Handle1;
+ EFI_FILE_PROTOCOL *Handle2;
+ FILEPATH_DEVICE_PATH *AlignedNode;
if (FileHandle == NULL) {
return (EFI_INVALID_PARAMETER);
}
- *FileHandle = NULL;
- Handle1 = NULL;
- Handle2 = NULL;
- Handle = NULL;
- ShellHandle = NULL;
- FilePathNode = NULL;
- AlignedNode = NULL;
- Status = EfiShellOpenRoot(DevicePath, &ShellHandle);
+ *FileHandle = NULL;
+ Handle1 = NULL;
+ Handle2 = NULL;
+ Handle = NULL;
+ ShellHandle = NULL;
+ FilePathNode = NULL;
+ AlignedNode = NULL;
- if (!EFI_ERROR(Status)) {
- Handle1 = ConvertShellHandleToEfiFileProtocol(ShellHandle);
+ Status = EfiShellOpenRoot (DevicePath, &ShellHandle);
+
+ if (!EFI_ERROR (Status)) {
+ Handle1 = ConvertShellHandleToEfiFileProtocol (ShellHandle);
if (Handle1 != NULL) {
//
// chop off the beginning part before the file system part...
//
- ///@todo BlockIo?
- Status = gBS->LocateDevicePath(&gEfiSimpleFileSystemProtocolGuid,
- &DevicePath,
- &Handle);
- if (!EFI_ERROR(Status)) {
+ /// @todo BlockIo?
+ Status = gBS->LocateDevicePath (
+ &gEfiSimpleFileSystemProtocolGuid,
+ &DevicePath,
+ &Handle
+ );
+ if (!EFI_ERROR (Status)) {
//
// To access as a file system, the file path should only
// contain file path components. Follow the file path nodes
// and find the target file
//
for ( FilePathNode = (FILEPATH_DEVICE_PATH *)DevicePath
- ; !IsDevicePathEnd (&FilePathNode->Header)
- ; FilePathNode = (FILEPATH_DEVICE_PATH *) NextDevicePathNode (&FilePathNode->Header)
- ){
- SHELL_FREE_NON_NULL(AlignedNode);
- AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePathNode), FilePathNode);
+ ; !IsDevicePathEnd (&FilePathNode->Header)
+ ; FilePathNode = (FILEPATH_DEVICE_PATH *)NextDevicePathNode (&FilePathNode->Header)
+ )
+ {
+ SHELL_FREE_NON_NULL (AlignedNode);
+ AlignedNode = AllocateCopyPool (DevicePathNodeLength (FilePathNode), FilePathNode);
//
// For file system access each node should be a file path component
//
- if (DevicePathType (&FilePathNode->Header) != MEDIA_DEVICE_PATH ||
- DevicePathSubType (&FilePathNode->Header) != MEDIA_FILEPATH_DP
- ) {
+ if ((DevicePathType (&FilePathNode->Header) != MEDIA_DEVICE_PATH) ||
+ (DevicePathSubType (&FilePathNode->Header) != MEDIA_FILEPATH_DP)
+ )
+ {
Status = EFI_UNSUPPORTED;
break;
}
@@ -985,14 +1036,13 @@ InternalOpenFileDevicePath( //
if (IsDevicePathEnd ((NextDevicePathNode (&FilePathNode->Header)))) {
Status = Handle2->Open (
- Handle2,
- &Handle1,
- AlignedNode->PathName,
- OpenMode,
- Attributes
- );
+ Handle2,
+ &Handle1,
+ AlignedNode->PathName,
+ OpenMode,
+ Attributes
+ );
} else {
-
//
// This is not the last node and we dont want to 'create' existing
// directory entries...
@@ -1003,26 +1053,27 @@ InternalOpenFileDevicePath( // prevents error on existing files/directories
//
Status = Handle2->Open (
- Handle2,
- &Handle1,
- AlignedNode->PathName,
- OpenMode &~EFI_FILE_MODE_CREATE,
- Attributes
- );
+ Handle2,
+ &Handle1,
+ AlignedNode->PathName,
+ OpenMode &~EFI_FILE_MODE_CREATE,
+ Attributes
+ );
//
// if above failed now open and create the 'item'
// if OpenMode EFI_FILE_MODE_CREATE bit was on (but disabled above)
//
if ((EFI_ERROR (Status)) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)) {
Status = Handle2->Open (
- Handle2,
- &Handle1,
- AlignedNode->PathName,
- OpenMode,
- Attributes
- );
+ Handle2,
+ &Handle1,
+ AlignedNode->PathName,
+ OpenMode,
+ Attributes
+ );
}
}
+
//
// Close the last node
//
@@ -1038,14 +1089,16 @@ InternalOpenFileDevicePath( }
}
}
- SHELL_FREE_NON_NULL(AlignedNode);
- if (EFI_ERROR(Status)) {
+
+ SHELL_FREE_NON_NULL (AlignedNode);
+ if (EFI_ERROR (Status)) {
if (Handle1 != NULL) {
- ShellInfoObject.NewEfiShellProtocol->CloseFile(Handle1);
+ ShellInfoObject.NewEfiShellProtocol->CloseFile (Handle1);
}
} else {
- *FileHandle = ConvertEfiFileProtocolToShellHandle(Handle1, ShellFileHandleGetPath(ShellHandle));
+ *FileHandle = ConvertEfiFileProtocolToShellHandle (Handle1, ShellFileHandleGetPath (ShellHandle));
}
+
return (Status);
}
@@ -1087,10 +1140,10 @@ InternalOpenFileDevicePath( **/
EFI_STATUS
EFIAPI
-EfiShellCreateFile(
- IN CONST CHAR16 *FileName,
- IN UINT64 FileAttribs,
- OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellCreateFile (
+ IN CONST CHAR16 *FileName,
+ IN UINT64 FileAttribs,
+ OUT SHELL_FILE_HANDLE *FileHandle
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
@@ -1101,30 +1154,32 @@ EfiShellCreateFile( // Is this for an environment variable
// do we start with >v
//
- if (StrStr(FileName, L">v") == FileName) {
+ if (StrStr (FileName, L">v") == FileName) {
Status = IsVolatileEnv (FileName + 2, &Volatile);
if (EFI_ERROR (Status)) {
return Status;
}
+
if (!Volatile) {
return (EFI_INVALID_PARAMETER);
}
- *FileHandle = CreateFileInterfaceEnv(FileName+2);
+
+ *FileHandle = CreateFileInterfaceEnv (FileName+2);
return (EFI_SUCCESS);
}
//
// We are opening a regular file.
//
- DevicePath = EfiShellGetDevicePathFromFilePath(FileName);
+ DevicePath = EfiShellGetDevicePathFromFilePath (FileName);
if (DevicePath == NULL) {
return (EFI_NOT_FOUND);
}
- Status = InternalOpenFileDevicePath(DevicePath, FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, FileAttribs);
- FreePool(DevicePath);
+ Status = InternalOpenFileDevicePath (DevicePath, FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, FileAttribs);
+ FreePool (DevicePath);
- return(Status);
+ return (Status);
}
/**
@@ -1146,12 +1201,12 @@ EfiShellCreateFile( **/
EFI_STATUS
EFIAPI
-EfiShellRegisterGuidName(
- IN CONST EFI_GUID *Guid,
- IN CONST CHAR16 *GuidName
+EfiShellRegisterGuidName (
+ IN CONST EFI_GUID *Guid,
+ IN CONST CHAR16 *GuidName
)
{
- return (AddNewGuidNameMapping(Guid, GuidName, NULL));
+ return (AddNewGuidNameMapping (Guid, GuidName, NULL));
}
/**
@@ -1208,43 +1263,45 @@ EfiShellRegisterGuidName( **/
EFI_STATUS
EFIAPI
-EfiShellOpenFileByName(
- IN CONST CHAR16 *FileName,
- OUT SHELL_FILE_HANDLE *FileHandle,
- IN UINT64 OpenMode
+EfiShellOpenFileByName (
+ IN CONST CHAR16 *FileName,
+ OUT SHELL_FILE_HANDLE *FileHandle,
+ IN UINT64 OpenMode
)
{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_STATUS Status;
- BOOLEAN Volatile;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_STATUS Status;
+ BOOLEAN Volatile;
*FileHandle = NULL;
//
// Is this for StdIn
//
- if (StrCmp(FileName, L">i") == 0) {
+ if (StrCmp (FileName, L">i") == 0) {
//
// make sure not writing to StdIn
//
if ((OpenMode & EFI_FILE_MODE_WRITE) != 0) {
return (EFI_INVALID_PARAMETER);
}
+
*FileHandle = ShellInfoObject.NewShellParametersProtocol->StdIn;
- ASSERT(*FileHandle != NULL);
+ ASSERT (*FileHandle != NULL);
return (EFI_SUCCESS);
}
//
// Is this for StdOut
//
- if (StrCmp(FileName, L">o") == 0) {
+ if (StrCmp (FileName, L">o") == 0) {
//
// make sure not writing to StdIn
//
if ((OpenMode & EFI_FILE_MODE_READ) != 0) {
return (EFI_INVALID_PARAMETER);
}
+
*FileHandle = &FileInterfaceStdOut;
return (EFI_SUCCESS);
}
@@ -1252,8 +1309,9 @@ EfiShellOpenFileByName( //
// Is this for NUL / NULL file
//
- if ((gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName, L"NUL") == 0) ||
- (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName, L"NULL") == 0)) {
+ if ((gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)FileName, L"NUL") == 0) ||
+ (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)FileName, L"NULL") == 0))
+ {
*FileHandle = &FileInterfaceNulFile;
return (EFI_SUCCESS);
}
@@ -1261,13 +1319,14 @@ EfiShellOpenFileByName( //
// Is this for StdErr
//
- if (StrCmp(FileName, L">e") == 0) {
+ if (StrCmp (FileName, L">e") == 0) {
//
// make sure not writing to StdIn
//
if ((OpenMode & EFI_FILE_MODE_READ) != 0) {
return (EFI_INVALID_PARAMETER);
}
+
*FileHandle = &FileInterfaceStdErr;
return (EFI_SUCCESS);
}
@@ -1276,23 +1335,26 @@ EfiShellOpenFileByName( // Is this for an environment variable
// do we start with >v
//
- if (StrStr(FileName, L">v") == FileName) {
+ if (StrStr (FileName, L">v") == FileName) {
Status = IsVolatileEnv (FileName + 2, &Volatile);
if (EFI_ERROR (Status)) {
return Status;
}
+
if (!Volatile &&
- ((OpenMode & EFI_FILE_MODE_WRITE) != 0)) {
+ ((OpenMode & EFI_FILE_MODE_WRITE) != 0))
+ {
return (EFI_INVALID_PARAMETER);
}
- *FileHandle = CreateFileInterfaceEnv(FileName+2);
+
+ *FileHandle = CreateFileInterfaceEnv (FileName+2);
return (EFI_SUCCESS);
}
//
// We are opening a regular file.
//
- DevicePath = EfiShellGetDevicePathFromFilePath(FileName);
+ DevicePath = EfiShellGetDevicePathFromFilePath (FileName);
if (DevicePath == NULL) {
return (EFI_NOT_FOUND);
@@ -1301,10 +1363,10 @@ EfiShellOpenFileByName( //
// Copy the device path, open the file, then free the memory
//
- Status = InternalOpenFileDevicePath(DevicePath, FileHandle, OpenMode, 0); // 0 = no specific file attributes
- FreePool(DevicePath);
+ Status = InternalOpenFileDevicePath (DevicePath, FileHandle, OpenMode, 0); // 0 = no specific file attributes
+ FreePool (DevicePath);
- return(Status);
+ return (Status);
}
/**
@@ -1320,29 +1382,32 @@ EfiShellOpenFileByName( **/
EFI_STATUS
EFIAPI
-EfiShellDeleteFileByName(
- IN CONST CHAR16 *FileName
+EfiShellDeleteFileByName (
+ IN CONST CHAR16 *FileName
)
{
- SHELL_FILE_HANDLE FileHandle;
- EFI_STATUS Status;
+ SHELL_FILE_HANDLE FileHandle;
+ EFI_STATUS Status;
FileHandle = NULL;
//
// get a handle to the file
//
- Status = EfiShellCreateFile(FileName,
- 0,
- &FileHandle);
- if (EFI_ERROR(Status)) {
+ Status = EfiShellCreateFile (
+ FileName,
+ 0,
+ &FileHandle
+ );
+ if (EFI_ERROR (Status)) {
return (Status);
}
+
//
// now delete the file
//
- ShellFileHandleRemove(FileHandle);
- return (ShellInfoObject.NewEfiShellProtocol->DeleteFile(FileHandle));
+ ShellFileHandleRemove (FileHandle);
+ return (ShellInfoObject.NewEfiShellProtocol->DeleteFile (FileHandle));
}
/**
@@ -1392,32 +1457,32 @@ EfiShellEnablePageBreak ( @retval EFI_UNSUPPORTED Nested shell invocations are not allowed.
**/
EFI_STATUS
-InternalShellExecuteDevicePath(
- IN CONST EFI_HANDLE *ParentImageHandle,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST CHAR16 *CommandLine OPTIONAL,
- IN CONST CHAR16 **Environment OPTIONAL,
- OUT EFI_STATUS *StartImageStatus OPTIONAL
+InternalShellExecuteDevicePath (
+ IN CONST EFI_HANDLE *ParentImageHandle,
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CONST CHAR16 *CommandLine OPTIONAL,
+ IN CONST CHAR16 **Environment OPTIONAL,
+ OUT EFI_STATUS *StartImageStatus OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_STATUS StartStatus;
- EFI_STATUS CleanupStatus;
- EFI_HANDLE NewHandle;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- LIST_ENTRY OrigEnvs;
- EFI_SHELL_PARAMETERS_PROTOCOL ShellParamsProtocol;
- CHAR16 *ImagePath;
- UINTN Index;
- CHAR16 *Walker;
- CHAR16 *NewCmdLine;
+ EFI_STATUS Status;
+ EFI_STATUS StartStatus;
+ EFI_STATUS CleanupStatus;
+ EFI_HANDLE NewHandle;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ LIST_ENTRY OrigEnvs;
+ EFI_SHELL_PARAMETERS_PROTOCOL ShellParamsProtocol;
+ CHAR16 *ImagePath;
+ UINTN Index;
+ CHAR16 *Walker;
+ CHAR16 *NewCmdLine;
if (ParentImageHandle == NULL) {
return (EFI_INVALID_PARAMETER);
}
- InitializeListHead(&OrigEnvs);
- ZeroMem(&ShellParamsProtocol, sizeof(EFI_SHELL_PARAMETERS_PROTOCOL));
+ InitializeListHead (&OrigEnvs);
+ ZeroMem (&ShellParamsProtocol, sizeof (EFI_SHELL_PARAMETERS_PROTOCOL));
NewHandle = NULL;
@@ -1426,9 +1491,9 @@ InternalShellExecuteDevicePath( return EFI_OUT_OF_RESOURCES;
}
- for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL ; Walker++) {
- if (*Walker == L'^' && *(Walker+1) == L'#') {
- CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0]));
+ for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL; Walker++) {
+ if ((*Walker == L'^') && (*(Walker+1) == L'#')) {
+ CopyMem (Walker, Walker+1, StrSize (Walker) - sizeof (Walker[0]));
}
}
@@ -1436,67 +1501,71 @@ InternalShellExecuteDevicePath( // Load the image with:
// FALSE - not from boot manager and NULL, 0 being not already in memory
//
- Status = gBS->LoadImage(
- FALSE,
- *ParentImageHandle,
- (EFI_DEVICE_PATH_PROTOCOL*)DevicePath,
- NULL,
- 0,
- &NewHandle);
+ Status = gBS->LoadImage (
+ FALSE,
+ *ParentImageHandle,
+ (EFI_DEVICE_PATH_PROTOCOL *)DevicePath,
+ NULL,
+ 0,
+ &NewHandle
+ );
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
if (NewHandle != NULL) {
- gBS->UnloadImage(NewHandle);
+ gBS->UnloadImage (NewHandle);
}
+
FreePool (NewCmdLine);
return (Status);
}
- Status = gBS->OpenProtocol(
- NewHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**)&LoadedImage,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status)) {
+ Status = gBS->OpenProtocol (
+ NewHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (!EFI_ERROR (Status)) {
//
// If the image is not an app abort it.
//
- if (LoadedImage->ImageCodeType != EfiLoaderCode){
- ShellPrintHiiEx(
+ if (LoadedImage->ImageCodeType != EfiLoaderCode) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_SHELL_IMAGE_NOT_APP),
ShellInfoObject.HiiHandle
- );
+ );
goto UnloadImage;
}
- ASSERT(LoadedImage->LoadOptionsSize == 0);
+ ASSERT (LoadedImage->LoadOptionsSize == 0);
if (NewCmdLine != NULL) {
- LoadedImage->LoadOptionsSize = (UINT32)StrSize(NewCmdLine);
- LoadedImage->LoadOptions = (VOID*)NewCmdLine;
+ LoadedImage->LoadOptionsSize = (UINT32)StrSize (NewCmdLine);
+ LoadedImage->LoadOptions = (VOID *)NewCmdLine;
}
//
// Save our current environment settings for later restoration if necessary
//
if (Environment != NULL) {
- Status = GetEnvironmentVariableList(&OrigEnvs);
- if (!EFI_ERROR(Status)) {
- Status = SetEnvironmentVariables(Environment);
+ Status = GetEnvironmentVariableList (&OrigEnvs);
+ if (!EFI_ERROR (Status)) {
+ Status = SetEnvironmentVariables (Environment);
}
}
//
// Initialize and install a shell parameters protocol on the image.
//
- ShellParamsProtocol.StdIn = ShellInfoObject.NewShellParametersProtocol->StdIn;
- ShellParamsProtocol.StdOut = ShellInfoObject.NewShellParametersProtocol->StdOut;
- ShellParamsProtocol.StdErr = ShellInfoObject.NewShellParametersProtocol->StdErr;
- Status = UpdateArgcArgv(&ShellParamsProtocol, NewCmdLine, Efi_Application, NULL, NULL);
+ ShellParamsProtocol.StdIn = ShellInfoObject.NewShellParametersProtocol->StdIn;
+ ShellParamsProtocol.StdOut = ShellInfoObject.NewShellParametersProtocol->StdOut;
+ ShellParamsProtocol.StdErr = ShellInfoObject.NewShellParametersProtocol->StdErr;
+ Status = UpdateArgcArgv (&ShellParamsProtocol, NewCmdLine, Efi_Application, NULL, NULL);
if (EFI_ERROR (Status)) {
goto UnloadImage;
}
@@ -1520,38 +1589,40 @@ InternalShellExecuteDevicePath( Status = EFI_OUT_OF_RESOURCES;
goto UnloadImage;
}
+
ShellParamsProtocol.Argc = 1;
} else {
// Free the string UpdateArgcArgv put in Argv[0];
FreePool (ShellParamsProtocol.Argv[0]);
}
+
ShellParamsProtocol.Argv[0] = ImagePath;
}
- Status = gBS->InstallProtocolInterface(&NewHandle, &gEfiShellParametersProtocolGuid, EFI_NATIVE_INTERFACE, &ShellParamsProtocol);
- ASSERT_EFI_ERROR(Status);
+ Status = gBS->InstallProtocolInterface (&NewHandle, &gEfiShellParametersProtocolGuid, EFI_NATIVE_INTERFACE, &ShellParamsProtocol);
+ ASSERT_EFI_ERROR (Status);
- ///@todo initialize and install ShellInterface protocol on the new image for compatibility if - PcdGetBool(PcdShellSupportOldProtocols)
+ /// @todo initialize and install ShellInterface protocol on the new image for compatibility if - PcdGetBool(PcdShellSupportOldProtocols)
//
// now start the image and if the caller wanted the return code pass it to them...
//
- if (!EFI_ERROR(Status)) {
- StartStatus = gBS->StartImage(
- NewHandle,
- 0,
- NULL
- );
+ if (!EFI_ERROR (Status)) {
+ StartStatus = gBS->StartImage (
+ NewHandle,
+ 0,
+ NULL
+ );
if (StartImageStatus != NULL) {
*StartImageStatus = StartStatus;
}
- CleanupStatus = gBS->UninstallProtocolInterface(
- NewHandle,
- &gEfiShellParametersProtocolGuid,
- &ShellParamsProtocol
- );
- ASSERT_EFI_ERROR(CleanupStatus);
+ CleanupStatus = gBS->UninstallProtocolInterface (
+ NewHandle,
+ &gEfiShellParametersProtocolGuid,
+ &ShellParamsProtocol
+ );
+ ASSERT_EFI_ERROR (CleanupStatus);
goto FreeAlloc;
}
@@ -1568,19 +1639,20 @@ FreeAlloc: FreePool (ShellParamsProtocol.Argv[Index]);
}
}
+
FreePool (ShellParamsProtocol.Argv);
}
}
// Restore environment variables
- if (!IsListEmpty(&OrigEnvs)) {
- CleanupStatus = SetEnvironmentVariableList(&OrigEnvs);
+ if (!IsListEmpty (&OrigEnvs)) {
+ CleanupStatus = SetEnvironmentVariableList (&OrigEnvs);
ASSERT_EFI_ERROR (CleanupStatus);
}
FreePool (NewCmdLine);
- return(Status);
+ return (Status);
}
/**
@@ -1603,39 +1675,39 @@ FreeAlloc: @retval EFI_UNSUPPORTED Nested shell invocations are not allowed.
**/
EFI_STATUS
-InternalShellExecute(
- IN CONST CHAR16 *CommandLine OPTIONAL,
- IN CONST CHAR16 **Environment OPTIONAL,
- OUT EFI_STATUS *StartImageStatus OPTIONAL
+InternalShellExecute (
+ IN CONST CHAR16 *CommandLine OPTIONAL,
+ IN CONST CHAR16 **Environment OPTIONAL,
+ OUT EFI_STATUS *StartImageStatus OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_STATUS CleanupStatus;
- LIST_ENTRY OrigEnvs;
+ EFI_STATUS Status;
+ EFI_STATUS CleanupStatus;
+ LIST_ENTRY OrigEnvs;
- InitializeListHead(&OrigEnvs);
+ InitializeListHead (&OrigEnvs);
//
// Save our current environment settings for later restoration if necessary
//
if (Environment != NULL) {
- Status = GetEnvironmentVariableList(&OrigEnvs);
- if (!EFI_ERROR(Status)) {
- Status = SetEnvironmentVariables(Environment);
+ Status = GetEnvironmentVariableList (&OrigEnvs);
+ if (!EFI_ERROR (Status)) {
+ Status = SetEnvironmentVariables (Environment);
} else {
return Status;
}
}
- Status = RunShellCommand(CommandLine, StartImageStatus);
+ Status = RunShellCommand (CommandLine, StartImageStatus);
// Restore environment variables
- if (!IsListEmpty(&OrigEnvs)) {
- CleanupStatus = SetEnvironmentVariableList(&OrigEnvs);
+ if (!IsListEmpty (&OrigEnvs)) {
+ CleanupStatus = SetEnvironmentVariableList (&OrigEnvs);
ASSERT_EFI_ERROR (CleanupStatus);
}
- return(Status);
+ return (Status);
}
/**
@@ -1646,9 +1718,9 @@ InternalShellExecute( **/
STATIC
BOOLEAN
-NestingEnabled(
+NestingEnabled (
VOID
-)
+ )
{
EFI_STATUS Status;
CHAR16 *Temp;
@@ -1663,15 +1735,16 @@ NestingEnabled( if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest) {
TempSize = 0;
Temp = NULL;
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(mNoNestingEnvVarName, &TempSize, Temp);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (mNoNestingEnvVarName, &TempSize, Temp);
if (Status == EFI_BUFFER_TOO_SMALL) {
- Temp = AllocateZeroPool(TempSize + sizeof(CHAR16));
+ Temp = AllocateZeroPool (TempSize + sizeof (CHAR16));
if (Temp != NULL) {
- Status = SHELL_GET_ENVIRONMENT_VARIABLE(mNoNestingEnvVarName, &TempSize, Temp);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE (mNoNestingEnvVarName, &TempSize, Temp);
}
}
- Temp2 = StrnCatGrow(&Temp2, NULL, mNoNestingTrue, 0);
- if (Temp != NULL && Temp2 != NULL && StringNoCaseCompare(&Temp, &Temp2) == 0) {
+
+ Temp2 = StrnCatGrow (&Temp2, NULL, mNoNestingTrue, 0);
+ if ((Temp != NULL) && (Temp2 != NULL) && (StringNoCaseCompare (&Temp, &Temp2) == 0)) {
//
// Use the no nesting method.
//
@@ -1679,8 +1752,8 @@ NestingEnabled( }
}
- SHELL_FREE_NON_NULL(Temp);
- SHELL_FREE_NON_NULL(Temp2);
+ SHELL_FREE_NON_NULL (Temp);
+ SHELL_FREE_NON_NULL (Temp2);
return (RetVal);
}
@@ -1720,11 +1793,11 @@ NestingEnabled( **/
EFI_STATUS
EFIAPI
-EfiShellExecute(
- IN EFI_HANDLE *ParentImageHandle,
- IN CHAR16 *CommandLine OPTIONAL,
- IN CHAR16 **Environment OPTIONAL,
- OUT EFI_STATUS *StatusCode OPTIONAL
+EfiShellExecute (
+ IN EFI_HANDLE *ParentImageHandle,
+ IN CHAR16 *CommandLine OPTIONAL,
+ IN CHAR16 **Environment OPTIONAL,
+ OUT EFI_STATUS *StatusCode OPTIONAL
)
{
EFI_STATUS Status;
@@ -1732,48 +1805,50 @@ EfiShellExecute( EFI_DEVICE_PATH_PROTOCOL *DevPath;
UINTN Size;
- if ((PcdGet8(PcdShellSupportLevel) < 1)) {
+ if ((PcdGet8 (PcdShellSupportLevel) < 1)) {
return (EFI_UNSUPPORTED);
}
- if (NestingEnabled()) {
+ if (NestingEnabled ()) {
DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
- DEBUG_CODE_BEGIN();
- Temp = ConvertDevicePathToText(ShellInfoObject.FileDevPath, TRUE, TRUE);
- FreePool(Temp);
- Temp = ConvertDevicePathToText(ShellInfoObject.ImageDevPath, TRUE, TRUE);
- FreePool(Temp);
- Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE);
- FreePool(Temp);
- DEBUG_CODE_END();
+ DEBUG_CODE_BEGIN ();
+ Temp = ConvertDevicePathToText (ShellInfoObject.FileDevPath, TRUE, TRUE);
+ FreePool (Temp);
+ Temp = ConvertDevicePathToText (ShellInfoObject.ImageDevPath, TRUE, TRUE);
+ FreePool (Temp);
+ Temp = ConvertDevicePathToText (DevPath, TRUE, TRUE);
+ FreePool (Temp);
+ DEBUG_CODE_END ();
Temp = NULL;
Size = 0;
- ASSERT((Temp == NULL && Size == 0) || (Temp != NULL));
- StrnCatGrow(&Temp, &Size, L"Shell.efi -exit ", 0);
- StrnCatGrow(&Temp, &Size, CommandLine, 0);
-
- Status = InternalShellExecuteDevicePath(
- ParentImageHandle,
- DevPath,
- Temp,
- (CONST CHAR16**)Environment,
- StatusCode);
+ ASSERT ((Temp == NULL && Size == 0) || (Temp != NULL));
+ StrnCatGrow (&Temp, &Size, L"Shell.efi -exit ", 0);
+ StrnCatGrow (&Temp, &Size, CommandLine, 0);
+
+ Status = InternalShellExecuteDevicePath (
+ ParentImageHandle,
+ DevPath,
+ Temp,
+ (CONST CHAR16 **)Environment,
+ StatusCode
+ );
//
// de-allocate and return
//
- FreePool(DevPath);
- FreePool(Temp);
+ FreePool (DevPath);
+ FreePool (Temp);
} else {
- Status = InternalShellExecute(
- (CONST CHAR16*)CommandLine,
- (CONST CHAR16**)Environment,
- StatusCode);
+ Status = InternalShellExecute (
+ (CONST CHAR16 *)CommandLine,
+ (CONST CHAR16 **)Environment,
+ StatusCode
+ );
}
- return(Status);
+ return (Status);
}
/**
@@ -1785,24 +1860,29 @@ EfiShellExecute( @param FileListNode pointer to the list node to free
**/
VOID
-InternalFreeShellFileInfoNode(
- IN EFI_SHELL_FILE_INFO *FileListNode
+InternalFreeShellFileInfoNode (
+ IN EFI_SHELL_FILE_INFO *FileListNode
)
{
if (FileListNode->Info != NULL) {
- FreePool((VOID*)FileListNode->Info);
+ FreePool ((VOID *)FileListNode->Info);
}
+
if (FileListNode->FileName != NULL) {
- FreePool((VOID*)FileListNode->FileName);
+ FreePool ((VOID *)FileListNode->FileName);
}
+
if (FileListNode->FullName != NULL) {
- FreePool((VOID*)FileListNode->FullName);
+ FreePool ((VOID *)FileListNode->FullName);
}
+
if (FileListNode->Handle != NULL) {
- ShellInfoObject.NewEfiShellProtocol->CloseFile(FileListNode->Handle);
+ ShellInfoObject.NewEfiShellProtocol->CloseFile (FileListNode->Handle);
}
- FreePool(FileListNode);
+
+ FreePool (FileListNode);
}
+
/**
Frees the file list.
@@ -1817,26 +1897,28 @@ InternalFreeShellFileInfoNode( **/
EFI_STATUS
EFIAPI
-EfiShellFreeFileList(
- IN EFI_SHELL_FILE_INFO **FileList
+EfiShellFreeFileList (
+ IN EFI_SHELL_FILE_INFO **FileList
)
{
- EFI_SHELL_FILE_INFO *ShellFileListItem;
+ EFI_SHELL_FILE_INFO *ShellFileListItem;
- if (FileList == NULL || *FileList == NULL) {
+ if ((FileList == NULL) || (*FileList == NULL)) {
return (EFI_INVALID_PARAMETER);
}
- for ( ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetFirstNode(&(*FileList)->Link)
- ; !IsListEmpty(&(*FileList)->Link)
- ; ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetFirstNode(&(*FileList)->Link)
- ){
- RemoveEntryList(&ShellFileListItem->Link);
- InternalFreeShellFileInfoNode(ShellFileListItem);
+ for ( ShellFileListItem = (EFI_SHELL_FILE_INFO *)GetFirstNode (&(*FileList)->Link)
+ ; !IsListEmpty (&(*FileList)->Link)
+ ; ShellFileListItem = (EFI_SHELL_FILE_INFO *)GetFirstNode (&(*FileList)->Link)
+ )
+ {
+ RemoveEntryList (&ShellFileListItem->Link);
+ InternalFreeShellFileInfoNode (ShellFileListItem);
}
- InternalFreeShellFileInfoNode(*FileList);
+
+ InternalFreeShellFileInfoNode (*FileList);
*FileList = NULL;
- return(EFI_SUCCESS);
+ return (EFI_SUCCESS);
}
/**
@@ -1851,17 +1933,17 @@ EfiShellFreeFileList( **/
EFI_STATUS
EFIAPI
-EfiShellRemoveDupInFileList(
- IN EFI_SHELL_FILE_INFO **FileList
+EfiShellRemoveDupInFileList (
+ IN EFI_SHELL_FILE_INFO **FileList
)
{
- EFI_STATUS Status;
- EFI_SHELL_FILE_INFO *Duplicates;
- EFI_SHELL_FILE_INFO *ShellFileListItem;
- EFI_SHELL_FILE_INFO *ShellFileListItem2;
- EFI_SHELL_FILE_INFO *TempNode;
+ EFI_STATUS Status;
+ EFI_SHELL_FILE_INFO *Duplicates;
+ EFI_SHELL_FILE_INFO *ShellFileListItem;
+ EFI_SHELL_FILE_INFO *ShellFileListItem2;
+ EFI_SHELL_FILE_INFO *TempNode;
- if (FileList == NULL || *FileList == NULL) {
+ if ((FileList == NULL) || (*FileList == NULL)) {
return (EFI_INVALID_PARAMETER);
}
@@ -1874,35 +1956,41 @@ EfiShellRemoveDupInFileList( EfiShellFreeFileList (&Duplicates);
return EFI_SUCCESS;
}
+
//
// Fall back to the slow method that needs no extra memory, and so cannot
// fail.
//
- for ( ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetFirstNode(&(*FileList)->Link)
- ; !IsNull(&(*FileList)->Link, &ShellFileListItem->Link)
- ; ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetNextNode(&(*FileList)->Link, &ShellFileListItem->Link)
- ){
- for ( ShellFileListItem2 = (EFI_SHELL_FILE_INFO*)GetNextNode(&(*FileList)->Link, &ShellFileListItem->Link)
- ; !IsNull(&(*FileList)->Link, &ShellFileListItem2->Link)
- ; ShellFileListItem2 = (EFI_SHELL_FILE_INFO*)GetNextNode(&(*FileList)->Link, &ShellFileListItem2->Link)
- ){
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)ShellFileListItem->FullName,
- (CHAR16*)ShellFileListItem2->FullName) == 0
- ){
- TempNode = (EFI_SHELL_FILE_INFO *)GetPreviousNode(
+ for ( ShellFileListItem = (EFI_SHELL_FILE_INFO *)GetFirstNode (&(*FileList)->Link)
+ ; !IsNull (&(*FileList)->Link, &ShellFileListItem->Link)
+ ; ShellFileListItem = (EFI_SHELL_FILE_INFO *)GetNextNode (&(*FileList)->Link, &ShellFileListItem->Link)
+ )
+ {
+ for ( ShellFileListItem2 = (EFI_SHELL_FILE_INFO *)GetNextNode (&(*FileList)->Link, &ShellFileListItem->Link)
+ ; !IsNull (&(*FileList)->Link, &ShellFileListItem2->Link)
+ ; ShellFileListItem2 = (EFI_SHELL_FILE_INFO *)GetNextNode (&(*FileList)->Link, &ShellFileListItem2->Link)
+ )
+ {
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)ShellFileListItem->FullName,
+ (CHAR16 *)ShellFileListItem2->FullName
+ ) == 0
+ )
+ {
+ TempNode = (EFI_SHELL_FILE_INFO *)GetPreviousNode (
&(*FileList)->Link,
&ShellFileListItem2->Link
);
- RemoveEntryList(&ShellFileListItem2->Link);
- InternalFreeShellFileInfoNode(ShellFileListItem2);
+ RemoveEntryList (&ShellFileListItem2->Link);
+ InternalFreeShellFileInfoNode (ShellFileListItem2);
// Set ShellFileListItem2 to PreviousNode so we don't access Freed
// memory in GetNextNode in the loop expression above.
ShellFileListItem2 = TempNode;
}
}
}
+
return (EFI_SUCCESS);
}
@@ -1910,12 +1998,12 @@ EfiShellRemoveDupInFileList( // This is the same structure as the external version, but it has no CONST qualifiers.
//
typedef struct {
- LIST_ENTRY Link; ///< Linked list members.
- EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL.
- CHAR16 *FullName; ///< Fully qualified filename.
- CHAR16 *FileName; ///< name of this file.
- SHELL_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed.
- EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL.
+ LIST_ENTRY Link; ///< Linked list members.
+ EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL.
+ CHAR16 *FullName; ///< Fully qualified filename.
+ CHAR16 *FileName; ///< name of this file.
+ SHELL_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed.
+ EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL.
} EFI_SHELL_FILE_INFO_NO_CONST;
/**
@@ -1927,43 +2015,46 @@ typedef struct { @retval NULL a memory allocation error occurred
@return != NULL a pointer to the new node
**/
-EFI_SHELL_FILE_INFO*
-InternalDuplicateShellFileInfo(
- IN EFI_SHELL_FILE_INFO *Node,
- IN BOOLEAN Save
+EFI_SHELL_FILE_INFO *
+InternalDuplicateShellFileInfo (
+ IN EFI_SHELL_FILE_INFO *Node,
+ IN BOOLEAN Save
)
{
- EFI_SHELL_FILE_INFO_NO_CONST *NewNode;
+ EFI_SHELL_FILE_INFO_NO_CONST *NewNode;
//
// try to confirm that the objects are in sync
//
- ASSERT(sizeof(EFI_SHELL_FILE_INFO_NO_CONST) == sizeof(EFI_SHELL_FILE_INFO));
+ ASSERT (sizeof (EFI_SHELL_FILE_INFO_NO_CONST) == sizeof (EFI_SHELL_FILE_INFO));
- NewNode = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
+ NewNode = AllocateZeroPool (sizeof (EFI_SHELL_FILE_INFO));
if (NewNode == NULL) {
return (NULL);
}
- NewNode->FullName = AllocateCopyPool(StrSize(Node->FullName), Node->FullName);
- NewNode->FileName = AllocateCopyPool(StrSize(Node->FileName), Node->FileName);
- NewNode->Info = AllocateCopyPool((UINTN)Node->Info->Size, Node->Info);
- if ( NewNode->FullName == NULL
- || NewNode->FileName == NULL
- || NewNode->Info == NULL
- ){
- SHELL_FREE_NON_NULL(NewNode->FullName);
- SHELL_FREE_NON_NULL(NewNode->FileName);
- SHELL_FREE_NON_NULL(NewNode->Info);
- SHELL_FREE_NON_NULL(NewNode);
- return(NULL);
+
+ NewNode->FullName = AllocateCopyPool (StrSize (Node->FullName), Node->FullName);
+ NewNode->FileName = AllocateCopyPool (StrSize (Node->FileName), Node->FileName);
+ NewNode->Info = AllocateCopyPool ((UINTN)Node->Info->Size, Node->Info);
+ if ( (NewNode->FullName == NULL)
+ || (NewNode->FileName == NULL)
+ || (NewNode->Info == NULL)
+ )
+ {
+ SHELL_FREE_NON_NULL (NewNode->FullName);
+ SHELL_FREE_NON_NULL (NewNode->FileName);
+ SHELL_FREE_NON_NULL (NewNode->Info);
+ SHELL_FREE_NON_NULL (NewNode);
+ return (NULL);
}
+
NewNode->Status = Node->Status;
NewNode->Handle = Node->Handle;
if (!Save) {
Node->Handle = NULL;
}
- return((EFI_SHELL_FILE_INFO*)NewNode);
+ return ((EFI_SHELL_FILE_INFO *)NewNode);
}
/**
@@ -1980,70 +2071,75 @@ InternalDuplicateShellFileInfo( @return a pointer to the newly allocated structure.
**/
EFI_SHELL_FILE_INFO *
-CreateAndPopulateShellFileInfo(
- IN CONST CHAR16 *BasePath,
- IN CONST EFI_STATUS Status,
- IN CONST CHAR16 *FileName,
- IN CONST SHELL_FILE_HANDLE Handle,
- IN CONST EFI_FILE_INFO *Info
+CreateAndPopulateShellFileInfo (
+ IN CONST CHAR16 *BasePath,
+ IN CONST EFI_STATUS Status,
+ IN CONST CHAR16 *FileName,
+ IN CONST SHELL_FILE_HANDLE Handle,
+ IN CONST EFI_FILE_INFO *Info
)
{
- EFI_SHELL_FILE_INFO *ShellFileListItem;
- CHAR16 *TempString;
- UINTN Size;
+ EFI_SHELL_FILE_INFO *ShellFileListItem;
+ CHAR16 *TempString;
+ UINTN Size;
TempString = NULL;
- Size = 0;
+ Size = 0;
- ShellFileListItem = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
+ ShellFileListItem = AllocateZeroPool (sizeof (EFI_SHELL_FILE_INFO));
if (ShellFileListItem == NULL) {
return (NULL);
}
- if (Info != NULL && Info->Size != 0) {
- ShellFileListItem->Info = AllocateZeroPool((UINTN)Info->Size);
+
+ if ((Info != NULL) && (Info->Size != 0)) {
+ ShellFileListItem->Info = AllocateZeroPool ((UINTN)Info->Size);
if (ShellFileListItem->Info == NULL) {
- FreePool(ShellFileListItem);
+ FreePool (ShellFileListItem);
return (NULL);
}
- CopyMem(ShellFileListItem->Info, Info, (UINTN)Info->Size);
+
+ CopyMem (ShellFileListItem->Info, Info, (UINTN)Info->Size);
} else {
ShellFileListItem->Info = NULL;
}
+
if (FileName != NULL) {
- ASSERT(TempString == NULL);
- ShellFileListItem->FileName = StrnCatGrow(&TempString, 0, FileName, 0);
+ ASSERT (TempString == NULL);
+ ShellFileListItem->FileName = StrnCatGrow (&TempString, 0, FileName, 0);
if (ShellFileListItem->FileName == NULL) {
- FreePool(ShellFileListItem->Info);
- FreePool(ShellFileListItem);
+ FreePool (ShellFileListItem->Info);
+ FreePool (ShellFileListItem);
return (NULL);
}
} else {
ShellFileListItem->FileName = NULL;
}
- Size = 0;
+
+ Size = 0;
TempString = NULL;
if (BasePath != NULL) {
- ASSERT((TempString == NULL && Size == 0) || (TempString != NULL));
- TempString = StrnCatGrow(&TempString, &Size, BasePath, 0);
+ ASSERT ((TempString == NULL && Size == 0) || (TempString != NULL));
+ TempString = StrnCatGrow (&TempString, &Size, BasePath, 0);
if (TempString == NULL) {
- FreePool((VOID*)ShellFileListItem->FileName);
- SHELL_FREE_NON_NULL(ShellFileListItem->Info);
- FreePool(ShellFileListItem);
+ FreePool ((VOID *)ShellFileListItem->FileName);
+ SHELL_FREE_NON_NULL (ShellFileListItem->Info);
+ FreePool (ShellFileListItem);
return (NULL);
}
}
+
if (ShellFileListItem->FileName != NULL) {
- ASSERT((TempString == NULL && Size == 0) || (TempString != NULL));
- TempString = StrnCatGrow(&TempString, &Size, ShellFileListItem->FileName, 0);
+ ASSERT ((TempString == NULL && Size == 0) || (TempString != NULL));
+ TempString = StrnCatGrow (&TempString, &Size, ShellFileListItem->FileName, 0);
if (TempString == NULL) {
- FreePool((VOID*)ShellFileListItem->FileName);
- FreePool(ShellFileListItem->Info);
- FreePool(ShellFileListItem);
+ FreePool ((VOID *)ShellFileListItem->FileName);
+ FreePool (ShellFileListItem->Info);
+ FreePool (ShellFileListItem);
return (NULL);
}
}
- TempString = PathCleanUpDirectories(TempString);
+ TempString = PathCleanUpDirectories (TempString);
ShellFileListItem->FullName = TempString;
ShellFileListItem->Status = Status;
@@ -2068,48 +2164,50 @@ CreateAndPopulateShellFileInfo( **/
EFI_STATUS
EFIAPI
-EfiShellFindFilesInDir(
- IN SHELL_FILE_HANDLE FileDirHandle,
- OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellFindFilesInDir (
+ IN SHELL_FILE_HANDLE FileDirHandle,
+ OUT EFI_SHELL_FILE_INFO **FileList
)
{
- EFI_SHELL_FILE_INFO *ShellFileList;
- EFI_SHELL_FILE_INFO *ShellFileListItem;
- EFI_FILE_INFO *FileInfo;
- EFI_STATUS Status;
- BOOLEAN NoFile;
- CHAR16 *TempString;
- CHAR16 *BasePath;
- UINTN Size;
- CHAR16 *TempSpot;
+ EFI_SHELL_FILE_INFO *ShellFileList;
+ EFI_SHELL_FILE_INFO *ShellFileListItem;
+ EFI_FILE_INFO *FileInfo;
+ EFI_STATUS Status;
+ BOOLEAN NoFile;
+ CHAR16 *TempString;
+ CHAR16 *BasePath;
+ UINTN Size;
+ CHAR16 *TempSpot;
BasePath = NULL;
- Status = FileHandleGetFileName(FileDirHandle, &BasePath);
- if (EFI_ERROR(Status)) {
+ Status = FileHandleGetFileName (FileDirHandle, &BasePath);
+ if (EFI_ERROR (Status)) {
return (Status);
}
- if (ShellFileHandleGetPath(FileDirHandle) != NULL) {
- TempString = NULL;
- Size = 0;
- TempString = StrnCatGrow(&TempString, &Size, ShellFileHandleGetPath(FileDirHandle), 0);
+ if (ShellFileHandleGetPath (FileDirHandle) != NULL) {
+ TempString = NULL;
+ Size = 0;
+ TempString = StrnCatGrow (&TempString, &Size, ShellFileHandleGetPath (FileDirHandle), 0);
if (TempString == NULL) {
- SHELL_FREE_NON_NULL(BasePath);
+ SHELL_FREE_NON_NULL (BasePath);
return (EFI_OUT_OF_RESOURCES);
}
- TempSpot = StrStr(TempString, L";");
+
+ TempSpot = StrStr (TempString, L";");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
- TempString = StrnCatGrow(&TempString, &Size, BasePath, 0);
+ TempString = StrnCatGrow (&TempString, &Size, BasePath, 0);
if (TempString == NULL) {
- SHELL_FREE_NON_NULL(BasePath);
+ SHELL_FREE_NON_NULL (BasePath);
return (EFI_OUT_OF_RESOURCES);
}
- SHELL_FREE_NON_NULL(BasePath);
- BasePath = TempString;
+
+ SHELL_FREE_NON_NULL (BasePath);
+ BasePath = TempString;
}
NoFile = FALSE;
@@ -2118,28 +2216,31 @@ EfiShellFindFilesInDir( FileInfo = NULL;
Status = EFI_SUCCESS;
-
- for ( Status = FileHandleFindFirstFile(FileDirHandle, &FileInfo)
- ; !EFI_ERROR(Status) && !NoFile
- ; Status = FileHandleFindNextFile(FileDirHandle, FileInfo, &NoFile)
- ){
+ for ( Status = FileHandleFindFirstFile (FileDirHandle, &FileInfo)
+ ; !EFI_ERROR (Status) && !NoFile
+ ; Status = FileHandleFindNextFile (FileDirHandle, FileInfo, &NoFile)
+ )
+ {
if (ShellFileList == NULL) {
- ShellFileList = (EFI_SHELL_FILE_INFO*)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
+ ShellFileList = (EFI_SHELL_FILE_INFO *)AllocateZeroPool (sizeof (EFI_SHELL_FILE_INFO));
if (ShellFileList == NULL) {
SHELL_FREE_NON_NULL (BasePath);
return EFI_OUT_OF_RESOURCES;
}
- InitializeListHead(&ShellFileList->Link);
+
+ InitializeListHead (&ShellFileList->Link);
}
+
//
// allocate a new EFI_SHELL_FILE_INFO and populate it...
//
- ShellFileListItem = CreateAndPopulateShellFileInfo(
- BasePath,
- EFI_SUCCESS, // success since we didn't fail to open it...
- FileInfo->FileName,
- NULL, // no handle since not open
- FileInfo);
+ ShellFileListItem = CreateAndPopulateShellFileInfo (
+ BasePath,
+ EFI_SUCCESS, // success since we didn't fail to open it...
+ FileInfo->FileName,
+ NULL, // no handle since not open
+ FileInfo
+ );
if (ShellFileListItem == NULL) {
Status = EFI_OUT_OF_RESOURCES;
//
@@ -2147,16 +2248,19 @@ EfiShellFindFilesInDir( //
break;
}
- InsertTailList(&ShellFileList->Link, &ShellFileListItem->Link);
+
+ InsertTailList (&ShellFileList->Link, &ShellFileListItem->Link);
}
- if (EFI_ERROR(Status)) {
- EfiShellFreeFileList(&ShellFileList);
+
+ if (EFI_ERROR (Status)) {
+ EfiShellFreeFileList (&ShellFileList);
*FileList = NULL;
} else {
*FileList = ShellFileList;
}
- SHELL_FREE_NON_NULL(BasePath);
- return(Status);
+
+ SHELL_FREE_NON_NULL (BasePath);
+ return (Status);
}
/**
@@ -2178,22 +2282,22 @@ EfiShellFindFilesInDir( **/
EFI_STATUS
EFIAPI
-EfiShellGetGuidFromName(
- IN CONST CHAR16 *GuidName,
- OUT EFI_GUID *Guid
+EfiShellGetGuidFromName (
+ IN CONST CHAR16 *GuidName,
+ OUT EFI_GUID *Guid
)
{
EFI_GUID *NewGuid;
EFI_STATUS Status;
- if (Guid == NULL || GuidName == NULL) {
+ if ((Guid == NULL) || (GuidName == NULL)) {
return (EFI_INVALID_PARAMETER);
}
- Status = GetGuidFromStringName(GuidName, NULL, &NewGuid);
+ Status = GetGuidFromStringName (GuidName, NULL, &NewGuid);
- if (!EFI_ERROR(Status)) {
- CopyGuid(Guid, NewGuid);
+ if (!EFI_ERROR (Status)) {
+ CopyGuid (Guid, NewGuid);
}
return (Status);
@@ -2218,30 +2322,28 @@ EfiShellGetGuidFromName( **/
EFI_STATUS
EFIAPI
-EfiShellGetGuidName(
- IN CONST EFI_GUID *Guid,
- OUT CONST CHAR16 **GuidName
+EfiShellGetGuidName (
+ IN CONST EFI_GUID *Guid,
+ OUT CONST CHAR16 **GuidName
)
{
- CHAR16 *Name;
+ CHAR16 *Name;
- if (Guid == NULL || GuidName == NULL) {
+ if ((Guid == NULL) || (GuidName == NULL)) {
return (EFI_INVALID_PARAMETER);
}
- Name = GetStringNameFromGuid(Guid, NULL);
- if (Name == NULL || StrLen(Name) == 0) {
- SHELL_FREE_NON_NULL(Name);
+ Name = GetStringNameFromGuid (Guid, NULL);
+ if ((Name == NULL) || (StrLen (Name) == 0)) {
+ SHELL_FREE_NON_NULL (Name);
return (EFI_NOT_FOUND);
}
- *GuidName = AddBufferToFreeList(Name);
+ *GuidName = AddBufferToFreeList (Name);
return (EFI_SUCCESS);
}
-
-
/**
If FileHandle is a directory then the function reads from FileHandle and reads in
each of the FileInfo structures. If one of them matches the Pattern's first
@@ -2265,53 +2367,58 @@ EfiShellGetGuidName( @retval EFI_OUT_OF_RESOURCES a memory allocation failed
**/
EFI_STATUS
-ShellSearchHandle(
- IN CONST CHAR16 *FilePattern,
- IN EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollation,
- IN SHELL_FILE_HANDLE FileHandle,
- IN OUT EFI_SHELL_FILE_INFO **FileList,
- IN CONST EFI_SHELL_FILE_INFO *ParentNode OPTIONAL,
- IN CONST CHAR16 *MapName
+ShellSearchHandle (
+ IN CONST CHAR16 *FilePattern,
+ IN EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollation,
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN OUT EFI_SHELL_FILE_INFO **FileList,
+ IN CONST EFI_SHELL_FILE_INFO *ParentNode OPTIONAL,
+ IN CONST CHAR16 *MapName
)
{
- EFI_STATUS Status;
- CONST CHAR16 *NextFilePatternStart;
- CHAR16 *CurrentFilePattern;
- EFI_SHELL_FILE_INFO *ShellInfo;
- EFI_SHELL_FILE_INFO *ShellInfoNode;
- EFI_SHELL_FILE_INFO *NewShellNode;
- EFI_FILE_INFO *FileInfo;
- BOOLEAN Directory;
- CHAR16 *NewFullName;
- UINTN Size;
-
- if ( FilePattern == NULL
- || UnicodeCollation == NULL
- || FileList == NULL
- ){
+ EFI_STATUS Status;
+ CONST CHAR16 *NextFilePatternStart;
+ CHAR16 *CurrentFilePattern;
+ EFI_SHELL_FILE_INFO *ShellInfo;
+ EFI_SHELL_FILE_INFO *ShellInfoNode;
+ EFI_SHELL_FILE_INFO *NewShellNode;
+ EFI_FILE_INFO *FileInfo;
+ BOOLEAN Directory;
+ CHAR16 *NewFullName;
+ UINTN Size;
+
+ if ( (FilePattern == NULL)
+ || (UnicodeCollation == NULL)
+ || (FileList == NULL)
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
- ShellInfo = NULL;
+
+ ShellInfo = NULL;
CurrentFilePattern = NULL;
if (*FilePattern == L'\\') {
FilePattern++;
}
- for( NextFilePatternStart = FilePattern
- ; *NextFilePatternStart != CHAR_NULL && *NextFilePatternStart != L'\\'
- ; NextFilePatternStart++);
+ for ( NextFilePatternStart = FilePattern
+ ; *NextFilePatternStart != CHAR_NULL && *NextFilePatternStart != L'\\'
+ ; NextFilePatternStart++)
+ {
+ }
- CurrentFilePattern = AllocateZeroPool((NextFilePatternStart-FilePattern+1)*sizeof(CHAR16));
+ CurrentFilePattern = AllocateZeroPool ((NextFilePatternStart-FilePattern+1)*sizeof (CHAR16));
if (CurrentFilePattern == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- StrnCpyS(CurrentFilePattern, NextFilePatternStart-FilePattern+1, FilePattern, NextFilePatternStart-FilePattern);
+ StrnCpyS (CurrentFilePattern, NextFilePatternStart-FilePattern+1, FilePattern, NextFilePatternStart-FilePattern);
- if (CurrentFilePattern[0] == CHAR_NULL
- &&NextFilePatternStart[0] == CHAR_NULL
- ){
+ if ( (CurrentFilePattern[0] == CHAR_NULL)
+ && (NextFilePatternStart[0] == CHAR_NULL)
+ )
+ {
//
// we want the parent or root node (if no parent)
//
@@ -2319,64 +2426,68 @@ ShellSearchHandle( //
// We want the root node. create the node.
//
- FileInfo = FileHandleGetInfo(FileHandle);
- NewShellNode = CreateAndPopulateShellFileInfo(
- MapName,
- EFI_SUCCESS,
- L"\\",
- FileHandle,
- FileInfo
- );
- SHELL_FREE_NON_NULL(FileInfo);
+ FileInfo = FileHandleGetInfo (FileHandle);
+ NewShellNode = CreateAndPopulateShellFileInfo (
+ MapName,
+ EFI_SUCCESS,
+ L"\\",
+ FileHandle,
+ FileInfo
+ );
+ SHELL_FREE_NON_NULL (FileInfo);
} else {
//
// Add the current parameter FileHandle to the list, then end...
//
- NewShellNode = InternalDuplicateShellFileInfo((EFI_SHELL_FILE_INFO*)ParentNode, TRUE);
+ NewShellNode = InternalDuplicateShellFileInfo ((EFI_SHELL_FILE_INFO *)ParentNode, TRUE);
}
+
if (NewShellNode == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
NewShellNode->Handle = NULL;
if (*FileList == NULL) {
- *FileList = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
- InitializeListHead(&((*FileList)->Link));
+ *FileList = AllocateZeroPool (sizeof (EFI_SHELL_FILE_INFO));
+ InitializeListHead (&((*FileList)->Link));
}
//
// Add to the returning to use list
//
- InsertTailList(&(*FileList)->Link, &NewShellNode->Link);
+ InsertTailList (&(*FileList)->Link, &NewShellNode->Link);
Status = EFI_SUCCESS;
}
} else {
- Status = EfiShellFindFilesInDir(FileHandle, &ShellInfo);
+ Status = EfiShellFindFilesInDir (FileHandle, &ShellInfo);
- if (!EFI_ERROR(Status)){
- if (StrStr(NextFilePatternStart, L"\\") != NULL){
+ if (!EFI_ERROR (Status)) {
+ if (StrStr (NextFilePatternStart, L"\\") != NULL) {
Directory = TRUE;
} else {
Directory = FALSE;
}
- for ( ShellInfoNode = (EFI_SHELL_FILE_INFO*)GetFirstNode(&ShellInfo->Link)
- ; !IsNull (&ShellInfo->Link, &ShellInfoNode->Link)
- ; ShellInfoNode = (EFI_SHELL_FILE_INFO*)GetNextNode(&ShellInfo->Link, &ShellInfoNode->Link)
- ){
- if (UnicodeCollation->MetaiMatch(UnicodeCollation, (CHAR16*)ShellInfoNode->FileName, CurrentFilePattern)){
- if (ShellInfoNode->FullName != NULL && StrStr(ShellInfoNode->FullName, L":") == NULL) {
- Size = StrSize (ShellInfoNode->FullName) + StrSize (MapName);
- NewFullName = AllocateZeroPool(Size);
+
+ for ( ShellInfoNode = (EFI_SHELL_FILE_INFO *)GetFirstNode (&ShellInfo->Link)
+ ; !IsNull (&ShellInfo->Link, &ShellInfoNode->Link)
+ ; ShellInfoNode = (EFI_SHELL_FILE_INFO *)GetNextNode (&ShellInfo->Link, &ShellInfoNode->Link)
+ )
+ {
+ if (UnicodeCollation->MetaiMatch (UnicodeCollation, (CHAR16 *)ShellInfoNode->FileName, CurrentFilePattern)) {
+ if ((ShellInfoNode->FullName != NULL) && (StrStr (ShellInfoNode->FullName, L":") == NULL)) {
+ Size = StrSize (ShellInfoNode->FullName) + StrSize (MapName);
+ NewFullName = AllocateZeroPool (Size);
if (NewFullName == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
- StrCpyS(NewFullName, Size / sizeof(CHAR16), MapName);
- StrCatS(NewFullName, Size / sizeof(CHAR16), ShellInfoNode->FullName);
- FreePool ((VOID *) ShellInfoNode->FullName);
+ StrCpyS (NewFullName, Size / sizeof (CHAR16), MapName);
+ StrCatS (NewFullName, Size / sizeof (CHAR16), ShellInfoNode->FullName);
+ FreePool ((VOID *)ShellInfoNode->FullName);
ShellInfoNode->FullName = NewFullName;
}
}
- if (Directory && !EFI_ERROR(Status) && ShellInfoNode->FullName != NULL && ShellInfoNode->FileName != NULL){
+
+ if (Directory && !EFI_ERROR (Status) && (ShellInfoNode->FullName != NULL) && (ShellInfoNode->FileName != NULL)) {
//
// should be a directory
//
@@ -2384,15 +2495,17 @@ ShellSearchHandle( //
// don't open the . and .. directories
//
- if ( (StrCmp(ShellInfoNode->FileName, L".") != 0)
- && (StrCmp(ShellInfoNode->FileName, L"..") != 0)
- ){
+ if ( (StrCmp (ShellInfoNode->FileName, L".") != 0)
+ && (StrCmp (ShellInfoNode->FileName, L"..") != 0)
+ )
+ {
//
//
//
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
break;
}
+
//
// Open the directory since we need that handle in the next recursion.
//
@@ -2401,11 +2514,11 @@ ShellSearchHandle( //
// recurse with the next part of the pattern
//
- Status = ShellSearchHandle(NextFilePatternStart, UnicodeCollation, ShellInfoNode->Handle, FileList, ShellInfoNode, MapName);
- EfiShellClose(ShellInfoNode->Handle);
+ Status = ShellSearchHandle (NextFilePatternStart, UnicodeCollation, ShellInfoNode->Handle, FileList, ShellInfoNode, MapName);
+ EfiShellClose (ShellInfoNode->Handle);
ShellInfoNode->Handle = NULL;
}
- } else if (!EFI_ERROR(Status)) {
+ } else if (!EFI_ERROR (Status)) {
//
// should be a file
//
@@ -2413,38 +2526,41 @@ ShellSearchHandle( //
// copy the information we need into a new Node
//
- NewShellNode = InternalDuplicateShellFileInfo(ShellInfoNode, FALSE);
+ NewShellNode = InternalDuplicateShellFileInfo (ShellInfoNode, FALSE);
if (NewShellNode == NULL) {
Status = EFI_OUT_OF_RESOURCES;
}
+
if (*FileList == NULL) {
- *FileList = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
- InitializeListHead(&((*FileList)->Link));
+ *FileList = AllocateZeroPool (sizeof (EFI_SHELL_FILE_INFO));
+ InitializeListHead (&((*FileList)->Link));
}
//
// Add to the returning to use list
//
- InsertTailList(&(*FileList)->Link, &NewShellNode->Link);
+ InsertTailList (&(*FileList)->Link, &NewShellNode->Link);
}
}
- if (EFI_ERROR(Status)) {
+
+ if (EFI_ERROR (Status)) {
break;
}
}
- if (EFI_ERROR(Status)) {
- EfiShellFreeFileList(&ShellInfo);
+
+ if (EFI_ERROR (Status)) {
+ EfiShellFreeFileList (&ShellInfo);
} else {
- Status = EfiShellFreeFileList(&ShellInfo);
+ Status = EfiShellFreeFileList (&ShellInfo);
}
}
}
- if (*FileList == NULL || (*FileList != NULL && IsListEmpty(&(*FileList)->Link))) {
+ if ((*FileList == NULL) || ((*FileList != NULL) && IsListEmpty (&(*FileList)->Link))) {
Status = EFI_NOT_FOUND;
}
- FreePool(CurrentFilePattern);
+ FreePool (CurrentFilePattern);
return (Status);
}
@@ -2476,65 +2592,71 @@ ShellSearchHandle( **/
EFI_STATUS
EFIAPI
-EfiShellFindFiles(
- IN CONST CHAR16 *FilePattern,
- OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellFindFiles (
+ IN CONST CHAR16 *FilePattern,
+ OUT EFI_SHELL_FILE_INFO **FileList
)
{
- EFI_STATUS Status;
- CHAR16 *PatternCopy;
- CHAR16 *PatternCurrentLocation;
- EFI_DEVICE_PATH_PROTOCOL *RootDevicePath;
- SHELL_FILE_HANDLE RootFileHandle;
- CHAR16 *MapName;
- UINTN Count;
-
- if ( FilePattern == NULL
- || FileList == NULL
- || StrStr(FilePattern, L":") == NULL
- ){
+ EFI_STATUS Status;
+ CHAR16 *PatternCopy;
+ CHAR16 *PatternCurrentLocation;
+ EFI_DEVICE_PATH_PROTOCOL *RootDevicePath;
+ SHELL_FILE_HANDLE RootFileHandle;
+ CHAR16 *MapName;
+ UINTN Count;
+
+ if ( (FilePattern == NULL)
+ || (FileList == NULL)
+ || (StrStr (FilePattern, L":") == NULL)
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
- Status = EFI_SUCCESS;
+
+ Status = EFI_SUCCESS;
RootDevicePath = NULL;
RootFileHandle = NULL;
MapName = NULL;
- PatternCopy = AllocateCopyPool(StrSize(FilePattern), FilePattern);
+ PatternCopy = AllocateCopyPool (StrSize (FilePattern), FilePattern);
if (PatternCopy == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- PatternCopy = PathCleanUpDirectories(PatternCopy);
+ PatternCopy = PathCleanUpDirectories (PatternCopy);
- Count = StrStr(PatternCopy, L":") - PatternCopy + 1;
+ Count = StrStr (PatternCopy, L":") - PatternCopy + 1;
ASSERT (Count <= StrLen (PatternCopy));
- ASSERT(MapName == NULL);
- MapName = StrnCatGrow(&MapName, NULL, PatternCopy, Count);
+ ASSERT (MapName == NULL);
+ MapName = StrnCatGrow (&MapName, NULL, PatternCopy, Count);
if (MapName == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
- RootDevicePath = EfiShellGetDevicePathFromFilePath(PatternCopy);
+ RootDevicePath = EfiShellGetDevicePathFromFilePath (PatternCopy);
if (RootDevicePath == NULL) {
Status = EFI_INVALID_PARAMETER;
} else {
- Status = EfiShellOpenRoot(RootDevicePath, &RootFileHandle);
- if (!EFI_ERROR(Status)) {
+ Status = EfiShellOpenRoot (RootDevicePath, &RootFileHandle);
+ if (!EFI_ERROR (Status)) {
for ( PatternCurrentLocation = PatternCopy
- ; *PatternCurrentLocation != ':'
- ; PatternCurrentLocation++);
+ ; *PatternCurrentLocation != ':'
+ ; PatternCurrentLocation++)
+ {
+ }
+
PatternCurrentLocation++;
- Status = ShellSearchHandle(PatternCurrentLocation, gUnicodeCollation, RootFileHandle, FileList, NULL, MapName);
- EfiShellClose(RootFileHandle);
+ Status = ShellSearchHandle (PatternCurrentLocation, gUnicodeCollation, RootFileHandle, FileList, NULL, MapName);
+ EfiShellClose (RootFileHandle);
}
- FreePool(RootDevicePath);
+
+ FreePool (RootDevicePath);
}
}
- SHELL_FREE_NON_NULL(PatternCopy);
- SHELL_FREE_NON_NULL(MapName);
+ SHELL_FREE_NON_NULL (PatternCopy);
+ SHELL_FREE_NON_NULL (MapName);
- return(Status);
+ return (Status);
}
/**
@@ -2554,49 +2676,51 @@ EfiShellFindFiles( **/
EFI_STATUS
EFIAPI
-EfiShellOpenFileList(
- IN CHAR16 *Path,
- IN UINT64 OpenMode,
- IN OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellOpenFileList (
+ IN CHAR16 *Path,
+ IN UINT64 OpenMode,
+ IN OUT EFI_SHELL_FILE_INFO **FileList
)
{
- EFI_STATUS Status;
- EFI_SHELL_FILE_INFO *ShellFileListItem;
- CHAR16 *Path2;
- UINTN Path2Size;
- CONST CHAR16 *CurDir;
- BOOLEAN Found;
+ EFI_STATUS Status;
+ EFI_SHELL_FILE_INFO *ShellFileListItem;
+ CHAR16 *Path2;
+ UINTN Path2Size;
+ CONST CHAR16 *CurDir;
+ BOOLEAN Found;
- PathCleanUpDirectories(Path);
+ PathCleanUpDirectories (Path);
- Path2Size = 0;
- Path2 = NULL;
+ Path2Size = 0;
+ Path2 = NULL;
- if (FileList == NULL || *FileList == NULL) {
+ if ((FileList == NULL) || (*FileList == NULL)) {
return (EFI_INVALID_PARAMETER);
}
- if (*Path == L'.' && *(Path+1) == L'\\') {
- Path+=2;
+ if ((*Path == L'.') && (*(Path+1) == L'\\')) {
+ Path += 2;
}
//
// convert a local path to an absolute path
//
- if (StrStr(Path, L":") == NULL) {
- CurDir = EfiShellGetCurDir(NULL);
- ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
- StrnCatGrow(&Path2, &Path2Size, CurDir, 0);
- StrnCatGrow(&Path2, &Path2Size, L"\\", 0);
+ if (StrStr (Path, L":") == NULL) {
+ CurDir = EfiShellGetCurDir (NULL);
+ ASSERT ((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
+ StrnCatGrow (&Path2, &Path2Size, CurDir, 0);
+ StrnCatGrow (&Path2, &Path2Size, L"\\", 0);
if (*Path == L'\\') {
Path++;
- while (PathRemoveLastItem(Path2)) ;
+ while (PathRemoveLastItem (Path2)) {
+ }
}
- ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
- StrnCatGrow(&Path2, &Path2Size, Path, 0);
+
+ ASSERT ((Path2 == NULL && Path2Size == 0) || (Path2 != NULL));
+ StrnCatGrow (&Path2, &Path2Size, Path, 0);
} else {
- ASSERT(Path2 == NULL);
- StrnCatGrow(&Path2, NULL, Path, 0);
+ ASSERT (Path2 == NULL);
+ StrnCatGrow (&Path2, NULL, Path, 0);
}
PathCleanUpDirectories (Path2);
@@ -2604,11 +2728,11 @@ EfiShellOpenFileList( //
// do the search
//
- Status = EfiShellFindFiles(Path2, FileList);
+ Status = EfiShellFindFiles (Path2, FileList);
- FreePool(Path2);
+ FreePool (Path2);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return (Status);
}
@@ -2616,20 +2740,22 @@ EfiShellOpenFileList( //
// We had no errors so open all the files (that are not already opened...)
//
- for ( ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetFirstNode(&(*FileList)->Link)
- ; !IsNull(&(*FileList)->Link, &ShellFileListItem->Link)
- ; ShellFileListItem = (EFI_SHELL_FILE_INFO*)GetNextNode(&(*FileList)->Link, &ShellFileListItem->Link)
- ){
- if (ShellFileListItem->Status == 0 && ShellFileListItem->Handle == NULL) {
+ for ( ShellFileListItem = (EFI_SHELL_FILE_INFO *)GetFirstNode (&(*FileList)->Link)
+ ; !IsNull (&(*FileList)->Link, &ShellFileListItem->Link)
+ ; ShellFileListItem = (EFI_SHELL_FILE_INFO *)GetNextNode (&(*FileList)->Link, &ShellFileListItem->Link)
+ )
+ {
+ if ((ShellFileListItem->Status == 0) && (ShellFileListItem->Handle == NULL)) {
ShellFileListItem->Status = EfiShellOpenFileByName (ShellFileListItem->FullName, &ShellFileListItem->Handle, OpenMode);
- Found = TRUE;
+ Found = TRUE;
}
}
if (!Found) {
return (EFI_NOT_FOUND);
}
- return(EFI_SUCCESS);
+
+ return (EFI_SUCCESS);
}
/**
@@ -2656,79 +2782,83 @@ EfiShellOpenFileList( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetEnvEx(
- IN CONST CHAR16 *Name,
- OUT UINT32 *Attributes OPTIONAL
+EfiShellGetEnvEx (
+ IN CONST CHAR16 *Name,
+ OUT UINT32 *Attributes OPTIONAL
)
{
- EFI_STATUS Status;
- VOID *Buffer;
- UINTN Size;
- ENV_VAR_LIST *Node;
- CHAR16 *CurrentWriteLocation;
+ EFI_STATUS Status;
+ VOID *Buffer;
+ UINTN Size;
+ ENV_VAR_LIST *Node;
+ CHAR16 *CurrentWriteLocation;
- Size = 0;
+ Size = 0;
Buffer = NULL;
if (Name == NULL) {
-
//
// Build the semi-colon delimited list. (2 passes)
//
- for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link)
- ; !IsNull(&gShellEnvVarList.Link, &Node->Link)
- ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link)
- ){
- ASSERT(Node->Key != NULL);
- Size += StrSize(Node->Key);
+ for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
+ ; !IsNull (&gShellEnvVarList.Link, &Node->Link)
+ ; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
+ )
+ {
+ ASSERT (Node->Key != NULL);
+ Size += StrSize (Node->Key);
}
- Size += 2*sizeof(CHAR16);
+ Size += 2*sizeof (CHAR16);
- Buffer = AllocateZeroPool(Size);
+ Buffer = AllocateZeroPool (Size);
if (Buffer == NULL) {
return (NULL);
}
- CurrentWriteLocation = (CHAR16*)Buffer;
- for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link)
- ; !IsNull(&gShellEnvVarList.Link, &Node->Link)
- ; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link)
- ){
- ASSERT(Node->Key != NULL);
- StrCpyS( CurrentWriteLocation,
- (Size)/sizeof(CHAR16) - (CurrentWriteLocation - ((CHAR16*)Buffer)),
- Node->Key
- );
- CurrentWriteLocation += StrLen(CurrentWriteLocation) + 1;
- }
+ CurrentWriteLocation = (CHAR16 *)Buffer;
+ for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
+ ; !IsNull (&gShellEnvVarList.Link, &Node->Link)
+ ; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
+ )
+ {
+ ASSERT (Node->Key != NULL);
+ StrCpyS (
+ CurrentWriteLocation,
+ (Size)/sizeof (CHAR16) - (CurrentWriteLocation - ((CHAR16 *)Buffer)),
+ Node->Key
+ );
+ CurrentWriteLocation += StrLen (CurrentWriteLocation) + 1;
+ }
} else {
//
// We are doing a specific environment variable
//
- Status = ShellFindEnvVarInList(Name, (CHAR16**)&Buffer, &Size, Attributes);
+ Status = ShellFindEnvVarInList (Name, (CHAR16 **)&Buffer, &Size, Attributes);
- if (EFI_ERROR(Status)){
+ if (EFI_ERROR (Status)) {
//
// get the size we need for this EnvVariable
//
- Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(Name, Attributes, &Size, Buffer);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (Name, Attributes, &Size, Buffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
//
// Allocate the space and recall the get function
//
- Buffer = AllocateZeroPool(Size);
- Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(Name, Attributes, &Size, Buffer);
+ Buffer = AllocateZeroPool (Size);
+ Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (Name, Attributes, &Size, Buffer);
}
+
//
// we didn't get it (might not exist)
// free the memory if we allocated any and return NULL
//
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- FreePool(Buffer);
+ FreePool (Buffer);
}
+
return (NULL);
} else {
//
@@ -2746,7 +2876,7 @@ EfiShellGetEnvEx( //
// return the buffer
//
- return (AddBufferToFreeList(Buffer));
+ return (AddBufferToFreeList (Buffer));
}
/**
@@ -2774,11 +2904,11 @@ EfiShellGetEnvEx( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetEnv(
- IN CONST CHAR16 *Name
+EfiShellGetEnv (
+ IN CONST CHAR16 *Name
)
{
- return (EfiShellGetEnvEx(Name, NULL));
+ return (EfiShellGetEnvEx (Name, NULL));
}
/**
@@ -2792,23 +2922,25 @@ EfiShellGetEnv( @retval EFI_SUCCESS The environment variable was successfully updated.
**/
EFI_STATUS
-InternalEfiShellSetEnv(
- IN CONST CHAR16 *Name,
- IN CONST CHAR16 *Value,
- IN BOOLEAN Volatile
+InternalEfiShellSetEnv (
+ IN CONST CHAR16 *Name,
+ IN CONST CHAR16 *Value,
+ IN BOOLEAN Volatile
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- if (Value == NULL || StrLen(Value) == 0) {
- Status = SHELL_DELETE_ENVIRONMENT_VARIABLE(Name);
- if (!EFI_ERROR(Status)) {
- ShellRemvoeEnvVarFromList(Name);
+ if ((Value == NULL) || (StrLen (Value) == 0)) {
+ Status = SHELL_DELETE_ENVIRONMENT_VARIABLE (Name);
+ if (!EFI_ERROR (Status)) {
+ ShellRemvoeEnvVarFromList (Name);
}
} else {
- SHELL_DELETE_ENVIRONMENT_VARIABLE(Name);
- Status = ShellAddEnvVarToList(
- Name, Value, StrSize(Value),
+ SHELL_DELETE_ENVIRONMENT_VARIABLE (Name);
+ Status = ShellAddEnvVarToList (
+ Name,
+ Value,
+ StrSize (Value),
EFI_VARIABLE_BOOTSERVICE_ACCESS | (Volatile ? 0 : EFI_VARIABLE_NON_VOLATILE)
);
if (!EFI_ERROR (Status)) {
@@ -2816,10 +2948,11 @@ InternalEfiShellSetEnv( ? SHELL_SET_ENVIRONMENT_VARIABLE_V (Name, StrSize (Value) - sizeof (CHAR16), Value)
: SHELL_SET_ENVIRONMENT_VARIABLE_NV (Name, StrSize (Value) - sizeof (CHAR16), Value);
if (EFI_ERROR (Status)) {
- ShellRemvoeEnvVarFromList(Name);
+ ShellRemvoeEnvVarFromList (Name);
}
}
}
+
return Status;
}
@@ -2846,15 +2979,16 @@ InternalEfiShellSetEnv( **/
EFI_STATUS
EFIAPI
-EfiShellSetEnv(
- IN CONST CHAR16 *Name,
- IN CONST CHAR16 *Value,
- IN BOOLEAN Volatile
+EfiShellSetEnv (
+ IN CONST CHAR16 *Name,
+ IN CONST CHAR16 *Value,
+ IN BOOLEAN Volatile
)
{
- if (Name == NULL || *Name == CHAR_NULL) {
+ if ((Name == NULL) || (*Name == CHAR_NULL)) {
return (EFI_INVALID_PARAMETER);
}
+
//
// Make sure we dont 'set' a predefined read only variable
//
@@ -2865,11 +2999,13 @@ EfiShellSetEnv( (StrCmp (Name, L"uefishellversion") == 0) ||
(StrCmp (Name, L"uefiversion") == 0) ||
(!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest &&
- StrCmp (Name, mNoNestingEnvVarName) == 0)
- ) {
+ (StrCmp (Name, mNoNestingEnvVarName) == 0))
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
- return (InternalEfiShellSetEnv(Name, Value, Volatile));
+
+ return (InternalEfiShellSetEnv (Name, Value, Volatile));
}
/**
@@ -2890,30 +3026,32 @@ EfiShellSetEnv( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetCurDir(
- IN CONST CHAR16 *FileSystemMapping OPTIONAL
+EfiShellGetCurDir (
+ IN CONST CHAR16 *FileSystemMapping OPTIONAL
)
{
- CHAR16 *PathToReturn;
- UINTN Size;
- SHELL_MAP_LIST *MapListItem;
- if (!IsListEmpty(&gShellMapList.Link)) {
+ CHAR16 *PathToReturn;
+ UINTN Size;
+ SHELL_MAP_LIST *MapListItem;
+
+ if (!IsListEmpty (&gShellMapList.Link)) {
//
// if parameter is NULL, use current
//
if (FileSystemMapping == NULL) {
- return (EfiShellGetEnv(L"cwd"));
+ return (EfiShellGetEnv (L"cwd"));
} else {
- Size = 0;
+ Size = 0;
PathToReturn = NULL;
- MapListItem = ShellCommandFindMapItem(FileSystemMapping);
+ MapListItem = ShellCommandFindMapItem (FileSystemMapping);
if (MapListItem != NULL) {
- ASSERT((PathToReturn == NULL && Size == 0) || (PathToReturn != NULL));
- PathToReturn = StrnCatGrow(&PathToReturn, &Size, MapListItem->MapName, 0);
- PathToReturn = StrnCatGrow(&PathToReturn, &Size, MapListItem->CurrentDirectoryPath, 0);
+ ASSERT ((PathToReturn == NULL && Size == 0) || (PathToReturn != NULL));
+ PathToReturn = StrnCatGrow (&PathToReturn, &Size, MapListItem->MapName, 0);
+ PathToReturn = StrnCatGrow (&PathToReturn, &Size, MapListItem->CurrentDirectoryPath, 0);
}
}
- return (AddBufferToFreeList(PathToReturn));
+
+ return (AddBufferToFreeList (PathToReturn));
} else {
return (NULL);
}
@@ -2948,9 +3086,9 @@ EfiShellGetCurDir( **/
EFI_STATUS
EFIAPI
-EfiShellSetCurDir(
- IN CONST CHAR16 *FileSystem OPTIONAL,
- IN CONST CHAR16 *Dir
+EfiShellSetCurDir (
+ IN CONST CHAR16 *FileSystem OPTIONAL,
+ IN CONST CHAR16 *Dir
)
{
CHAR16 *MapName;
@@ -2967,33 +3105,34 @@ EfiShellSetCurDir( TempString = NULL;
DirectoryName = NULL;
- if ((FileSystem == NULL && Dir == NULL) || Dir == NULL) {
+ if (((FileSystem == NULL) && (Dir == NULL)) || (Dir == NULL)) {
return (EFI_INVALID_PARAMETER);
}
- if (IsListEmpty(&gShellMapList.Link)){
+ if (IsListEmpty (&gShellMapList.Link)) {
return (EFI_NOT_FOUND);
}
- DirectoryName = StrnCatGrow(&DirectoryName, NULL, Dir, 0);
- ASSERT(DirectoryName != NULL);
+ DirectoryName = StrnCatGrow (&DirectoryName, NULL, Dir, 0);
+ ASSERT (DirectoryName != NULL);
- PathCleanUpDirectories(DirectoryName);
+ PathCleanUpDirectories (DirectoryName);
if (FileSystem == NULL) {
//
// determine the file system mapping to use
//
- if (StrStr(DirectoryName, L":") != NULL) {
- ASSERT(MapName == NULL);
- MapName = StrnCatGrow(&MapName, NULL, DirectoryName, (StrStr(DirectoryName, L":")-DirectoryName+1));
+ if (StrStr (DirectoryName, L":") != NULL) {
+ ASSERT (MapName == NULL);
+ MapName = StrnCatGrow (&MapName, NULL, DirectoryName, (StrStr (DirectoryName, L":")-DirectoryName+1));
}
+
//
// find the file system mapping's entry in the list
// or use current
//
if (MapName != NULL) {
- MapListItem = ShellCommandFindMapItem(MapName);
+ MapListItem = ShellCommandFindMapItem (MapName);
//
// make that the current file system mapping
@@ -3007,87 +3146,97 @@ EfiShellSetCurDir( if (MapListItem == NULL) {
FreePool (DirectoryName);
- SHELL_FREE_NON_NULL(MapName);
+ SHELL_FREE_NON_NULL (MapName);
return (EFI_NOT_FOUND);
}
//
// now update the MapListItem's current directory
//
- if (MapListItem->CurrentDirectoryPath != NULL && DirectoryName[StrLen(DirectoryName) - 1] != L':') {
- FreePool(MapListItem->CurrentDirectoryPath);
+ if ((MapListItem->CurrentDirectoryPath != NULL) && (DirectoryName[StrLen (DirectoryName) - 1] != L':')) {
+ FreePool (MapListItem->CurrentDirectoryPath);
MapListItem->CurrentDirectoryPath = NULL;
}
+
if (MapName != NULL) {
- TempLen = StrLen(MapName);
- if (TempLen != StrLen(DirectoryName)) {
- ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
- MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName+StrLen(MapName), 0);
+ TempLen = StrLen (MapName);
+ if (TempLen != StrLen (DirectoryName)) {
+ ASSERT ((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
+ MapListItem->CurrentDirectoryPath = StrnCatGrow (&MapListItem->CurrentDirectoryPath, &Size, DirectoryName+StrLen (MapName), 0);
}
+
FreePool (MapName);
} else {
- ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
- MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);
+ ASSERT ((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
+ MapListItem->CurrentDirectoryPath = StrnCatGrow (&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);
}
- if ((MapListItem->CurrentDirectoryPath != NULL && MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] == L'\\') || (MapListItem->CurrentDirectoryPath == NULL)) {
- ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
+
+ if (((MapListItem->CurrentDirectoryPath != NULL) && (MapListItem->CurrentDirectoryPath[StrLen (MapListItem->CurrentDirectoryPath)-1] == L'\\')) || (MapListItem->CurrentDirectoryPath == NULL)) {
+ ASSERT ((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
if (MapListItem->CurrentDirectoryPath != NULL) {
- MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL;
- }
+ MapListItem->CurrentDirectoryPath[StrLen (MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL;
+ }
}
} else {
//
// cant have a mapping in the directory...
//
- if (StrStr(DirectoryName, L":") != NULL) {
+ if (StrStr (DirectoryName, L":") != NULL) {
FreePool (DirectoryName);
return (EFI_INVALID_PARAMETER);
}
+
//
// FileSystem != NULL
//
- MapListItem = ShellCommandFindMapItem(FileSystem);
+ MapListItem = ShellCommandFindMapItem (FileSystem);
if (MapListItem == NULL) {
FreePool (DirectoryName);
return (EFI_INVALID_PARAMETER);
}
-// gShellCurMapping = MapListItem;
+
+ // gShellCurMapping = MapListItem;
if (DirectoryName != NULL) {
//
// change current dir on that file system
//
if (MapListItem->CurrentDirectoryPath != NULL) {
- FreePool(MapListItem->CurrentDirectoryPath);
- DEBUG_CODE(MapListItem->CurrentDirectoryPath = NULL;);
+ FreePool (MapListItem->CurrentDirectoryPath);
+ DEBUG_CODE (
+ MapListItem->CurrentDirectoryPath = NULL;
+ );
}
-// ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
-// MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, FileSystem, 0);
- ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
- MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, L"\\", 0);
- ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
- MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);
- if (MapListItem->CurrentDirectoryPath != NULL && MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] == L'\\') {
- ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
- MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL;
+
+ // ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
+ // MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, FileSystem, 0);
+ ASSERT ((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
+ MapListItem->CurrentDirectoryPath = StrnCatGrow (&MapListItem->CurrentDirectoryPath, &Size, L"\\", 0);
+ ASSERT ((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
+ MapListItem->CurrentDirectoryPath = StrnCatGrow (&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);
+ if ((MapListItem->CurrentDirectoryPath != NULL) && (MapListItem->CurrentDirectoryPath[StrLen (MapListItem->CurrentDirectoryPath)-1] == L'\\')) {
+ ASSERT ((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
+ MapListItem->CurrentDirectoryPath[StrLen (MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL;
}
}
}
+
FreePool (DirectoryName);
//
// if updated the current directory then update the environment variable
//
if (MapListItem == gShellCurMapping) {
Size = 0;
- ASSERT((TempString == NULL && Size == 0) || (TempString != NULL));
- StrnCatGrow(&TempString, &Size, MapListItem->MapName, 0);
- ASSERT((TempString == NULL && Size == 0) || (TempString != NULL));
- StrnCatGrow(&TempString, &Size, MapListItem->CurrentDirectoryPath, 0);
- Status = InternalEfiShellSetEnv(L"cwd", TempString, TRUE);
- FreePool(TempString);
+ ASSERT ((TempString == NULL && Size == 0) || (TempString != NULL));
+ StrnCatGrow (&TempString, &Size, MapListItem->MapName, 0);
+ ASSERT ((TempString == NULL && Size == 0) || (TempString != NULL));
+ StrnCatGrow (&TempString, &Size, MapListItem->CurrentDirectoryPath, 0);
+ Status = InternalEfiShellSetEnv (L"cwd", TempString, TRUE);
+ FreePool (TempString);
return (Status);
}
- return(EFI_SUCCESS);
+
+ return (EFI_SUCCESS);
}
/**
@@ -3117,45 +3266,47 @@ EfiShellSetCurDir( **/
EFI_STATUS
EFIAPI
-EfiShellGetHelpText(
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Sections OPTIONAL,
- OUT CHAR16 **HelpText
+EfiShellGetHelpText (
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Sections OPTIONAL,
+ OUT CHAR16 **HelpText
)
{
CONST CHAR16 *ManFileName;
CHAR16 *FixCommand;
EFI_STATUS Status;
- ASSERT(HelpText != NULL);
+ ASSERT (HelpText != NULL);
FixCommand = NULL;
- ManFileName = ShellCommandGetManFileNameHandler(Command);
+ ManFileName = ShellCommandGetManFileNameHandler (Command);
if (ManFileName != NULL) {
- return (ProcessManFile(ManFileName, Command, Sections, NULL, HelpText));
+ return (ProcessManFile (ManFileName, Command, Sections, NULL, HelpText));
} else {
- if ((StrLen(Command)> 4)
- && (Command[StrLen(Command)-1] == L'i' || Command[StrLen(Command)-1] == L'I')
- && (Command[StrLen(Command)-2] == L'f' || Command[StrLen(Command)-2] == L'F')
- && (Command[StrLen(Command)-3] == L'e' || Command[StrLen(Command)-3] == L'E')
- && (Command[StrLen(Command)-4] == L'.')
- ) {
- FixCommand = AllocateZeroPool(StrSize(Command) - 4 * sizeof (CHAR16));
+ if ( (StrLen (Command) > 4)
+ && ((Command[StrLen (Command)-1] == L'i') || (Command[StrLen (Command)-1] == L'I'))
+ && ((Command[StrLen (Command)-2] == L'f') || (Command[StrLen (Command)-2] == L'F'))
+ && ((Command[StrLen (Command)-3] == L'e') || (Command[StrLen (Command)-3] == L'E'))
+ && (Command[StrLen (Command)-4] == L'.')
+ )
+ {
+ FixCommand = AllocateZeroPool (StrSize (Command) - 4 * sizeof (CHAR16));
if (FixCommand == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- StrnCpyS( FixCommand,
- (StrSize(Command) - 4 * sizeof (CHAR16))/sizeof(CHAR16),
- Command,
- StrLen(Command)-4
- );
- Status = ProcessManFile(FixCommand, FixCommand, Sections, NULL, HelpText);
- FreePool(FixCommand);
+ StrnCpyS (
+ FixCommand,
+ (StrSize (Command) - 4 * sizeof (CHAR16))/sizeof (CHAR16),
+ Command,
+ StrLen (Command)-4
+ );
+ Status = ProcessManFile (FixCommand, FixCommand, Sections, NULL, HelpText);
+ FreePool (FixCommand);
return Status;
} else {
- return (ProcessManFile(Command, Command, Sections, NULL, HelpText));
+ return (ProcessManFile (Command, Command, Sections, NULL, HelpText));
}
}
}
@@ -3170,11 +3321,11 @@ EfiShellGetHelpText( **/
BOOLEAN
EFIAPI
-EfiShellGetPageBreak(
+EfiShellGetPageBreak (
VOID
)
{
- return(ShellInfoObject.PageBreakEnabled);
+ return (ShellInfoObject.PageBreakEnabled);
}
/**
@@ -3187,11 +3338,11 @@ EfiShellGetPageBreak( **/
BOOLEAN
EFIAPI
-EfiShellIsRootShell(
+EfiShellIsRootShell (
VOID
)
{
- return(ShellInfoObject.RootShellInstance);
+ return (ShellInfoObject.RootShellInstance);
}
/**
@@ -3204,23 +3355,22 @@ EfiShellIsRootShell( @return !NULL a list of all alias'
**/
CHAR16 *
-InternalEfiShellGetListAlias(
+InternalEfiShellGetListAlias (
VOID
)
{
-
- EFI_STATUS Status;
- EFI_GUID Guid;
- CHAR16 *VariableName;
- UINTN NameSize;
- UINTN NameBufferSize;
- CHAR16 *RetVal;
- UINTN RetSize;
+ EFI_STATUS Status;
+ EFI_GUID Guid;
+ CHAR16 *VariableName;
+ UINTN NameSize;
+ UINTN NameBufferSize;
+ CHAR16 *RetVal;
+ UINTN RetSize;
NameBufferSize = INIT_NAME_BUFFER_SIZE;
- VariableName = AllocateZeroPool(NameBufferSize);
- RetSize = 0;
- RetVal = NULL;
+ VariableName = AllocateZeroPool (NameBufferSize);
+ RetSize = 0;
+ RetVal = NULL;
if (VariableName == NULL) {
return (NULL);
@@ -3230,37 +3380,38 @@ InternalEfiShellGetListAlias( while (TRUE) {
NameSize = NameBufferSize;
- Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid);
- if (Status == EFI_NOT_FOUND){
+ Status = gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
+ if (Status == EFI_NOT_FOUND) {
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;
- SHELL_FREE_NON_NULL(RetVal);
+ SHELL_FREE_NON_NULL (RetVal);
RetVal = NULL;
break;
}
NameSize = NameBufferSize;
- Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid);
+ Status = gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
}
if (EFI_ERROR (Status)) {
- SHELL_FREE_NON_NULL(RetVal);
+ SHELL_FREE_NON_NULL (RetVal);
RetVal = NULL;
break;
}
- if (CompareGuid(&Guid, &gShellAliasGuid)){
- ASSERT((RetVal == NULL && RetSize == 0) || (RetVal != NULL));
- RetVal = StrnCatGrow(&RetVal, &RetSize, VariableName, 0);
- RetVal = StrnCatGrow(&RetVal, &RetSize, L";", 0);
+ if (CompareGuid (&Guid, &gShellAliasGuid)) {
+ ASSERT ((RetVal == NULL && RetSize == 0) || (RetVal != NULL));
+ RetVal = StrnCatGrow (&RetVal, &RetSize, VariableName, 0);
+ RetVal = StrnCatGrow (&RetVal, &RetSize, L";", 0);
} // compare guid
} // while
- SHELL_FREE_NON_NULL(VariableName);
+
+ SHELL_FREE_NON_NULL (VariableName);
return (RetVal);
}
@@ -3275,16 +3426,17 @@ InternalEfiShellGetListAlias( **/
CHAR16 *
ToLower (
- CHAR16 *Str
+ CHAR16 *Str
)
{
- UINTN Index;
+ UINTN Index;
for (Index = 0; Str[Index] != L'\0'; Index++) {
- if (Str[Index] >= L'A' && Str[Index] <= L'Z') {
+ if ((Str[Index] >= L'A') && (Str[Index] <= L'Z')) {
Str[Index] -= (CHAR16)(L'A' - L'a');
}
}
+
return Str;
}
@@ -3308,9 +3460,9 @@ ToLower ( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetAlias(
- IN CONST CHAR16 *Alias,
- OUT BOOLEAN *Volatile OPTIONAL
+EfiShellGetAlias (
+ IN CONST CHAR16 *Alias,
+ OUT BOOLEAN *Volatile OPTIONAL
)
{
CHAR16 *RetVal;
@@ -3326,27 +3478,32 @@ EfiShellGetAlias( if (AliasLower == NULL) {
return NULL;
}
+
ToLower (AliasLower);
if (Volatile == NULL) {
GetVariable2 (AliasLower, &gShellAliasGuid, (VOID **)&AliasVal, NULL);
- FreePool(AliasLower);
- return (AddBufferToFreeList(AliasVal));
+ FreePool (AliasLower);
+ return (AddBufferToFreeList (AliasVal));
}
+
RetSize = 0;
- RetVal = NULL;
- Status = gRT->GetVariable(AliasLower, &gShellAliasGuid, &Attribs, &RetSize, RetVal);
+ RetVal = NULL;
+ Status = gRT->GetVariable (AliasLower, &gShellAliasGuid, &Attribs, &RetSize, RetVal);
if (Status == EFI_BUFFER_TOO_SMALL) {
- RetVal = AllocateZeroPool(RetSize);
- Status = gRT->GetVariable(AliasLower, &gShellAliasGuid, &Attribs, &RetSize, RetVal);
+ RetVal = AllocateZeroPool (RetSize);
+ Status = gRT->GetVariable (AliasLower, &gShellAliasGuid, &Attribs, &RetSize, RetVal);
}
- if (EFI_ERROR(Status)) {
+
+ if (EFI_ERROR (Status)) {
if (RetVal != NULL) {
- FreePool(RetVal);
+ FreePool (RetVal);
}
- FreePool(AliasLower);
+
+ FreePool (AliasLower);
return (NULL);
}
+
if ((EFI_VARIABLE_NON_VOLATILE & Attribs) == EFI_VARIABLE_NON_VOLATILE) {
*Volatile = FALSE;
} else {
@@ -3354,9 +3511,10 @@ EfiShellGetAlias( }
FreePool (AliasLower);
- return (AddBufferToFreeList(RetVal));
+ return (AddBufferToFreeList (RetVal));
}
- return (AddBufferToFreeList(InternalEfiShellGetListAlias()));
+
+ return (AddBufferToFreeList (InternalEfiShellGetListAlias ()));
}
/**
@@ -3376,10 +3534,10 @@ EfiShellGetAlias( @retval EFI_NOT_FOUND the Alias intended to be deleted was not found
**/
EFI_STATUS
-InternalSetAlias(
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Alias,
- IN BOOLEAN Volatile
+InternalSetAlias (
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias,
+ IN BOOLEAN Volatile
)
{
EFI_STATUS Status;
@@ -3395,6 +3553,7 @@ InternalSetAlias( Alias = Command;
DeleteAlias = TRUE;
}
+
ASSERT (Alias != NULL);
//
@@ -3404,15 +3563,18 @@ InternalSetAlias( if (AliasLower == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
ToLower (AliasLower);
if (DeleteAlias) {
Status = gRT->SetVariable (AliasLower, &gShellAliasGuid, 0, 0, NULL);
} else {
Status = gRT->SetVariable (
- AliasLower, &gShellAliasGuid,
+ AliasLower,
+ &gShellAliasGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | (Volatile ? 0 : EFI_VARIABLE_NON_VOLATILE),
- StrSize (Command), (VOID *) Command
+ StrSize (Command),
+ (VOID *)Command
);
}
@@ -3444,36 +3606,36 @@ InternalSetAlias( **/
EFI_STATUS
EFIAPI
-EfiShellSetAlias(
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Alias,
- IN BOOLEAN Replace,
- IN BOOLEAN Volatile
+EfiShellSetAlias (
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias,
+ IN BOOLEAN Replace,
+ IN BOOLEAN Volatile
)
{
- if (ShellCommandIsOnAliasList(Alias==NULL?Command:Alias)) {
+ if (ShellCommandIsOnAliasList ((Alias == NULL) ? Command : Alias)) {
//
// cant set over a built in alias
//
return (EFI_ACCESS_DENIED);
- } else if (Command == NULL || *Command == CHAR_NULL || StrLen(Command) == 0) {
+ } else if ((Command == NULL) || (*Command == CHAR_NULL) || (StrLen (Command) == 0)) {
//
// Command is null or empty
//
return (EFI_INVALID_PARAMETER);
- } else if (EfiShellGetAlias(Command, NULL) != NULL && !Replace) {
+ } else if ((EfiShellGetAlias (Command, NULL) != NULL) && !Replace) {
//
// Alias already exists, Replace not set
//
return (EFI_ACCESS_DENIED);
} else {
- return (InternalSetAlias(Command, Alias, Volatile));
+ return (InternalSetAlias (Command, Alias, Volatile));
}
}
// Pure FILE_HANDLE operations are passed to FileHandleLib
// these functions are indicated by the *
-EFI_SHELL_PROTOCOL mShellProtocol = {
+EFI_SHELL_PROTOCOL mShellProtocol = {
EfiShellExecute,
EfiShellGetEnv,
EfiShellSetEnv,
@@ -3496,21 +3658,21 @@ EFI_SHELL_PROTOCOL mShellProtocol = { EfiShellDisablePageBreak,
EfiShellGetPageBreak,
EfiShellGetDeviceName,
- (EFI_SHELL_GET_FILE_INFO)FileHandleGetInfo, //*
- (EFI_SHELL_SET_FILE_INFO)FileHandleSetInfo, //*
+ (EFI_SHELL_GET_FILE_INFO)FileHandleGetInfo, // *
+ (EFI_SHELL_SET_FILE_INFO)FileHandleSetInfo, // *
EfiShellOpenFileByName,
EfiShellClose,
EfiShellCreateFile,
- (EFI_SHELL_READ_FILE)FileHandleRead, //*
- (EFI_SHELL_WRITE_FILE)FileHandleWrite, //*
- (EFI_SHELL_DELETE_FILE)FileHandleDelete, //*
+ (EFI_SHELL_READ_FILE)FileHandleRead, // *
+ (EFI_SHELL_WRITE_FILE)FileHandleWrite, // *
+ (EFI_SHELL_DELETE_FILE)FileHandleDelete, // *
EfiShellDeleteFileByName,
- (EFI_SHELL_GET_FILE_POSITION)FileHandleGetPosition, //*
- (EFI_SHELL_SET_FILE_POSITION)FileHandleSetPosition, //*
- (EFI_SHELL_FLUSH_FILE)FileHandleFlush, //*
+ (EFI_SHELL_GET_FILE_POSITION)FileHandleGetPosition, // *
+ (EFI_SHELL_SET_FILE_POSITION)FileHandleSetPosition, // *
+ (EFI_SHELL_FLUSH_FILE)FileHandleFlush, // *
EfiShellFindFiles,
EfiShellFindFilesInDir,
- (EFI_SHELL_GET_FILE_SIZE)FileHandleGetSize, //*
+ (EFI_SHELL_GET_FILE_SIZE)FileHandleGetSize, // *
EfiShellOpenRoot,
EfiShellOpenRootByHandle,
NULL,
@@ -3554,79 +3716,91 @@ CreatePopulateInstallShellProtocol ( return (EFI_INVALID_PARAMETER);
}
- BufferSize = 0;
- Buffer = NULL;
+ BufferSize = 0;
+ Buffer = NULL;
OldProtocolNode = NULL;
- InitializeListHead(&ShellInfoObject.OldShellList.Link);
+ InitializeListHead (&ShellInfoObject.OldShellList.Link);
//
// Initialize EfiShellProtocol object...
//
- Status = gBS->CreateEvent(0,
- 0,
- NULL,
- NULL,
- &mShellProtocol.ExecutionBreak);
- if (EFI_ERROR(Status)) {
+ Status = gBS->CreateEvent (
+ 0,
+ 0,
+ NULL,
+ NULL,
+ &mShellProtocol.ExecutionBreak
+ );
+ if (EFI_ERROR (Status)) {
return (Status);
}
//
// Get the size of the buffer we need.
//
- Status = gBS->LocateHandle(ByProtocol,
- &gEfiShellProtocolGuid,
- NULL,
- &BufferSize,
- Buffer);
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiShellProtocolGuid,
+ NULL,
+ &BufferSize,
+ Buffer
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
//
// Allocate and recall with buffer of correct size
//
- Buffer = AllocateZeroPool(BufferSize);
+ Buffer = AllocateZeroPool (BufferSize);
if (Buffer == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- Status = gBS->LocateHandle(ByProtocol,
- &gEfiShellProtocolGuid,
- NULL,
- &BufferSize,
- Buffer);
- if (EFI_ERROR(Status)) {
- FreePool(Buffer);
+
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiShellProtocolGuid,
+ NULL,
+ &BufferSize,
+ Buffer
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (Buffer);
return (Status);
}
+
//
// now overwrite each of them, but save the info to restore when we end.
//
- for (HandleCounter = 0 ; HandleCounter < (BufferSize/sizeof(EFI_HANDLE)) ; HandleCounter++) {
- Status = gBS->OpenProtocol(Buffer[HandleCounter],
- &gEfiShellProtocolGuid,
- (VOID **) &OldShell,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR(Status)) {
- OldProtocolNode = AllocateZeroPool(sizeof(SHELL_PROTOCOL_HANDLE_LIST));
+ for (HandleCounter = 0; HandleCounter < (BufferSize/sizeof (EFI_HANDLE)); HandleCounter++) {
+ Status = gBS->OpenProtocol (
+ Buffer[HandleCounter],
+ &gEfiShellProtocolGuid,
+ (VOID **)&OldShell,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+ OldProtocolNode = AllocateZeroPool (sizeof (SHELL_PROTOCOL_HANDLE_LIST));
if (OldProtocolNode == NULL) {
if (!IsListEmpty (&ShellInfoObject.OldShellList.Link)) {
CleanUpShellProtocol (&mShellProtocol);
}
+
Status = EFI_OUT_OF_RESOURCES;
break;
}
+
//
// reinstall over the old one...
//
OldProtocolNode->Handle = Buffer[HandleCounter];
OldProtocolNode->Interface = OldShell;
- Status = gBS->ReinstallProtocolInterface(
- OldProtocolNode->Handle,
- &gEfiShellProtocolGuid,
- OldProtocolNode->Interface,
- (VOID*)(&mShellProtocol));
- if (!EFI_ERROR(Status)) {
+ Status = gBS->ReinstallProtocolInterface (
+ OldProtocolNode->Handle,
+ &gEfiShellProtocolGuid,
+ OldProtocolNode->Interface,
+ (VOID *)(&mShellProtocol)
+ );
+ if (!EFI_ERROR (Status)) {
//
// we reinstalled successfully. log this so we can reverse it later.
//
@@ -3634,31 +3808,34 @@ CreatePopulateInstallShellProtocol ( //
// add to the list for subsequent...
//
- InsertTailList(&ShellInfoObject.OldShellList.Link, &OldProtocolNode->Link);
+ InsertTailList (&ShellInfoObject.OldShellList.Link, &OldProtocolNode->Link);
}
}
}
- FreePool(Buffer);
+
+ FreePool (Buffer);
} else if (Status == EFI_NOT_FOUND) {
- ASSERT(IsListEmpty(&ShellInfoObject.OldShellList.Link));
+ ASSERT (IsListEmpty (&ShellInfoObject.OldShellList.Link));
//
// no one else published yet. just publish it ourselves.
//
Status = gBS->InstallProtocolInterface (
- &gImageHandle,
- &gEfiShellProtocolGuid,
- EFI_NATIVE_INTERFACE,
- (VOID*)(&mShellProtocol));
+ &gImageHandle,
+ &gEfiShellProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ (VOID *)(&mShellProtocol)
+ );
}
- if (PcdGetBool(PcdShellSupportOldProtocols)){
- ///@todo support ShellEnvironment2
- ///@todo do we need to support ShellEnvironment (not ShellEnvironment2) also?
+ if (PcdGetBool (PcdShellSupportOldProtocols)) {
+ /// @todo support ShellEnvironment2
+ /// @todo do we need to support ShellEnvironment (not ShellEnvironment2) also?
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
*NewShell = &mShellProtocol;
}
+
return (Status);
}
@@ -3677,16 +3854,17 @@ CleanUpShellProtocol ( IN OUT EFI_SHELL_PROTOCOL *NewShell
)
{
- SHELL_PROTOCOL_HANDLE_LIST *Node2;
+ SHELL_PROTOCOL_HANDLE_LIST *Node2;
//
// if we need to restore old protocols...
//
- if (!IsListEmpty(&ShellInfoObject.OldShellList.Link)) {
- for (Node2 = (SHELL_PROTOCOL_HANDLE_LIST *) GetFirstNode (&ShellInfoObject.OldShellList.Link)
+ if (!IsListEmpty (&ShellInfoObject.OldShellList.Link)) {
+ for (Node2 = (SHELL_PROTOCOL_HANDLE_LIST *)GetFirstNode (&ShellInfoObject.OldShellList.Link)
; !IsListEmpty (&ShellInfoObject.OldShellList.Link)
- ; Node2 = (SHELL_PROTOCOL_HANDLE_LIST *) GetFirstNode (&ShellInfoObject.OldShellList.Link)
- ) {
+ ; Node2 = (SHELL_PROTOCOL_HANDLE_LIST *)GetFirstNode (&ShellInfoObject.OldShellList.Link)
+ )
+ {
RemoveEntryList (&Node2->Link);
gBS->ReinstallProtocolInterface (Node2->Handle, &gEfiShellProtocolGuid, NewShell, Node2->Interface);
FreePool (Node2);
@@ -3697,6 +3875,7 @@ CleanUpShellProtocol ( //
gBS->UninstallProtocolInterface (gImageHandle, &gEfiShellProtocolGuid, NewShell);
}
+
return EFI_SUCCESS;
}
@@ -3712,32 +3891,34 @@ CleanUpShellEnvironment ( IN OUT EFI_SHELL_PROTOCOL *NewShell
)
{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
+ EFI_STATUS Status;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
CleanUpShellProtocol (NewShell);
- Status = gBS->CloseEvent(NewShell->ExecutionBreak);
+ Status = gBS->CloseEvent (NewShell->ExecutionBreak);
NewShell->ExecutionBreak = NULL;
- Status = gBS->OpenProtocol(
- gST->ConsoleInHandle,
- &gEfiSimpleTextInputExProtocolGuid,
- (VOID**)&SimpleEx,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ Status = gBS->OpenProtocol (
+ gST->ConsoleInHandle,
+ &gEfiSimpleTextInputExProtocolGuid,
+ (VOID **)&SimpleEx,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
- Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlCNotifyHandle1);
- Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlCNotifyHandle2);
- Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlCNotifyHandle3);
- Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlCNotifyHandle4);
- Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlSNotifyHandle1);
- Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlSNotifyHandle2);
- Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlSNotifyHandle3);
- Status = SimpleEx->UnregisterKeyNotify(SimpleEx, ShellInfoObject.CtrlSNotifyHandle4);
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.CtrlCNotifyHandle1);
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.CtrlCNotifyHandle2);
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.CtrlCNotifyHandle3);
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.CtrlCNotifyHandle4);
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.CtrlSNotifyHandle1);
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.CtrlSNotifyHandle2);
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.CtrlSNotifyHandle3);
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, ShellInfoObject.CtrlSNotifyHandle4);
}
+
return (Status);
}
@@ -3750,23 +3931,27 @@ CleanUpShellEnvironment ( **/
EFI_STATUS
EFIAPI
-NotificationFunction(
- IN EFI_KEY_DATA *KeyData
+NotificationFunction (
+ IN EFI_KEY_DATA *KeyData
)
{
- if ( ((KeyData->Key.UnicodeChar == L'c') &&
- (KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED) || KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED))) ||
+ if (((KeyData->Key.UnicodeChar == L'c') &&
+ ((KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED)) || (KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED)))) ||
(KeyData->Key.UnicodeChar == 3)
- ){
+ )
+ {
if (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak == NULL) {
return (EFI_UNSUPPORTED);
}
- return (gBS->SignalEvent(ShellInfoObject.NewEfiShellProtocol->ExecutionBreak));
- } else if ((KeyData->Key.UnicodeChar == L's') &&
- (KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED) || KeyData->KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED))
- ){
+
+ return (gBS->SignalEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak));
+ } else if ((KeyData->Key.UnicodeChar == L's') &&
+ ((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;
}
+
return (EFI_SUCCESS);
}
@@ -3778,28 +3963,30 @@ NotificationFunction( @retval EFI_OUT_OF_RESOURCES There is not enough memory available.
**/
EFI_STATUS
-InernalEfiShellStartMonitor(
+InernalEfiShellStartMonitor (
VOID
)
{
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
- EFI_KEY_DATA KeyData;
- EFI_STATUS Status;
-
- Status = gBS->OpenProtocol(
- gST->ConsoleInHandle,
- &gEfiSimpleTextInputExProtocolGuid,
- (VOID**)&SimpleEx,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
+ EFI_KEY_DATA KeyData;
+ EFI_STATUS Status;
+
+ Status = gBS->OpenProtocol (
+ gST->ConsoleInHandle,
+ &gEfiSimpleTextInputExProtocolGuid,
+ (VOID **)&SimpleEx,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_SHELL_NO_IN_EX),
- ShellInfoObject.HiiHandle);
+ ShellInfoObject.HiiHandle
+ );
return (EFI_SUCCESS);
}
@@ -3812,37 +3999,43 @@ InernalEfiShellStartMonitor( KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
KeyData.Key.UnicodeChar = L'c';
- Status = SimpleEx->RegisterKeyNotify(
- SimpleEx,
- &KeyData,
- NotificationFunction,
- &ShellInfoObject.CtrlCNotifyHandle1);
+ Status = SimpleEx->RegisterKeyNotify (
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &ShellInfoObject.CtrlCNotifyHandle1
+ );
- KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
- if (!EFI_ERROR(Status)) {
- Status = SimpleEx->RegisterKeyNotify(
- SimpleEx,
- &KeyData,
- NotificationFunction,
- &ShellInfoObject.CtrlCNotifyHandle2);
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->RegisterKeyNotify (
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &ShellInfoObject.CtrlCNotifyHandle2
+ );
}
- KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
- KeyData.Key.UnicodeChar = 3;
- if (!EFI_ERROR(Status)) {
- Status = SimpleEx->RegisterKeyNotify(
- SimpleEx,
- &KeyData,
- NotificationFunction,
- &ShellInfoObject.CtrlCNotifyHandle3);
- }
- KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
- if (!EFI_ERROR(Status)) {
- Status = SimpleEx->RegisterKeyNotify(
- SimpleEx,
- &KeyData,
- NotificationFunction,
- &ShellInfoObject.CtrlCNotifyHandle4);
+
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
+ KeyData.Key.UnicodeChar = 3;
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->RegisterKeyNotify (
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &ShellInfoObject.CtrlCNotifyHandle3
+ );
+ }
+
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->RegisterKeyNotify (
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &ShellInfoObject.CtrlCNotifyHandle4
+ );
}
+
return (Status);
}
-
diff --git a/ShellPkg/Application/Shell/ShellProtocol.h b/ShellPkg/Application/Shell/ShellProtocol.h index 472d98dba2..3d872ffb68 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.h +++ b/ShellPkg/Application/Shell/ShellProtocol.h @@ -14,13 +14,13 @@ #include "Shell.h"
typedef struct {
- LIST_ENTRY Link;
- EFI_SHELL_PROTOCOL *Interface;
- EFI_HANDLE Handle;
+ LIST_ENTRY Link;
+ EFI_SHELL_PROTOCOL *Interface;
+ EFI_HANDLE Handle;
} SHELL_PROTOCOL_HANDLE_LIST;
// flags values...
-#define SHELL_MAP_FLAGS_CONSIST BIT1
+#define SHELL_MAP_FLAGS_CONSIST BIT1
/**
Function to create and install on the current handle.
@@ -87,9 +87,9 @@ CleanUpShellEnvironment ( **/
EFI_STATUS
EFIAPI
-EfiShellSetMap(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL,
- IN CONST CHAR16 *Mapping
+EfiShellSetMap (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL,
+ IN CONST CHAR16 *Mapping
);
/**
@@ -107,8 +107,8 @@ EfiShellSetMap( **/
CONST EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
-EfiShellGetDevicePathFromMap(
- IN CONST CHAR16 *Mapping
+EfiShellGetDevicePathFromMap (
+ IN CONST CHAR16 *Mapping
);
/**
@@ -130,8 +130,8 @@ EfiShellGetDevicePathFromMap( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetMapFromDevicePath(
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+EfiShellGetMapFromDevicePath (
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
@@ -149,8 +149,8 @@ EfiShellGetMapFromDevicePath( **/
CHAR16 *
EFIAPI
-EfiShellGetFilePathFromDevicePath(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
+EfiShellGetFilePathFromDevicePath (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
);
/**
@@ -166,8 +166,8 @@ EfiShellGetFilePathFromDevicePath( **/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
-EfiShellGetDevicePathFromFilePath(
- IN CONST CHAR16 *Path
+EfiShellGetDevicePathFromFilePath (
+ IN CONST CHAR16 *Path
);
/**
@@ -208,11 +208,11 @@ EfiShellGetDevicePathFromFilePath( **/
EFI_STATUS
EFIAPI
-EfiShellGetDeviceName(
- IN EFI_HANDLE DeviceHandle,
- IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
- IN CHAR8 *Language,
- OUT CHAR16 **BestDeviceName
+EfiShellGetDeviceName (
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
+ IN CHAR8 *Language,
+ OUT CHAR16 **BestDeviceName
);
/**
@@ -232,9 +232,9 @@ EfiShellGetDeviceName( **/
EFI_STATUS
EFIAPI
-EfiShellOpenRootByHandle(
- IN EFI_HANDLE DeviceHandle,
- OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellOpenRootByHandle (
+ IN EFI_HANDLE DeviceHandle,
+ OUT SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -255,9 +255,9 @@ EfiShellOpenRootByHandle( **/
EFI_STATUS
EFIAPI
-EfiShellOpenRoot(
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellOpenRoot (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ OUT SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -287,11 +287,11 @@ EfiShellBatchIsActive ( @retval other an error occurred.
**/
EFI_STATUS
-InternalOpenFileDevicePath(
- IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath2,
- OUT SHELL_FILE_HANDLE *FileHandle,
- IN UINT64 OpenMode,
- IN UINT64 Attributes OPTIONAL
+InternalOpenFileDevicePath (
+ IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath2,
+ OUT SHELL_FILE_HANDLE *FileHandle,
+ IN UINT64 OpenMode,
+ IN UINT64 Attributes OPTIONAL
);
/**
@@ -332,10 +332,10 @@ InternalOpenFileDevicePath( **/
EFI_STATUS
EFIAPI
-EfiShellCreateFile(
- IN CONST CHAR16 *FileName,
- IN UINT64 FileAttribs,
- OUT SHELL_FILE_HANDLE *FileHandle
+EfiShellCreateFile (
+ IN CONST CHAR16 *FileName,
+ IN UINT64 FileAttribs,
+ OUT SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -392,10 +392,10 @@ EfiShellCreateFile( **/
EFI_STATUS
EFIAPI
-EfiShellOpenFileByName(
- IN CONST CHAR16 *FileName,
- OUT SHELL_FILE_HANDLE *FileHandle,
- IN UINT64 OpenMode
+EfiShellOpenFileByName (
+ IN CONST CHAR16 *FileName,
+ OUT SHELL_FILE_HANDLE *FileHandle,
+ IN UINT64 OpenMode
);
/**
@@ -412,8 +412,8 @@ EfiShellOpenFileByName( **/
EFI_STATUS
EFIAPI
-EfiShellDeleteFileByName(
- IN CONST CHAR16 *FileName
+EfiShellDeleteFileByName (
+ IN CONST CHAR16 *FileName
);
/**
@@ -456,12 +456,12 @@ EfiShellEnablePageBreak ( @retval EFI_UNSUPPORTED Nested shell invocations are not allowed.
**/
EFI_STATUS
-InternalShellExecuteDevicePath(
- IN CONST EFI_HANDLE *ParentImageHandle,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST CHAR16 *CommandLine OPTIONAL,
- IN CONST CHAR16 **Environment OPTIONAL,
- OUT EFI_STATUS *StartImageStatus OPTIONAL
+InternalShellExecuteDevicePath (
+ IN CONST EFI_HANDLE *ParentImageHandle,
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CONST CHAR16 *CommandLine OPTIONAL,
+ IN CONST CHAR16 **Environment OPTIONAL,
+ OUT EFI_STATUS *StartImageStatus OPTIONAL
);
/**
@@ -497,11 +497,11 @@ InternalShellExecuteDevicePath( **/
EFI_STATUS
EFIAPI
-EfiShellExecute(
- IN EFI_HANDLE *ParentImageHandle,
- IN CHAR16 *CommandLine OPTIONAL,
- IN CHAR16 **Environment OPTIONAL,
- OUT EFI_STATUS *StatusCode OPTIONAL
+EfiShellExecute (
+ IN EFI_HANDLE *ParentImageHandle,
+ IN CHAR16 *CommandLine OPTIONAL,
+ IN CHAR16 **Environment OPTIONAL,
+ OUT EFI_STATUS *StatusCode OPTIONAL
);
/**
@@ -513,8 +513,8 @@ EfiShellExecute( @param FileListNode pointer to the list node to free
**/
VOID
-FreeShellFileInfoNode(
- IN EFI_SHELL_FILE_INFO *FileListNode
+FreeShellFileInfoNode (
+ IN EFI_SHELL_FILE_INFO *FileListNode
);
/**
@@ -531,8 +531,8 @@ FreeShellFileInfoNode( **/
EFI_STATUS
EFIAPI
-EfiShellFreeFileList(
- IN EFI_SHELL_FILE_INFO **FileList
+EfiShellFreeFileList (
+ IN EFI_SHELL_FILE_INFO **FileList
);
/**
@@ -547,8 +547,8 @@ EfiShellFreeFileList( **/
EFI_STATUS
EFIAPI
-EfiShellRemoveDupInFileList(
- IN EFI_SHELL_FILE_INFO **FileList
+EfiShellRemoveDupInFileList (
+ IN EFI_SHELL_FILE_INFO **FileList
);
/**
@@ -563,12 +563,12 @@ EfiShellRemoveDupInFileList( **/
EFI_SHELL_FILE_INFO *
-CreateAndPopulateShellFileInfo(
- IN CONST CHAR16 *BasePath,
- IN CONST EFI_STATUS Status,
- IN CONST CHAR16 *FileName,
- IN CONST SHELL_FILE_HANDLE Handle,
- IN CONST EFI_FILE_INFO *Info
+CreateAndPopulateShellFileInfo (
+ IN CONST CHAR16 *BasePath,
+ IN CONST EFI_STATUS Status,
+ IN CONST CHAR16 *FileName,
+ IN CONST SHELL_FILE_HANDLE Handle,
+ IN CONST EFI_FILE_INFO *Info
);
/**
@@ -586,9 +586,9 @@ CreateAndPopulateShellFileInfo( **/
EFI_STATUS
EFIAPI
-EfiShellFindFilesInDir(
- IN SHELL_FILE_HANDLE FileDirHandle,
- OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellFindFilesInDir (
+ IN SHELL_FILE_HANDLE FileDirHandle,
+ OUT EFI_SHELL_FILE_INFO **FileList
);
/**
@@ -619,9 +619,9 @@ EfiShellFindFilesInDir( **/
EFI_STATUS
EFIAPI
-EfiShellFindFiles(
- IN CONST CHAR16 *FilePattern,
- OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellFindFiles (
+ IN CONST CHAR16 *FilePattern,
+ OUT EFI_SHELL_FILE_INFO **FileList
);
/**
@@ -641,10 +641,10 @@ EfiShellFindFiles( **/
EFI_STATUS
EFIAPI
-EfiShellOpenFileList(
- IN CHAR16 *Path,
- IN UINT64 OpenMode,
- IN OUT EFI_SHELL_FILE_INFO **FileList
+EfiShellOpenFileList (
+ IN CHAR16 *Path,
+ IN UINT64 OpenMode,
+ IN OUT EFI_SHELL_FILE_INFO **FileList
);
/**
@@ -660,8 +660,8 @@ EfiShellOpenFileList( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetEnv(
- IN CONST CHAR16 *Name
+EfiShellGetEnv (
+ IN CONST CHAR16 *Name
);
/**
@@ -687,10 +687,10 @@ EfiShellGetEnv( **/
EFI_STATUS
EFIAPI
-EfiShellSetEnv(
- IN CONST CHAR16 *Name,
- IN CONST CHAR16 *Value,
- IN BOOLEAN Volatile
+EfiShellSetEnv (
+ IN CONST CHAR16 *Name,
+ IN CONST CHAR16 *Value,
+ IN BOOLEAN Volatile
);
/**
@@ -709,8 +709,8 @@ EfiShellSetEnv( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetCurDir(
- IN CONST CHAR16 *FileSystemMapping OPTIONAL
+EfiShellGetCurDir (
+ IN CONST CHAR16 *FileSystemMapping OPTIONAL
);
/**
@@ -738,9 +738,9 @@ EfiShellGetCurDir( **/
EFI_STATUS
EFIAPI
-EfiShellSetCurDir(
- IN CONST CHAR16 *FileSystem OPTIONAL,
- IN CONST CHAR16 *Dir
+EfiShellSetCurDir (
+ IN CONST CHAR16 *FileSystem OPTIONAL,
+ IN CONST CHAR16 *Dir
);
/**
@@ -770,10 +770,10 @@ EfiShellSetCurDir( **/
EFI_STATUS
EFIAPI
-EfiShellGetHelpText(
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Sections OPTIONAL,
- OUT CHAR16 **HelpText
+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,9 +823,9 @@ EfiShellIsRootShell( **/
CONST CHAR16 *
EFIAPI
-EfiShellGetAlias(
- IN CONST CHAR16 *Command,
- OUT BOOLEAN *Volatile OPTIONAL
+EfiShellGetAlias (
+ IN CONST CHAR16 *Command,
+ OUT BOOLEAN *Volatile OPTIONAL
);
/**
@@ -845,10 +845,10 @@ EfiShellGetAlias( @retval EFI_NOT_FOUND the Alias intended to be deleted was not found
**/
EFI_STATUS
-InternalSetAlias(
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Alias OPTIONAL,
- IN BOOLEAN Volatile
+InternalSetAlias (
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias OPTIONAL,
+ IN BOOLEAN Volatile
);
/**
@@ -873,11 +873,11 @@ InternalSetAlias( **/
EFI_STATUS
EFIAPI
-EfiShellSetAlias(
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Alias OPTIONAL,
- IN BOOLEAN Replace,
- IN BOOLEAN Volatile
+EfiShellSetAlias (
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias OPTIONAL,
+ IN BOOLEAN Replace,
+ IN BOOLEAN Volatile
);
/**
@@ -889,8 +889,8 @@ EfiShellSetAlias( @param FileListNode pointer to the list node to free
**/
VOID
-InternalFreeShellFileInfoNode(
- IN EFI_SHELL_FILE_INFO *FileListNode
+InternalFreeShellFileInfoNode (
+ IN EFI_SHELL_FILE_INFO *FileListNode
);
/**
@@ -904,10 +904,10 @@ InternalFreeShellFileInfoNode( @retval EFI_SUCCESS The environment variable was successfully updated.
**/
EFI_STATUS
-InternalEfiShellSetEnv(
- IN CONST CHAR16 *Name,
- IN CONST CHAR16 *Value,
- IN BOOLEAN Volatile
+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(
- IN EFI_KEY_DATA *KeyData
+NotificationFunction (
+ IN EFI_KEY_DATA *KeyData
);
-#endif //_SHELL_PROTOCOL_HEADER_
+#endif //_SHELL_PROTOCOL_HEADER_
diff --git a/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c b/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c index b9451795ff..e5f7b89c62 100644 --- a/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c +++ b/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c @@ -29,16 +29,18 @@ INTN
EFIAPI
ShellAppMain (
- IN UINTN Argc,
- IN CHAR16 **Argv
+ IN UINTN Argc,
+ IN CHAR16 **Argv
)
{
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;
diff --git a/ShellPkg/Application/ShellExecTestApp/SA.c b/ShellPkg/Application/ShellExecTestApp/SA.c index cc5228bf39..cfaeaae0d4 100644 --- a/ShellPkg/Application/ShellExecTestApp/SA.c +++ b/ShellPkg/Application/ShellExecTestApp/SA.c @@ -27,6 +27,6 @@ UefiMain ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- Print(L"ShellExecute - Pass");
+ Print (L"ShellExecute - Pass");
return EFI_SUCCESS;
}
diff --git a/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c b/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c index 21eacac5e3..093633ee27 100644 --- a/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c +++ b/ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c @@ -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);
}
@@ -52,11 +57,11 @@ Test(CONST VOID *b1, CONST VOID *b2) INTN
EFIAPI
ShellAppMain (
- IN UINTN Argc,
- IN CHAR16 **Argv
+ IN UINTN Argc,
+ IN CHAR16 **Argv
)
{
- INTN Array[10];
+ INTN Array[10];
Array[0] = 2;
Array[1] = 3;
@@ -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;
}
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index f7f3676bc9..1799ab176a 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -25,18 +25,18 @@ #pragma pack(1)
typedef struct {
- EFI_ACPI_DESCRIPTION_HEADER Header;
- UINT32 Entry;
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 Entry;
} RSDT_TABLE;
typedef struct {
- EFI_ACPI_DESCRIPTION_HEADER Header;
- UINT64 Entry;
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT64 Entry;
} XSDT_TABLE;
#pragma pack()
-EFI_HII_HANDLE mDpHiiHandle;
+EFI_HII_HANDLE mDpHiiHandle;
typedef struct {
EFI_HANDLE Handle;
@@ -49,21 +49,21 @@ UINTN mCachePairCount = 0; //
/// Module-Global Variables
///@{
-CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
-CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
-UINT64 mInterestThreshold;
-BOOLEAN mShowId = FALSE;
-UINT8 *mBootPerformanceTable;
-UINTN mBootPerformanceTableSize;
-BOOLEAN mPeiPhase = FALSE;
-BOOLEAN mDxePhase = FALSE;
-
-PERF_SUMMARY_DATA SummaryData = { 0 }; ///< Create the SummaryData structure and init. to ZERO.
+CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
+CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
+UINT64 mInterestThreshold;
+BOOLEAN mShowId = FALSE;
+UINT8 *mBootPerformanceTable;
+UINTN mBootPerformanceTableSize;
+BOOLEAN mPeiPhase = FALSE;
+BOOLEAN mDxePhase = FALSE;
+
+PERF_SUMMARY_DATA SummaryData = { 0 }; ///< Create the SummaryData structure and init. to ZERO.
MEASUREMENT_RECORD *mMeasurementList = NULL;
-UINTN mMeasurementNum = 0;
+UINTN mMeasurementNum = 0;
/// Items for which to gather cumulative statistics.
-PERF_CUM_DATA CumData[] = {
+PERF_CUM_DATA CumData[] = {
PERF_INIT_CUM_DATA (LOAD_IMAGE_TOK),
PERF_INIT_CUM_DATA (START_IMAGE_TOK),
PERF_INIT_CUM_DATA (DRIVERBINDING_START_TOK),
@@ -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);
-
-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}
- };
+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 }
+};
///@}
@@ -93,20 +93,29 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { Display the trailing Verbose information.
**/
VOID
-DumpStatistics( void )
+DumpStatistics (
+ void
+ )
{
- EFI_STRING StringPtr;
- EFI_STRING StringPtrUnknown;
+ 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_STATS_NUMTRACE), mDpHiiHandle, SummaryData.NumTrace);
+ 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);
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMHANDLES), mDpHiiHandle, SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles);
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), mDpHiiHandle, SummaryData.NumPEIMs);
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), mDpHiiHandle, SummaryData.NumGlobal);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPHASES), mDpHiiHandle, SummaryData.NumSummary);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMHANDLES), mDpHiiHandle, SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), mDpHiiHandle, SummaryData.NumPEIMs);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), mDpHiiHandle, SummaryData.NumGlobal);
SHELL_FREE_NON_NULL (StringPtr);
SHELL_FREE_NON_NULL (StringPtrUnknown);
}
@@ -121,16 +130,16 @@ GetBootPerformanceTable ( {
FIRMWARE_PERFORMANCE_TABLE *FirmwarePerformanceTable;
- FirmwarePerformanceTable = (FIRMWARE_PERFORMANCE_TABLE *) EfiLocateFirstAcpiTable (
- EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE
- );
+ FirmwarePerformanceTable = (FIRMWARE_PERFORMANCE_TABLE *)EfiLocateFirstAcpiTable (
+ EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE
+ );
if (FirmwarePerformanceTable == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle);
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;
}
@@ -144,15 +153,16 @@ GetBootPerformanceTable ( **/
VOID
GetHandleFormModuleGuid (
- IN EFI_GUID *ModuleGuid,
- IN OUT EFI_HANDLE *Handle
+ IN EFI_GUID *ModuleGuid,
+ IN OUT EFI_HANDLE *Handle
)
{
- UINTN Index;
+ UINTN Index;
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;
}
@@ -176,14 +187,14 @@ BuildCachedGuidHandleTable ( VOID
)
{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- UINTN Index;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- EFI_GUID *TempGuid;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ UINTN Index;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
+ EFI_GUID *TempGuid;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);
if (EFI_ERROR (Status)) {
@@ -201,55 +212,58 @@ BuildCachedGuidHandleTable ( // Try Handle as ImageHandle.
//
Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiLoadedImageProtocolGuid,
- (VOID**) &LoadedImage
- );
+ HandleBuffer[Index],
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage
+ );
if (EFI_ERROR (Status)) {
//
// Try Handle as Controller Handle
//
Status = gBS->OpenProtocol (
- HandleBuffer[Index],
- &gEfiDriverBindingProtocolGuid,
- (VOID **) &DriverBinding,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ HandleBuffer[Index],
+ &gEfiDriverBindingProtocolGuid,
+ (VOID **)&DriverBinding,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
//
// Get Image protocol from ImageHandle
//
Status = gBS->HandleProtocol (
- DriverBinding->ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**) &LoadedImage
- );
+ DriverBinding->ImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (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;
- TempGuid = &FvFilePath->FvFileName;
+ 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;
}
@@ -268,198 +282,209 @@ GetMeasurementInfo ( IN OUT MEASUREMENT_RECORD *Measurement
)
{
- VOID *ModuleGuid;
- EFI_HANDLE StartHandle;
+ VOID *ModuleGuid;
+ EFI_HANDLE StartHandle;
switch (RecordHeader->Type) {
- case FPDT_GUID_EVENT_TYPE:
- ModuleGuid = &(((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Guid);
- Measurement->Identifier = ((UINT32)((FPDT_GUID_EVENT_RECORD *)RecordHeader)->ProgressID);
- if (IsStart) {
- Measurement->StartTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp;
- } else {
- Measurement->EndTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp;
- }
- switch (Measurement->Identifier) {
- case MODULE_START_ID:
- case MODULE_END_ID:
- if (mPeiPhase) {
- Measurement->Token = ALit_PEIM;
- Measurement->Module = ALit_PEIM;
- } else if (mDxePhase) {
- Measurement->Token = ALit_START_IMAGE;
- Measurement->Module = ALit_START_IMAGE;
+ case FPDT_GUID_EVENT_TYPE:
+ ModuleGuid = &(((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Guid);
+ Measurement->Identifier = ((UINT32)((FPDT_GUID_EVENT_RECORD *)RecordHeader)->ProgressID);
+ if (IsStart) {
+ Measurement->StartTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp;
+ } else {
+ Measurement->EndTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp;
}
- break;
- default:
- ASSERT(FALSE);
- }
- if (Measurement->Token != NULL && AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0) {
- Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
- } else {
- 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)) {
- Measurement->Token = ALit_PEIM;
- Measurement->Module = ALit_PEIM;
- Measurement->Handle = ModuleGuid;
- } else {
- Measurement->Token = ALit_START_IMAGE;
- Measurement->Module = ALit_START_IMAGE;
- }
+ switch (Measurement->Identifier) {
+ case MODULE_START_ID:
+ case MODULE_END_ID:
+ if (mPeiPhase) {
+ Measurement->Token = ALit_PEIM;
+ Measurement->Module = ALit_PEIM;
+ } else if (mDxePhase) {
+ Measurement->Token = ALit_START_IMAGE;
+ Measurement->Module = ALit_START_IMAGE;
+ }
+
+ break;
+ default:
+ ASSERT (FALSE);
}
- }
- break;
- case FPDT_DYNAMIC_STRING_EVENT_TYPE:
- ModuleGuid = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
- Measurement->Identifier = ((UINT32)((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->ProgressID);
- if (IsStart) {
- Measurement->StartTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
- } else {
- Measurement->EndTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
- }
- switch (Measurement->Identifier) {
- case MODULE_START_ID:
- case MODULE_END_ID:
- if (mPeiPhase) {
- Measurement->Token = ALit_PEIM;
- } else if (mDxePhase) {
- Measurement->Token = ALit_START_IMAGE;
+ if ((Measurement->Token != NULL) && (AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0)) {
+ Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
+ } else {
+ 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)) {
+ Measurement->Token = ALit_PEIM;
+ Measurement->Module = ALit_PEIM;
+ Measurement->Handle = ModuleGuid;
+ } else {
+ Measurement->Token = ALit_START_IMAGE;
+ Measurement->Module = ALit_START_IMAGE;
+ }
+ }
}
- break;
- case MODULE_LOADIMAGE_START_ID:
- case MODULE_LOADIMAGE_END_ID:
- Measurement->Token = ALit_LOAD_IMAGE;
break;
- case MODULE_DB_START_ID:
- case MODULE_DB_END_ID:
- Measurement->Token = ALit_DB_START;
- break;
+ case FPDT_DYNAMIC_STRING_EVENT_TYPE:
+ ModuleGuid = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
+ Measurement->Identifier = ((UINT32)((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->ProgressID);
+ if (IsStart) {
+ Measurement->StartTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
+ } else {
+ Measurement->EndTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
+ }
- case MODULE_DB_SUPPORT_START_ID:
- case MODULE_DB_SUPPORT_END_ID:
- Measurement->Token = ALit_DB_SUPPORT;
- break;
+ switch (Measurement->Identifier) {
+ case MODULE_START_ID:
+ case MODULE_END_ID:
+ if (mPeiPhase) {
+ Measurement->Token = ALit_PEIM;
+ } else if (mDxePhase) {
+ Measurement->Token = ALit_START_IMAGE;
+ }
+
+ break;
+
+ case MODULE_LOADIMAGE_START_ID:
+ case MODULE_LOADIMAGE_END_ID:
+ Measurement->Token = ALit_LOAD_IMAGE;
+ break;
+
+ case MODULE_DB_START_ID:
+ case MODULE_DB_END_ID:
+ Measurement->Token = ALit_DB_START;
+ break;
+
+ case MODULE_DB_SUPPORT_START_ID:
+ case MODULE_DB_SUPPORT_END_ID:
+ Measurement->Token = ALit_DB_SUPPORT;
+ break;
+
+ case MODULE_DB_STOP_START_ID:
+ case MODULE_DB_STOP_END_ID:
+ Measurement->Token = ALit_DB_STOP;
+ break;
+
+ default:
+ Measurement->Token = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->String;
+ break;
+ }
- case MODULE_DB_STOP_START_ID:
- case MODULE_DB_STOP_END_ID:
- Measurement->Token = ALit_DB_STOP;
- break;
+ Measurement->Module = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->String;
+
+ if ((Measurement->Token != NULL) && (AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0)) {
+ Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
+ } else {
+ 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)) {
+ Measurement->Token = ALit_PEIM;
+ Measurement->Handle = ModuleGuid;
+ } else {
+ Measurement->Token = ALit_START_IMAGE;
+ }
+ }
+ }
- default:
- Measurement->Token = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->String;
break;
- }
- Measurement->Module = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->String;
+ case FPDT_GUID_QWORD_EVENT_TYPE:
+ ModuleGuid = &(((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Guid);
+ Measurement->Identifier = ((UINT32)((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->ProgressID);
+ if (IsStart) {
+ Measurement->StartTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp;
+ } else {
+ Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp;
+ }
- if (Measurement->Token != NULL && AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0) {
- Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
- } else {
- GetHandleFormModuleGuid(ModuleGuid, &StartHandle);
+ switch (Measurement->Identifier) {
+ case MODULE_DB_START_ID:
+ Measurement->Token = ALit_DB_START;
+ Measurement->Module = ALit_DB_START;
+ break;
+
+ case MODULE_DB_SUPPORT_START_ID:
+ case MODULE_DB_SUPPORT_END_ID:
+ Measurement->Token = ALit_DB_SUPPORT;
+ Measurement->Module = ALit_DB_SUPPORT;
+ break;
+
+ case MODULE_DB_STOP_START_ID:
+ case MODULE_DB_STOP_END_ID:
+ Measurement->Token = ALit_DB_STOP;
+ Measurement->Module = ALit_DB_STOP;
+ break;
+
+ case MODULE_LOADIMAGE_START_ID:
+ case MODULE_LOADIMAGE_END_ID:
+ Measurement->Token = ALit_LOAD_IMAGE;
+ Measurement->Module = ALit_LOAD_IMAGE;
+ break;
+
+ default:
+ ASSERT (FALSE);
+ }
+
+ GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
Measurement->Handle = StartHandle;
+ break;
+
+ case FPDT_GUID_QWORD_STRING_EVENT_TYPE:
+ 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;
+ } else {
+ Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
+ }
+
//
- // When no perf entry to record the PEI and DXE phase,
- // For start image, we need detect the PEIM and non PEIM here.
+ // Currently only "DB:Start:" end record with FPDT_GUID_QWORD_STRING_EVENT_TYPE.
//
- 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 {
- Measurement->Token = ALit_START_IMAGE;
- }
+ switch (Measurement->Identifier) {
+ case MODULE_DB_END_ID:
+ Measurement->Token = ALit_DB_START;
+ Measurement->Module = ALit_DB_START;
+ break;
+ default:
+ ASSERT (FALSE);
}
- }
- break;
- case FPDT_GUID_QWORD_EVENT_TYPE:
- ModuleGuid = &(((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Guid);
- Measurement->Identifier = ((UINT32)((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->ProgressID);
- if (IsStart) {
- Measurement->StartTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp;
- } else {
- Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp;
- }
- switch (Measurement->Identifier) {
- case MODULE_DB_START_ID:
- Measurement->Token = ALit_DB_START;
- Measurement->Module = ALit_DB_START;
- break;
-
- case MODULE_DB_SUPPORT_START_ID:
- case MODULE_DB_SUPPORT_END_ID:
- Measurement->Token = ALit_DB_SUPPORT;
- Measurement->Module = ALit_DB_SUPPORT;
+ GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
+ Measurement->Handle = StartHandle;
break;
- case MODULE_DB_STOP_START_ID:
- case MODULE_DB_STOP_END_ID:
- Measurement->Token = ALit_DB_STOP;
- Measurement->Module = ALit_DB_STOP;
- break;
+ case FPDT_DUAL_GUID_STRING_EVENT_TYPE:
+ ModuleGuid = &(((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Guid1);
+ Measurement->Identifier = ((UINT32)((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->ProgressID);
+ if (IsStart) {
+ Measurement->StartTimeStamp = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
+ } else {
+ Measurement->EndTimeStamp = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
+ }
- case MODULE_LOADIMAGE_START_ID:
- case MODULE_LOADIMAGE_END_ID:
- Measurement->Token = ALit_LOAD_IMAGE;
- Measurement->Module = ALit_LOAD_IMAGE;
+ Measurement->Token = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String;
+ Measurement->Module = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String;
+ GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
+ Measurement->Handle = StartHandle;
break;
default:
- ASSERT(FALSE);
- }
- GetHandleFormModuleGuid(ModuleGuid, &StartHandle);
- Measurement->Handle = StartHandle;
- break;
-
- case FPDT_GUID_QWORD_STRING_EVENT_TYPE:
- 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;
- } else {
- Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
- }
- //
- // Currently only "DB:Start:" end record with FPDT_GUID_QWORD_STRING_EVENT_TYPE.
- //
- switch (Measurement->Identifier) {
- case MODULE_DB_END_ID:
- Measurement->Token = ALit_DB_START;
- Measurement->Module = ALit_DB_START;
break;
- default:
- ASSERT(FALSE);
- }
- GetHandleFormModuleGuid(ModuleGuid, &StartHandle);
- Measurement->Handle = StartHandle;
- break;
-
- case FPDT_DUAL_GUID_STRING_EVENT_TYPE:
- ModuleGuid = &(((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Guid1);
- Measurement->Identifier = ((UINT32)((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->ProgressID);
- if (IsStart) {
- Measurement->StartTimeStamp = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
- } 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);
- Measurement->Handle = StartHandle;
- break;
-
- default:
- break;
}
}
@@ -471,32 +496,35 @@ GetMeasurementInfo ( **/
VOID
SearchMeasurement (
- IN MEASUREMENT_RECORD *EndMeasureMent
+ IN MEASUREMENT_RECORD *EndMeasureMent
)
{
- INTN Index;
+ INTN Index;
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 &&
- (AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
- (AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0) &&
- mMeasurementList[Index].Identifier == PERF_CROSSMODULE_START_ID) {
+ 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].EndTimeStamp = EndMeasureMent->EndTimeStamp;
break;
}
} else {
- if (mMeasurementList[Index].EndTimeStamp == 0 && mMeasurementList[Index].Handle == EndMeasureMent->Handle &&
- (AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
- (AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0)) {
+ if ((mMeasurementList[Index].EndTimeStamp == 0) && (mMeasurementList[Index].Handle == EndMeasureMent->Handle) &&
+ (AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
+ (AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0))
+ {
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
break;
}
@@ -528,9 +556,9 @@ BuildMeasurementList ( PerformanceTablePtr = (mBootPerformanceTable + TableLength);
while (TableLength < mBootPerformanceTableSize) {
- RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER*) PerformanceTablePtr;
- StartRecordEvent = (UINT8 *)RecordHeader;
- StartProgressId = ((FPDT_GUID_EVENT_RECORD *)StartRecordEvent)->ProgressID;
+ RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)PerformanceTablePtr;
+ StartRecordEvent = (UINT8 *)RecordHeader;
+ StartProgressId = ((FPDT_GUID_EVENT_RECORD *)StartRecordEvent)->ProgressID;
//
// If the record with ProgressId 0, the record doesn't appear in pairs. The timestamp in the record is the EndTimeStamp, its StartTimeStamp is 0.
@@ -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;
}
@@ -577,12 +609,12 @@ InitCumulativeData ( VOID
)
{
- UINTN Index;
+ UINTN Index;
for (Index = 0; Index < NumCum; ++Index) {
- CumData[Index].Count = 0;
- CumData[Index].MinDur = PERF_MAXDUR;
- CumData[Index].MaxDur = 0;
+ CumData[Index].Count = 0;
+ CumData[Index].MinDur = PERF_MAXDUR;
+ CumData[Index].MaxDur = 0;
CumData[Index].Duration = 0;
}
}
@@ -617,55 +649,55 @@ InitSummaryData ( **/
SHELL_STATUS
RunDp (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- LIST_ENTRY *ParamPackage;
- CONST CHAR16 *CmdLineArg;
- EFI_STATUS Status;
-
- PERFORMANCE_PROPERTY *PerformanceProperty;
- UINTN Number2Display;
-
- EFI_STRING StringPtr;
- BOOLEAN SummaryMode;
- BOOLEAN VerboseMode;
- BOOLEAN AllMode;
- BOOLEAN RawMode;
- BOOLEAN ExcludeMode;
- BOOLEAN CumulativeMode;
- CONST CHAR16 *CustomCumulativeToken;
- PERF_CUM_DATA *CustomCumulativeData;
- UINTN NameSize;
- SHELL_STATUS ShellStatus;
- TIMER_INFO TimerInfo;
- UINT64 Intermediate;
-
- StringPtr = NULL;
- SummaryMode = FALSE;
- VerboseMode = FALSE;
- AllMode = FALSE;
- RawMode = FALSE;
- ExcludeMode = FALSE;
- CumulativeMode = FALSE;
+ LIST_ENTRY *ParamPackage;
+ CONST CHAR16 *CmdLineArg;
+ EFI_STATUS Status;
+
+ PERFORMANCE_PROPERTY *PerformanceProperty;
+ UINTN Number2Display;
+
+ EFI_STRING StringPtr;
+ BOOLEAN SummaryMode;
+ BOOLEAN VerboseMode;
+ BOOLEAN AllMode;
+ BOOLEAN RawMode;
+ BOOLEAN ExcludeMode;
+ BOOLEAN CumulativeMode;
+ CONST CHAR16 *CustomCumulativeToken;
+ PERF_CUM_DATA *CustomCumulativeData;
+ UINTN NameSize;
+ SHELL_STATUS ShellStatus;
+ TIMER_INFO TimerInfo;
+ UINT64 Intermediate;
+
+ StringPtr = NULL;
+ SummaryMode = FALSE;
+ VerboseMode = FALSE;
+ AllMode = FALSE;
+ RawMode = FALSE;
+ ExcludeMode = FALSE;
+ CumulativeMode = FALSE;
CustomCumulativeData = NULL;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
//
// 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;
}
@@ -673,12 +705,12 @@ RunDp ( //
// Boolean options
//
- VerboseMode = ShellCommandLineGetFlag (ParamPackage, L"-v");
- 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");
- mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i");
+ VerboseMode = ShellCommandLineGetFlag (ParamPackage, L"-v");
+ 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");
+ mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i");
CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c");
if (AllMode && RawMode) {
@@ -688,7 +720,7 @@ RunDp ( // Options with Values
if (ShellCommandLineGetFlag (ParamPackage, L"-n")) {
- CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n");
+ CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n");
if (CmdLineArg == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_FEW), mDpHiiHandle);
return SHELL_INVALID_PARAMETER;
@@ -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;
}
@@ -714,12 +747,12 @@ RunDp ( }
if (ShellCommandLineGetFlag (ParamPackage, L"-t")) {
- CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-t");
+ CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-t");
if (CmdLineArg == NULL) {
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,16 +775,18 @@ RunDp ( ShellStatus = SHELL_OUT_OF_RESOURCES;
goto Done;
}
- CustomCumulativeData->MinDur = PERF_MAXDUR;
- CustomCumulativeData->MaxDur = 0;
- CustomCumulativeData->Count = 0;
+
+ CustomCumulativeData->MinDur = PERF_MAXDUR;
+ CustomCumulativeData->MaxDur = 0;
+ CustomCumulativeData->Count = 0;
CustomCumulativeData->Duration = 0;
- NameSize = StrLen (CustomCumulativeToken) + 1;
- CustomCumulativeData->Name = AllocateZeroPool (NameSize);
+ NameSize = StrLen (CustomCumulativeToken) + 1;
+ CustomCumulativeData->Name = AllocateZeroPool (NameSize);
if (CustomCumulativeData->Name == NULL) {
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;
@@ -815,7 +850,7 @@ RunDp ( TimerInfo.Frequency = (UINT32)DivU64x32 (PerformanceProperty->Frequency, 1000);
TimerInfo.StartCount = 0;
TimerInfo.EndCount = 0xFFFF;
- TimerInfo.CountUp = TRUE;
+ TimerInfo.CountUp = TRUE;
//
// Print header
@@ -827,52 +862,60 @@ 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,
- StringPtr,
- TimerInfo.StartCount,
- TimerInfo.EndCount
- );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DP_TIMER_PROPERTIES),
+ mDpHiiHandle,
+ StringPtr,
+ TimerInfo.StartCount,
+ TimerInfo.EndCount
+ );
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;
@@ -890,21 +933,24 @@ RunDp ( goto Done;
}
- ProcessCumulative (NULL);
+ 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.
@@ -926,12 +971,12 @@ Done: **/
EFI_HII_HANDLE
InitializeHiiPackage (
- EFI_HANDLE ImageHandle
+ EFI_HANDLE ImageHandle
)
{
- EFI_STATUS Status;
- EFI_HII_PACKAGE_LIST_HEADER *PackageList;
- EFI_HII_HANDLE HiiHandle;
+ EFI_STATUS Status;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ EFI_HII_HANDLE HiiHandle;
//
// Retrieve HII package list from ImageHandle
@@ -962,5 +1007,6 @@ InitializeHiiPackage ( if (EFI_ERROR (Status)) {
return NULL;
}
+
return HiiHandle;
}
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h index 84fe0b502f..ee09ca4913 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h @@ -9,7 +9,6 @@ #ifndef _DP_H_
#define _DP_H_
-
#include <Uefi.h>
#include <Guid/Performance.h>
@@ -36,32 +35,32 @@ #include <Library/UefiHiiServicesLib.h>
#include <Library/PerformanceLib.h>
-extern EFI_HII_HANDLE mDpHiiHandle;
+extern EFI_HII_HANDLE mDpHiiHandle;
-#define DP_MAJOR_VERSION 2
-#define DP_MINOR_VERSION 5
+#define DP_MAJOR_VERSION 2
+#define DP_MINOR_VERSION 5
/**
* The value assigned to DP_DEBUG controls which debug output
* is generated. Set it to ZERO to disable.
**/
-#define DP_DEBUG 0
+#define DP_DEBUG 0
-#define DEFAULT_THRESHOLD 1000 ///< One millisecond.
-#define DEFAULT_DISPLAYCOUNT 50
-#define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
+#define DEFAULT_THRESHOLD 1000 ///< One millisecond.
+#define DEFAULT_DISPLAYCOUNT 50
+#define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
-#define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
+#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 {
- UINT64 StartCount; ///< Value timer is initialized with.
- UINT64 EndCount; ///< Value timer has just before it wraps.
- UINT32 Frequency; ///< Timer count frequency in KHz.
- BOOLEAN CountUp; ///< TRUE if the counter counts up.
+ UINT64 StartCount; ///< Value timer is initialized with.
+ UINT64 EndCount; ///< Value timer has just before it wraps.
+ UINT32 Frequency; ///< Timer count frequency in KHz.
+ BOOLEAN CountUp; ///< TRUE if the counter counts up.
} TIMER_INFO;
/** Initialize one PERF_CUM_DATA structure instance for token t.
@@ -73,40 +72,40 @@ typedef struct { * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;
* - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];
**/
-#define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
+#define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
typedef struct {
- UINT64 Duration; ///< Cumulative duration for this item.
- UINT64 MinDur; ///< Smallest duration encountered.
- UINT64 MaxDur; ///< Largest duration encountered.
- CHAR8 *Name; ///< ASCII name of this item.
- UINT32 Count; ///< Total number of measurements accumulated.
+ UINT64 Duration; ///< Cumulative duration for this item.
+ UINT64 MinDur; ///< Smallest duration encountered.
+ UINT64 MaxDur; ///< Largest duration encountered.
+ CHAR8 *Name; ///< ASCII name of this item.
+ UINT32 Count; ///< Total number of measurements accumulated.
} PERF_CUM_DATA;
typedef struct {
- UINT32 NumTrace; ///< Number of recorded TRACE performance measurements.
- UINT32 NumIncomplete; ///< Number of measurements with no END value.
- UINT32 NumSummary; ///< Number of summary section measurements.
- UINT32 NumHandles; ///< Number of measurements with handles.
- UINT32 NumPEIMs; ///< Number of measurements of PEIMs.
- UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle.
+ UINT32 NumTrace; ///< Number of recorded TRACE performance measurements.
+ UINT32 NumIncomplete; ///< Number of measurements with no END value.
+ UINT32 NumSummary; ///< Number of summary section measurements.
+ UINT32 NumHandles; ///< Number of measurements with handles.
+ UINT32 NumPEIMs; ///< Number of measurements of PEIMs.
+ UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle.
} PERF_SUMMARY_DATA;
typedef struct {
- CONST VOID *Handle;
- CONST CHAR8 *Token; ///< Measured token string name.
- CONST CHAR8 *Module; ///< Module string name.
- UINT64 StartTimeStamp; ///< Start time point.
- UINT64 EndTimeStamp; ///< End time point.
- UINT32 Identifier; ///< Identifier.
+ CONST VOID *Handle;
+ CONST CHAR8 *Token; ///< Measured token string name.
+ CONST CHAR8 *Module; ///< Module string name.
+ UINT64 StartTimeStamp; ///< Start time point.
+ UINT64 EndTimeStamp; ///< End time point.
+ UINT32 Identifier; ///< Identifier.
} MEASUREMENT_RECORD;
typedef struct {
- CHAR8 *Name; ///< Measured token string name.
- UINT64 CumulativeTime; ///< Accumulated Elapsed Time.
- UINT64 MinTime; ///< Minimum Elapsed Time.
- UINT64 MaxTime; ///< Maximum Elapsed Time.
- UINT32 Count; ///< Number of measurements accumulated.
+ CHAR8 *Name; ///< Measured token string name.
+ UINT64 CumulativeTime; ///< Accumulated Elapsed Time.
+ UINT64 MinTime; ///< Minimum Elapsed Time.
+ UINT64 MaxTime; ///< Maximum Elapsed Time.
+ UINT32 Count; ///< Number of measurements accumulated.
} PROFILE_RECORD;
/**
@@ -122,8 +121,8 @@ typedef struct { **/
SHELL_STATUS
RunDp (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -135,6 +134,7 @@ RunDp ( **/
EFI_HII_HANDLE
InitializeHiiPackage (
- EFI_HANDLE ImageHandle
+ EFI_HANDLE ImageHandle
);
-#endif // _DP_H_
+
+#endif // _DP_H_
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c index b4b242a411..f148583493 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c @@ -16,7 +16,7 @@ // the resource section. Thus the application can use '-?' option to show help message in
// Shell.
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_DP);
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_DP);
/**
Entry point of Tftp standalone application.
@@ -31,11 +31,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (S EFI_STATUS
EFIAPI
DpAppInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
mDpHiiHandle = InitializeHiiPackage (ImageHandle);
if (mDpHiiHandle == NULL) {
return EFI_ABORTED;
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c index 50fcc6e746..e4ee4cc5ec 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c @@ -25,10 +25,10 @@ SHELL_STATUS
EFIAPI
DpCommandHandler (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
- IN EFI_SHELL_PROTOCOL *Shell
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
+ IN EFI_SHELL_PROTOCOL *Shell
)
{
gEfiShellParametersProtocol = ShellParameters;
@@ -49,14 +49,14 @@ DpCommandHandler ( CHAR16 *
EFIAPI
DpCommandGetHelp (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN CONST CHAR8 *Language
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
+ IN CONST CHAR8 *Language
)
{
return HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_GET_HELP_DP), Language);
}
-EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mDpDynamicCommand = {
+EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mDpDynamicCommand = {
L"dp",
DpCommandHandler,
DpCommandGetHelp
@@ -77,11 +77,12 @@ EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mDpDynamicCommand = { EFI_STATUS
EFIAPI
DpCommandInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
mDpHiiHandle = InitializeHiiPackage (ImageHandle);
if (mDpHiiHandle == NULL) {
return EFI_ABORTED;
@@ -108,10 +109,11 @@ DpCommandInitialize ( EFI_STATUS
EFIAPI
DpUnload (
- IN EFI_HANDLE ImageHandle
-)
+ IN EFI_HANDLE ImageHandle
+ )
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
Status = gBS->UninstallProtocolInterface (
ImageHandle,
&gEfiShellDynamicCommandProtocolGuid,
@@ -120,6 +122,7 @@ DpUnload ( if (EFI_ERROR (Status)) {
return Status;
}
+
HiiRemovePackages (mDpHiiHandle);
return EFI_SUCCESS;
}
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h index 75a3dbacfb..39878c6085 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h @@ -10,31 +10,32 @@ (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_
-#define DP_GAUGE_STRING_LENGTH 36
+#define DP_GAUGE_STRING_LENGTH 36
//
/// Module-Global Variables
///@{
-extern EFI_HII_HANDLE mDpHiiHandle;
-extern CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
-extern CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
-extern UINT64 mInterestThreshold;
-extern BOOLEAN mShowId;
-extern UINT8 *mBootPerformanceTable;
-extern UINTN mBootPerformanceTableLength;
-extern MEASUREMENT_RECORD *mMeasurementList;
-extern UINTN mMeasurementNum;
+extern EFI_HII_HANDLE mDpHiiHandle;
+extern CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
+extern CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
+extern UINT64 mInterestThreshold;
+extern BOOLEAN mShowId;
+extern UINT8 *mBootPerformanceTable;
+extern UINTN mBootPerformanceTableLength;
+extern MEASUREMENT_RECORD *mMeasurementList;
+extern UINTN mMeasurementNum;
extern PERF_SUMMARY_DATA SummaryData; ///< Create the SummaryData structure and init. to ZERO.
/// Items for which to gather cumulative statistics.
-extern PERF_CUM_DATA CumData[];
+extern PERF_CUM_DATA CumData[];
/// Number of items for which we are gathering cumulative statistics.
-extern UINT32 const NumCum;
+extern UINT32 const NumCum;
///@}
@@ -60,7 +61,7 @@ extern UINT32 const NumCum; **/
UINT64
GetDuration (
- IN OUT MEASUREMENT_RECORD *Measurement
+ IN OUT MEASUREMENT_RECORD *Measurement
);
/**
@@ -75,8 +76,8 @@ GetDuration ( @retval FALSE The measurement record is NOT for an EFI Phase.
**/
BOOLEAN
-IsPhase(
- IN MEASUREMENT_RECORD *Measurement
+IsPhase (
+ IN MEASUREMENT_RECORD *Measurement
);
/**
@@ -89,8 +90,8 @@ IsPhase( **/
BOOLEAN
-IsCorePerf(
- IN MEASUREMENT_RECORD *Measurement
+IsCorePerf (
+ IN MEASUREMENT_RECORD *Measurement
);
/**
@@ -107,8 +108,8 @@ IsCorePerf( **/
VOID
DpGetShortPdbFileName (
- IN CHAR8 *PdbFileName,
- OUT CHAR16 *UnicodeBuffer
+ IN CHAR8 *PdbFileName,
+ OUT CHAR16 *UnicodeBuffer
);
/**
@@ -129,7 +130,7 @@ DpGetShortPdbFileName ( **/
VOID
DpGetNameFromHandle (
- IN EFI_HANDLE Handle
+ IN EFI_HANDLE Handle
);
/**
@@ -147,7 +148,7 @@ DpGetNameFromHandle ( **/
UINT64
DurationInMicroSeconds (
- IN UINT64 Duration
+ IN UINT64 Duration
);
/**
@@ -164,8 +165,8 @@ DurationInMicroSeconds ( @retval >=0 Return value is the index into CumData where Token is found.
**/
INTN
-GetCumulativeItem(
- IN MEASUREMENT_RECORD *Measurement
+GetCumulativeItem (
+ IN MEASUREMENT_RECORD *Measurement
);
/**
@@ -186,8 +187,8 @@ GetCumulativeItem( **/
VOID
-GatherStatistics(
- IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
+GatherStatistics (
+ IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
);
/**
@@ -212,9 +213,9 @@ GatherStatistics( @return Others from a call to gBS->LocateHandleBuffer().
**/
EFI_STATUS
-DumpAllTrace(
- IN UINTN Limit,
- IN BOOLEAN ExcludeFlag
+DumpAllTrace (
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
);
/**
@@ -237,9 +238,9 @@ DumpAllTrace( @retval EFI_ABORTED The user aborts the operation.
**/
EFI_STATUS
-DumpRawTrace(
- IN UINTN Limit,
- IN BOOLEAN ExcludeFlag
+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(
- IN BOOLEAN ExcludeFlag
+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,8 +307,8 @@ ProcessGlobal( **/
VOID
-ProcessCumulative(
- IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
+ProcessCumulative (
+ IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
);
#endif
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c b/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c index 1a247d4bd4..0abb8797ec 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c @@ -46,27 +46,27 @@ **/
UINTN
GetPerformanceMeasurementRecord (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp,
- OUT UINT32 *Identifier
+ IN UINTN LogEntryKey,
+ OUT CONST VOID **Handle,
+ OUT CONST CHAR8 **Token,
+ OUT CONST CHAR8 **Module,
+ OUT UINT64 *StartTimeStamp,
+ OUT UINT64 *EndTimeStamp,
+ OUT UINT32 *Identifier
)
{
if (LogEntryKey == mMeasurementNum) {
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,24 +89,25 @@ GetPerformanceMeasurementRecord ( **/
VOID
-GatherStatistics(
- IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
+GatherStatistics (
+ IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
)
{
- MEASUREMENT_RECORD Measurement;
- UINT64 Duration;
- UINTN LogEntryKey;
- INTN TIndex;
+ MEASUREMENT_RECORD Measurement;
+ UINT64 Duration;
+ UINTN LogEntryKey;
+ INTN TIndex;
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurementRecord (
- LogEntryKey,
- &Measurement.Handle,
- &Measurement.Token,
- &Measurement.Module,
- &Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp,
- &Measurement.Identifier)) != 0)
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &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;
}
}
@@ -132,13 +133,14 @@ GatherStatistics( }
Duration = GetDuration (&Measurement);
- TIndex = GetCumulativeItem (&Measurement);
+ TIndex = GetCumulativeItem (&Measurement);
if (TIndex >= 0) {
CumData[TIndex].Duration += Duration;
CumData[TIndex].Count++;
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,38 +185,43 @@ GatherStatistics( @return Others from a call to gBS->LocateHandleBuffer().
**/
EFI_STATUS
-DumpAllTrace(
- IN UINTN Limit,
- IN BOOLEAN ExcludeFlag
+DumpAllTrace (
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
)
{
- MEASUREMENT_RECORD Measurement;
- UINT64 ElapsedTime;
- UINT64 Duration;
- CHAR16 *IncFlag;
- UINTN LogEntryKey;
- UINTN Count;
- UINTN Index;
- UINTN TIndex;
-
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- EFI_STATUS Status;
- EFI_STRING StringPtrUnknown;
+ MEASUREMENT_RECORD Measurement;
+ UINT64 ElapsedTime;
+ UINT64 Duration;
+ CHAR16 *IncFlag;
+ UINTN LogEntryKey;
+ UINTN Count;
+ UINTN Index;
+ UINTN TIndex;
+
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ EFI_STATUS Status;
+ EFI_STRING StringPtrUnknown;
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);
+ 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
+ );
FreePool (StringPtrUnknown);
// Get Handle information
//
- Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);
+ 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
@@ -229,35 +237,38 @@ DumpAllTrace( }
LogEntryKey = 0;
- Count = 0;
- Index = 0;
- while ( WITHIN_LIMIT(Count, Limit) &&
+ Count = 0;
+ Index = 0;
+ while ( WITHIN_LIMIT (Count, Limit) &&
((LogEntryKey = GetPerformanceMeasurementRecord (
- LogEntryKey,
- &Measurement.Handle,
- &Measurement.Token,
- &Measurement.Module,
- &Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp,
- &Measurement.Identifier)) != 0)
- )
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier
+ )) != 0)
+ )
{
++Index; // Count every record. First record is 1.
ElapsedTime = 0;
SHELL_FREE_NON_NULL (IncFlag);
if (Measurement.EndTimeStamp != 0) {
- Duration = GetDuration (&Measurement);
- ElapsedTime = DurationInMicroSeconds ( Duration );
- IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);
- }
- else {
+ Duration = GetDuration (&Measurement);
+ ElapsedTime = DurationInMicroSeconds (Duration);
+ IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);
+ } 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
@@ -279,10 +290,15 @@ DumpAllTrace( // Ensure that the argument strings are not too long.
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
- mUnicodeToken[13] = 0;
+ 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,
@@ -290,26 +306,34 @@ DumpAllTrace( mUnicodeToken,
ElapsedTime,
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,
mGaugeString,
mUnicodeToken,
ElapsedTime
- );
+ );
}
+
if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
break;
}
}
}
+
if (HandleBuffer != NULL) {
FreePool (HandleBuffer);
}
+
SHELL_FREE_NON_NULL (IncFlag);
return Status;
@@ -336,28 +360,34 @@ DumpAllTrace( @retval EFI_ABORTED The user aborts the operation.
**/
EFI_STATUS
-DumpRawTrace(
- IN UINTN Limit,
- IN BOOLEAN ExcludeFlag
+DumpRawTrace (
+ IN UINTN Limit,
+ IN BOOLEAN ExcludeFlag
)
{
- MEASUREMENT_RECORD Measurement;
- UINT64 ElapsedTime;
- UINT64 Duration;
- UINTN LogEntryKey;
- UINTN Count;
- UINTN Index;
+ MEASUREMENT_RECORD Measurement;
+ UINT64 ElapsedTime;
+ UINT64 Duration;
+ UINTN LogEntryKey;
+ UINTN Count;
+ UINTN Index;
- EFI_STRING StringPtr;
- EFI_STRING StringPtrUnknown;
- EFI_STATUS Status;
+ EFI_STRING StringPtr;
+ EFI_STRING StringPtrUnknown;
+ EFI_STATUS Status;
Status = EFI_SUCCESS;
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);
+ 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
+ );
FreePool (StringPtr);
FreePool (StringPtrUnknown);
@@ -370,34 +400,43 @@ DumpRawTrace( }
LogEntryKey = 0;
- Count = 0;
- Index = 0;
- while ( WITHIN_LIMIT(Count, Limit) &&
+ Count = 0;
+ Index = 0;
+ while ( WITHIN_LIMIT (Count, Limit) &&
((LogEntryKey = GetPerformanceMeasurementRecord (
- LogEntryKey,
- &Measurement.Handle,
- &Measurement.Token,
- &Measurement.Module,
- &Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp,
- &Measurement.Identifier)) != 0)
- )
+ LogEntryKey,
+ &Measurement.Handle,
+ &Measurement.Token,
+ &Measurement.Module,
+ &Measurement.StartTimeStamp,
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier
+ )) != 0)
+ )
{
++Index; // Count every record. First record is 1.
ElapsedTime = 0;
if (Measurement.EndTimeStamp != 0) {
- Duration = GetDuration (&Measurement);
- ElapsedTime = DurationInMicroSeconds ( Duration );
+ Duration = GetDuration (&Measurement);
+ 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,
@@ -405,22 +444,29 @@ DumpRawTrace( Measurement.Token,
Measurement.Module,
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,
Measurement.EndTimeStamp,
Measurement.Token,
Measurement.Module
- );
+ );
}
+
if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
break;
}
}
+
return Status;
}
@@ -429,22 +475,22 @@ DumpRawTrace( **/
VOID
-ProcessPhases(
+ProcessPhases (
VOID
)
{
- MEASUREMENT_RECORD Measurement;
- UINT64 BdsTimeoutValue;
- UINT64 SecTime;
- UINT64 PeiTime;
- UINT64 DxeTime;
- UINT64 BdsTime;
- UINT64 ElapsedTime;
- UINT64 Duration;
- UINT64 Total;
- EFI_STRING StringPtr;
- UINTN LogEntryKey;
- EFI_STRING StringPtrUnknown;
+ MEASUREMENT_RECORD Measurement;
+ UINT64 BdsTimeoutValue;
+ UINT64 SecTime;
+ UINT64 PeiTime;
+ UINT64 DxeTime;
+ UINT64 BdsTime;
+ UINT64 ElapsedTime;
+ UINT64 Duration;
+ UINT64 Total;
+ EFI_STRING StringPtr;
+ UINTN LogEntryKey;
+ EFI_STRING StringPtrUnknown;
BdsTimeoutValue = 0;
SecTime = 0;
@@ -455,9 +501,15 @@ ProcessPhases( // Get Execution Phase Statistics
//
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);
+ 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
+ );
FreePool (StringPtr);
FreePool (StringPtrUnknown);
@@ -469,25 +521,28 @@ 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
- && (AsciiStrCmp (Measurement.Token, ALit_BdsTO) == 0)
- )
+ if ( (Measurement.Handle != NULL)
+ && (AsciiStrCmp (Measurement.Token, ALit_BdsTO) == 0)
+ )
{
BdsTimeoutValue = Duration;
} else if (AsciiStrCmp (Measurement.Token, ALit_SEC) == 0) {
- SecTime = Duration;
+ SecTime = Duration;
} else if (AsciiStrCmp (Measurement.Token, ALit_PEI) == 0) {
- PeiTime = Duration;
+ PeiTime = Duration;
} else if (AsciiStrCmp (Measurement.Token, ALit_DXE) == 0) {
- DxeTime = Duration;
+ DxeTime = Duration;
} else if (AsciiStrCmp (Measurement.Token, ALit_BDS) == 0) {
- BdsTime = Duration;
+ BdsTime = Duration;
}
}
@@ -496,8 +551,8 @@ ProcessPhases( // print SEC phase duration time
//
if (SecTime > 0) {
- ElapsedTime = DurationInMicroSeconds ( SecTime ); // Calculate elapsed time in microseconds
- Total += DivU64x32 (ElapsedTime, 1000); // Accumulate time in milliseconds
+ 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);
}
@@ -505,7 +560,7 @@ ProcessPhases( //
if (PeiTime > 0) {
ElapsedTime = DivU64x32 (PeiTime, 1000000);
- Total += ElapsedTime;
+ Total += ElapsedTime;
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_PEI, ElapsedTime);
}
@@ -513,7 +568,7 @@ ProcessPhases( //
if (DxeTime > 0) {
ElapsedTime = DivU64x32 (DxeTime, 1000000);
- Total += ElapsedTime;
+ Total += ElapsedTime;
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_DXE, ElapsedTime);
}
@@ -521,7 +576,7 @@ ProcessPhases( //
if (BdsTime > 0) {
ElapsedTime = DivU64x32 (BdsTime, 1000000);
- Total += ElapsedTime;
+ Total += ElapsedTime;
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_BDS, ElapsedTime);
}
@@ -543,47 +598,53 @@ ProcessPhases( @return Others from a call to gBS->LocateHandleBuffer().
**/
EFI_STATUS
-ProcessHandles(
- IN BOOLEAN ExcludeFlag
+ProcessHandles (
+ IN BOOLEAN ExcludeFlag
)
{
- MEASUREMENT_RECORD Measurement;
- UINT64 ElapsedTime;
- UINT64 Duration;
- EFI_HANDLE *HandleBuffer;
- EFI_STRING StringPtr;
- UINTN Index;
- UINTN LogEntryKey;
- UINTN Count;
- UINTN HandleCount;
- EFI_STATUS Status;
- EFI_STRING StringPtrUnknown;
+ MEASUREMENT_RECORD Measurement;
+ UINT64 ElapsedTime;
+ UINT64 Duration;
+ EFI_HANDLE *HandleBuffer;
+ EFI_STRING StringPtr;
+ UINTN Index;
+ UINTN LogEntryKey;
+ UINTN Count;
+ UINTN HandleCount;
+ EFI_STATUS Status;
+ EFI_STRING StringPtrUnknown;
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);
+ 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
+ );
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;
- Count = 0;
+ Count = 0;
while ((LogEntryKey = GetPerformanceMeasurementRecord (
LogEntryKey,
&Measurement.Handle,
@@ -591,18 +652,21 @@ ProcessHandles( &Measurement.Module,
&Measurement.StartTimeStamp,
&Measurement.EndTimeStamp,
- &Measurement.Identifier)) != 0)
+ &Measurement.Identifier
+ )) != 0)
{
Count++;
- Duration = GetDuration (&Measurement);
- ElapsedTime = DurationInMicroSeconds ( Duration );
+ Duration = GetDuration (&Measurement);
+ 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,39 +676,53 @@ ProcessHandles( break;
}
}
+
// Ensure that the argument strings are not too long.
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
- mUnicodeToken[11] = 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,
mUnicodeToken,
ElapsedTime,
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,
mUnicodeToken,
ElapsedTime
- );
+ );
}
}
+
if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
break;
}
}
}
+
if (HandleBuffer != NULL) {
FreePool (HandleBuffer);
}
+
return Status;
}
@@ -657,25 +735,31 @@ ProcessHandles( @retval EFI_ABORTED The user aborts the operation.
**/
EFI_STATUS
-ProcessPeims(
+ProcessPeims (
VOID
-)
+ )
{
- MEASUREMENT_RECORD Measurement;
- UINT64 Duration;
- UINT64 ElapsedTime;
- EFI_STRING StringPtr;
- UINTN LogEntryKey;
- UINTN TIndex;
- EFI_STRING StringPtrUnknown;
- EFI_STATUS Status;
+ MEASUREMENT_RECORD Measurement;
+ UINT64 Duration;
+ UINT64 ElapsedTime;
+ EFI_STRING StringPtr;
+ UINTN LogEntryKey;
+ UINTN TIndex;
+ EFI_STRING StringPtrUnknown;
+ EFI_STATUS Status;
Status = EFI_SUCCESS;
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);
+ 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
+ );
FreePool (StringPtr);
FreePool (StringPtrUnknown);
@@ -684,8 +768,9 @@ 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;
+ TIndex = 0;
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurementRecord (
LogEntryKey,
@@ -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
+ Duration = GetDuration (&Measurement);
+ 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,
- TIndex, // 1 based, Which measurement record is being printed
- Measurement.Handle, // file guid
- ElapsedTime,
- Measurement.Identifier
- );
+ 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,
- TIndex, // 1 based, Which measurement record is being printed
- Measurement.Handle, // file guid
- ElapsedTime
- );
+ 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,25 +841,31 @@ ProcessPeims( @retval EFI_ABORTED The user aborts the operation.
**/
EFI_STATUS
-ProcessGlobal(
+ProcessGlobal (
VOID
-)
+ )
{
- MEASUREMENT_RECORD Measurement;
- UINT64 Duration;
- UINT64 ElapsedTime;
- EFI_STRING StringPtr;
- UINTN LogEntryKey;
- UINTN Index; // Index, or number, of the measurement record being processed
- EFI_STRING StringPtrUnknown;
- EFI_STATUS Status;
+ MEASUREMENT_RECORD Measurement;
+ UINT64 Duration;
+ UINT64 ElapsedTime;
+ EFI_STRING StringPtr;
+ UINTN LogEntryKey;
+ UINTN Index; // Index, or number, of the measurement record being processed
+ EFI_STRING StringPtrUnknown;
+ EFI_STATUS Status;
Status = EFI_SUCCESS;
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);
+ 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
+ );
FreePool (StringPtr);
FreePool (StringPtrUnknown);
@@ -769,9 +874,10 @@ 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;
+ Index = 1;
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurementRecord (
@@ -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;
+ mGaugeString[25] = 0;
mUnicodeToken[31] = 0;
- if ( ! ( IsPhase( &Measurement) ||
- IsCorePerf (&Measurement) ||
- (Measurement.EndTimeStamp == 0)
- ))
+ if ( !(IsPhase (&Measurement) ||
+ IsCorePerf (&Measurement) ||
+ (Measurement.EndTimeStamp == 0)
+ ))
{
- Duration = GetDuration (&Measurement);
- ElapsedTime = DurationInMicroSeconds ( Duration );
+ Duration = GetDuration (&Measurement);
+ 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,22 +954,28 @@ ProcessGlobal( **/
VOID
-ProcessCumulative(
- IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
+ProcessCumulative (
+ IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
)
{
- UINT64 AvgDur; // the computed average duration
- UINT64 Dur;
- UINT64 MinDur;
- UINT64 MaxDur;
- EFI_STRING StringPtr;
- UINTN TIndex;
- EFI_STRING StringPtrUnknown;
+ UINT64 AvgDur; // the computed average duration
+ UINT64 Dur;
+ UINT64 MinDur;
+ UINT64 MaxDur;
+ EFI_STRING StringPtr;
+ UINTN TIndex;
+ EFI_STRING StringPtrUnknown;
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);
+ 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
+ );
FreePool (StringPtr);
FreePool (StringPtrUnknown);
@@ -860,19 +986,24 @@ 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);
-
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), mDpHiiHandle,
- CumData[TIndex].Name,
- CumData[TIndex].Count,
- Dur,
- AvgDur,
- MinDur,
- MaxDur
- );
+ 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,
+ CumData[TIndex].Name,
+ CumData[TIndex].Count,
+ Dur,
+ AvgDur,
+ MinDur,
+ MaxDur
+ );
}
}
@@ -892,13 +1023,19 @@ ProcessCumulative( MaxDur = 0;
MinDur = 0;
}
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), mDpHiiHandle,
- CustomCumulativeData->Name,
- CustomCumulativeData->Count,
- Dur,
- AvgDur,
- MinDur,
- MaxDur
- );
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DP_CUMULATIVE_STATS),
+ mDpHiiHandle,
+ CustomCumulativeData->Name,
+ CustomCumulativeData->Count,
+ Dur,
+ AvgDur,
+ MinDur,
+ MaxDur
+ );
}
}
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c b/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c index 418b852790..60c886c11d 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c @@ -55,23 +55,24 @@ **/
UINT64
GetDuration (
- IN OUT MEASUREMENT_RECORD *Measurement
+ IN OUT MEASUREMENT_RECORD *Measurement
)
{
- UINT64 Duration;
- BOOLEAN Error;
+ UINT64 Duration;
+ BOOLEAN Error;
if (Measurement->EndTimeStamp == 0) {
return 0;
}
Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp;
- Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp);
+ Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp);
if (Error) {
DEBUG ((DEBUG_ERROR, ALit_TimerLibError));
Duration = 0;
}
+
return Duration;
}
@@ -87,18 +88,18 @@ GetDuration ( @retval FALSE The measurement record is NOT for an EFI Phase.
**/
BOOLEAN
-IsPhase(
- IN MEASUREMENT_RECORD *Measurement
+IsPhase (
+ IN MEASUREMENT_RECORD *Measurement
)
{
- BOOLEAN RetVal;
+ BOOLEAN RetVal;
RetVal = (BOOLEAN)(
- ((AsciiStrCmp (Measurement->Token, ALit_SEC) == 0) ||
- (AsciiStrCmp (Measurement->Token, ALit_PEI) == 0) ||
- (AsciiStrCmp (Measurement->Token, ALit_DXE) == 0) ||
- (AsciiStrCmp (Measurement->Token, ALit_BDS) == 0))
- );
+ ((AsciiStrCmp (Measurement->Token, ALit_SEC) == 0) ||
+ (AsciiStrCmp (Measurement->Token, ALit_PEI) == 0) ||
+ (AsciiStrCmp (Measurement->Token, ALit_DXE) == 0) ||
+ (AsciiStrCmp (Measurement->Token, ALit_BDS) == 0))
+ );
return RetVal;
}
@@ -112,24 +113,24 @@ IsPhase( **/
BOOLEAN
-IsCorePerf(
- IN MEASUREMENT_RECORD *Measurement
+IsCorePerf (
+ IN MEASUREMENT_RECORD *Measurement
)
{
- BOOLEAN RetVal;
+ BOOLEAN RetVal;
RetVal = (BOOLEAN)(
- ((Measurement->Identifier == MODULE_START_ID) ||
- (Measurement->Identifier == MODULE_END_ID) ||
- (Measurement->Identifier == MODULE_LOADIMAGE_START_ID) ||
- (Measurement->Identifier == MODULE_LOADIMAGE_END_ID) ||
- (Measurement->Identifier == MODULE_DB_START_ID) ||
- (Measurement->Identifier == MODULE_DB_END_ID) ||
- (Measurement->Identifier == MODULE_DB_SUPPORT_START_ID) ||
- (Measurement->Identifier == MODULE_DB_SUPPORT_END_ID) ||
- (Measurement->Identifier == MODULE_DB_STOP_START_ID) ||
- (Measurement->Identifier == MODULE_DB_STOP_START_ID))
- );
+ ((Measurement->Identifier == MODULE_START_ID) ||
+ (Measurement->Identifier == MODULE_END_ID) ||
+ (Measurement->Identifier == MODULE_LOADIMAGE_START_ID) ||
+ (Measurement->Identifier == MODULE_LOADIMAGE_END_ID) ||
+ (Measurement->Identifier == MODULE_DB_START_ID) ||
+ (Measurement->Identifier == MODULE_DB_END_ID) ||
+ (Measurement->Identifier == MODULE_DB_SUPPORT_START_ID) ||
+ (Measurement->Identifier == MODULE_DB_SUPPORT_END_ID) ||
+ (Measurement->Identifier == MODULE_DB_STOP_START_ID) ||
+ (Measurement->Identifier == MODULE_DB_STOP_START_ID))
+ );
return RetVal;
}
@@ -147,14 +148,14 @@ IsCorePerf( **/
VOID
DpGetShortPdbFileName (
- IN CHAR8 *PdbFileName,
- OUT CHAR16 *UnicodeBuffer
+ IN CHAR8 *PdbFileName,
+ OUT CHAR16 *UnicodeBuffer
)
{
- UINTN IndexA; // Current work location within an ASCII string.
- UINTN IndexU; // Current work location within a Unicode string.
- UINTN StartIndex;
- UINTN EndIndex;
+ UINTN IndexA; // Current work location within an ASCII string.
+ UINTN IndexU; // Current work location within a Unicode string.
+ UINTN StartIndex;
+ UINTN EndIndex;
ZeroMem (UnicodeBuffer, (DP_GAUGE_STRING_LENGTH + 1) * sizeof (CHAR16));
@@ -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;
@@ -204,26 +206,26 @@ DpGetShortPdbFileName ( **/
VOID
DpGetNameFromHandle (
- IN EFI_HANDLE Handle
+ IN EFI_HANDLE Handle
)
{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *Image;
- CHAR8 *PdbFileName;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- EFI_STRING StringPtr;
- EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_GUID *NameGuid;
- CHAR16 *NameString;
- UINTN StringSize;
- CHAR8 *PlatformLanguage;
- CHAR8 *BestLanguage;
- EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
-
- Image = NULL;
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *Image;
+ CHAR8 *PdbFileName;
+ EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
+ EFI_STRING StringPtr;
+ EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_GUID *NameGuid;
+ CHAR16 *NameString;
+ UINTN StringSize;
+ CHAR8 *PlatformLanguage;
+ CHAR8 *BestLanguage;
+ EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
+
+ Image = NULL;
LoadedImageDevicePath = NULL;
- DevicePath = NULL;
+ DevicePath = NULL;
//
// Method 1: Get the name string from image PDB
@@ -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);
}
@@ -326,13 +329,13 @@ DpGetNameFromHandle ( //
NameString = NULL;
StringSize = 0;
- Status = GetSectionFromAnyFv (
- NameGuid,
- EFI_SECTION_USER_INTERFACE,
- 0,
- (VOID **) &NameString,
- &StringSize
- );
+ Status = GetSectionFromAnyFv (
+ NameGuid,
+ EFI_SECTION_USER_INTERFACE,
+ 0,
+ (VOID **)&NameString,
+ &StringSize
+ );
if (!EFI_ERROR (Status)) {
//
@@ -347,6 +350,7 @@ DpGetNameFromHandle ( //
UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);
}
+
return;
} else {
//
@@ -386,7 +390,7 @@ DpGetNameFromHandle ( **/
UINT64
DurationInMicroSeconds (
- IN UINT64 Duration
+ IN UINT64 Duration
)
{
return DivU64x32 (Duration, 1000);
@@ -406,17 +410,18 @@ DurationInMicroSeconds ( @retval >=0 Return value is the index into CumData where Token is found.
**/
INTN
-GetCumulativeItem(
- IN MEASUREMENT_RECORD *Measurement
+GetCumulativeItem (
+ IN MEASUREMENT_RECORD *Measurement
)
{
- INTN Index;
+ 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
}
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c index abf5be6d1c..4bb73af748 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c @@ -7,16 +7,16 @@ #include <Guid/ExtendedFirmwarePerformance.h>
// ASCII String literals which probably don't need translation
-CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
-CHAR8 const ALit_SEC[] = SEC_TOK;
-CHAR8 const ALit_DXE[] = DXE_TOK;
-CHAR8 const ALit_PEI[] = PEI_TOK;
-CHAR8 const ALit_BDS[] = BDS_TOK;
-CHAR8 const ALit_START_IMAGE[] = START_IMAGE_TOK;
-CHAR8 const ALit_LOAD_IMAGE[] = LOAD_IMAGE_TOK;
-CHAR8 const ALit_DB_START[] = DRIVERBINDING_START_TOK;
-CHAR8 const ALit_DB_SUPPORT[] = DRIVERBINDING_SUPPORT_TOK;
-CHAR8 const ALit_DB_STOP[] = DRIVERBINDING_STOP_TOK;
+CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
+CHAR8 const ALit_SEC[] = SEC_TOK;
+CHAR8 const ALit_DXE[] = DXE_TOK;
+CHAR8 const ALit_PEI[] = PEI_TOK;
+CHAR8 const ALit_BDS[] = BDS_TOK;
+CHAR8 const ALit_START_IMAGE[] = START_IMAGE_TOK;
+CHAR8 const ALit_LOAD_IMAGE[] = LOAD_IMAGE_TOK;
+CHAR8 const ALit_DB_START[] = DRIVERBINDING_START_TOK;
+CHAR8 const ALit_DB_SUPPORT[] = DRIVERBINDING_SUPPORT_TOK;
+CHAR8 const ALit_DB_STOP[] = DRIVERBINDING_STOP_TOK;
-CHAR8 const ALit_BdsTO[] = "BdsTimeOut";
-CHAR8 const ALit_PEIM[] = "PEIM";
+CHAR8 const ALit_BdsTO[] = "BdsTimeOut";
+CHAR8 const ALit_PEIM[] = "PEIM";
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h b/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h index e03fb3fda4..7174251ac4 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h @@ -4,23 +4,24 @@ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
+
#ifndef _LITERALS_H_
#define _LITERALS_H_
// ASCII String literals which probably don't need translation
-extern CHAR8 const ALit_TimerLibError[];
-extern CHAR8 const ALit_SEC[];
-extern CHAR8 const ALit_DXE[];
-extern CHAR8 const ALit_SHELL[];
-extern CHAR8 const ALit_PEI[];
-extern CHAR8 const ALit_BDS[];
-extern CHAR8 const ALit_PEIM[];
-extern CHAR8 const ALit_START_IMAGE[];
-extern CHAR8 const ALit_LOAD_IMAGE[];
-extern CHAR8 const ALit_DB_START[];
-extern CHAR8 const ALit_DB_SUPPORT[];
-extern CHAR8 const ALit_DB_STOP[];
-extern CHAR8 const ALit_BdsTO[];
-extern CHAR8 const ALit_PEIM[];
+extern CHAR8 const ALit_TimerLibError[];
+extern CHAR8 const ALit_SEC[];
+extern CHAR8 const ALit_DXE[];
+extern CHAR8 const ALit_SHELL[];
+extern CHAR8 const ALit_PEI[];
+extern CHAR8 const ALit_BDS[];
+extern CHAR8 const ALit_PEIM[];
+extern CHAR8 const ALit_START_IMAGE[];
+extern CHAR8 const ALit_LOAD_IMAGE[];
+extern CHAR8 const ALit_DB_START[];
+extern CHAR8 const ALit_DB_SUPPORT[];
+extern CHAR8 const ALit_DB_STOP[];
+extern CHAR8 const ALit_BdsTO[];
+extern CHAR8 const ALit_PEIM[];
-#endif // _LITERALS_H_
+#endif // _LITERALS_H_
diff --git a/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c index 7b9b2d2380..b4e88e7635 100644 --- a/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c +++ b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c @@ -11,7 +11,7 @@ #include "Http.h"
-#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32
+#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32
//
// Constant strings and definitions related to the message
@@ -37,17 +37,17 @@ //
// Buffer size. Note that larger buffer does not mean better speed.
//
-#define DEFAULT_BUF_SIZE SIZE_32KB
-#define MAX_BUF_SIZE SIZE_4MB
+#define DEFAULT_BUF_SIZE SIZE_32KB
+#define MAX_BUF_SIZE SIZE_4MB
-#define MIN_PARAM_COUNT 2
-#define MAX_PARAM_COUNT 4
+#define MIN_PARAM_COUNT 2
+#define MAX_PARAM_COUNT 4
#define NEED_REDIRECTION(Code) \
(((Code >= HTTP_STATUS_300_MULTIPLE_CHOICES) \
&& (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 ( \
@@ -69,13 +69,13 @@ typedef enum { #define USER_AGENT_HDR "Mozilla/5.0 (EDK2; Linux) Gecko/20100101 Firefox/79.0"
-#define TIMER_MAX_TIMEOUT_S 10
+#define TIMER_MAX_TIMEOUT_S 10
//
// File name to use when Uri ends with "/".
//
-#define DEFAULT_HTML_FILE L"index.html"
-#define DEFAULT_HTTP_PROTO L"http"
+#define DEFAULT_HTML_FILE L"index.html"
+#define DEFAULT_HTTP_PROTO L"http"
//
// String to delete the HTTP progress message to be able to update it :
@@ -85,20 +85,20 @@ typedef enum { L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\
\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
-#define HTTP_KB L"\b\b\b\b\b\b\b\b\b\b"
+#define HTTP_KB L"\b\b\b\b\b\b\b\b\b\b"
//
// Frame for the progression slider.
//
-#define HTTP_PROGR_FRAME L"[ ]"
+#define HTTP_PROGR_FRAME L"[ ]"
//
// 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)
//
@@ -109,19 +109,19 @@ typedef enum { //
// Define EPOCH (1970-JANUARY-01) in the Julian Date representation.
//
-#define EPOCH_JULIAN_DATE 2440588
+#define EPOCH_JULIAN_DATE 2440588
//
// Seconds per unit.
//
-#define SEC_PER_MIN ((UINTN) 60)
-#define SEC_PER_HOUR ((UINTN) 3600)
-#define SEC_PER_DAY ((UINTN) 86400)
+#define SEC_PER_MIN ((UINTN) 60)
+#define SEC_PER_HOUR ((UINTN) 3600)
+#define SEC_PER_DAY ((UINTN) 86400)
//
// String descriptions for server errors.
//
-STATIC CONST CHAR16 *ErrStatusDesc[] =
+STATIC CONST CHAR16 *ErrStatusDesc[] =
{
L"400 Bad Request",
L"401 Unauthorized",
@@ -149,32 +149,32 @@ STATIC CONST CHAR16 *ErrStatusDesc[] = L"505 HTTP version not supported"
};
-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}
+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 }
};
//
// Local File Handle.
//
-STATIC SHELL_FILE_HANDLE mFileHandle = NULL;
+STATIC SHELL_FILE_HANDLE mFileHandle = NULL;
//
// Path of the local file, Unicode encoded.
//
-STATIC CONST CHAR16 *mLocalFilePath;
+STATIC CONST CHAR16 *mLocalFilePath;
-STATIC BOOLEAN gRequestCallbackComplete = FALSE;
-STATIC BOOLEAN gResponseCallbackComplete = FALSE;
+STATIC BOOLEAN gRequestCallbackComplete = FALSE;
+STATIC BOOLEAN gResponseCallbackComplete = FALSE;
-STATIC BOOLEAN gHttpError;
+STATIC BOOLEAN gHttpError;
-EFI_HII_HANDLE mHttpHiiHandle;
+EFI_HII_HANDLE mHttpHiiHandle;
//
// Functions declarations.
@@ -286,9 +286,9 @@ CloseProtocolAndDestroyServiceChild ( STATIC
EFI_STATUS
DownloadFile (
- IN HTTP_DOWNLOAD_CONTEXT *Context,
- IN EFI_HANDLE ControllerHandle,
- IN CHAR16 *NicName
+ IN HTTP_DOWNLOAD_CONTEXT *Context,
+ IN EFI_HANDLE ControllerHandle,
+ IN CHAR16 *NicName
);
/**
@@ -302,11 +302,11 @@ DownloadFile ( STATIC
EFI_STATUS
TrimSpaces (
- IN CHAR16 *String
+ IN CHAR16 *String
)
{
- CHAR16 *Str;
- UINTN Len;
+ CHAR16 *Str;
+ UINTN Len;
ASSERT (String != NULL);
@@ -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;
}
@@ -355,8 +355,8 @@ STATIC VOID
EFIAPI
RequestCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
gRequestCallbackComplete = TRUE;
@@ -371,8 +371,8 @@ STATIC VOID
EFIAPI
ResponseCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
gResponseCallbackComplete = TRUE;
@@ -396,19 +396,19 @@ EfiGetEpochDays ( IN EFI_TIME *Time
)
{
- UINTN a;
- UINTN y;
- UINTN m;
+ UINTN a;
+ UINTN y;
+ UINTN m;
//
// Absolute Julian Date representation of the supplied Time.
//
- UINTN JulianDate;
+ UINTN JulianDate;
//
// Number of days elapsed since EPOCH_JULIAN_DAY.
//
- UINTN EpochDays;
+ UINTN EpochDays;
- a = (14 - Time->Month) / 12 ;
+ a = (14 - Time->Month) / 12;
y = Time->Year + 4800 - a;
m = Time->Month + (12 * a) - 3;
@@ -437,8 +437,8 @@ EfiTimeToEpoch ( //
// Number of days elapsed since EPOCH_JULIAN_DAY.
//
- UINTN EpochDays;
- UINTN EpochSeconds;
+ UINTN EpochDays;
+ UINTN EpochSeconds;
EpochDays = EfiGetEpochDays (Time);
@@ -471,32 +471,32 @@ RunHttp ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *CheckPackage;
- UINTN ParamCount;
- UINTN HandleCount;
- UINTN NicNumber;
- UINTN InitialSize;
- UINTN ParamOffset;
- UINTN StartSize;
- CHAR16 *ProblemParam;
- CHAR16 NicName[IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH];
- CHAR16 *Walker1;
- CHAR16 *VStr;
- CONST CHAR16 *UserNicName;
- CONST CHAR16 *ValueStr;
- CONST CHAR16 *RemoteFilePath;
- CONST CHAR16 *Walker;
- EFI_HTTPv4_ACCESS_POINT IPv4Node;
- EFI_HANDLE *Handles;
- EFI_HANDLE ControllerHandle;
- HTTP_DOWNLOAD_CONTEXT Context;
- BOOLEAN NicFound;
-
- ProblemParam = NULL;
- RemoteFilePath = NULL;
- NicFound = FALSE;
- Handles = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *CheckPackage;
+ UINTN ParamCount;
+ UINTN HandleCount;
+ UINTN NicNumber;
+ UINTN InitialSize;
+ UINTN ParamOffset;
+ UINTN StartSize;
+ CHAR16 *ProblemParam;
+ CHAR16 NicName[IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH];
+ CHAR16 *Walker1;
+ CHAR16 *VStr;
+ CONST CHAR16 *UserNicName;
+ CONST CHAR16 *ValueStr;
+ CONST CHAR16 *RemoteFilePath;
+ CONST CHAR16 *Walker;
+ EFI_HTTPv4_ACCESS_POINT IPv4Node;
+ EFI_HANDLE *Handles;
+ EFI_HANDLE ControllerHandle;
+ HTTP_DOWNLOAD_CONTEXT Context;
+ BOOLEAN NicFound;
+
+ ProblemParam = NULL;
+ RemoteFilePath = NULL;
+ NicFound = FALSE;
+ Handles = NULL;
//
// Initialize the Shell library (we must be in non-auto-init...).
@@ -522,8 +522,8 @@ RunHttp ( TRUE
);
if (EFI_ERROR (Status)) {
- if ((Status == EFI_VOLUME_CORRUPTED)
- && (ProblemParam != NULL))
+ if ( (Status == EFI_VOLUME_CORRUPTED)
+ && (ProblemParam != NULL))
{
PRINT_HII_APP (STRING_TOKEN (STR_GEN_PROBLEM), ProblemParam);
SHELL_FREE_NON_NULL (ProblemParam);
@@ -554,7 +554,7 @@ RunHttp ( ZeroMem (&IPv4Node, sizeof (IPv4Node));
IPv4Node.UseDefaultAddress = TRUE;
- Context.HttpConfigData.HttpVersion = HttpVersion11;
+ Context.HttpConfigData.HttpVersion = HttpVersion11;
Context.HttpConfigData.AccessPoint.IPv4Node = &IPv4Node;
//
@@ -592,7 +592,7 @@ RunHttp ( }
if (*Walker1 == L'/') {
- ParamOffset = 1;
+ ParamOffset = 1;
RemoteFilePath = Walker1;
}
@@ -629,7 +629,8 @@ RunHttp ( Walker = RemoteFilePath + StrLen (RemoteFilePath);
while ((--Walker) >= RemoteFilePath) {
if ((*Walker == L'\\') ||
- (*Walker == L'/' ) ) {
+ (*Walker == L'/'))
+ {
break;
}
}
@@ -659,12 +660,12 @@ RunHttp ( UserNicName = ShellCommandLineGetValue (CheckPackage, L"-i");
ValueStr = ShellCommandLineGetValue (CheckPackage, L"-l");
- if ((ValueStr != NULL)
- && (!StringToUint16 (
- ValueStr,
- &Context.HttpConfigData.AccessPoint.IPv4Node->LocalPort
- )
- ))
+ if ( (ValueStr != NULL)
+ && (!StringToUint16 (
+ ValueStr,
+ &Context.HttpConfigData.AccessPoint.IPv4Node->LocalPort
+ )
+ ))
{
goto Error;
}
@@ -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;
}
@@ -756,10 +757,10 @@ RunHttp ( }
if (gHttpError) {
- //
- // This is not related to connection, so no need to repeat with
- // another interface.
- //
+ //
+ // This is not related to connection, so no need to repeat with
+ // another interface.
+ //
break;
}
}
@@ -841,7 +842,7 @@ GetNicName ( &gEfiManagedNetworkServiceBindingProtocolGuid,
&gEfiManagedNetworkProtocolGuid,
&MnpHandle,
- (VOID**)&Mnp
+ (VOID **)&Mnp
);
if (EFI_ERROR (Status)) {
goto Error;
@@ -907,12 +908,12 @@ CreateServiceChildAndOpenProtocol ( EFI_STATUS Status;
*ChildHandle = NULL;
- Status = NetLibCreateServiceChild (
- ControllerHandle,
- gImageHandle,
- ServiceBindingProtocolGuid,
- ChildHandle
- );
+ Status = NetLibCreateServiceChild (
+ ControllerHandle,
+ gImageHandle,
+ ServiceBindingProtocolGuid,
+ ChildHandle
+ );
if (!EFI_ERROR (Status)) {
Status = gBS->OpenProtocol (
*ChildHandle,
@@ -990,8 +991,8 @@ WaitForCompletion ( IN OUT BOOLEAN *CallBackComplete
)
{
- EFI_STATUS Status;
- EFI_EVENT WaitEvt;
+ EFI_STATUS Status;
+ EFI_EVENT WaitEvt;
Status = EFI_SUCCESS;
@@ -1005,25 +1006,25 @@ WaitForCompletion ( NULL,
&WaitEvt
);
- ASSERT_EFI_ERROR (Status);
+ ASSERT_EFI_ERROR (Status);
- if (!EFI_ERROR (Status)) {
- Status = gBS->SetTimer (
- WaitEvt,
- TimerRelative,
- EFI_TIMER_PERIOD_SECONDS (TIMER_MAX_TIMEOUT_S)
- );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->SetTimer (
+ WaitEvt,
+ TimerRelative,
+ EFI_TIMER_PERIOD_SECONDS (TIMER_MAX_TIMEOUT_S)
+ );
- ASSERT_EFI_ERROR (Status);
- }
+ ASSERT_EFI_ERROR (Status);
+ }
- while (! *CallBackComplete
- && (!EFI_ERROR (Status))
- && EFI_ERROR (gBS->CheckEvent (WaitEvt)))
+ 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,12 +1033,12 @@ WaitForCompletion ( // Note that at this point Response may not has been populated,
// so it needs to be checked first.
//
- if (Context->ResponseToken.Message
- && Context->ResponseToken.Message->Data.Response
- && (NEED_REDIRECTION (
- Context->ResponseToken.Message->Data.Response->StatusCode
- )
- ))
+ if ( Context->ResponseToken.Message
+ && Context->ResponseToken.Message->Data.Response
+ && (NEED_REDIRECTION (
+ Context->ResponseToken.Message->Data.Response->StatusCode
+ )
+ ))
{
break;
}
@@ -1079,20 +1080,20 @@ SendRequest ( IN CHAR16 *DownloadUrl
)
{
- EFI_HTTP_REQUEST_DATA RequestData;
- EFI_HTTP_HEADER RequestHeader[HdrMax];
- EFI_HTTP_MESSAGE RequestMessage;
- EFI_STATUS Status;
- CHAR16 *Host;
- UINTN StringSize;
+ EFI_HTTP_REQUEST_DATA RequestData;
+ EFI_HTTP_HEADER RequestHeader[HdrMax];
+ EFI_HTTP_MESSAGE RequestMessage;
+ EFI_STATUS Status;
+ CHAR16 *Host;
+ UINTN StringSize;
ZeroMem (&RequestData, sizeof (RequestData));
ZeroMem (&RequestHeader, sizeof (RequestHeader));
ZeroMem (&RequestMessage, sizeof (RequestMessage));
ZeroMem (&Context->RequestToken, sizeof (Context->RequestToken));
- RequestHeader[HdrHost].FieldName = "Host";
- RequestHeader[HdrConn].FieldName = "Connection";
+ RequestHeader[HdrHost].FieldName = "Host";
+ RequestHeader[HdrConn].FieldName = "Connection";
RequestHeader[HdrAgent].FieldName = "User-Agent";
Host = (CHAR16 *)Context->ServerAddrAndProto;
@@ -1113,7 +1114,7 @@ SendRequest ( //
Host++;
- StringSize = StrLen (Host) + 1;
+ StringSize = StrLen (Host) + 1;
RequestHeader[HdrHost].FieldValue = AllocatePool (StringSize);
if (!RequestHeader[HdrHost].FieldValue) {
return EFI_OUT_OF_RESOURCES;
@@ -1125,17 +1126,17 @@ SendRequest ( StringSize
);
- RequestHeader[HdrConn].FieldValue = "close";
+ RequestHeader[HdrConn].FieldValue = "close";
RequestHeader[HdrAgent].FieldValue = USER_AGENT_HDR;
- RequestMessage.HeaderCount = HdrMax;
+ RequestMessage.HeaderCount = HdrMax;
RequestData.Method = HttpMethodGet;
- RequestData.Url = DownloadUrl;
+ RequestData.Url = DownloadUrl;
RequestMessage.Data.Request = &RequestData;
- RequestMessage.Headers = RequestHeader;
- RequestMessage.BodyLength = 0;
- RequestMessage.Body = NULL;
+ RequestMessage.Headers = RequestHeader;
+ RequestMessage.BodyLength = 0;
+ RequestMessage.Body = NULL;
Context->RequestToken.Event = NULL;
//
@@ -1150,10 +1151,10 @@ SendRequest ( );
ASSERT_EFI_ERROR (Status);
- Context->RequestToken.Status = EFI_SUCCESS;
+ Context->RequestToken.Status = EFI_SUCCESS;
Context->RequestToken.Message = &RequestMessage;
- gRequestCallbackComplete = FALSE;
- Status = Context->Http->Request (Context->Http, &Context->RequestToken);
+ gRequestCallbackComplete = FALSE;
+ Status = Context->Http->Request (Context->Http, &Context->RequestToken);
if (EFI_ERROR (Status)) {
goto Error;
}
@@ -1193,15 +1194,15 @@ SavePortion ( IN CHAR8 *Buffer
)
{
- CHAR16 Progress[HTTP_PROGRESS_MESSAGE_SIZE];
- UINTN NbOfKb;
- UINTN Index;
- UINTN LastStep;
- UINTN Step;
- EFI_STATUS Status;
+ CHAR16 Progress[HTTP_PROGRESS_MESSAGE_SIZE];
+ UINTN NbOfKb;
+ UINTN Index;
+ UINTN LastStep;
+ UINTN Step;
+ EFI_STATUS Status;
LastStep = 0;
- Step = 0;
+ Step = 0;
ShellSetFilePosition (mFileHandle, Context->LastReportedNbOfBytes);
Status = ShellWriteFile (mFileHandle, &DownloadLen, Buffer);
@@ -1219,14 +1220,14 @@ SavePortion ( }
Context->ContentDownloaded += DownloadLen;
- NbOfKb = Context->ContentDownloaded >> 10;
+ NbOfKb = Context->ContentDownloaded >> 10;
Progress[0] = L'\0';
if (Context->ContentLength) {
- LastStep = (Context->LastReportedNbOfBytes * HTTP_PROGRESS_SLIDER_STEPS) /
- Context->ContentLength;
- Step = (Context->ContentDownloaded * HTTP_PROGRESS_SLIDER_STEPS) /
- Context->ContentLength;
+ LastStep = (Context->LastReportedNbOfBytes * HTTP_PROGRESS_SLIDER_STEPS) /
+ Context->ContentLength;
+ Step = (Context->ContentDownloaded * HTTP_PROGRESS_SLIDER_STEPS) /
+ Context->ContentLength;
}
Context->LastReportedNbOfBytes = Context->ContentDownloaded;
@@ -1265,7 +1266,6 @@ SavePortion ( NbOfKb
);
-
ShellPrintEx (-1, -1, L"%s", Progress);
return EFI_SUCCESS;
@@ -1286,29 +1286,29 @@ SavePortion ( STATIC
EFI_STATUS
SetHostURI (
- IN CHAR8 *Location,
- IN HTTP_DOWNLOAD_CONTEXT *Context,
- IN CHAR16 *DownloadUrl
+ IN CHAR8 *Location,
+ IN HTTP_DOWNLOAD_CONTEXT *Context,
+ IN CHAR16 *DownloadUrl
)
{
- EFI_STATUS Status;
- UINTN StringSize;
- UINTN FirstStep;
- UINTN Idx;
- UINTN Step;
- CHAR8 *Walker;
- CHAR16 *Temp;
- CHAR8 *Tmp;
- CHAR16 *Url;
- BOOLEAN IsAbEmptyUrl;
-
- Tmp = NULL;
- Url = NULL;
+ EFI_STATUS Status;
+ UINTN StringSize;
+ UINTN FirstStep;
+ UINTN Idx;
+ UINTN Step;
+ CHAR8 *Walker;
+ CHAR16 *Temp;
+ CHAR8 *Tmp;
+ CHAR16 *Url;
+ BOOLEAN IsAbEmptyUrl;
+
+ Tmp = NULL;
+ Url = NULL;
IsAbEmptyUrl = FALSE;
- FirstStep = 0;
+ FirstStep = 0;
StringSize = (AsciiStrSize (Location) * sizeof (CHAR16));
- Url = AllocateZeroPool (StringSize);
+ Url = AllocateZeroPool (StringSize);
if (!Url) {
return EFI_OUT_OF_RESOURCES;
}
@@ -1320,7 +1320,7 @@ SetHostURI ( );
if (EFI_ERROR (Status)) {
- goto Error;
+ goto Error;
}
//
@@ -1347,11 +1347,11 @@ SetHostURI ( }
if (AsciiStrStr (Location, "://") || IsAbEmptyUrl) {
- Idx = 0;
+ Idx = 0;
Walker = Location;
for (Step = FirstStep; Step < 2; Step++) {
- for (; *Walker != '/' && *Walker != '\0'; Walker++) {
+ for ( ; *Walker != '/' && *Walker != '\0'; Walker++) {
Idx++;
}
@@ -1359,7 +1359,7 @@ SetHostURI ( //
// Skip "//"
//
- Idx += 2;
+ Idx += 2;
Walker += 2;
}
}
@@ -1375,7 +1375,7 @@ SetHostURI ( //
// Location now points to Uri
//
- Location += Idx;
+ Location += Idx;
StringSize = (Idx + 1) * sizeof (CHAR16);
SHELL_FREE_NON_NULL (Context->ServerAddrAndProto);
@@ -1421,7 +1421,7 @@ SetHostURI ( SHELL_FREE_NON_NULL (Context->Uri);
- StringSize = AsciiStrSize (Location) * sizeof (CHAR16);
+ StringSize = AsciiStrSize (Location) * sizeof (CHAR16);
Context->Uri = AllocateZeroPool (StringSize);
if (!Context->Uri) {
Status = EFI_OUT_OF_RESOURCES;
@@ -1460,15 +1460,15 @@ STATIC EFI_STATUS
EFIAPI
ParseMsg (
- IN HTTP_BODY_PARSE_EVENT EventType,
- IN CHAR8 *Data,
- IN UINTN Length,
- IN VOID *Context
+ IN HTTP_BODY_PARSE_EVENT EventType,
+ IN CHAR8 *Data,
+ IN UINTN Length,
+ IN VOID *Context
)
{
- if ((Data == NULL)
- || (EventType == BodyParseEventOnComplete)
- || (Context == NULL))
+ if ( (Data == NULL)
+ || (EventType == BodyParseEventOnComplete)
+ || (Context == NULL))
{
return EFI_SUCCESS;
}
@@ -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).
@@ -1498,38 +1497,38 @@ ParseMsg ( STATIC
EFI_STATUS
GetResponse (
- IN HTTP_DOWNLOAD_CONTEXT *Context,
- IN CHAR16 *DownloadUrl
+ IN HTTP_DOWNLOAD_CONTEXT *Context,
+ IN CHAR16 *DownloadUrl
)
{
- EFI_HTTP_RESPONSE_DATA ResponseData;
- EFI_HTTP_MESSAGE ResponseMessage;
- EFI_HTTP_HEADER *Header;
- EFI_STATUS Status;
- VOID *MsgParser;
- EFI_TIME StartTime;
- EFI_TIME EndTime;
- CONST CHAR16 *Desc;
- UINTN ElapsedSeconds;
- BOOLEAN IsTrunked;
- BOOLEAN CanMeasureTime;
+ EFI_HTTP_RESPONSE_DATA ResponseData;
+ EFI_HTTP_MESSAGE ResponseMessage;
+ EFI_HTTP_HEADER *Header;
+ EFI_STATUS Status;
+ VOID *MsgParser;
+ EFI_TIME StartTime;
+ EFI_TIME EndTime;
+ CONST CHAR16 *Desc;
+ UINTN ElapsedSeconds;
+ BOOLEAN IsTrunked;
+ BOOLEAN CanMeasureTime;
ZeroMem (&ResponseData, sizeof (ResponseData));
ZeroMem (&ResponseMessage, sizeof (ResponseMessage));
ZeroMem (&Context->ResponseToken, sizeof (Context->ResponseToken));
IsTrunked = FALSE;
- ResponseMessage.Body = Context->Buffer;
- Context->ResponseToken.Status = EFI_SUCCESS;
+ ResponseMessage.Body = Context->Buffer;
+ Context->ResponseToken.Status = EFI_SUCCESS;
Context->ResponseToken.Message = &ResponseMessage;
- Context->ContentLength = 0;
- Context->Status = REQ_OK;
- Status = EFI_SUCCESS;
- MsgParser = NULL;
- ResponseData.StatusCode = HTTP_STATUS_UNSUPPORTED_STATUS;
- ResponseMessage.Data.Response = &ResponseData;
- Context->ResponseToken.Event = NULL;
- CanMeasureTime = FALSE;
+ Context->ContentLength = 0;
+ Context->Status = REQ_OK;
+ Status = EFI_SUCCESS;
+ MsgParser = NULL;
+ ResponseData.StatusCode = HTTP_STATUS_UNSUPPORTED_STATUS;
+ ResponseMessage.Data.Response = &ResponseData;
+ Context->ResponseToken.Event = NULL;
+ CanMeasureTime = FALSE;
if (Context->Flags & DL_FLAG_TIME) {
ZeroMem (&StartTime, sizeof (StartTime));
CanMeasureTime = !EFI_ERROR (gRT->GetTime (&StartTime, NULL));
@@ -1538,8 +1537,8 @@ GetResponse ( do {
SHELL_FREE_NON_NULL (ResponseMessage.Headers);
ResponseMessage.HeaderCount = 0;
- gResponseCallbackComplete = FALSE;
- ResponseMessage.BodyLength = Context->BufferSize;
+ gResponseCallbackComplete = FALSE;
+ ResponseMessage.BodyLength = Context->BufferSize;
if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
@@ -1642,8 +1641,8 @@ GetResponse ( HttpGetEntityLength (MsgParser, &Context->ContentLength);
- if (ResponseData.StatusCode >= HTTP_STATUS_400_BAD_REQUEST
- && (ResponseData.StatusCode != HTTP_STATUS_308_PERMANENT_REDIRECT))
+ if ( (ResponseData.StatusCode >= HTTP_STATUS_400_BAD_REQUEST)
+ && (ResponseData.StatusCode != HTTP_STATUS_308_PERMANENT_REDIRECT))
{
//
// Server reported an error via Response code.
@@ -1665,7 +1664,7 @@ GetResponse ( // This gives an RFC HTTP error.
//
Context->Status = ShellStrToUintn (Desc);
- Status = ENCODE_ERROR (Context->Status);
+ Status = ENCODE_ERROR (Context->Status);
}
}
}
@@ -1680,13 +1679,13 @@ GetResponse ( ResponseMessage.Body
);
}
- } while (!HttpIsMessageComplete (MsgParser)
- && !EFI_ERROR (Status)
- && ResponseMessage.BodyLength);
+ } while ( !HttpIsMessageComplete (MsgParser)
+ && !EFI_ERROR (Status)
+ && ResponseMessage.BodyLength);
- if (Context->Status != REQ_NEED_REPEAT
- && Status == EFI_SUCCESS
- && CanMeasureTime)
+ if ( (Context->Status != REQ_NEED_REPEAT)
+ && (Status == EFI_SUCCESS)
+ && CanMeasureTime)
{
if (!EFI_ERROR (gRT->GetTime (&EndTime, NULL))) {
ElapsedSeconds = EfiTimeToEpoch (&EndTime) - EfiTimeToEpoch (&StartTime);
@@ -1726,22 +1725,22 @@ GetResponse ( STATIC
EFI_STATUS
DownloadFile (
- IN HTTP_DOWNLOAD_CONTEXT *Context,
- IN EFI_HANDLE ControllerHandle,
- IN CHAR16 *NicName
+ IN HTTP_DOWNLOAD_CONTEXT *Context,
+ IN EFI_HANDLE ControllerHandle,
+ IN CHAR16 *NicName
)
{
- EFI_STATUS Status;
- CHAR16 *DownloadUrl;
- UINTN UrlSize;
- EFI_HANDLE HttpChildHandle;
+ EFI_STATUS Status;
+ CHAR16 *DownloadUrl;
+ UINTN UrlSize;
+ EFI_HANDLE HttpChildHandle;
ASSERT (Context);
if (Context == NULL) {
return EFI_INVALID_PARAMETER;
}
- DownloadUrl = NULL;
+ DownloadUrl = NULL;
HttpChildHandle = NULL;
Context->Buffer = AllocatePool (Context->BufferSize);
@@ -1780,7 +1779,7 @@ DownloadFile ( &gEfiHttpServiceBindingProtocolGuid,
&gEfiHttpProtocolGuid,
&HttpChildHandle,
- (VOID**)&Context->Http
+ (VOID **)&Context->Http
);
if (EFI_ERROR (Status)) {
@@ -1794,7 +1793,7 @@ DownloadFile ( goto ON_EXIT;
}
- UrlSize = 0;
+ UrlSize = 0;
DownloadUrl = StrnCatGrow (
&DownloadUrl,
&UrlSize,
@@ -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) {
@@ -1864,12 +1863,12 @@ ON_EXIT: **/
EFI_HII_HANDLE
InitializeHiiPackage (
- IN EFI_HANDLE ImageHandle
+ IN EFI_HANDLE ImageHandle
)
{
- EFI_STATUS Status;
- EFI_HII_PACKAGE_LIST_HEADER *PackageList;
- EFI_HII_HANDLE HiiHandle;
+ EFI_STATUS Status;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ EFI_HII_HANDLE HiiHandle;
//
// Retrieve HII package list from ImageHandle.
@@ -1891,11 +1890,11 @@ InitializeHiiPackage ( // Publish HII package list to HII Database.
//
Status = gHiiDatabase->NewPackageList (
- gHiiDatabase,
- PackageList,
- NULL,
- &HiiHandle
- );
+ gHiiDatabase,
+ PackageList,
+ NULL,
+ &HiiHandle
+ );
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
return NULL;
diff --git a/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h index fa8b6f5aa4..f6c4b2c537 100644 --- a/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h +++ b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h @@ -32,7 +32,7 @@ #include <Protocol/HttpUtilities.h>
#include <Protocol/ServiceBinding.h>
-#define HTTP_APP_NAME L"http"
+#define HTTP_APP_NAME L"http"
#define REQ_OK 0
#define REQ_NEED_REPEAT 1
@@ -40,25 +40,25 @@ //
// Download Flags.
//
-#define DL_FLAG_TIME BIT0 // Show elapsed time.
-#define DL_FLAG_KEEP_BAD BIT1 // Keep files even if download failed.
+#define DL_FLAG_TIME BIT0 // Show elapsed time.
+#define DL_FLAG_KEEP_BAD BIT1 // Keep files even if download failed.
-extern EFI_HII_HANDLE mHttpHiiHandle;
+extern EFI_HII_HANDLE mHttpHiiHandle;
typedef struct {
- UINTN ContentDownloaded;
- UINTN ContentLength;
- UINTN LastReportedNbOfBytes;
- UINTN BufferSize;
- UINTN Status;
- UINTN Flags;
- UINT8 *Buffer;
- CHAR16 *ServerAddrAndProto;
- CHAR16 *Uri;
- EFI_HTTP_TOKEN ResponseToken;
- EFI_HTTP_TOKEN RequestToken;
- EFI_HTTP_PROTOCOL *Http;
- EFI_HTTP_CONFIG_DATA HttpConfigData;
+ UINTN ContentDownloaded;
+ UINTN ContentLength;
+ UINTN LastReportedNbOfBytes;
+ UINTN BufferSize;
+ UINTN Status;
+ UINTN Flags;
+ UINT8 *Buffer;
+ CHAR16 *ServerAddrAndProto;
+ CHAR16 *Uri;
+ EFI_HTTP_TOKEN ResponseToken;
+ EFI_HTTP_TOKEN RequestToken;
+ EFI_HTTP_PROTOCOL *Http;
+ EFI_HTTP_CONFIG_DATA HttpConfigData;
} HTTP_DOWNLOAD_CONTEXT;
/**
@@ -87,6 +87,7 @@ RunHttp ( **/
EFI_HII_HANDLE
InitializeHiiPackage (
- IN EFI_HANDLE ImageHandle
+ IN EFI_HANDLE ImageHandle
);
+
#endif // _HTTP_H_
diff --git a/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c b/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c index a7d2c27191..6622e058aa 100644 --- a/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c +++ b/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c @@ -20,7 +20,7 @@ * Thus the application can use '-?' option to show help message in Shell.
*/
GLOBAL_REMOVE_IF_UNREFERENCED
-EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_HTTP);
+EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_HTTP);
/**
Entry point of Http standalone application.
@@ -35,12 +35,12 @@ EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_HTTP); EFI_STATUS
EFIAPI
HttpAppInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
if (mHttpHiiHandle == NULL) {
diff --git a/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c b/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c index 7f59cc74d2..45aeaac347 100644 --- a/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c +++ b/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c @@ -28,10 +28,10 @@ SHELL_STATUS
EFIAPI
HttpCommandHandler (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
- IN EFI_SHELL_PROTOCOL *Shell
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
+ IN EFI_SHELL_PROTOCOL *Shell
)
{
gEfiShellParametersProtocol = ShellParameters;
@@ -53,8 +53,8 @@ HttpCommandHandler ( CHAR16 *
EFIAPI
HttpCommandGetHelp (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN CONST CHAR8 *Language
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
+ IN CONST CHAR8 *Language
)
{
return HiiGetString (
@@ -64,7 +64,7 @@ HttpCommandGetHelp ( );
}
-EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mHttpDynamicCommand = {
+EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mHttpDynamicCommand = {
HTTP_APP_NAME,
HttpCommandHandler,
HttpCommandGetHelp
@@ -85,11 +85,11 @@ EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mHttpDynamicCommand = { EFI_STATUS
EFIAPI
HttpCommandInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
if (mHttpHiiHandle == NULL) {
@@ -117,10 +117,10 @@ HttpCommandInitialize ( EFI_STATUS
EFIAPI
HttpUnload (
- IN EFI_HANDLE ImageHandle
-)
+ IN EFI_HANDLE ImageHandle
+ )
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = gBS->UninstallProtocolInterface (
ImageHandle,
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c index 4e296c495b..7e5c73b3da 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c @@ -10,8 +10,8 @@ #include "Tftp.h"
-#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32
-EFI_HII_HANDLE mTftpHiiHandle;
+#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32
+EFI_HII_HANDLE mTftpHiiHandle;
/*
Constant strings and definitions related to the message indicating the amount of
@@ -19,7 +19,7 @@ EFI_HII_HANDLE mTftpHiiHandle; */
// Frame for the progression slider
-STATIC CONST CHAR16 mTftpProgressFrame[] = L"[ ]";
+STATIC CONST CHAR16 mTftpProgressFrame[] = L"[ ]";
// Number of steps in the progression slider
#define TFTP_PROGRESS_SLIDER_STEPS ((sizeof (mTftpProgressFrame) / sizeof (CHAR16)) - 3)
@@ -33,13 +33,13 @@ STATIC CONST CHAR16 mTftpProgressFrame[] = L"[ // String to delete the TFTP progress message to be able to update it :
// (TFTP_PROGRESS_MESSAGE_SIZE-1) '\b'
-STATIC CONST CHAR16 mTftpProgressDelete[] = L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
+STATIC CONST CHAR16 mTftpProgressDelete[] = L"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
// Local File Handle
-SHELL_FILE_HANDLE mFileHandle;
+SHELL_FILE_HANDLE mFileHandle;
// Path of the local file, Unicode encoded
-CONST CHAR16 *mLocalFilePath;
+CONST CHAR16 *mLocalFilePath;
/**
Check and convert the UINT16 option values of the 'tftp' command
@@ -206,49 +206,57 @@ CheckPacket ( IN EFI_MTFTP4_PACKET *Packet
);
-EFI_MTFTP4_CONFIG_DATA DefaultMtftp4ConfigData = {
+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}
- };
+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 }
+};
///
/// The default block size (512) of tftp is defined in the RFC1350.
///
-#define MTFTP_DEFAULT_BLKSIZE 512
+#define MTFTP_DEFAULT_BLKSIZE 512
///
/// The valid range of block size option is defined in the RFC2348.
///
-#define MTFTP_MIN_BLKSIZE 8
-#define MTFTP_MAX_BLKSIZE 65464
+#define MTFTP_MIN_BLKSIZE 8
+#define MTFTP_MAX_BLKSIZE 65464
///
/// The default windowsize (1) of tftp.
///
-#define MTFTP_DEFAULT_WINDOWSIZE 1
+#define MTFTP_DEFAULT_WINDOWSIZE 1
///
/// The valid range of window size option.
/// Note that: RFC 7440 does not mention max window size value, but for the
/// stability reason, the value is limited to 64.
///
-#define MTFTP_MIN_WINDOWSIZE 1
-#define MTFTP_MAX_WINDOWSIZE 64
+#define MTFTP_MIN_WINDOWSIZE 1
+#define MTFTP_MAX_WINDOWSIZE 64
/**
Function for 'tftp' command.
@@ -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;
}
@@ -356,23 +380,29 @@ RunTftp ( // Check the host IPv4 address
//
ValueStr = ShellCommandLineGetRawValue (CheckPackage, 1);
- Status = NetLibStrToIp4 (ValueStr, &Mtftp4ConfigData.ServerIp);
+ 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);
- FilePathSize = StrLen (RemoteFilePath) + 1;
+ 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,11 +455,17 @@ 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,11 +475,17 @@ 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,11 +495,17 @@ 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;
}
}
@@ -464,32 +514,41 @@ RunTftp ( // Locate all MTFTP4 Service Binding protocols
//
ShellStatus = SHELL_NOT_FOUND;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiManagedNetworkServiceBindingProtocolGuid,
- NULL,
- &HandleCount,
- &Handles
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiManagedNetworkServiceBindingProtocolGuid,
+ NULL,
+ &HandleCount,
+ &Handles
+ );
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;
}
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,46 +565,68 @@ 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;
}
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;
}
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;
}
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,9 +686,14 @@ 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
);
@@ -713,12 +805,12 @@ CreateServiceChildAndOpenProtocol ( EFI_STATUS Status;
*ChildHandle = NULL;
- Status = NetLibCreateServiceChild (
- ControllerHandle,
- gImageHandle,
- ServiceBindingProtocolGuid,
- ChildHandle
- );
+ Status = NetLibCreateServiceChild (
+ ControllerHandle,
+ gImageHandle,
+ ServiceBindingProtocolGuid,
+ ChildHandle
+ );
if (!EFI_ERROR (Status)) {
Status = gBS->OpenProtocol (
*ChildHandle,
@@ -810,21 +902,21 @@ GetFileSize ( UINT32 OptCnt;
UINT8 OptBuf[128];
- ReqOpt[0].OptionStr = (UINT8*)"tsize";
- OptBuf[0] = '0';
- OptBuf[1] = 0;
- ReqOpt[0].ValueStr = OptBuf;
+ ReqOpt[0].OptionStr = (UINT8 *)"tsize";
+ OptBuf[0] = '0';
+ OptBuf[1] = 0;
+ ReqOpt[0].ValueStr = OptBuf;
Status = Mtftp4->GetInfo (
- Mtftp4,
- NULL,
- (UINT8*)FilePath,
- NULL,
- 1,
- ReqOpt,
- &PktLen,
- &Packet
- );
+ Mtftp4,
+ NULL,
+ (UINT8 *)FilePath,
+ NULL,
+ 1,
+ ReqOpt,
+ &PktLen,
+ &Packet
+ );
if (EFI_ERROR (Status)) {
goto Error;
@@ -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;
}
@@ -889,11 +983,11 @@ DownloadFile ( IN UINT16 WindowSize
)
{
- EFI_STATUS Status;
- DOWNLOAD_CONTEXT *TftpContext;
- EFI_MTFTP4_TOKEN Mtftp4Token;
- UINT8 BlksizeBuf[10];
- UINT8 WindowsizeBuf[10];
+ EFI_STATUS Status;
+ DOWNLOAD_CONTEXT *TftpContext;
+ EFI_MTFTP4_TOKEN Mtftp4Token;
+ UINT8 BlksizeBuf[10];
+ UINT8 WindowsizeBuf[10];
ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN));
@@ -902,13 +996,14 @@ DownloadFile ( Status = EFI_OUT_OF_RESOURCES;
goto Error;
}
- TftpContext->FileSize = FileSize;
+
+ 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].ValueStr = BlksizeBuf;
- Mtftp4Token.OptionCount ++;
+ Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *)"blksize";
+ AsciiSPrint ((CHAR8 *)BlksizeBuf, sizeof (BlksizeBuf), "%d", BlockSize);
+ Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr = BlksizeBuf;
+ 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].ValueStr = WindowsizeBuf;
- Mtftp4Token.OptionCount ++;
+ Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *)"windowsize";
+ AsciiSPrint ((CHAR8 *)WindowsizeBuf, sizeof (WindowsizeBuf), "%d", WindowSize);
+ Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr = WindowsizeBuf;
+ Mtftp4Token.OptionCount++;
}
ShellPrintHiiEx (
- -1, -1, NULL, STRING_TOKEN (STR_TFTP_DOWNLOADING),
- mTftpHiiHandle, FilePath
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_TFTP_DOWNLOADING),
+ mTftpHiiHandle,
+ FilePath
);
//
@@ -943,24 +1042,32 @@ DownloadFile ( }
Status = ShellOpenFileByName (
- mLocalFilePath,
- &mFileHandle,
- EFI_FILE_MODE_CREATE |
- EFI_FILE_MODE_WRITE |
- EFI_FILE_MODE_READ,
- 0
- );
+ mLocalFilePath,
+ &mFileHandle,
+ EFI_FILE_MODE_CREATE |
+ EFI_FILE_MODE_WRITE |
+ EFI_FILE_MODE_READ,
+ 0
+ );
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,19 +1132,28 @@ 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;
}
@@ -1046,11 +1162,11 @@ CheckPacket ( }
Context->DownloadedNbOfBytes += DownloadLen;
- NbOfKb = Context->DownloadedNbOfBytes / 1024;
+ NbOfKb = Context->DownloadedNbOfBytes / 1024;
Progress[0] = L'\0';
- LastStep = (Context->LastReportedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;
- Step = (Context->DownloadedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;
+ LastStep = (Context->LastReportedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;
+ Step = (Context->DownloadedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;
if (Step <= LastStep) {
return EFI_SUCCESS;
@@ -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 (
@@ -1089,12 +1207,12 @@ CheckPacket ( **/
EFI_HII_HANDLE
InitializeHiiPackage (
- EFI_HANDLE ImageHandle
+ EFI_HANDLE ImageHandle
)
{
- EFI_STATUS Status;
- EFI_HII_PACKAGE_LIST_HEADER *PackageList;
- EFI_HII_HANDLE HiiHandle;
+ EFI_STATUS Status;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ EFI_HII_HANDLE HiiHandle;
//
// Retrieve HII package list from ImageHandle
@@ -1125,5 +1243,6 @@ InitializeHiiPackage ( if (EFI_ERROR (Status)) {
return NULL;
}
+
return HiiHandle;
}
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h index c46a0d5b0c..89cb79c335 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h @@ -30,12 +30,12 @@ #include <Library/PrintLib.h>
#include <Library/UefiHiiServicesLib.h>
-extern EFI_HII_HANDLE mTftpHiiHandle;
+extern EFI_HII_HANDLE mTftpHiiHandle;
typedef struct {
- UINTN FileSize;
- UINTN DownloadedNbOfBytes;
- UINTN LastReportedNbOfBytes;
+ UINTN FileSize;
+ UINTN DownloadedNbOfBytes;
+ UINTN LastReportedNbOfBytes;
} DOWNLOAD_CONTEXT;
/**
@@ -64,6 +64,7 @@ RunTftp ( **/
EFI_HII_HANDLE
InitializeHiiPackage (
- EFI_HANDLE ImageHandle
+ EFI_HANDLE ImageHandle
);
+
#endif // _TFTP_H_
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c index 0972454c28..5af7784cff 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c @@ -17,7 +17,7 @@ // the resource section. Thus the application can use '-?' option to show help message in
// Shell.
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_TFTP);
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_TFTP);
/**
Entry point of Tftp standalone application.
@@ -32,11 +32,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (S EFI_STATUS
EFIAPI
TftpAppInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
if (mTftpHiiHandle == NULL) {
return EFI_ABORTED;
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c index 8e5df7b2d1..23c86a785c 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c @@ -26,10 +26,10 @@ SHELL_STATUS
EFIAPI
TftpCommandHandler (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
- IN EFI_SHELL_PROTOCOL *Shell
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
+ IN EFI_SHELL_PROTOCOL *Shell
)
{
gEfiShellParametersProtocol = ShellParameters;
@@ -50,14 +50,14 @@ TftpCommandHandler ( CHAR16 *
EFIAPI
TftpCommandGetHelp (
- IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
- IN CONST CHAR8 *Language
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
+ IN CONST CHAR8 *Language
)
{
return HiiGetString (mTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP), Language);
}
-EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand = {
+EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand = {
L"tftp",
TftpCommandHandler,
TftpCommandGetHelp
@@ -78,11 +78,12 @@ EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand = { EFI_STATUS
EFIAPI
TftpCommandInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
if (mTftpHiiHandle == NULL) {
return EFI_ABORTED;
@@ -109,10 +110,11 @@ TftpCommandInitialize ( EFI_STATUS
EFIAPI
TftpUnload (
- IN EFI_HANDLE ImageHandle
-)
+ IN EFI_HANDLE ImageHandle
+ )
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
Status = gBS->UninstallProtocolInterface (
ImageHandle,
&gEfiShellDynamicCommandProtocolGuid,
@@ -121,6 +123,7 @@ TftpUnload ( if (EFI_ERROR (Status)) {
return Status;
}
+
HiiRemovePackages (mTftpHiiHandle);
return EFI_SUCCESS;
}
diff --git a/ShellPkg/Include/Guid/ShellAliasGuid.h b/ShellPkg/Include/Guid/ShellAliasGuid.h index a4ae588f4d..2bdc257ea9 100644 --- a/ShellPkg/Include/Guid/ShellAliasGuid.h +++ b/ShellPkg/Include/Guid/ShellAliasGuid.h @@ -14,6 +14,6 @@ 0x0053d9d6, 0x2659, 0x4599, { 0xa2, 0x6b, 0xef, 0x45, 0x36, 0xe6, 0x31, 0xa9 } \
}
-extern EFI_GUID gShellAliasGuid;
+extern EFI_GUID gShellAliasGuid;
#endif
diff --git a/ShellPkg/Include/Guid/ShellEnvironment2Ext.h b/ShellPkg/Include/Guid/ShellEnvironment2Ext.h index 75182b79a7..d7eb06d12e 100644 --- a/ShellPkg/Include/Guid/ShellEnvironment2Ext.h +++ b/ShellPkg/Include/Guid/ShellEnvironment2Ext.h @@ -14,6 +14,6 @@ 0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
}
-extern EFI_GUID gEfiShellEnvironment2ExtGuid;
+extern EFI_GUID gEfiShellEnvironment2ExtGuid;
#endif
diff --git a/ShellPkg/Include/Guid/ShellLibHiiGuid.h b/ShellPkg/Include/Guid/ShellLibHiiGuid.h index 6e328b460d..afd3cd60f2 100644 --- a/ShellPkg/Include/Guid/ShellLibHiiGuid.h +++ b/ShellPkg/Include/Guid/ShellLibHiiGuid.h @@ -69,17 +69,17 @@ 0x5f5f605d, 0x1583, 0x4a2d, {0xa6, 0xb2, 0xeb, 0x12, 0xda, 0xb4, 0xa2, 0xb6 } \
}
-extern EFI_GUID gHandleParsingHiiGuid;
-extern EFI_GUID gShellDebug1HiiGuid;
-extern EFI_GUID gShellDriver1HiiGuid;
-extern EFI_GUID gShellInstall1HiiGuid;
-extern EFI_GUID gShellLevel1HiiGuid;
-extern EFI_GUID gShellLevel2HiiGuid;
-extern EFI_GUID gShellLevel3HiiGuid;
-extern EFI_GUID gShellNetwork1HiiGuid;
-extern EFI_GUID gShellNetwork2HiiGuid;
-extern EFI_GUID gShellTftpHiiGuid;
-extern EFI_GUID gShellHttpHiiGuid;
-extern EFI_GUID gShellBcfgHiiGuid;
+extern EFI_GUID gHandleParsingHiiGuid;
+extern EFI_GUID gShellDebug1HiiGuid;
+extern EFI_GUID gShellDriver1HiiGuid;
+extern EFI_GUID gShellInstall1HiiGuid;
+extern EFI_GUID gShellLevel1HiiGuid;
+extern EFI_GUID gShellLevel2HiiGuid;
+extern EFI_GUID gShellLevel3HiiGuid;
+extern EFI_GUID gShellNetwork1HiiGuid;
+extern EFI_GUID gShellNetwork2HiiGuid;
+extern EFI_GUID gShellTftpHiiGuid;
+extern EFI_GUID gShellHttpHiiGuid;
+extern EFI_GUID gShellBcfgHiiGuid;
#endif
diff --git a/ShellPkg/Include/Guid/ShellMapGuid.h b/ShellPkg/Include/Guid/ShellMapGuid.h index fad7290e10..973f7da5de 100644 --- a/ShellPkg/Include/Guid/ShellMapGuid.h +++ b/ShellPkg/Include/Guid/ShellMapGuid.h @@ -14,6 +14,6 @@ 0x51271e13, 0x7de3, 0x43af, { 0x8b, 0xc2, 0x71, 0xad, 0x3b, 0x82, 0x43, 0x25 } \
}
-extern EFI_GUID gShellMapGuid;
+extern EFI_GUID gShellMapGuid;
#endif
diff --git a/ShellPkg/Include/Guid/ShellPkgTokenSpace.h b/ShellPkg/Include/Guid/ShellPkgTokenSpace.h index 818211ebbb..76d2e1afb5 100644 --- a/ShellPkg/Include/Guid/ShellPkgTokenSpace.h +++ b/ShellPkg/Include/Guid/ShellPkgTokenSpace.h @@ -14,6 +14,6 @@ 0x171e9188, 0x31d3, 0x40f5, { 0xb1, 0xc, 0x53, 0x9b, 0x2d, 0xb9, 0x40, 0xcd } \
}
-extern EFI_GUID gEfiShellPkgTokenSpaceGuid;
+extern EFI_GUID gEfiShellPkgTokenSpaceGuid;
#endif
diff --git a/ShellPkg/Include/Guid/ShellVariableGuid.h b/ShellPkg/Include/Guid/ShellVariableGuid.h index b26865f305..d6a03b5c5d 100644 --- a/ShellPkg/Include/Guid/ShellVariableGuid.h +++ b/ShellPkg/Include/Guid/ShellVariableGuid.h @@ -14,6 +14,6 @@ 0x158def5a, 0xf656, 0x419c, { 0xb0, 0x27, 0x7a, 0x31, 0x92, 0xc0, 0x79, 0xd2 } \
}
-extern EFI_GUID gShellVariableGuid;
+extern EFI_GUID gShellVariableGuid;
#endif
diff --git a/ShellPkg/Include/Library/AcpiViewCommandLib.h b/ShellPkg/Include/Library/AcpiViewCommandLib.h index 11cf96c6e0..7309cb7a1a 100644 --- a/ShellPkg/Include/Library/AcpiViewCommandLib.h +++ b/ShellPkg/Include/Library/AcpiViewCommandLib.h @@ -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
);
diff --git a/ShellPkg/Include/Library/BcfgCommandLib.h b/ShellPkg/Include/Library/BcfgCommandLib.h index c10ee0d29e..ec5579ce61 100644 --- a/ShellPkg/Include/Library/BcfgCommandLib.h +++ b/ShellPkg/Include/Library/BcfgCommandLib.h @@ -43,4 +43,3 @@ BcfgLibraryUnregisterBcfgCommand ( );
#endif
-
diff --git a/ShellPkg/Include/Library/HandleParsingLib.h b/ShellPkg/Include/Library/HandleParsingLib.h index ea16b855b6..8193be94a4 100644 --- a/ShellPkg/Include/Library/HandleParsingLib.h +++ b/ShellPkg/Include/Library/HandleParsingLib.h @@ -26,10 +26,10 @@ **/
EFI_STATUS
EFIAPI
-AddNewGuidNameMapping(
- IN CONST EFI_GUID *Guid,
- IN CONST CHAR16 *TheName,
- IN CONST CHAR8 *Lang OPTIONAL
+AddNewGuidNameMapping (
+ IN CONST EFI_GUID *Guid,
+ IN CONST CHAR16 *TheName,
+ IN CONST CHAR8 *Lang OPTIONAL
);
/**
@@ -43,11 +43,11 @@ AddNewGuidNameMapping( @return The pointer to a string of the name. The caller
is responsible to free this memory.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-GetStringNameFromGuid(
- IN CONST EFI_GUID *Guid,
- IN CONST CHAR8 *Lang OPTIONAL
+GetStringNameFromGuid (
+ IN CONST EFI_GUID *Guid,
+ IN CONST CHAR8 *Lang OPTIONAL
);
/**
@@ -63,10 +63,10 @@ GetStringNameFromGuid( **/
EFI_STATUS
EFIAPI
-GetGuidFromStringName(
- IN CONST CHAR16 *Name,
- IN CONST CHAR8 *Lang OPTIONAL,
- OUT EFI_GUID **Guid
+GetGuidFromStringName (
+ IN CONST CHAR16 *Name,
+ IN CONST CHAR8 *Lang OPTIONAL,
+ OUT EFI_GUID **Guid
);
/**
@@ -85,12 +85,12 @@ GetGuidFromStringName( @return The pointer to string.
@retval NULL An error was encountered.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-GetProtocolInformationDump(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST EFI_GUID *Guid,
- IN CONST BOOLEAN Verbose
+GetProtocolInformationDump (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST EFI_GUID *Guid,
+ IN CONST BOOLEAN Verbose
);
/**
@@ -105,11 +105,11 @@ 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(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST CHAR8 *Language
+GetStringNameFromHandle (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST CHAR8 *Language
);
/**
@@ -133,19 +133,19 @@ GetBestLanguageForDriver ( IN BOOLEAN Iso639Language
);
-#define HR_UNKNOWN 0
-#define HR_IMAGE_HANDLE BIT1
-#define HR_DRIVER_BINDING_HANDLE BIT2 // has driver binding
-#define HR_DEVICE_DRIVER BIT3 // device driver (hybrid?)
-#define HR_BUS_DRIVER BIT4 // a bus driver (hybrid?)
-#define HR_DRIVER_CONFIGURATION_HANDLE BIT5
-#define HR_DRIVER_DIAGNOSTICS_HANDLE BIT6
-#define HR_COMPONENT_NAME_HANDLE BIT7
-#define HR_DEVICE_HANDLE BIT8
-#define HR_PARENT_HANDLE BIT9
-#define HR_CONTROLLER_HANDLE BIT10
-#define HR_CHILD_HANDLE BIT11
-#define HR_VALID_MASK (BIT1|BIT2|BIT3|BIT4|BIT5|BIT6|BIT7|BIT8|BIT9|BIT10|BIT11)
+#define HR_UNKNOWN 0
+#define HR_IMAGE_HANDLE BIT1
+#define HR_DRIVER_BINDING_HANDLE BIT2 // has driver binding
+#define HR_DEVICE_DRIVER BIT3 // device driver (hybrid?)
+#define HR_BUS_DRIVER BIT4 // a bus driver (hybrid?)
+#define HR_DRIVER_CONFIGURATION_HANDLE BIT5
+#define HR_DRIVER_DIAGNOSTICS_HANDLE BIT6
+#define HR_COMPONENT_NAME_HANDLE BIT7
+#define HR_DEVICE_HANDLE BIT8
+#define HR_PARENT_HANDLE BIT9
+#define HR_CONTROLLER_HANDLE BIT10
+#define HR_CHILD_HANDLE BIT11
+#define HR_VALID_MASK (BIT1|BIT2|BIT3|BIT4|BIT5|BIT6|BIT7|BIT8|BIT9|BIT10|BIT11)
/**
Gets all the related EFI_HANDLEs based on the mask supplied.
@@ -177,11 +177,11 @@ GetBestLanguageForDriver ( EFI_STATUS
EFIAPI
ParseHandleDatabaseByRelationship (
- IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
- IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
- IN CONST UINTN Mask,
- IN UINTN *MatchingHandleCount,
- OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+ IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
+ IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
+ IN CONST UINTN Mask,
+ IN UINTN *MatchingHandleCount,
+ OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
);
/**
@@ -213,11 +213,11 @@ ParseHandleDatabaseByRelationship ( EFI_STATUS
EFIAPI
ParseHandleDatabaseByRelationshipWithType (
- IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
- IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
- IN UINTN *HandleCount,
- OUT EFI_HANDLE **HandleBuffer,
- OUT UINTN **HandleType
+ IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
+ IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
+ IN UINTN *HandleCount,
+ OUT EFI_HANDLE **HandleBuffer,
+ OUT UINTN **HandleType
);
/**
@@ -290,10 +290,10 @@ ParseHandleDatabaseByRelationshipWithType ( **/
EFI_STATUS
EFIAPI
-ParseHandleDatabaseForChildDevices(
- IN CONST EFI_HANDLE DriverHandle,
- IN UINTN *MatchingHandleCount,
- OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+ParseHandleDatabaseForChildDevices (
+ IN CONST EFI_HANDLE DriverHandle,
+ IN UINTN *MatchingHandleCount,
+ OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
);
/**
@@ -309,13 +309,12 @@ ParseHandleDatabaseForChildDevices( **/
EFI_STATUS
EFIAPI
-ParseHandleDatabaseForChildControllers(
- IN CONST EFI_HANDLE ControllerHandle,
- OUT UINTN *MatchingHandleCount,
- OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+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,8 +328,8 @@ ParseHandleDatabaseForChildControllers( **/
UINTN
EFIAPI
-ConvertHandleToHandleIndex(
- IN CONST EFI_HANDLE TheHandle
+ConvertHandleToHandleIndex (
+ IN CONST EFI_HANDLE TheHandle
);
/**
@@ -344,8 +343,8 @@ ConvertHandleToHandleIndex( **/
EFI_HANDLE
EFIAPI
-ConvertHandleIndexToHandle(
- IN CONST UINTN TheIndex
+ConvertHandleIndexToHandle (
+ IN CONST UINTN TheIndex
);
/**
@@ -359,10 +358,10 @@ 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
+ 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
+ IN CONST EFI_GUID **ProtocolGuids
);
-
/**
Return all supported GUIDs.
@@ -397,8 +395,8 @@ GetHandleListByProtocolList ( EFI_STATUS
EFIAPI
GetAllMappingGuids (
- OUT EFI_GUID *Guids,
- IN OUT UINTN *Count
+ OUT EFI_GUID *Guids,
+ IN OUT UINTN *Count
);
#endif // __HANDLE_PARSING_LIB__
diff --git a/ShellPkg/Include/Library/ShellCEntryLib.h b/ShellPkg/Include/Library/ShellCEntryLib.h index f242b25600..ced72036d2 100644 --- a/ShellPkg/Include/Library/ShellCEntryLib.h +++ b/ShellPkg/Include/Library/ShellCEntryLib.h @@ -26,9 +26,8 @@ INTN
EFIAPI
ShellAppMain (
- IN UINTN Argc,
- IN CHAR16 **Argv
+ IN UINTN Argc,
+ IN CHAR16 **Argv
);
#endif
-
diff --git a/ShellPkg/Include/Library/ShellCommandLib.h b/ShellPkg/Include/Library/ShellCommandLib.h index bc1afed5e7..7a97b203f1 100644 --- a/ShellPkg/Include/Library/ShellCommandLib.h +++ b/ShellPkg/Include/Library/ShellCommandLib.h @@ -26,23 +26,23 @@ //
// The extern global protocol poionters.
//
-extern EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation;
-extern CONST CHAR16* SupportLevel[];
+extern EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation;
+extern CONST CHAR16 *SupportLevel[];
//
// The map list objects.
//
typedef struct {
- LIST_ENTRY Link;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- CHAR16 *MapName;
- CHAR16 *CurrentDirectoryPath;
- UINT64 Flags;
+ LIST_ENTRY Link;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ CHAR16 *MapName;
+ CHAR16 *CurrentDirectoryPath;
+ UINT64 Flags;
} SHELL_MAP_LIST;
/// List of Mappings - DeviceName and Drive Letter(ism).
-extern SHELL_MAP_LIST gShellMapList;
+extern SHELL_MAP_LIST gShellMapList;
/// Pointer to node of current directory in the mMapList.
-extern SHELL_MAP_LIST *gShellCurMapping;
+extern SHELL_MAP_LIST *gShellCurMapping;
/**
Returns the help MAN fileName for a given shell command.
@@ -130,14 +130,14 @@ SHELL_STATUS RETURN_STATUS
EFIAPI
ShellCommandRegisterCommandName (
- IN CONST CHAR16 *CommandString,
- IN SHELL_RUN_COMMAND CommandHandler,
- IN SHELL_GET_MAN_FILENAME GetManFileName,
- IN UINT32 ShellMinSupportLevel,
- IN CONST CHAR16 *ProfileName,
- IN CONST BOOLEAN CanAffectLE,
- IN CONST EFI_HII_HANDLE HiiHandle,
- IN CONST EFI_STRING_ID ManFormatHelp
+ IN CONST CHAR16 *CommandString,
+ IN SHELL_RUN_COMMAND CommandHandler,
+ IN SHELL_GET_MAN_FILENAME GetManFileName,
+ IN UINT32 ShellMinSupportLevel,
+ IN CONST CHAR16 *ProfileName,
+ IN CONST BOOLEAN CanAffectLE,
+ IN CONST EFI_HII_HANDLE HiiHandle,
+ IN CONST EFI_STRING_ID ManFormatHelp
);
/**
@@ -167,9 +167,9 @@ ShellCommandRegisterCommandName ( RETURN_STATUS
EFIAPI
ShellCommandRunCommandHandler (
- IN CONST CHAR16 *CommandString,
- IN OUT SHELL_STATUS *RetVal,
- IN OUT BOOLEAN *CanAffectLE OPTIONAL
+ IN CONST CHAR16 *CommandString,
+ IN OUT SHELL_STATUS *RetVal,
+ IN OUT BOOLEAN *CanAffectLE OPTIONAL
);
/**
@@ -185,16 +185,15 @@ ShellCommandRunCommandHandler ( @retval other The name of the MAN file.
@sa SHELL_GET_MAN_FILENAME
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameHandler (
- IN CONST CHAR16 *CommandString
+ IN CONST CHAR16 *CommandString
);
-
typedef struct {
- LIST_ENTRY Link;
- CHAR16 *CommandString;
+ LIST_ENTRY Link;
+ CHAR16 *CommandString;
} COMMAND_LIST;
/**
@@ -206,16 +205,16 @@ typedef struct { @return A linked list of all available shell commands.
**/
-CONST COMMAND_LIST*
+CONST COMMAND_LIST *
EFIAPI
ShellCommandGetCommandList (
- IN CONST BOOLEAN Sort
+ IN CONST BOOLEAN Sort
);
typedef struct {
- LIST_ENTRY Link;
- CHAR16 *CommandString;
- CHAR16 *Alias;
+ LIST_ENTRY Link;
+ CHAR16 *CommandString;
+ CHAR16 *Alias;
} ALIAS_LIST;
/**
@@ -234,8 +233,8 @@ typedef struct { RETURN_STATUS
EFIAPI
ShellCommandRegisterAlias (
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Alias
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias
);
/**
@@ -245,7 +244,7 @@ ShellCommandRegisterAlias ( @return A linked list of all requested shell aliases.
**/
-CONST ALIAS_LIST*
+CONST ALIAS_LIST *
EFIAPI
ShellCommandGetInitAliasList (
VOID
@@ -262,7 +261,7 @@ ShellCommandGetInitAliasList ( BOOLEAN
EFIAPI
ShellCommandIsOnAliasList (
- IN CONST CHAR16 *Alias
+ IN CONST CHAR16 *Alias
);
/**
@@ -276,7 +275,7 @@ ShellCommandIsOnAliasList ( BOOLEAN
EFIAPI
ShellCommandIsCommandOnList (
- IN CONST CHAR16 *CommandString
+ IN CONST CHAR16 *CommandString
);
/**
@@ -287,10 +286,10 @@ 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
+ IN CONST CHAR16 *CommandString
);
/**
@@ -324,11 +323,9 @@ ShellCommandGetEchoState ( VOID
EFIAPI
ShellCommandSetEchoState (
- IN BOOLEAN State
+ IN BOOLEAN State
);
-
-
/**
Indicate that the current shell or script should exit.
@@ -338,8 +335,8 @@ ShellCommandSetEchoState ( VOID
EFIAPI
ShellCommandRegisterExit (
- IN BOOLEAN ScriptOnly,
- IN CONST UINT64 ErrorCode
+ IN BOOLEAN ScriptOnly,
+ IN CONST UINT64 ErrorCode
);
/**
@@ -380,20 +377,20 @@ ShellCommandGetScriptExit ( );
typedef struct {
- LIST_ENTRY Link; ///< List enumerator items.
- UINTN Line; ///< What line of the script file this was on.
- CHAR16 *Cl; ///< The original command line.
- VOID *Data; ///< The data structure format dependant upon Command. (not always used)
- BOOLEAN Reset; ///< Reset the command (it must be treated like a initial run (but it may have data already))
+ LIST_ENTRY Link; ///< List enumerator items.
+ UINTN Line; ///< What line of the script file this was on.
+ CHAR16 *Cl; ///< The original command line.
+ VOID *Data; ///< The data structure format dependant upon Command. (not always used)
+ BOOLEAN Reset; ///< Reset the command (it must be treated like a initial run (but it may have data already))
} SCRIPT_COMMAND_LIST;
typedef struct {
- CHAR16 *ScriptName; ///< The filename of this script.
- CHAR16 **Argv; ///< The parmameters to the script file.
- UINTN Argc; ///< The count of parameters.
- LIST_ENTRY CommandList; ///< The script converted to a list of commands (SCRIPT_COMMAND_LIST objects).
- SCRIPT_COMMAND_LIST *CurrentCommand; ///< The command currently being operated. If !=NULL must be a member of CommandList.
- LIST_ENTRY SubstList; ///< A list of current script loop alias' (ALIAS_LIST objects) (Used for the for %-based replacement).
+ CHAR16 *ScriptName; ///< The filename of this script.
+ CHAR16 **Argv; ///< The parmameters to the script file.
+ UINTN Argc; ///< The count of parameters.
+ LIST_ENTRY CommandList; ///< The script converted to a list of commands (SCRIPT_COMMAND_LIST objects).
+ SCRIPT_COMMAND_LIST *CurrentCommand; ///< The command currently being operated. If !=NULL must be a member of CommandList.
+ LIST_ENTRY SubstList; ///< A list of current script loop alias' (ALIAS_LIST objects) (Used for the for %-based replacement).
} SCRIPT_FILE;
/**
@@ -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,10 +416,10 @@ 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
+ IN SCRIPT_FILE *Script OPTIONAL
);
/**
@@ -433,7 +430,7 @@ ShellCommandSetNewScript ( VOID
EFIAPI
DeleteScriptFileStruct (
- IN SCRIPT_FILE *Script
+ IN SCRIPT_FILE *Script
);
/**
@@ -466,10 +463,10 @@ typedef enum { @retval NULL a memory allocation failed.
@return a new map name string
**/
-CHAR16*
+CHAR16 *
EFIAPI
-ShellCommandCreateNewMappingName(
- IN CONST SHELL_MAPPING_TYPE Type
+ShellCommandCreateNewMappingName (
+ IN CONST SHELL_MAPPING_TYPE Type
);
/**
@@ -482,7 +479,7 @@ ShellCommandCreateNewMappingName( EFI_STATUS
EFIAPI
ShellCommandConsistMappingInitialize (
- EFI_DEVICE_PATH_PROTOCOL ***Table
+ EFI_DEVICE_PATH_PROTOCOL ***Table
);
/**
@@ -497,7 +494,7 @@ ShellCommandConsistMappingInitialize ( EFI_STATUS
EFIAPI
ShellCommandConsistMappingUnInitialize (
- EFI_DEVICE_PATH_PROTOCOL **Table
+ EFI_DEVICE_PATH_PROTOCOL **Table
);
/**
@@ -513,11 +510,11 @@ 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,
- IN EFI_DEVICE_PATH_PROTOCOL **Table
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN EFI_DEVICE_PATH_PROTOCOL **Table
);
/**
@@ -528,10 +525,10 @@ ShellCommandConsistMappingGenMappingName ( @return the node on the list.
**/
-SHELL_MAP_LIST*
+SHELL_MAP_LIST *
EFIAPI
ShellCommandFindMapItem (
- IN CONST CHAR16 *MapKey
+ IN CONST CHAR16 *MapKey
);
/**
@@ -553,11 +550,11 @@ ShellCommandFindMapItem ( **/
EFI_STATUS
EFIAPI
-ShellCommandAddMapItemAndUpdatePath(
- IN CONST CHAR16 *Name,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST UINT64 Flags,
- IN CONST BOOLEAN Path
+ShellCommandAddMapItemAndUpdatePath (
+ IN CONST CHAR16 *Name,
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CONST UINT64 Flags,
+ IN CONST BOOLEAN Path
);
/**
@@ -574,7 +571,7 @@ ShellCommandAddMapItemAndUpdatePath( **/
EFI_STATUS
EFIAPI
-ShellCommandCreateInitialMappingsAndPaths(
+ShellCommandCreateInitialMappingsAndPaths (
VOID
);
@@ -596,10 +593,10 @@ ShellCommandUpdateMapping ( @return a EFI_FILE_PROTOCOL* representing the same file.
**/
-EFI_FILE_PROTOCOL*
+EFI_FILE_PROTOCOL *
EFIAPI
-ConvertShellHandleToEfiFileProtocol(
- IN CONST SHELL_FILE_HANDLE Handle
+ConvertShellHandleToEfiFileProtocol (
+ IN CONST SHELL_FILE_HANDLE Handle
);
/**
@@ -612,8 +609,8 @@ ConvertShellHandleToEfiFileProtocol( **/
BOOLEAN
EFIAPI
-ShellFileHandleRemove(
- IN CONST SHELL_FILE_HANDLE Handle
+ShellFileHandleRemove (
+ IN CONST SHELL_FILE_HANDLE Handle
);
/**
@@ -626,9 +623,9 @@ ShellFileHandleRemove( **/
SHELL_FILE_HANDLE
EFIAPI
-ConvertEfiFileProtocolToShellHandle(
- IN CONST EFI_FILE_PROTOCOL *Handle,
- IN CONST CHAR16 *Path
+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(
- IN CONST SHELL_FILE_HANDLE Handle
+ShellFileHandleGetPath (
+ IN CONST SHELL_FILE_HANDLE Handle
);
-
/**
Function to determine if a SHELL_FILE_HANDLE is at the end of the file.
@@ -659,8 +655,8 @@ ShellFileHandleGetPath( **/
BOOLEAN
EFIAPI
-ShellFileHandleEof(
- IN SHELL_FILE_HANDLE Handle
+ShellFileHandleEof (
+ IN SHELL_FILE_HANDLE Handle
);
typedef struct {
@@ -676,7 +672,7 @@ typedef struct { VOID
EFIAPI
FreeBufferList (
- IN BUFFER_LIST *List
+ IN BUFFER_LIST *List
);
/**
@@ -690,10 +686,10 @@ FreeBufferList ( VOID
EFIAPI
DumpHex (
- IN UINTN Indent,
- IN UINTN Offset,
- IN UINTN DataSize,
- IN VOID *UserData
+ IN UINTN Indent,
+ IN UINTN Offset,
+ IN UINTN DataSize,
+ IN VOID *UserData
);
/**
@@ -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,
@@ -791,8 +787,9 @@ typedef enum { EFI_STATUS
EFIAPI
ShellSortFileList (
- IN OUT EFI_SHELL_FILE_INFO **FileList,
- OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL,
- IN SHELL_SORT_FILE_LIST Order
+ IN OUT EFI_SHELL_FILE_INFO **FileList,
+ OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL,
+ IN SHELL_SORT_FILE_LIST Order
);
+
#endif //_SHELL_COMMAND_LIB_
diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h index ed9b8f9105..10cf7f4fef 100644 --- a/ShellPkg/Include/Library/ShellLib.h +++ b/ShellPkg/Include/Library/ShellLib.h @@ -27,8 +27,8 @@ } \
} while(FALSE)
-extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
-extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
+extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
+extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
/**
Return a clean, fully-qualified version of an input path. If the return value
@@ -58,10 +58,10 @@ extern EFI_SHELL_PROTOCOL *gEfiShellProtocol; Path. The caller must free this memory when it is no
longer needed.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-FullyQualifyPath(
- IN CONST CHAR16 *Path
+FullyQualifyPath (
+ IN CONST CHAR16 *Path
);
/**
@@ -78,10 +78,10 @@ FullyQualifyPath( @return The information about the file.
**/
-EFI_FILE_INFO*
+EFI_FILE_INFO *
EFIAPI
ShellGetFileInfo (
- IN SHELL_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
);
/**
@@ -106,8 +106,8 @@ ShellGetFileInfo ( EFI_STATUS
EFIAPI
ShellSetFileInfo (
- IN SHELL_FILE_HANDLE FileHandle,
- IN EFI_FILE_INFO *FileInfo
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN EFI_FILE_INFO *FileInfo
);
/**
@@ -141,11 +141,11 @@ ShellSetFileInfo ( **/
EFI_STATUS
EFIAPI
-ShellOpenFileByDevicePath(
- IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
- OUT SHELL_FILE_HANDLE *FileHandle,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
+ShellOpenFileByDevicePath (
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
+ OUT SHELL_FILE_HANDLE *FileHandle,
+ IN UINT64 OpenMode,
+ IN UINT64 Attributes
);
/**
@@ -179,11 +179,11 @@ ShellOpenFileByDevicePath( **/
EFI_STATUS
EFIAPI
-ShellOpenFileByName(
- IN CONST CHAR16 *FileName,
- OUT SHELL_FILE_HANDLE *FileHandle,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
+ShellOpenFileByName (
+ IN CONST CHAR16 *FileName,
+ OUT SHELL_FILE_HANDLE *FileHandle,
+ IN UINT64 OpenMode,
+ IN UINT64 Attributes
);
/**
@@ -215,9 +215,9 @@ ShellOpenFileByName( **/
EFI_STATUS
EFIAPI
-ShellCreateDirectory(
- IN CONST CHAR16 *DirectoryName,
- OUT SHELL_FILE_HANDLE *FileHandle
+ShellCreateDirectory (
+ IN CONST CHAR16 *DirectoryName,
+ OUT SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -251,10 +251,10 @@ ShellCreateDirectory( **/
EFI_STATUS
EFIAPI
-ShellReadFile(
- IN SHELL_FILE_HANDLE FileHandle,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
+ShellReadFile (
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN OUT UINTN *ReadSize,
+ OUT VOID *Buffer
);
/**
@@ -285,10 +285,10 @@ ShellReadFile( **/
EFI_STATUS
EFIAPI
-ShellWriteFile(
- IN SHELL_FILE_HANDLE FileHandle,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+ShellWriteFile (
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
);
/**
@@ -306,7 +306,7 @@ ShellWriteFile( EFI_STATUS
EFIAPI
ShellCloseFile (
- IN SHELL_FILE_HANDLE *FileHandle
+ IN SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -326,7 +326,7 @@ ShellCloseFile ( EFI_STATUS
EFIAPI
ShellDeleteFile (
- IN SHELL_FILE_HANDLE *FileHandle
+ IN SHELL_FILE_HANDLE *FileHandle
);
/**
@@ -374,8 +374,8 @@ ShellSetFilePosition ( EFI_STATUS
EFIAPI
ShellGetFilePosition (
- IN SHELL_FILE_HANDLE FileHandle,
- OUT UINT64 *Position
+ IN SHELL_FILE_HANDLE FileHandle,
+ OUT UINT64 *Position
);
/**
@@ -395,7 +395,7 @@ ShellGetFilePosition ( EFI_STATUS
EFIAPI
ShellFlushFile (
- IN SHELL_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
);
/** Retrieve first entry from a directory.
@@ -425,8 +425,8 @@ ShellFlushFile ( EFI_STATUS
EFIAPI
ShellFindFirstFile (
- IN SHELL_FILE_HANDLE DirHandle,
- OUT EFI_FILE_INFO **Buffer
+ IN SHELL_FILE_HANDLE DirHandle,
+ OUT EFI_FILE_INFO **Buffer
);
/** Retrieve next entries from a directory.
@@ -451,10 +451,10 @@ ShellFindFirstFile ( **/
EFI_STATUS
EFIAPI
-ShellFindNextFile(
- IN SHELL_FILE_HANDLE DirHandle,
- IN OUT EFI_FILE_INFO *Buffer,
- IN OUT BOOLEAN *NoFile
+ShellFindNextFile (
+ IN SHELL_FILE_HANDLE DirHandle,
+ IN OUT EFI_FILE_INFO *Buffer,
+ IN OUT BOOLEAN *NoFile
);
/**
@@ -472,8 +472,8 @@ ShellFindNextFile( EFI_STATUS
EFIAPI
ShellGetFileSize (
- IN SHELL_FILE_HANDLE FileHandle,
- OUT UINT64 *Size
+ IN SHELL_FILE_HANDLE FileHandle,
+ OUT UINT64 *Size
);
/**
@@ -486,7 +486,7 @@ ShellGetFileSize ( **/
BOOLEAN
EFIAPI
-ShellGetExecutionBreakFlag(
+ShellGetExecutionBreakFlag (
VOID
);
@@ -501,10 +501,10 @@ 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
+ IN CONST CHAR16 *EnvKey
);
/**
@@ -530,9 +530,9 @@ ShellGetEnvironmentVariable ( EFI_STATUS
EFIAPI
ShellSetEnvironmentVariable (
- IN CONST CHAR16 *EnvKey,
- IN CONST CHAR16 *EnvVal,
- IN BOOLEAN Volatile
+ IN CONST CHAR16 *EnvKey,
+ IN CONST CHAR16 *EnvVal,
+ IN BOOLEAN Volatile
);
/**
@@ -568,11 +568,11 @@ ShellSetEnvironmentVariable ( EFI_STATUS
EFIAPI
ShellExecute (
- IN EFI_HANDLE *ParentHandle,
- IN CHAR16 *CommandLine,
- IN BOOLEAN Output,
- IN CHAR16 **EnvironmentVariables,
- OUT EFI_STATUS *Status
+ IN EFI_HANDLE *ParentHandle,
+ IN CHAR16 *CommandLine,
+ IN BOOLEAN Output,
+ IN CHAR16 **EnvironmentVariables,
+ OUT EFI_STATUS *Status
);
/**
@@ -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
);
/**
@@ -606,7 +606,7 @@ ShellGetCurrentDir ( VOID
EFIAPI
ShellSetPageBreakMode (
- IN BOOLEAN CurrentState
+ IN BOOLEAN CurrentState
);
/**
@@ -635,9 +635,9 @@ ShellSetPageBreakMode ( EFI_STATUS
EFIAPI
ShellOpenFileMetaArg (
- IN CHAR16 *Arg,
- IN UINT64 OpenMode,
- IN OUT EFI_SHELL_FILE_INFO **ListHead
+ IN CHAR16 *Arg,
+ IN UINT64 OpenMode,
+ IN OUT EFI_SHELL_FILE_INFO **ListHead
);
/**
@@ -651,7 +651,7 @@ ShellOpenFileMetaArg ( EFI_STATUS
EFIAPI
ShellCloseFileMetaArg (
- IN OUT EFI_SHELL_FILE_INFO **ListHead
+ IN OUT EFI_SHELL_FILE_INFO **ListHead
);
/**
@@ -669,7 +669,7 @@ ShellCloseFileMetaArg ( CHAR16 *
EFIAPI
ShellFindFilePath (
- IN CONST CHAR16 *FileName
+ IN CONST CHAR16 *FileName
);
/**
@@ -691,12 +691,12 @@ ShellFindFilePath ( CHAR16 *
EFIAPI
ShellFindFilePathEx (
- IN CONST CHAR16 *FileName,
- IN CONST CHAR16 *FileExtension
+ IN CONST CHAR16 *FileName,
+ IN CONST CHAR16 *FileExtension
);
typedef enum {
- TypeFlag = 0, ///< A flag that is present or not present only (IE "-a").
+ TypeFlag = 0, ///< A flag that is present or not present only (IE "-a").
TypeValue, ///< A flag that has some data following it with a space (IE "-a 1").
TypePosition, ///< Some data that did not follow a parameter (IE "filename.txt").
TypeStart, ///< A flag that has variable value appended to the end (IE "-ad", "-afd", "-adf", etc...).
@@ -707,16 +707,15 @@ typedef enum { } SHELL_PARAM_TYPE;
typedef struct {
- CHAR16 *Name;
- SHELL_PARAM_TYPE Type;
+ CHAR16 *Name;
+ SHELL_PARAM_TYPE Type;
} SHELL_PARAM_ITEM;
-
/// Helper structure for no parameters (besides -? and -b)
-extern SHELL_PARAM_ITEM EmptyParamList[];
+extern SHELL_PARAM_ITEM EmptyParamList[];
/// Helper structure for -sfo only (besides -? and -b)
-extern SHELL_PARAM_ITEM SfoParamList[];
+extern SHELL_PARAM_ITEM SfoParamList[];
/**
Checks the command line arguments passed against the list of valid ones.
@@ -745,15 +744,15 @@ extern SHELL_PARAM_ITEM SfoParamList[]; EFI_STATUS
EFIAPI
ShellCommandLineParseEx (
- IN CONST SHELL_PARAM_ITEM *CheckList,
- OUT LIST_ENTRY **CheckPackage,
- OUT CHAR16 **ProblemParam OPTIONAL,
- IN BOOLEAN AutoPageBreak,
- IN BOOLEAN AlwaysAllowNumbers
+ IN CONST SHELL_PARAM_ITEM *CheckList,
+ OUT LIST_ENTRY **CheckPackage,
+ OUT CHAR16 **ProblemParam OPTIONAL,
+ IN BOOLEAN AutoPageBreak,
+ IN BOOLEAN AlwaysAllowNumbers
);
/// 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.
@@ -768,7 +767,7 @@ ShellCommandLineParseEx ( VOID
EFIAPI
ShellCommandLineFreeVarList (
- IN LIST_ENTRY *CheckPackage
+ IN LIST_ENTRY *CheckPackage
);
/**
@@ -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,11 +804,11 @@ 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,
- IN CHAR16 *KeyString
+ IN CONST LIST_ENTRY *CheckPackage,
+ IN CHAR16 *KeyString
);
/**
@@ -825,11 +824,11 @@ 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 UINTN Position
+ IN CONST LIST_ENTRY *CONST CheckPackage,
+ IN UINTN Position
);
/**
@@ -844,8 +843,8 @@ ShellCommandLineGetRawValue ( **/
UINTN
EFIAPI
-ShellCommandLineGetCount(
- IN CONST LIST_ENTRY *CheckPackage
+ShellCommandLineGetCount (
+ IN CONST LIST_ENTRY *CheckPackage
);
/**
@@ -865,8 +864,8 @@ ShellCommandLineGetCount( EFI_STATUS
EFIAPI
ShellCommandLineCheckDuplicate (
- IN CONST LIST_ENTRY *CheckPackage,
- OUT CHAR16 **Param
+ IN CONST LIST_ENTRY *CheckPackage,
+ OUT CHAR16 **Param
);
/**
@@ -919,10 +918,10 @@ ShellInitialize ( **/
EFI_STATUS
EFIAPI
-ShellPrintEx(
- IN INT32 Col OPTIONAL,
- IN INT32 Row OPTIONAL,
- IN CONST CHAR16 *Format,
+ShellPrintEx (
+ IN INT32 Col OPTIONAL,
+ IN INT32 Row OPTIONAL,
+ IN CONST CHAR16 *Format,
...
);
@@ -960,12 +959,12 @@ ShellPrintEx( **/
EFI_STATUS
EFIAPI
-ShellPrintHiiEx(
- IN INT32 Col OPTIONAL,
- IN INT32 Row OPTIONAL,
- IN CONST CHAR8 *Language OPTIONAL,
- IN CONST EFI_STRING_ID HiiFormatStringId,
- IN CONST EFI_HII_HANDLE HiiFormatHandle,
+ShellPrintHiiEx (
+ IN INT32 Col OPTIONAL,
+ IN INT32 Row OPTIONAL,
+ IN CONST CHAR8 *Language OPTIONAL,
+ IN CONST EFI_STRING_ID HiiFormatStringId,
+ IN CONST EFI_HII_HANDLE HiiFormatHandle,
...
);
@@ -982,8 +981,8 @@ ShellPrintHiiEx( **/
EFI_STATUS
EFIAPI
-ShellIsDirectory(
- IN CONST CHAR16 *DirName
+ShellIsDirectory (
+ IN CONST CHAR16 *DirName
);
/**
@@ -1001,8 +1000,8 @@ ShellIsDirectory( **/
EFI_STATUS
EFIAPI
-ShellIsFile(
- IN CONST CHAR16 *Name
+ShellIsFile (
+ IN CONST CHAR16 *Name
);
/**
@@ -1020,8 +1019,8 @@ ShellIsFile( **/
EFI_STATUS
EFIAPI
-ShellIsFileInPath(
- IN CONST CHAR16 *Name
+ShellIsFileInPath (
+ IN CONST CHAR16 *Name
);
/**
@@ -1038,8 +1037,8 @@ ShellIsFileInPath( **/
UINTN
EFIAPI
-ShellStrToUintn(
- IN CONST CHAR16 *String
+ShellStrToUintn (
+ IN CONST CHAR16 *String
);
/**
@@ -1055,8 +1054,8 @@ ShellStrToUintn( **/
UINTN
EFIAPI
-ShellHexStrToUintn(
- IN CONST CHAR16 *String
+ShellHexStrToUintn (
+ IN CONST CHAR16 *String
);
/**
@@ -1091,13 +1090,13 @@ ShellHexStrToUintn( @return The Destination after appending the Source.
**/
-CHAR16*
+CHAR16 *
EFIAPI
StrnCatGrow (
- IN OUT CHAR16 **Destination,
- IN OUT UINTN *CurrentSize,
- IN CONST CHAR16 *Source,
- IN UINTN Count
+ IN OUT CHAR16 **Destination,
+ IN OUT UINTN *CurrentSize,
+ IN CONST CHAR16 *Source,
+ IN UINTN Count
);
/**
@@ -1129,14 +1128,14 @@ StrnCatGrow ( **/
EFI_STATUS
EFIAPI
-ShellCopySearchAndReplace(
- IN CHAR16 CONST *SourceString,
- IN OUT CHAR16 *NewString,
- IN UINTN NewSize,
- IN CONST CHAR16 *FindTarget,
- IN CONST CHAR16 *ReplaceWith,
- IN CONST BOOLEAN SkipPreCarrot,
- IN CONST BOOLEAN ParameterReplacing
+ShellCopySearchAndReplace (
+ IN CHAR16 CONST *SourceString,
+ IN OUT CHAR16 *NewString,
+ IN UINTN NewSize,
+ IN CONST CHAR16 *FindTarget,
+ IN CONST CHAR16 *ReplaceWith,
+ IN CONST BOOLEAN SkipPreCarrot,
+ IN CONST BOOLEAN ParameterReplacing
);
/**
@@ -1156,7 +1155,7 @@ ShellCopySearchAndReplace( BOOLEAN
EFIAPI
ShellIsHexaDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
);
/**
@@ -1176,7 +1175,7 @@ ShellIsHexaDecimalDigitCharacter ( BOOLEAN
EFIAPI
ShellIsDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
);
///
@@ -1233,9 +1232,9 @@ typedef enum { EFI_STATUS
EFIAPI
ShellPromptForResponse (
- IN SHELL_PROMPT_REQUEST_TYPE Type,
- IN CHAR16 *Prompt OPTIONAL,
- IN OUT VOID **Response OPTIONAL
+ IN SHELL_PROMPT_REQUEST_TYPE Type,
+ IN CHAR16 *Prompt OPTIONAL,
+ IN OUT VOID **Response OPTIONAL
);
/**
@@ -1258,10 +1257,10 @@ ShellPromptForResponse ( EFI_STATUS
EFIAPI
ShellPromptForResponseHii (
- IN SHELL_PROMPT_REQUEST_TYPE Type,
- IN CONST EFI_STRING_ID HiiFormatStringId,
- IN CONST EFI_HII_HANDLE HiiFormatHandle,
- IN OUT VOID **Response
+ IN SHELL_PROMPT_REQUEST_TYPE Type,
+ IN CONST EFI_STRING_ID HiiFormatStringId,
+ IN CONST EFI_HII_HANDLE HiiFormatHandle,
+ IN OUT VOID **Response
);
/**
@@ -1301,9 +1300,9 @@ ShellIsHexOrDecimalNumber ( **/
EFI_STATUS
EFIAPI
-ShellConvertStringToUint64(
+ShellConvertStringToUint64 (
IN CONST CHAR16 *String,
- OUT UINT64 *Value,
+ OUT UINT64 *Value,
IN CONST BOOLEAN ForceHex,
IN CONST BOOLEAN StopAtSpace
);
@@ -1319,8 +1318,8 @@ ShellConvertStringToUint64( **/
EFI_STATUS
EFIAPI
-ShellFileExists(
- IN CONST CHAR16 *Name
+ShellFileExists (
+ IN CONST CHAR16 *Name
);
/**
@@ -1338,11 +1337,11 @@ ShellFileExists( @sa ShellFileHandleReadLine
**/
-CHAR16*
+CHAR16 *
EFIAPI
-ShellFileHandleReturnLine(
- IN SHELL_FILE_HANDLE Handle,
- IN OUT BOOLEAN *Ascii
+ShellFileHandleReturnLine (
+ IN SHELL_FILE_HANDLE Handle,
+ IN OUT BOOLEAN *Ascii
);
/**
@@ -1373,12 +1372,12 @@ ShellFileHandleReturnLine( **/
EFI_STATUS
EFIAPI
-ShellFileHandleReadLine(
- IN SHELL_FILE_HANDLE Handle,
- IN OUT CHAR16 *Buffer,
- IN OUT UINTN *Size,
- IN BOOLEAN Truncate,
- IN OUT BOOLEAN *Ascii
+ShellFileHandleReadLine (
+ IN SHELL_FILE_HANDLE Handle,
+ IN OUT CHAR16 *Buffer,
+ IN OUT UINTN *Size,
+ IN BOOLEAN Truncate,
+ IN OUT BOOLEAN *Ascii
);
/**
@@ -1406,8 +1405,8 @@ ShellFileHandleReadLine( **/
EFI_STATUS
EFIAPI
-ShellDeleteFileByName(
- IN CONST CHAR16 *FileName
+ShellDeleteFileByName (
+ IN CONST CHAR16 *FileName
);
/**
@@ -1424,9 +1423,9 @@ ShellDeleteFileByName( EFI_STATUS
EFIAPI
ShellPrintHelp (
- IN CONST CHAR16 *CommandToGetHelpOn,
- IN CONST CHAR16 *SectionToGetHelpOn,
- IN BOOLEAN PrintCommandText
+ IN CONST CHAR16 *CommandToGetHelpOn,
+ IN CONST CHAR16 *SectionToGetHelpOn,
+ IN BOOLEAN PrintCommandText
);
#endif // __SHELL_LIB__
diff --git a/ShellPkg/Include/Protocol/EfiShellEnvironment2.h b/ShellPkg/Include/Protocol/EfiShellEnvironment2.h index 433c522d26..8b7c86dc24 100644 --- a/ShellPkg/Include/Protocol/EfiShellEnvironment2.h +++ b/ShellPkg/Include/Protocol/EfiShellEnvironment2.h @@ -6,12 +6,11 @@ **/
-
#ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_
#define _SHELL_ENVIRONMENT_2_PROTOCOL_H_
-#define DEFAULT_INIT_ROW 1
-#define DEFAULT_AUTO_LF FALSE
+#define DEFAULT_INIT_ROW 1
+#define DEFAULT_AUTO_LF FALSE
/**
This function is a prototype for a function that dumps information on a protocol
@@ -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
);
@@ -70,20 +69,20 @@ EFI_STATUS Structure returned from functions that open multiple files.
**/
typedef struct {
- UINT32 Signature; ///< SHELL_FILE_ARG_SIGNATURE.
- LIST_ENTRY Link; ///< Linked list helper.
- EFI_STATUS Status; ///< File's status.
+ UINT32 Signature; ///< SHELL_FILE_ARG_SIGNATURE.
+ LIST_ENTRY Link; ///< Linked list helper.
+ EFI_STATUS Status; ///< File's status.
- EFI_FILE_HANDLE Parent; ///< What is the Parent file of this file.
- UINT64 OpenMode; ///< How was the file opened.
- CHAR16 *ParentName; ///< String representation of parent.
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; ///< DevicePath for Parent.
+ EFI_FILE_HANDLE Parent; ///< What is the Parent file of this file.
+ UINT64 OpenMode; ///< How was the file opened.
+ CHAR16 *ParentName; ///< String representation of parent.
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; ///< DevicePath for Parent.
- CHAR16 *FullName; ///< Path and file name for this file.
- CHAR16 *FileName; ///< File name for this file.
+ CHAR16 *FullName; ///< Path and file name for this file.
+ CHAR16 *FileName; ///< File name for this file.
- EFI_FILE_HANDLE Handle; ///< Handle to this file.
- EFI_FILE_INFO *Info; ///< Pointer to file info for this file.
+ EFI_FILE_HANDLE Handle; ///< Handle to this file.
+ EFI_FILE_INFO *Info; ///< Pointer to file info for this file.
} SHELL_FILE_ARG;
/// Signature for SHELL_FILE_ARG.
@@ -105,8 +104,8 @@ GUID for the shell environment2 extension (main GUID above). 0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
}
-#define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2.
-#define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2.
+#define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2.
+#define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2.
/**
Execute a command line.
@@ -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
);
@@ -590,43 +590,43 @@ UINTN Handle Enumerator structure.
**/
typedef struct {
- INIT_HANDLE_ENUMERATOR Init; ///< The pointer to INIT_HANDLE_ENUMERATOR function.
- NEXT_HANDLE Next; ///< The pointer to NEXT_HANDLE function.
- SKIP_HANDLE Skip; ///< The pointer to SKIP_HANDLE function.
- RESET_HANDLE_ENUMERATOR Reset; ///< The pointer to RESET_HANDLE_ENUMERATOR function.
- CLOSE_HANDLE_ENUMERATOR Close; ///< The pointer to CLOSE_HANDLE_ENUMERATOR function.
- GET_NUM GetNum; ///< The pointer to GET_NUM function.
+ INIT_HANDLE_ENUMERATOR Init; ///< The pointer to INIT_HANDLE_ENUMERATOR function.
+ NEXT_HANDLE Next; ///< The pointer to NEXT_HANDLE function.
+ SKIP_HANDLE Skip; ///< The pointer to SKIP_HANDLE function.
+ RESET_HANDLE_ENUMERATOR Reset; ///< The pointer to RESET_HANDLE_ENUMERATOR function.
+ CLOSE_HANDLE_ENUMERATOR Close; ///< The pointer to CLOSE_HANDLE_ENUMERATOR function.
+ GET_NUM GetNum; ///< The pointer to GET_NUM function.
} HANDLE_ENUMERATOR;
/**
Signature for the PROTOCOL_INFO structure.
**/
-#define PROTOCOL_INFO_SIGNATURE SIGNATURE_32 ('s', 'p', 'i', 'n')
+#define PROTOCOL_INFO_SIGNATURE SIGNATURE_32 ('s', 'p', 'i', 'n')
/**
PROTOCOL_INFO structure for protocol enumerator functions.
**/
typedef struct {
- UINTN Signature; ///< PROTOCOL_INFO_SIGNATURE.
- LIST_ENTRY Link; ///< Standard linked list helper member.
+ UINTN Signature; ///< PROTOCOL_INFO_SIGNATURE.
+ LIST_ENTRY Link; ///< Standard linked list helper member.
//
// The parsing info for the protocol.
//
- EFI_GUID ProtocolId; ///< The GUID for the protocol.
- CHAR16 *IdString; ///< The name of the protocol.
- SHELLENV_DUMP_PROTOCOL_INFO DumpToken; ///< The pointer to DumpToken function for the protocol.
- SHELLENV_DUMP_PROTOCOL_INFO DumpInfo; ///< The pointer to DumpInfo function for the protocol.
+ EFI_GUID ProtocolId; ///< The GUID for the protocol.
+ CHAR16 *IdString; ///< The name of the protocol.
+ SHELLENV_DUMP_PROTOCOL_INFO DumpToken; ///< The pointer to DumpToken function for the protocol.
+ SHELLENV_DUMP_PROTOCOL_INFO DumpInfo; ///< The pointer to DumpInfo function for the protocol.
//
// Patabase info on which handles are supporting this protocol.
//
- UINTN NoHandles; ///< The number of handles producing this protocol.
- EFI_HANDLE *Handles; ///< The array of handles.
-
+ 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
);
@@ -712,11 +711,11 @@ VOID Protocol enumerator structure of function pointers.
**/
typedef struct {
- INIT_PROTOCOL_INFO_ENUMERATOR Init; ///< The pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.
- NEXT_PROTOCOL_INFO Next; ///< The pointer to NEXT_PROTOCOL_INFO function.
- SKIP_PROTOCOL_INFO Skip; ///< The pointer to SKIP_PROTOCOL_INFO function.
- RESET_PROTOCOL_INFO_ENUMERATOR Reset; ///< The pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.
- CLOSE_PROTOCOL_INFO_ENUMERATOR Close; ///< The pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.
+ INIT_PROTOCOL_INFO_ENUMERATOR Init; ///< The pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.
+ NEXT_PROTOCOL_INFO Next; ///< The pointer to NEXT_PROTOCOL_INFO function.
+ SKIP_PROTOCOL_INFO Skip; ///< The pointer to SKIP_PROTOCOL_INFO function.
+ RESET_PROTOCOL_INFO_ENUMERATOR Reset; ///< The pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.
+ CLOSE_PROTOCOL_INFO_ENUMERATOR Close; ///< The pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.
} PROTOCOL_INFO_ENUMERATOR;
/**
@@ -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,
@@ -764,8 +763,8 @@ EFI_STATUS IN UINTN Indent
);
-#define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< The string for lowest version this shell supports.
-#define EFI_SHELL_ENHANCED_MODE_VER L"1.1.2" ///< The string for highest version this shell supports.
+#define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< The string for lowest version this shell supports.
+#define EFI_SHELL_ENHANCED_MODE_VER L"1.1.2" ///< The string for highest version this shell supports.
/**
This function gets the shell mode as stored in the shell environment
@@ -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,65 +904,65 @@ 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
);
/// EFI_SHELL_ENVIRONMENT2 protocol structure.
typedef struct {
- SHELLENV_EXECUTE Execute;
- SHELLENV_GET_ENV GetEnv;
- SHELLENV_GET_MAP GetMap;
- SHELLENV_ADD_CMD AddCmd;
- SHELLENV_ADD_PROT AddProt;
- SHELLENV_GET_PROT GetProt;
- SHELLENV_CUR_DIR CurDir;
- SHELLENV_FILE_META_ARG FileMetaArg;
- SHELLENV_FREE_FILE_LIST FreeFileList;
+ SHELLENV_EXECUTE Execute;
+ SHELLENV_GET_ENV GetEnv;
+ SHELLENV_GET_MAP GetMap;
+ SHELLENV_ADD_CMD AddCmd;
+ SHELLENV_ADD_PROT AddProt;
+ SHELLENV_GET_PROT GetProt;
+ SHELLENV_CUR_DIR CurDir;
+ SHELLENV_FILE_META_ARG FileMetaArg;
+ SHELLENV_FREE_FILE_LIST FreeFileList;
//
// The following services are only used by the shell itself.
//
- SHELLENV_NEW_SHELL NewShell;
- SHELLENV_BATCH_IS_ACTIVE BatchIsActive;
+ SHELLENV_NEW_SHELL NewShell;
+ SHELLENV_BATCH_IS_ACTIVE BatchIsActive;
- SHELLENV_FREE_RESOURCES FreeResources;
+ SHELLENV_FREE_RESOURCES FreeResources;
//
// GUID to differentiate ShellEnvironment2 from ShellEnvironment.
//
- EFI_GUID SESGuid;
+ EFI_GUID SESGuid;
//
// Major Version grows if shell environment interface has been changes.
//
- UINT32 MajorVersion;
- UINT32 MinorVersion;
- SHELLENV_ENABLE_PAGE_BREAK EnablePageBreak;
- SHELLENV_DISABLE_PAGE_BREAK DisablePageBreak;
- SHELLENV_GET_PAGE_BREAK GetPageBreak;
-
- SHELLENV_SET_KEY_FILTER SetKeyFilter;
- SHELLENV_GET_KEY_FILTER GetKeyFilter;
-
- SHELLENV_GET_EXECUTION_BREAK GetExecutionBreak;
- SHELLENV_INCREMENT_SHELL_NESTING_LEVEL IncrementShellNestingLevel;
- SHELLENV_DECREMENT_SHELL_NESTING_LEVEL DecrementShellNestingLevel;
- SHELLENV_IS_ROOT_SHELL IsRootShell;
-
- SHELLENV_CLOSE_CONSOLE_PROXY CloseConsoleProxy;
- HANDLE_ENUMERATOR HandleEnumerator;
- PROTOCOL_INFO_ENUMERATOR ProtocolInfoEnumerator;
- GET_DEVICE_NAME GetDeviceName;
- GET_SHELL_MODE GetShellMode;
- SHELLENV_NAME_TO_PATH NameToPath;
- SHELLENV_GET_FS_NAME GetFsName;
- SHELLENV_FILE_META_ARG_NO_WILDCARD FileMetaArgNoWildCard;
- SHELLENV_DEL_DUP_FILE DelDupFileArg;
- SHELLENV_GET_FS_DEVICE_PATH GetFsDevicePath;
+ UINT32 MajorVersion;
+ UINT32 MinorVersion;
+ SHELLENV_ENABLE_PAGE_BREAK EnablePageBreak;
+ SHELLENV_DISABLE_PAGE_BREAK DisablePageBreak;
+ SHELLENV_GET_PAGE_BREAK GetPageBreak;
+
+ SHELLENV_SET_KEY_FILTER SetKeyFilter;
+ SHELLENV_GET_KEY_FILTER GetKeyFilter;
+
+ SHELLENV_GET_EXECUTION_BREAK GetExecutionBreak;
+ SHELLENV_INCREMENT_SHELL_NESTING_LEVEL IncrementShellNestingLevel;
+ SHELLENV_DECREMENT_SHELL_NESTING_LEVEL DecrementShellNestingLevel;
+ SHELLENV_IS_ROOT_SHELL IsRootShell;
+
+ SHELLENV_CLOSE_CONSOLE_PROXY CloseConsoleProxy;
+ HANDLE_ENUMERATOR HandleEnumerator;
+ PROTOCOL_INFO_ENUMERATOR ProtocolInfoEnumerator;
+ GET_DEVICE_NAME GetDeviceName;
+ GET_SHELL_MODE GetShellMode;
+ SHELLENV_NAME_TO_PATH NameToPath;
+ SHELLENV_GET_FS_NAME GetFsName;
+ SHELLENV_FILE_META_ARG_NO_WILDCARD FileMetaArgNoWildCard;
+ SHELLENV_DEL_DUP_FILE DelDupFileArg;
+ SHELLENV_GET_FS_DEVICE_PATH GetFsDevicePath;
} EFI_SHELL_ENVIRONMENT2;
-extern EFI_GUID gEfiShellEnvironment2Guid;
-extern EFI_GUID gEfiShellEnvironment2ExtGuid;
+extern EFI_GUID gEfiShellEnvironment2Guid;
+extern EFI_GUID gEfiShellEnvironment2ExtGuid;
#endif // _SHELL_ENVIRONMENT_2_PROTOCOL_H_
diff --git a/ShellPkg/Include/Protocol/EfiShellInterface.h b/ShellPkg/Include/Protocol/EfiShellInterface.h index 8686f4767a..136e059097 100644 --- a/ShellPkg/Include/Protocol/EfiShellInterface.h +++ b/ShellPkg/Include/Protocol/EfiShellInterface.h @@ -40,7 +40,7 @@ typedef enum { /// Attributes for an argument.
///
typedef struct _EFI_SHELL_ARG_INFO {
- UINT32 Attributes;
+ UINT32 Attributes;
} EFI_SHELL_ARG_INFO;
///
@@ -50,39 +50,39 @@ typedef struct { ///
/// Handle back to original image handle & image information.
///
- EFI_HANDLE ImageHandle;
- EFI_LOADED_IMAGE_PROTOCOL *Info;
+ EFI_HANDLE ImageHandle;
+ EFI_LOADED_IMAGE_PROTOCOL *Info;
///
/// Parsed arg list converted more C-like format.
///
- CHAR16 **Argv;
- UINTN Argc;
+ CHAR16 **Argv;
+ UINTN Argc;
///
/// Storage for file redirection args after parsing.
///
- CHAR16 **RedirArgv;
- UINTN RedirArgc;
+ CHAR16 **RedirArgv;
+ UINTN RedirArgc;
///
/// A file style handle for console io.
///
- EFI_FILE_PROTOCOL *StdIn;
- EFI_FILE_PROTOCOL *StdOut;
- EFI_FILE_PROTOCOL *StdErr;
+ EFI_FILE_PROTOCOL *StdIn;
+ EFI_FILE_PROTOCOL *StdOut;
+ EFI_FILE_PROTOCOL *StdErr;
///
/// List of attributes for each argument.
///
- EFI_SHELL_ARG_INFO *ArgInfo;
+ EFI_SHELL_ARG_INFO *ArgInfo;
///
/// Whether we are echoing.
///
- BOOLEAN EchoOn;
+ BOOLEAN EchoOn;
} EFI_SHELL_INTERFACE;
-extern EFI_GUID gEfiShellInterfaceGuid;
+extern EFI_GUID gEfiShellInterfaceGuid;
#endif
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index be713688ac..aa0115bdd4 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -14,10 +14,14 @@ #include <PiDxe.h>
#include <Protocol/FirmwareVolume2.h>
-EFI_HII_HANDLE mHandleParsingHiiHandle = NULL;
-HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0};
-GUID_INFO_BLOCK *mGuidList;
-UINTN mGuidListCount;
+EFI_HII_HANDLE mHandleParsingHiiHandle = NULL;
+HANDLE_INDEX_LIST mHandleList = {
+ {
+ { NULL, NULL }, 0, 0
+ }, 0
+};
+GUID_INFO_BLOCK *mGuidList;
+UINTN mGuidListCount;
/**
Function to find the file name associated with a LoadedImageProtocol.
@@ -27,9 +31,9 @@ UINTN mGuidListCount; @retval A string representation of the file name associated
with LoadedImage, or NULL if no name can be found.
**/
-CHAR16*
+CHAR16 *
FindLoadedImageFileName (
- IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage
+ IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage
)
{
EFI_GUID *NameGuid;
@@ -43,7 +47,7 @@ FindLoadedImageFileName ( return NULL;
}
- NameGuid = EfiGetNameGuidFromFwVolDevicePathNode((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)LoadedImage->FilePath);
+ NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)LoadedImage->FilePath);
if (NameGuid == NULL) {
return NULL;
@@ -52,7 +56,7 @@ FindLoadedImageFileName ( //
// Get the FirmwareVolume2Protocol of the device handle that this image was loaded from.
//
- Status = gBS->HandleProtocol (LoadedImage->DeviceHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID**) &Fv);
+ Status = gBS->HandleProtocol (LoadedImage->DeviceHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);
//
// FirmwareVolume2Protocol is PI, and is not required to be available.
@@ -65,7 +69,7 @@ FindLoadedImageFileName ( // Read the user interface section of the image.
//
Buffer = NULL;
- Status = Fv->ReadSection(Fv, NameGuid, EFI_SECTION_USER_INTERFACE, 0, &Buffer, &BufferSize, &AuthenticationStatus);
+ Status = Fv->ReadSection (Fv, NameGuid, EFI_SECTION_USER_INTERFACE, 0, &Buffer, &BufferSize, &AuthenticationStatus);
if (EFI_ERROR (Status)) {
return NULL;
@@ -85,32 +89,49 @@ FindLoadedImageFileName ( @retval A string representation of the type allocated from BS Pool.
**/
-CHAR16*
+CHAR16 *
ConvertMemoryType (
- IN CONST EFI_MEMORY_TYPE Memory
+ IN CONST EFI_MEMORY_TYPE Memory
)
{
- CHAR16 *RetVal;
+ CHAR16 *RetVal;
+
RetVal = NULL;
switch (Memory) {
- case EfiReservedMemoryType: StrnCatGrow(&RetVal, NULL, L"EfiReservedMemoryType", 0); break;
- case EfiLoaderCode: StrnCatGrow(&RetVal, NULL, L"EfiLoaderCode", 0); break;
- case EfiLoaderData: StrnCatGrow(&RetVal, NULL, L"EfiLoaderData", 0); break;
- case EfiBootServicesCode: StrnCatGrow(&RetVal, NULL, L"EfiBootServicesCode", 0); break;
- case EfiBootServicesData: StrnCatGrow(&RetVal, NULL, L"EfiBootServicesData", 0); break;
- case EfiRuntimeServicesCode: StrnCatGrow(&RetVal, NULL, L"EfiRuntimeServicesCode", 0); break;
- case EfiRuntimeServicesData: StrnCatGrow(&RetVal, NULL, L"EfiRuntimeServicesData", 0); break;
- case EfiConventionalMemory: StrnCatGrow(&RetVal, NULL, L"EfiConventionalMemory", 0); break;
- case EfiUnusableMemory: StrnCatGrow(&RetVal, NULL, L"EfiUnusableMemory", 0); break;
- case EfiACPIReclaimMemory: StrnCatGrow(&RetVal, NULL, L"EfiACPIReclaimMemory", 0); break;
- case EfiACPIMemoryNVS: StrnCatGrow(&RetVal, NULL, L"EfiACPIMemoryNVS", 0); break;
- case EfiMemoryMappedIO: StrnCatGrow(&RetVal, NULL, L"EfiMemoryMappedIO", 0); break;
- case EfiMemoryMappedIOPortSpace: StrnCatGrow(&RetVal, NULL, L"EfiMemoryMappedIOPortSpace", 0); break;
- case EfiPalCode: StrnCatGrow(&RetVal, NULL, L"EfiPalCode", 0); break;
- case EfiMaxMemoryType: StrnCatGrow(&RetVal, NULL, L"EfiMaxMemoryType", 0); break;
- default: ASSERT(FALSE);
+ case EfiReservedMemoryType: StrnCatGrow (&RetVal, NULL, L"EfiReservedMemoryType", 0);
+ break;
+ case EfiLoaderCode: StrnCatGrow (&RetVal, NULL, L"EfiLoaderCode", 0);
+ break;
+ case EfiLoaderData: StrnCatGrow (&RetVal, NULL, L"EfiLoaderData", 0);
+ break;
+ case EfiBootServicesCode: StrnCatGrow (&RetVal, NULL, L"EfiBootServicesCode", 0);
+ break;
+ case EfiBootServicesData: StrnCatGrow (&RetVal, NULL, L"EfiBootServicesData", 0);
+ break;
+ case EfiRuntimeServicesCode: StrnCatGrow (&RetVal, NULL, L"EfiRuntimeServicesCode", 0);
+ break;
+ case EfiRuntimeServicesData: StrnCatGrow (&RetVal, NULL, L"EfiRuntimeServicesData", 0);
+ break;
+ case EfiConventionalMemory: StrnCatGrow (&RetVal, NULL, L"EfiConventionalMemory", 0);
+ break;
+ case EfiUnusableMemory: StrnCatGrow (&RetVal, NULL, L"EfiUnusableMemory", 0);
+ break;
+ case EfiACPIReclaimMemory: StrnCatGrow (&RetVal, NULL, L"EfiACPIReclaimMemory", 0);
+ break;
+ case EfiACPIMemoryNVS: StrnCatGrow (&RetVal, NULL, L"EfiACPIMemoryNVS", 0);
+ break;
+ case EfiMemoryMappedIO: StrnCatGrow (&RetVal, NULL, L"EfiMemoryMappedIO", 0);
+ break;
+ case EfiMemoryMappedIOPortSpace: StrnCatGrow (&RetVal, NULL, L"EfiMemoryMappedIOPortSpace", 0);
+ break;
+ case EfiPalCode: StrnCatGrow (&RetVal, NULL, L"EfiPalCode", 0);
+ break;
+ case EfiMaxMemoryType: StrnCatGrow (&RetVal, NULL, L"EfiMaxMemoryType", 0);
+ break;
+ default: ASSERT (FALSE);
}
+
return (RetVal);
}
@@ -121,22 +142,29 @@ ConvertMemoryType ( @retval A string representation of the type allocated from BS Pool.
**/
-CHAR16*
+CHAR16 *
ConvertPixelFormat (
- IN CONST EFI_GRAPHICS_PIXEL_FORMAT Fmt
+ IN CONST EFI_GRAPHICS_PIXEL_FORMAT Fmt
)
{
- CHAR16 *RetVal;
+ CHAR16 *RetVal;
+
RetVal = NULL;
switch (Fmt) {
- case PixelRedGreenBlueReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelRedGreenBlueReserved8BitPerColor", 0); break;
- case PixelBlueGreenRedReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelBlueGreenRedReserved8BitPerColor", 0); break;
- case PixelBitMask: StrnCatGrow(&RetVal, NULL, L"PixelBitMask", 0); break;
- case PixelBltOnly: StrnCatGrow(&RetVal, NULL, L"PixelBltOnly", 0); break;
- case PixelFormatMax: StrnCatGrow(&RetVal, NULL, L"PixelFormatMax", 0); break;
- default: ASSERT(FALSE);
+ case PixelRedGreenBlueReserved8BitPerColor: StrnCatGrow (&RetVal, NULL, L"PixelRedGreenBlueReserved8BitPerColor", 0);
+ break;
+ case PixelBlueGreenRedReserved8BitPerColor: StrnCatGrow (&RetVal, NULL, L"PixelBlueGreenRedReserved8BitPerColor", 0);
+ break;
+ case PixelBitMask: StrnCatGrow (&RetVal, NULL, L"PixelBitMask", 0);
+ break;
+ case PixelBltOnly: StrnCatGrow (&RetVal, NULL, L"PixelBltOnly", 0);
+ break;
+ case PixelFormatMax: StrnCatGrow (&RetVal, NULL, L"PixelFormatMax", 0);
+ break;
+ default: ASSERT (FALSE);
}
+
return (RetVal);
}
@@ -169,7 +197,9 @@ HandleParsingLibConstructor ( **/
VOID
-HandleParsingHiiInit (VOID)
+HandleParsingHiiInit (
+ VOID
+ )
{
if (mHandleParsingHiiHandle == NULL) {
mHandleParsingHiiHandle = HiiAddPackages (&gHandleParsingHiiGuid, gImageHandle, UefiHandleParsingLibStrings, NULL);
@@ -192,16 +222,17 @@ HandleParsingLibDestructor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- UINTN LoopCount;
+ UINTN LoopCount;
for (LoopCount = 0; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++) {
- SHELL_FREE_NON_NULL(mGuidList[LoopCount].GuidId);
+ SHELL_FREE_NON_NULL (mGuidList[LoopCount].GuidId);
}
- SHELL_FREE_NON_NULL(mGuidList);
+ SHELL_FREE_NON_NULL (mGuidList);
if (mHandleParsingHiiHandle != NULL) {
- HiiRemovePackages(mHandleParsingHiiHandle);
+ HiiRemovePackages (mHandleParsingHiiHandle);
}
+
return (EFI_SUCCESS);
}
@@ -215,69 +246,71 @@ HandleParsingLibDestructor ( @retval A poitner to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-LoadedImageProtocolDumpInformation(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+LoadedImageProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_STATUS Status;
- CHAR16 *RetVal;
- CHAR16 *Temp;
- CHAR16 *FileName;
- CHAR8 *PdbFileName;
- CHAR16 *FilePath;
- CHAR16 *CodeType;
- CHAR16 *DataType;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
+ CHAR16 *Temp;
+ CHAR16 *FileName;
+ CHAR8 *PdbFileName;
+ CHAR16 *FilePath;
+ CHAR16 *CodeType;
+ CHAR16 *DataType;
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**)&LoadedImage,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ TheHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
return NULL;
}
- FileName = FindLoadedImageFileName(LoadedImage);
- FilePath = ConvertDevicePathToText(LoadedImage->FilePath, TRUE, TRUE);
+ FileName = FindLoadedImageFileName (LoadedImage);
+ FilePath = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE);
if (!Verbose) {
if (FileName == NULL) {
FileName = FilePath;
} else {
- SHELL_FREE_NON_NULL(FilePath);
+ SHELL_FREE_NON_NULL (FilePath);
}
+
return FileName;
}
- HandleParsingHiiInit();
+ HandleParsingHiiInit ();
RetVal = NULL;
if (FileName != NULL) {
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUMP_NAME), NULL);
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_LI_DUMP_NAME), NULL);
if (Temp != NULL) {
- RetVal = CatSPrint(NULL, Temp, FileName);
+ RetVal = CatSPrint (NULL, Temp, FileName);
}
- SHELL_FREE_NON_NULL(Temp);
- SHELL_FREE_NON_NULL(FileName);
+ SHELL_FREE_NON_NULL (Temp);
+ SHELL_FREE_NON_NULL (FileName);
}
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUMP_MAIN), NULL);
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_LI_DUMP_MAIN), NULL);
if (Temp == NULL) {
return NULL;
}
+
PdbFileName = PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase);
- DataType = ConvertMemoryType(LoadedImage->ImageDataType);
- CodeType = ConvertMemoryType(LoadedImage->ImageCodeType);
+ DataType = ConvertMemoryType (LoadedImage->ImageDataType);
+ CodeType = ConvertMemoryType (LoadedImage->ImageCodeType);
- RetVal = CatSPrint(
+ RetVal = CatSPrint (
RetVal,
Temp,
LoadedImage->Revision,
@@ -295,11 +328,10 @@ LoadedImageProtocolDumpInformation( LoadedImage->Unload
);
-
- SHELL_FREE_NON_NULL(Temp);
- SHELL_FREE_NON_NULL(FilePath);
- SHELL_FREE_NON_NULL(CodeType);
- SHELL_FREE_NON_NULL(DataType);
+ SHELL_FREE_NON_NULL (Temp);
+ SHELL_FREE_NON_NULL (FilePath);
+ SHELL_FREE_NON_NULL (CodeType);
+ SHELL_FREE_NON_NULL (DataType);
return RetVal;
}
@@ -314,11 +346,11 @@ LoadedImageProtocolDumpInformation( @retval A poitner to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-GraphicsOutputProtocolDumpInformation(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+GraphicsOutputProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
@@ -332,33 +364,33 @@ GraphicsOutputProtocolDumpInformation( EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GopInfo;
if (!Verbose) {
- return (CatSPrint(NULL, L"GraphicsOutput"));
+ return (CatSPrint (NULL, L"GraphicsOutput"));
}
- HandleParsingHiiInit();
+ HandleParsingHiiInit ();
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_GOP_DUMP_MAIN), NULL);
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_DUMP_MAIN), NULL);
if (Temp == NULL) {
return NULL;
}
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID**)&GraphicsOutput,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ TheHandle,
+ &gEfiGraphicsOutputProtocolGuid,
+ (VOID **)&GraphicsOutput,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
SHELL_FREE_NON_NULL (Temp);
return NULL;
}
- Fmt = ConvertPixelFormat(GraphicsOutput->Mode->Info->PixelFormat);
+ Fmt = ConvertPixelFormat (GraphicsOutput->Mode->Info->PixelFormat);
- RetVal = CatSPrint(
+ RetVal = CatSPrint (
NULL,
Temp,
GraphicsOutput->Mode->MaxMode,
@@ -371,9 +403,9 @@ GraphicsOutputProtocolDumpInformation( GraphicsOutput->Mode->Info->VerticalResolution,
Fmt,
GraphicsOutput->Mode->Info->PixelsPerScanLine,
- GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.RedMask,
- GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.GreenMask,
- GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.BlueMask
+ GraphicsOutput->Mode->Info->PixelFormat != PixelBitMask ? 0 : GraphicsOutput->Mode->Info->PixelInformation.RedMask,
+ GraphicsOutput->Mode->Info->PixelFormat != PixelBitMask ? 0 : GraphicsOutput->Mode->Info->PixelInformation.GreenMask,
+ GraphicsOutput->Mode->Info->PixelFormat != PixelBitMask ? 0 : GraphicsOutput->Mode->Info->PixelInformation.BlueMask
);
SHELL_FREE_NON_NULL (Temp);
@@ -389,6 +421,7 @@ GraphicsOutputProtocolDumpInformation( if (TempRetVal == NULL) {
goto EXIT;
}
+
RetVal = TempRetVal;
SHELL_FREE_NON_NULL (Temp);
@@ -398,7 +431,6 @@ GraphicsOutputProtocolDumpInformation( goto EXIT;
}
-
for (Mode = 0; Mode < GraphicsOutput->Mode->MaxMode; Mode++) {
Status = GraphicsOutput->QueryMode (
GraphicsOutput,
@@ -423,10 +455,9 @@ GraphicsOutputProtocolDumpInformation( RetVal = TempRetVal;
}
-
EXIT:
- SHELL_FREE_NON_NULL(Temp);
- SHELL_FREE_NON_NULL(Fmt);
+ SHELL_FREE_NON_NULL (Temp);
+ SHELL_FREE_NON_NULL (Fmt);
return RetVal;
}
@@ -441,18 +472,18 @@ EXIT: @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
EdidDiscoveredProtocolDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered;
- EFI_STATUS Status;
- CHAR16 *RetVal;
- CHAR16 *Temp;
- CHAR16 *TempRetVal;
+ EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
+ CHAR16 *Temp;
+ CHAR16 *TempRetVal;
if (!Verbose) {
return (CatSPrint (NULL, L"EDIDDiscovered"));
@@ -461,7 +492,7 @@ EdidDiscoveredProtocolDumpInformation ( Status = gBS->OpenProtocol (
TheHandle,
&gEfiEdidDiscoveredProtocolGuid,
- (VOID**)&EdidDiscovered,
+ (VOID **)&EdidDiscovered,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -485,13 +516,15 @@ EdidDiscoveredProtocolDumpInformation ( SHELL_FREE_NON_NULL (RetVal);
return NULL;
}
+
TempRetVal = CatSPrint (RetVal, Temp);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
TempRetVal = CatSDumpHex (RetVal, 4, 0, EdidDiscovered->SizeOfEdid, EdidDiscovered->Edid);
- RetVal = TempRetVal;
+ RetVal = TempRetVal;
}
+
return RetVal;
}
@@ -505,11 +538,11 @@ EdidDiscoveredProtocolDumpInformation ( @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
EdidActiveProtocolDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
EFI_EDID_ACTIVE_PROTOCOL *EdidActive;
@@ -525,7 +558,7 @@ EdidActiveProtocolDumpInformation ( Status = gBS->OpenProtocol (
TheHandle,
&gEfiEdidActiveProtocolGuid,
- (VOID**)&EdidActive,
+ (VOID **)&EdidActive,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -549,13 +582,15 @@ EdidActiveProtocolDumpInformation ( SHELL_FREE_NON_NULL (RetVal);
return NULL;
}
+
TempRetVal = CatSPrint (RetVal, Temp);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
TempRetVal = CatSDumpHex (RetVal, 4, 0, EdidActive->SizeOfEdid, EdidActive->Edid);
- RetVal = TempRetVal;
+ RetVal = TempRetVal;
}
+
return RetVal;
}
@@ -569,133 +604,142 @@ EdidActiveProtocolDumpInformation ( @retval A poitner to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-PciRootBridgeIoDumpInformation(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+PciRootBridgeIoDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Configuration;
- UINT64 Supports;
- UINT64 Attributes;
- CHAR16 *Temp;
- CHAR16 *Temp2;
- CHAR16 *RetVal;
- EFI_STATUS Status;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Configuration;
+ UINT64 Supports;
+ UINT64 Attributes;
+ CHAR16 *Temp;
+ CHAR16 *Temp2;
+ CHAR16 *RetVal;
+ EFI_STATUS Status;
- RetVal = NULL;
+ RetVal = NULL;
if (!Verbose) {
- return (CatSPrint(NULL, L"PciRootBridgeIo"));
+ return (CatSPrint (NULL, L"PciRootBridgeIo"));
}
- HandleParsingHiiInit();
+ HandleParsingHiiInit ();
- Status = gBS->HandleProtocol(
- TheHandle,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID**)&PciRootBridgeIo);
+ Status = gBS->HandleProtocol (
+ TheHandle,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ (VOID **)&PciRootBridgeIo
+ );
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return NULL;
}
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_PH), NULL);
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_PH), NULL);
if (Temp == NULL) {
return NULL;
}
- Temp2 = CatSPrint(NULL, Temp, PciRootBridgeIo->ParentHandle);
- FreePool(Temp);
+
+ Temp2 = CatSPrint (NULL, Temp, PciRootBridgeIo->ParentHandle);
+ FreePool (Temp);
RetVal = Temp2;
- Temp2 = NULL;
+ Temp2 = NULL;
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SEG), NULL);
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_SEG), NULL);
if (Temp == NULL) {
- SHELL_FREE_NON_NULL(RetVal);
+ SHELL_FREE_NON_NULL (RetVal);
return NULL;
}
- Temp2 = CatSPrint(RetVal, Temp, PciRootBridgeIo->SegmentNumber);
- FreePool(Temp);
- FreePool(RetVal);
+
+ Temp2 = CatSPrint (RetVal, Temp, PciRootBridgeIo->SegmentNumber);
+ FreePool (Temp);
+ FreePool (RetVal);
RetVal = Temp2;
- Temp2 = NULL;
+ Temp2 = NULL;
Supports = 0;
Attributes = 0;
- Status = PciRootBridgeIo->GetAttributes (PciRootBridgeIo, &Supports, &Attributes);
- if (!EFI_ERROR(Status)) {
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_ATT), NULL);
+ Status = PciRootBridgeIo->GetAttributes (PciRootBridgeIo, &Supports, &Attributes);
+ if (!EFI_ERROR (Status)) {
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_ATT), NULL);
if (Temp == NULL) {
- SHELL_FREE_NON_NULL(RetVal);
+ SHELL_FREE_NON_NULL (RetVal);
return NULL;
}
- Temp2 = CatSPrint(RetVal, Temp, Attributes);
- FreePool(Temp);
- FreePool(RetVal);
+
+ Temp2 = CatSPrint (RetVal, Temp, Attributes);
+ FreePool (Temp);
+ FreePool (RetVal);
RetVal = Temp2;
- Temp2 = NULL;
+ Temp2 = NULL;
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SUPPORTS), NULL);
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_SUPPORTS), NULL);
if (Temp == NULL) {
- SHELL_FREE_NON_NULL(RetVal);
+ SHELL_FREE_NON_NULL (RetVal);
return NULL;
}
- Temp2 = CatSPrint(RetVal, Temp, Supports);
- FreePool(Temp);
- FreePool(RetVal);
+
+ Temp2 = CatSPrint (RetVal, Temp, Supports);
+ FreePool (Temp);
+ FreePool (RetVal);
RetVal = Temp2;
- Temp2 = NULL;
+ Temp2 = NULL;
}
- Configuration = NULL;
- Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Configuration);
- if (!EFI_ERROR(Status) && Configuration != NULL) {
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_TITLE), NULL);
+ Configuration = NULL;
+ Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **)&Configuration);
+ if (!EFI_ERROR (Status) && (Configuration != NULL)) {
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_TITLE), NULL);
if (Temp == NULL) {
- SHELL_FREE_NON_NULL(RetVal);
+ SHELL_FREE_NON_NULL (RetVal);
return NULL;
}
- Temp2 = CatSPrint(RetVal, Temp, Supports);
- FreePool(Temp);
- FreePool(RetVal);
+
+ Temp2 = CatSPrint (RetVal, Temp, Supports);
+ FreePool (Temp);
+ FreePool (RetVal);
RetVal = Temp2;
- Temp2 = NULL;
+ Temp2 = NULL;
while (Configuration->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
Temp = NULL;
switch (Configuration->ResType) {
- case ACPI_ADDRESS_SPACE_TYPE_MEM:
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_MEM), NULL);
- break;
- case ACPI_ADDRESS_SPACE_TYPE_IO:
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_IO), NULL);
- break;
- case ACPI_ADDRESS_SPACE_TYPE_BUS:
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_BUS), NULL);
- break;
+ case ACPI_ADDRESS_SPACE_TYPE_MEM:
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_MEM), NULL);
+ break;
+ case ACPI_ADDRESS_SPACE_TYPE_IO:
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_IO), NULL);
+ break;
+ case ACPI_ADDRESS_SPACE_TYPE_BUS:
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIRB_DUMP_BUS), NULL);
+ break;
}
+
if (Temp != NULL) {
- Temp2 = CatSPrint(RetVal, L"\r\n%s", Temp);
- FreePool(Temp);
- FreePool(RetVal);
+ Temp2 = CatSPrint (RetVal, L"\r\n%s", Temp);
+ FreePool (Temp);
+ FreePool (RetVal);
RetVal = Temp2;
- Temp2 = NULL;
+ Temp2 = NULL;
}
- Temp2 = CatSPrint(RetVal,
- L"%%H%02x %016lx %016lx %02x%%N",
- Configuration->SpecificFlag,
- Configuration->AddrRangeMin,
- Configuration->AddrRangeMax,
- Configuration->AddrSpaceGranularity
- );
- FreePool(RetVal);
+ Temp2 = CatSPrint (
+ RetVal,
+ L"%%H%02x %016lx %016lx %02x%%N",
+ Configuration->SpecificFlag,
+ Configuration->AddrRangeMin,
+ Configuration->AddrRangeMax,
+ Configuration->AddrSpaceGranularity
+ );
+ FreePool (RetVal);
RetVal = Temp2;
- Temp2 = NULL;
+ Temp2 = NULL;
Configuration++;
}
}
+
return (RetVal);
}
@@ -709,71 +753,73 @@ PciRootBridgeIoDumpInformation( @retval A poitner to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-TxtOutProtocolDumpInformation(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+TxtOutProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Dev;
- INTN Index;
- UINTN Col;
- UINTN Row;
- EFI_STATUS Status;
- CHAR16 *RetVal;
- UINTN Size;
- CHAR16 *Temp;
- UINTN NewSize;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Dev;
+ INTN Index;
+ UINTN Col;
+ UINTN Row;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
+ UINTN Size;
+ CHAR16 *Temp;
+ UINTN NewSize;
if (!Verbose) {
return (NULL);
}
- HandleParsingHiiInit();
+ HandleParsingHiiInit ();
- RetVal = NULL;
- Size = 0;
+ RetVal = NULL;
+ Size = 0;
- Status = gBS->HandleProtocol(
- TheHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID**)&Dev);
+ Status = gBS->HandleProtocol (
+ TheHandle,
+ &gEfiSimpleTextOutProtocolGuid,
+ (VOID **)&Dev
+ );
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
ASSERT (Dev != NULL && Dev->Mode != NULL);
- Size = (Dev->Mode->MaxMode + 1) * 80;
- RetVal = AllocateZeroPool(Size);
+ Size = (Dev->Mode->MaxMode + 1) * 80;
+ RetVal = AllocateZeroPool (Size);
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_TXT_OUT_DUMP_HEADER), NULL);
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_TXT_OUT_DUMP_HEADER), NULL);
if (Temp != NULL) {
- UnicodeSPrint(RetVal, Size, Temp, Dev, Dev->Mode->Attribute);
- FreePool(Temp);
+ UnicodeSPrint (RetVal, Size, Temp, Dev, Dev->Mode->Attribute);
+ FreePool (Temp);
}
//
// Dump TextOut Info
//
- Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_TXT_OUT_DUMP_LINE), NULL);
+ Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_TXT_OUT_DUMP_LINE), NULL);
for (Index = 0; Index < Dev->Mode->MaxMode; Index++) {
- Status = Dev->QueryMode (Dev, Index, &Col, &Row);
- NewSize = Size - StrSize(RetVal);
- UnicodeSPrint(
- RetVal + StrLen(RetVal),
+ Status = Dev->QueryMode (Dev, Index, &Col, &Row);
+ NewSize = Size - StrSize (RetVal);
+ UnicodeSPrint (
+ RetVal + StrLen (RetVal),
NewSize,
- Temp == NULL?L"":Temp,
+ Temp == NULL ? L"" : Temp,
Index == Dev->Mode->Mode ? L'*' : L' ',
Index,
- !EFI_ERROR(Status)?(INTN)Col:-1,
- !EFI_ERROR(Status)?(INTN)Row:-1
- );
+ !EFI_ERROR (Status) ? (INTN)Col : -1,
+ !EFI_ERROR (Status) ? (INTN)Row : -1
+ );
}
- FreePool(Temp);
+
+ FreePool (Temp);
return (RetVal);
}
-STATIC CONST UINTN VersionStringSize = 60;
+STATIC CONST UINTN VersionStringSize = 60;
/**
Function to dump information about EfiDriverSupportedEfiVersion protocol.
@@ -785,30 +831,33 @@ STATIC CONST UINTN VersionStringSize = 60; @retval A poitner to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-DriverEfiVersionProtocolDumpInformation(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+DriverEfiVersionProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL *DriverEfiVersion;
- EFI_STATUS Status;
- CHAR16 *RetVal;
+ EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL *DriverEfiVersion;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
- Status = gBS->HandleProtocol(
- TheHandle,
- &gEfiDriverSupportedEfiVersionProtocolGuid,
- (VOID**)&DriverEfiVersion);
+ Status = gBS->HandleProtocol (
+ TheHandle,
+ &gEfiDriverSupportedEfiVersionProtocolGuid,
+ (VOID **)&DriverEfiVersion
+ );
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
- RetVal = AllocateZeroPool(VersionStringSize);
+ RetVal = AllocateZeroPool (VersionStringSize);
if (RetVal != NULL) {
UnicodeSPrint (RetVal, VersionStringSize, L"0x%08x", DriverEfiVersion->FirmwareVersion);
}
+
return (RetVal);
}
+
/**
Function to convert device path to string.
@@ -820,29 +869,30 @@ DriverEfiVersionProtocolDumpInformation( @retval A pointer to a string containing the information.
**/
-CHAR16*
-ConvertDevicePathToShortText(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath,
- IN CONST BOOLEAN Verbose,
- IN CONST UINTN Length
+CHAR16 *
+ConvertDevicePathToShortText (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath,
+ IN CONST BOOLEAN Verbose,
+ IN CONST UINTN Length
)
{
- CHAR16 *Temp;
- CHAR16 *Temp2;
- UINTN Size;
+ CHAR16 *Temp;
+ CHAR16 *Temp2;
+ UINTN Size;
//
// I cannot decide whether to allow shortcuts here (the second BOOLEAN on the next line)
//
- Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE);
- if (!Verbose && Temp != NULL && StrLen(Temp) > Length) {
+ Temp = ConvertDevicePathToText (DevPath, TRUE, TRUE);
+ if (!Verbose && (Temp != NULL) && (StrLen (Temp) > Length)) {
Temp2 = NULL;
Size = 0;
- Temp2 = StrnCatGrow(&Temp2, &Size, L"..", 0);
- Temp2 = StrnCatGrow(&Temp2, &Size, Temp+(StrLen(Temp) - (Length - 2)), 0);
- FreePool(Temp);
+ Temp2 = StrnCatGrow (&Temp2, &Size, L"..", 0);
+ Temp2 = StrnCatGrow (&Temp2, &Size, Temp+(StrLen (Temp) - (Length - 2)), 0);
+ FreePool (Temp);
Temp = Temp2;
}
+
return (Temp);
}
@@ -857,36 +907,40 @@ ConvertDevicePathToShortText( @retval A pointer to a string containing the information.
**/
-STATIC CHAR16*
+STATIC CHAR16 *
EFIAPI
DevicePathProtocolDumpInformationEx (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose,
- IN EFI_GUID *Protocol
-)
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose,
+ IN EFI_GUID *Protocol
+ )
{
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
- CHAR16 *DevPathStr;
- CHAR16 *DevPathStrTemp;
- UINTN Size;
- EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;
+ CHAR16 *DevPathStr;
+ CHAR16 *DevPathStrTemp;
+ UINTN Size;
+ EFI_STATUS Status;
+
DevPathStr = NULL;
DevPathStrTemp = NULL;
- Status = gBS->OpenProtocol(TheHandle, Protocol, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status)) {
+ Status = gBS->OpenProtocol (TheHandle, Protocol, (VOID **)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ if (!EFI_ERROR (Status)) {
DevPathStr = ConvertDevicePathToShortText (DevPath, Verbose, 30);
if (Verbose) {
- Size = StrSize(DevPathStr) + sizeof(CHAR16) * 2;
+ Size = StrSize (DevPathStr) + sizeof (CHAR16) * 2;
DevPathStrTemp = AllocateZeroPool (Size);
if (DevPathStrTemp != NULL) {
- StrnCatS (DevPathStrTemp, Size/sizeof(CHAR16), L" ", 2);
- StrnCatS (DevPathStrTemp, Size/sizeof(CHAR16), DevPathStr, StrLen (DevPathStr));
+ StrnCatS (DevPathStrTemp, Size/sizeof (CHAR16), L" ", 2);
+ StrnCatS (DevPathStrTemp, Size/sizeof (CHAR16), DevPathStr, StrLen (DevPathStr));
}
+
FreePool (DevPathStr);
DevPathStr = DevPathStrTemp;
}
- gBS->CloseProtocol(TheHandle, Protocol, gImageHandle, NULL);
+
+ gBS->CloseProtocol (TheHandle, Protocol, gImageHandle, NULL);
}
+
return DevPathStr;
}
@@ -900,11 +954,11 @@ DevicePathProtocolDumpInformationEx ( @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-DevicePathProtocolDumpInformation(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+DevicePathProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
return DevicePathProtocolDumpInformationEx (TheHandle, Verbose, &gEfiDevicePathProtocolGuid);
@@ -920,11 +974,11 @@ DevicePathProtocolDumpInformation( @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-LoadedImageDevicePathProtocolDumpInformation(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+LoadedImageDevicePathProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
return DevicePathProtocolDumpInformationEx (TheHandle, Verbose, &gEfiLoadedImageDevicePathProtocolGuid);
@@ -940,25 +994,26 @@ LoadedImageDevicePathProtocolDumpInformation( @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
BusSpecificDriverOverrideProtocolDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_STATUS Status;
- CHAR16 *GetString;
- CHAR16 *RetVal;
- CHAR16 *TempRetVal;
- EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_HANDLE ImageHandle;
- UINTN Size;
+ EFI_STATUS Status;
+ CHAR16 *GetString;
+ CHAR16 *RetVal;
+ CHAR16 *TempRetVal;
+ EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_HANDLE ImageHandle;
+ UINTN Size;
if (!Verbose) {
return NULL;
}
+
Size = 0;
GetString = NULL;
RetVal = NULL;
@@ -968,7 +1023,7 @@ BusSpecificDriverOverrideProtocolDumpInformation ( Status = gBS->OpenProtocol (
TheHandle,
&gEfiBusSpecificDriverOverrideProtocolGuid,
- (VOID**)&BusSpecificDriverOverride,
+ (VOID **)&BusSpecificDriverOverride,
gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -976,11 +1031,13 @@ BusSpecificDriverOverrideProtocolDumpInformation ( if (EFI_ERROR (Status)) {
return NULL;
}
+
HandleParsingHiiInit ();
- GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_BSDO_DUMP_MAIN), NULL);
+ GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_BSDO_DUMP_MAIN), NULL);
if (GetString == NULL) {
return NULL;
}
+
do {
Status = BusSpecificDriverOverride->GetDriver (
BusSpecificDriverOverride,
@@ -990,9 +1047,9 @@ BusSpecificDriverOverrideProtocolDumpInformation ( Status = gBS->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
- (VOID **) &LoadedImage
+ (VOID **)&LoadedImage
);
- if(!EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
TempRetVal = CatSPrint (
TempRetVal,
GetString,
@@ -1019,36 +1076,38 @@ BusSpecificDriverOverrideProtocolDumpInformation ( @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
BlockIoProtocolDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_BLOCK_IO_MEDIA *BlockMedia;
- CHAR16 *GetString;
- CHAR16 *RetVal;
+ EFI_STATUS Status;
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;
+ EFI_BLOCK_IO_MEDIA *BlockMedia;
+ CHAR16 *GetString;
+ CHAR16 *RetVal;
if (!Verbose) {
return NULL;
}
- GetString = NULL;
- RetVal = NULL;
+
+ GetString = NULL;
+ RetVal = NULL;
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID**)&BlockIo,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ TheHandle,
+ &gEfiBlockIoProtocolGuid,
+ (VOID **)&BlockIo,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
return NULL;
}
+
BlockMedia = BlockIo->Media;
//
// Per spec:
@@ -1065,23 +1124,24 @@ BlockIoProtocolDumpInformation ( );
HandleParsingHiiInit ();
- GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_BLOCKIO_INFO), NULL);
+ GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_BLOCKIO_INFO), NULL);
if (GetString == NULL) {
return NULL;
}
+
RetVal = CatSPrint (
- RetVal,
- GetString,
- BlockMedia->RemovableMedia ? L"Removable " : L"Fixed ",
- BlockMedia->MediaPresent ? L"" : L"not-present ",
- BlockMedia->MediaId,
- BlockMedia->BlockSize,
- BlockMedia->LastBlock,
- MultU64x32 (BlockMedia->LastBlock + 1, BlockMedia->BlockSize),
- BlockMedia->LogicalPartition ? L"partition" : L"raw",
- BlockMedia->ReadOnly ? L"ro" : L"rw",
- BlockMedia->WriteCaching ? L"cached" : L"!cached"
- );
+ RetVal,
+ GetString,
+ BlockMedia->RemovableMedia ? L"Removable " : L"Fixed ",
+ BlockMedia->MediaPresent ? L"" : L"not-present ",
+ BlockMedia->MediaId,
+ BlockMedia->BlockSize,
+ BlockMedia->LastBlock,
+ MultU64x32 (BlockMedia->LastBlock + 1, BlockMedia->BlockSize),
+ BlockMedia->LogicalPartition ? L"partition" : L"raw",
+ BlockMedia->ReadOnly ? L"ro" : L"rw",
+ BlockMedia->WriteCaching ? L"cached" : L"!cached"
+ );
SHELL_FREE_NON_NULL (GetString);
return RetVal;
@@ -1095,11 +1155,11 @@ BlockIoProtocolDumpInformation ( @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
DebugSupportProtocolDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
EFI_STATUS Status;
@@ -1110,42 +1170,45 @@ DebugSupportProtocolDumpInformation ( if (!Verbose) {
return NULL;
}
+
GetString = NULL;
- RetVal = NULL;
- Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiDebugSupportProtocolGuid,
- (VOID**)&DebugSupport,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ RetVal = NULL;
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiDebugSupportProtocolGuid,
+ (VOID **)&DebugSupport,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
return NULL;
}
+
HandleParsingHiiInit ();
- GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_DEBUGSUPPORT_INFO), NULL);
+ GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_DEBUGSUPPORT_INFO), NULL);
if (GetString == NULL) {
return NULL;
}
+
//
// Dump Debug support info
//
switch (DebugSupport->Isa) {
- case (IsaIa32):
- RetVal = CatSPrint (RetVal, GetString, L"IA-32");
- break;
- case (IsaIpf):
- RetVal = CatSPrint (RetVal, GetString, L"IPF");
- break;
- case (IsaEbc):
- RetVal = CatSPrint (RetVal, GetString, L"EBC");
- break;
- default:
- SHELL_FREE_NON_NULL (GetString);
- GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_DEBUGSUPPORT_UNKNOWN), NULL);
- RetVal = GetString != NULL ? CatSPrint (RetVal, GetString, DebugSupport->Isa) : NULL;
- break;
+ case (IsaIa32):
+ RetVal = CatSPrint (RetVal, GetString, L"IA-32");
+ break;
+ case (IsaIpf):
+ RetVal = CatSPrint (RetVal, GetString, L"IPF");
+ break;
+ case (IsaEbc):
+ RetVal = CatSPrint (RetVal, GetString, L"EBC");
+ break;
+ default:
+ SHELL_FREE_NON_NULL (GetString);
+ GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_DEBUGSUPPORT_UNKNOWN), NULL);
+ RetVal = GetString != NULL ? CatSPrint (RetVal, GetString, DebugSupport->Isa) : NULL;
+ break;
}
SHELL_FREE_NON_NULL (GetString);
@@ -1162,77 +1225,81 @@ DebugSupportProtocolDumpInformation ( @retval A poitner to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
PciIoProtocolDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 Pci;
- UINTN Segment;
- UINTN Bus;
- UINTN Device;
- UINTN Function;
- UINTN Index;
- CHAR16 *GetString;
- CHAR16 *TempRetVal;
- CHAR16 *RetVal;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 Pci;
+ UINTN Segment;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
+ UINTN Index;
+ CHAR16 *GetString;
+ CHAR16 *TempRetVal;
+ CHAR16 *RetVal;
if (!Verbose) {
return (NULL);
}
- RetVal = NULL;
- GetString = NULL;
- TempRetVal = NULL;
- Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiPciIoProtocolGuid,
- (VOID**)&PciIo,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR(Status)) {
+ RetVal = NULL;
+ GetString = NULL;
+ TempRetVal = NULL;
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiPciIoProtocolGuid,
+ (VOID **)&PciIo,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (EFI_ERROR (Status)) {
return NULL;
}
+
PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (Pci), &Pci);
PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
HandleParsingHiiInit ();
- GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIIO_DUMP_MAIN), NULL);
+ GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PCIIO_DUMP_MAIN), NULL);
if (GetString == NULL) {
return NULL;
}
+
RetVal = CatSPrint (
- NULL,
- GetString,
- Segment,
- Bus,
- Device,
- Function,
- PciIo->RomSize,
- PciIo->RomImage,
- Pci.Hdr.VendorId,
- Pci.Hdr.DeviceId,
- Pci.Hdr.ClassCode[0],
- Pci.Hdr.ClassCode[1],
- Pci.Hdr.ClassCode[2]
- );
- for (Index = 0; Index < sizeof (Pci); Index ++) {
+ NULL,
+ GetString,
+ Segment,
+ Bus,
+ Device,
+ Function,
+ PciIo->RomSize,
+ PciIo->RomImage,
+ Pci.Hdr.VendorId,
+ Pci.Hdr.DeviceId,
+ Pci.Hdr.ClassCode[0],
+ Pci.Hdr.ClassCode[1],
+ Pci.Hdr.ClassCode[2]
+ );
+ for (Index = 0; Index < sizeof (Pci); Index++) {
if ((Index % 0x10) == 0) {
- TempRetVal = CatSPrint (RetVal, L"\r\n %02x", *((UINT8 *) (&Pci) + Index));
+ TempRetVal = CatSPrint (RetVal, L"\r\n %02x", *((UINT8 *)(&Pci) + Index));
} else {
- TempRetVal = CatSPrint (RetVal, L"%02x", *((UINT8 *) (&Pci) + Index));
+ TempRetVal = CatSPrint (RetVal, L"%02x", *((UINT8 *)(&Pci) + Index));
}
+
FreePool (RetVal);
- RetVal = TempRetVal;
+ RetVal = TempRetVal;
TempRetVal = NULL;
}
- FreePool(GetString);
+ FreePool (GetString);
return RetVal;
}
@@ -1246,11 +1313,11 @@ PciIoProtocolDumpInformation ( @retval A poitner to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
UsbIoProtocolDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
EFI_STATUS Status;
@@ -1262,34 +1329,37 @@ UsbIoProtocolDumpInformation ( if (!Verbose) {
return (NULL);
}
- RetVal = NULL;
+
+ RetVal = NULL;
GetString = NULL;
- Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID**)&UsbIo,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiUsbIoProtocolGuid,
+ (VOID **)&UsbIo,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return NULL;
}
+
UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc);
HandleParsingHiiInit ();
- GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_USBIO_DUMP_MAIN), NULL);
+ GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_USBIO_DUMP_MAIN), NULL);
if (GetString == NULL) {
return NULL;
}
+
RetVal = CatSPrint (
- NULL,
- GetString,
- InterfaceDesc.InterfaceNumber,
- InterfaceDesc.InterfaceClass,
- InterfaceDesc.InterfaceSubClass,
- InterfaceDesc.InterfaceProtocol
- );
+ NULL,
+ GetString,
+ InterfaceDesc.InterfaceNumber,
+ InterfaceDesc.InterfaceClass,
+ InterfaceDesc.InterfaceSubClass,
+ InterfaceDesc.InterfaceProtocol
+ );
FreePool (GetString);
return RetVal;
@@ -1303,11 +1373,11 @@ UsbIoProtocolDumpInformation ( @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
AdapterInformationDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
EFI_STATUS Status;
@@ -1323,17 +1393,16 @@ AdapterInformationDumpInformation ( UINTN InformationBlockSize;
if (!Verbose) {
- return (CatSPrint(NULL, L"AdapterInfo"));
+ return (CatSPrint (NULL, L"AdapterInfo"));
}
- InfoTypesBuffer = NULL;
- InformationBlock = NULL;
-
+ InfoTypesBuffer = NULL;
+ InformationBlock = NULL;
Status = gBS->OpenProtocol (
- (EFI_HANDLE) (TheHandle),
+ (EFI_HANDLE)(TheHandle),
&gEfiAdapterInformationProtocolGuid,
- (VOID **) &EfiAdptrInfoProtocol,
+ (VOID **)&EfiAdptrInfoProtocol,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1353,31 +1422,33 @@ AdapterInformationDumpInformation ( );
RetVal = NULL;
if (EFI_ERROR (Status)) {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GET_SUPP_TYPES_FAILED), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GET_SUPP_TYPES_FAILED), NULL);
if (TempStr != NULL) {
RetVal = CatSPrint (NULL, TempStr, Status);
} else {
goto ERROR_EXIT;
}
} else {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SUPP_TYPE_HEADER), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_SUPP_TYPE_HEADER), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
RetVal = CatSPrint (NULL, TempStr);
SHELL_FREE_NON_NULL (TempStr);
for (GuidIndex = 0; GuidIndex < InfoTypesBufferCount; GuidIndex++) {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_NUMBER), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GUID_NUMBER), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr, (GuidIndex + 1), &InfoTypesBuffer[GuidIndex]);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
SHELL_FREE_NON_NULL (TempStr);
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_STRING), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GUID_STRING), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
@@ -1399,7 +1470,6 @@ AdapterInformationDumpInformation ( SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
} else {
-
GuidStr = GetStringNameFromGuid (&InfoTypesBuffer[GuidIndex], NULL);
if (GuidStr == NULL) {
TempRetVal = CatSPrint (RetVal, TempStr, L"UnknownInfoType");
@@ -1407,7 +1477,7 @@ AdapterInformationDumpInformation ( RetVal = TempRetVal;
SHELL_FREE_NON_NULL (TempStr);
- SHELL_FREE_NON_NULL(GuidStr);
+ SHELL_FREE_NON_NULL (GuidStr);
//
// So that we never have to pass this UnknownInfoType to the parsing function "GetInformation" service of AIP
//
@@ -1416,7 +1486,7 @@ AdapterInformationDumpInformation ( TempRetVal = CatSPrint (RetVal, TempStr, GuidStr);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
- SHELL_FREE_NON_NULL(GuidStr);
+ SHELL_FREE_NON_NULL (GuidStr);
}
}
@@ -1430,19 +1500,21 @@ AdapterInformationDumpInformation ( );
if (EFI_ERROR (Status)) {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GETINFO_FAILED), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GETINFO_FAILED), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr, Status);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
} else {
if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_MEDIA_STATE), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_MEDIA_STATE), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (
RetVal,
TempStr,
@@ -1452,10 +1524,11 @@ AdapterInformationDumpInformation ( SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
} else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_NETWORK_BOOT_INFO), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_NETWORK_BOOT_INFO), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (
RetVal,
TempStr,
@@ -1471,10 +1544,11 @@ AdapterInformationDumpInformation ( SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
} else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid) == TRUE) {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SAN_MAC_ADDRESS_INFO), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_SAN_MAC_ADDRESS_INFO), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (
RetVal,
TempStr,
@@ -1488,7 +1562,7 @@ AdapterInformationDumpInformation ( SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
} else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoUndiIpv6SupportGuid) == TRUE) {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_UNDI_IPV6_INFO), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_UNDI_IPV6_INFO), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
@@ -1501,15 +1575,17 @@ AdapterInformationDumpInformation ( SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
} else {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_UNKNOWN_INFO_TYPE), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_UNKNOWN_INFO_TYPE), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr, &InfoTypesBuffer[GuidIndex]);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
}
}
+
SHELL_FREE_NON_NULL (TempStr);
SHELL_FREE_NON_NULL (InformationBlock);
}
@@ -1533,60 +1609,60 @@ ERROR_EXIT: @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
FirmwareManagementDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_STATUS Status;
- EFI_FIRMWARE_MANAGEMENT_PROTOCOL *EfiFwMgmtProtocol;
- EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo;
- EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1 *ImageInfoV1;
- EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2 *ImageInfoV2;
- UINT64 AttributeSetting;
- UINTN ImageInfoSize;
- UINTN DescriptorSize;
- UINT32 DescriptorVersion;
- UINT32 PackageVersion;
- UINT8 DescriptorCount;
- UINT8 Index;
- UINT8 Index1;
- UINT8 ImageCount;
- CHAR16 *PackageVersionName;
- CHAR16 *TempStr;
- CHAR16 *RetVal;
- CHAR16 *TempRetVal;
- CHAR16 *AttributeSettingStr;
- BOOLEAN Found;
- BOOLEAN AttributeSupported;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL *EfiFwMgmtProtocol;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1 *ImageInfoV1;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2 *ImageInfoV2;
+ UINT64 AttributeSetting;
+ UINTN ImageInfoSize;
+ UINTN DescriptorSize;
+ UINT32 DescriptorVersion;
+ UINT32 PackageVersion;
+ UINT8 DescriptorCount;
+ UINT8 Index;
+ UINT8 Index1;
+ UINT8 ImageCount;
+ CHAR16 *PackageVersionName;
+ CHAR16 *TempStr;
+ CHAR16 *RetVal;
+ CHAR16 *TempRetVal;
+ CHAR16 *AttributeSettingStr;
+ BOOLEAN Found;
+ BOOLEAN AttributeSupported;
//
// Initialize local variables
//
- ImageCount = 0;
- ImageInfoSize = 1;
- AttributeSetting = 0;
- Found = FALSE;
- AttributeSupported = FALSE;
- ImageInfo = NULL;
- ImageInfoV1 = NULL;
- ImageInfoV2 = NULL;
- PackageVersionName = NULL;
- RetVal = NULL;
- TempRetVal = NULL;
- TempStr = NULL;
- AttributeSettingStr = NULL;
+ ImageCount = 0;
+ ImageInfoSize = 1;
+ AttributeSetting = 0;
+ Found = FALSE;
+ AttributeSupported = FALSE;
+ ImageInfo = NULL;
+ ImageInfoV1 = NULL;
+ ImageInfoV2 = NULL;
+ PackageVersionName = NULL;
+ RetVal = NULL;
+ TempRetVal = NULL;
+ TempStr = NULL;
+ AttributeSettingStr = NULL;
if (!Verbose) {
- return (CatSPrint(NULL, L"FirmwareManagement"));
+ return (CatSPrint (NULL, L"FirmwareManagement"));
}
Status = gBS->OpenProtocol (
- (EFI_HANDLE) (TheHandle),
+ (EFI_HANDLE)(TheHandle),
&gEfiFirmwareManagementProtocolGuid,
- (VOID **) &EfiFwMgmtProtocol,
+ (VOID **)&EfiFwMgmtProtocol,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1634,7 +1710,6 @@ FirmwareManagementDumpInformation ( // Decode Image Descriptor data only if its version is supported
//
if (DescriptorVersion <= EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION) {
-
if (ImageInfo == NULL) {
goto ERROR_EXIT;
}
@@ -1645,20 +1720,22 @@ FirmwareManagementDumpInformation ( //
// Set ImageInfoSize in return buffer
//
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGE_INFO_SIZE), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGE_INFO_SIZE), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
RetVal = CatSPrint (NULL, TempStr, ImageInfoSize);
SHELL_FREE_NON_NULL (TempStr);
//
// Set DescriptorVersion in return buffer
//
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_DESCRIPTOR_VERSION), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_DESCRIPTOR_VERSION), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr, DescriptorVersion);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
@@ -1667,23 +1744,24 @@ FirmwareManagementDumpInformation ( //
// Set DescriptorCount in return buffer
//
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_DESCRIPTOR_COUNT), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_DESCRIPTOR_COUNT), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr, DescriptorCount);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
SHELL_FREE_NON_NULL (TempStr);
-
//
// Set DescriptorSize in return buffer
//
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_DESCRIPTOR_SIZE), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_DESCRIPTOR_SIZE), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr, DescriptorSize);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
@@ -1692,10 +1770,11 @@ FirmwareManagementDumpInformation ( //
// Set PackageVersion in return buffer
//
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_PACKAGE_VERSION), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_PACKAGE_VERSION), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr, PackageVersion);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
@@ -1704,10 +1783,11 @@ FirmwareManagementDumpInformation ( //
// Set PackageVersionName in return buffer
//
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_PACKAGE_VERSION_NAME), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_PACKAGE_VERSION_NAME), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr, PackageVersionName);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
@@ -1748,26 +1828,31 @@ FirmwareManagementDumpInformation ( SHELL_FREE_NON_NULL (AttributeSettingStr);
AttributeSettingStr = TempRetVal;
}
+
if ((AttributeSetting & IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0x0) {
TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_RESET_REQUIRED");
SHELL_FREE_NON_NULL (AttributeSettingStr);
AttributeSettingStr = TempRetVal;
}
+
if ((AttributeSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != 0x0) {
TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED");
SHELL_FREE_NON_NULL (AttributeSettingStr);
AttributeSettingStr = TempRetVal;
}
+
if ((AttributeSetting & IMAGE_ATTRIBUTE_IN_USE) != 0x0) {
TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_IN_USE");
SHELL_FREE_NON_NULL (AttributeSettingStr);
AttributeSettingStr = TempRetVal;
}
+
if ((AttributeSetting & IMAGE_ATTRIBUTE_UEFI_IMAGE) != 0x0) {
TempRetVal = CatSPrint (AttributeSettingStr, L" IMAGE_ATTRIBUTE_UEFI_IMAGE");
SHELL_FREE_NON_NULL (AttributeSettingStr);
AttributeSettingStr = TempRetVal;
}
+
TempRetVal = CatSPrint (AttributeSettingStr, L" )");
SHELL_FREE_NON_NULL (AttributeSettingStr);
AttributeSettingStr = TempRetVal;
@@ -1778,10 +1863,11 @@ FirmwareManagementDumpInformation ( ImageCount++;
}
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGE_DESCRIPTOR_INFO_V1), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGE_DESCRIPTOR_INFO_V1), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (
RetVal,
TempStr,
@@ -1805,10 +1891,11 @@ FirmwareManagementDumpInformation ( ImageCount++;
}
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGE_DESCRIPTOR_INFO_V2), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGE_DESCRIPTOR_INFO_V2), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (
RetVal,
TempStr,
@@ -1833,10 +1920,11 @@ FirmwareManagementDumpInformation ( ImageCount++;
}
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGE_DESCRIPTOR_INFO), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGE_DESCRIPTOR_INFO), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (
RetVal,
TempStr,
@@ -1864,8 +1952,8 @@ FirmwareManagementDumpInformation ( }
if (ImageCount > 0) {
- for (Index=0; Index<DescriptorCount; Index++) {
- for (Index1=Index+1; Index1<DescriptorCount; Index1++) {
+ for (Index = 0; Index < DescriptorCount; Index++) {
+ for (Index1 = Index+1; Index1 < DescriptorCount; Index1++) {
if (DescriptorVersion == EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1) {
if (ImageInfoV1[Index].ImageId == ImageInfoV1[Index1].ImageId) {
Found = TRUE;
@@ -1900,10 +1988,11 @@ ENDLOOP: // Check if ImageId with duplicate value was found
//
if (Found) {
- TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_FMP_IMAGEID_NON_UNIQUE), NULL);
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_FMP_IMAGEID_NON_UNIQUE), NULL);
if (TempStr == NULL) {
goto ERROR_EXIT;
}
+
TempRetVal = CatSPrint (RetVal, TempStr);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
@@ -1935,31 +2024,31 @@ ERROR_EXIT: @retval A pointer to a string containing the information.
**/
-CHAR16*
+CHAR16 *
EFIAPI
PartitionInfoProtocolDumpInformation (
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
)
{
- EFI_STATUS Status;
- EFI_PARTITION_INFO_PROTOCOL *PartitionInfo;
- CHAR16 *PartitionType;
- CHAR16 *EfiSystemPartition;
- CHAR16 *RetVal;
+ EFI_STATUS Status;
+ EFI_PARTITION_INFO_PROTOCOL *PartitionInfo;
+ CHAR16 *PartitionType;
+ CHAR16 *EfiSystemPartition;
+ CHAR16 *RetVal;
if (!Verbose) {
return NULL;
}
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiPartitionInfoProtocolGuid,
- (VOID**)&PartitionInfo,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ TheHandle,
+ &gEfiPartitionInfoProtocolGuid,
+ (VOID **)&PartitionInfo,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
return NULL;
}
@@ -1967,28 +2056,30 @@ PartitionInfoProtocolDumpInformation ( HandleParsingHiiInit ();
switch (PartitionInfo->Type) {
- case PARTITION_TYPE_OTHER:
- PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_OTHER), NULL);
- break;
- case PARTITION_TYPE_MBR:
- PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_MBR), NULL);
- break;
- case PARTITION_TYPE_GPT:
- PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_GPT), NULL);
- break;
- default:
- PartitionType = NULL;
- break;
+ case PARTITION_TYPE_OTHER:
+ PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_TYPE_OTHER), NULL);
+ break;
+ case PARTITION_TYPE_MBR:
+ PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_TYPE_MBR), NULL);
+ break;
+ case PARTITION_TYPE_GPT:
+ PartitionType = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_TYPE_GPT), NULL);
+ break;
+ default:
+ PartitionType = NULL;
+ break;
}
+
if (PartitionType == NULL) {
return NULL;
}
if (PartitionInfo->System == 1) {
- EfiSystemPartition = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_EFI_SYS_PART), NULL);
+ EfiSystemPartition = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_EFI_SYS_PART), NULL);
} else {
- EfiSystemPartition = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_PARTINFO_DUMP_NOT_EFI_SYS_PART), NULL);
+ EfiSystemPartition = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_PARTINFO_DUMP_NOT_EFI_SYS_PART), NULL);
}
+
if (EfiSystemPartition == NULL) {
SHELL_FREE_NON_NULL (PartitionType);
return NULL;
@@ -2023,9 +2114,9 @@ PartitionInfoProtocolDumpInformation ( { \
0xc95a93d, 0xa006, 0x11d4, { 0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
-STATIC CONST EFI_GUID WinNtThunkProtocolGuid = LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_GUID;
-STATIC CONST EFI_GUID WinNtIoProtocolGuid = LOCAL_EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID;
-STATIC CONST EFI_GUID WinNtSerialPortGuid = LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID;
+STATIC CONST EFI_GUID WinNtThunkProtocolGuid = LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_GUID;
+STATIC CONST EFI_GUID WinNtIoProtocolGuid = LOCAL_EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID;
+STATIC CONST EFI_GUID WinNtSerialPortGuid = LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID;
//
// Deprecated protocols we dont want to link from IntelFrameworkModulePkg
@@ -2038,375 +2129,374 @@ STATIC CONST EFI_GUID WinNtSerialPortGuid = LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID { \
0x64a892dc, 0x5561, 0x4536, { 0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55 } \
}
-STATIC CONST EFI_GUID EfiIsaIoProtocolGuid = LOCAL_EFI_ISA_IO_PROTOCOL_GUID;
-STATIC CONST EFI_GUID EfiIsaAcpiProtocolGuid = LOCAL_EFI_ISA_ACPI_PROTOCOL_GUID;
-
+STATIC CONST EFI_GUID EfiIsaIoProtocolGuid = LOCAL_EFI_ISA_IO_PROTOCOL_GUID;
+STATIC CONST EFI_GUID EfiIsaAcpiProtocolGuid = LOCAL_EFI_ISA_ACPI_PROTOCOL_GUID;
-STATIC CONST GUID_INFO_BLOCK mGuidStringListNT[] = {
- {STRING_TOKEN(STR_WINNT_THUNK), (EFI_GUID*)&WinNtThunkProtocolGuid, NULL},
- {STRING_TOKEN(STR_WINNT_DRIVER_IO), (EFI_GUID*)&WinNtIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_WINNT_SERIAL_PORT), (EFI_GUID*)&WinNtSerialPortGuid, NULL},
- {0, NULL, NULL},
+STATIC CONST GUID_INFO_BLOCK mGuidStringListNT[] = {
+ { STRING_TOKEN (STR_WINNT_THUNK), (EFI_GUID *)&WinNtThunkProtocolGuid, NULL },
+ { STRING_TOKEN (STR_WINNT_DRIVER_IO), (EFI_GUID *)&WinNtIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_WINNT_SERIAL_PORT), (EFI_GUID *)&WinNtSerialPortGuid, NULL },
+ { 0, NULL, NULL },
};
-STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
- {STRING_TOKEN(STR_LOADED_IMAGE), &gEfiLoadedImageProtocolGuid, LoadedImageProtocolDumpInformation},
- {STRING_TOKEN(STR_DEVICE_PATH), &gEfiDevicePathProtocolGuid, DevicePathProtocolDumpInformation},
- {STRING_TOKEN(STR_IMAGE_PATH), &gEfiLoadedImageDevicePathProtocolGuid, LoadedImageDevicePathProtocolDumpInformation},
- {STRING_TOKEN(STR_DEVICE_PATH_UTIL), &gEfiDevicePathUtilitiesProtocolGuid, NULL},
- {STRING_TOKEN(STR_DEVICE_PATH_TXT), &gEfiDevicePathToTextProtocolGuid, NULL},
- {STRING_TOKEN(STR_DEVICE_PATH_FTXT), &gEfiDevicePathFromTextProtocolGuid, NULL},
- {STRING_TOKEN(STR_DEVICE_PATH_PC), &gEfiPcAnsiGuid, NULL},
- {STRING_TOKEN(STR_DEVICE_PATH_VT100), &gEfiVT100Guid, NULL},
- {STRING_TOKEN(STR_DEVICE_PATH_VT100P), &gEfiVT100PlusGuid, NULL},
- {STRING_TOKEN(STR_DEVICE_PATH_VTUTF8), &gEfiVTUTF8Guid, NULL},
- {STRING_TOKEN(STR_DRIVER_BINDING), &gEfiDriverBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_PLATFORM_OVERRIDE), &gEfiPlatformDriverOverrideProtocolGuid, NULL},
- {STRING_TOKEN(STR_BUS_OVERRIDE), &gEfiBusSpecificDriverOverrideProtocolGuid, BusSpecificDriverOverrideProtocolDumpInformation},
- {STRING_TOKEN(STR_DRIVER_DIAG), &gEfiDriverDiagnosticsProtocolGuid, NULL},
- {STRING_TOKEN(STR_DRIVER_DIAG2), &gEfiDriverDiagnostics2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_DRIVER_CN), &gEfiComponentNameProtocolGuid, NULL},
- {STRING_TOKEN(STR_DRIVER_CN2), &gEfiComponentName2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_PLAT_DRV_CFG), &gEfiPlatformToDriverConfigurationProtocolGuid, NULL},
- {STRING_TOKEN(STR_DRIVER_VERSION), &gEfiDriverSupportedEfiVersionProtocolGuid, DriverEfiVersionProtocolDumpInformation},
- {STRING_TOKEN(STR_TXT_IN), &gEfiSimpleTextInProtocolGuid, NULL},
- {STRING_TOKEN(STR_TXT_IN_EX), &gEfiSimpleTextInputExProtocolGuid, NULL},
- {STRING_TOKEN(STR_TXT_OUT), &gEfiSimpleTextOutProtocolGuid, TxtOutProtocolDumpInformation},
- {STRING_TOKEN(STR_SIM_POINTER), &gEfiSimplePointerProtocolGuid, NULL},
- {STRING_TOKEN(STR_ABS_POINTER), &gEfiAbsolutePointerProtocolGuid, NULL},
- {STRING_TOKEN(STR_SERIAL_IO), &gEfiSerialIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_GRAPHICS_OUTPUT), &gEfiGraphicsOutputProtocolGuid, GraphicsOutputProtocolDumpInformation},
- {STRING_TOKEN(STR_EDID_DISCOVERED), &gEfiEdidDiscoveredProtocolGuid, EdidDiscoveredProtocolDumpInformation},
- {STRING_TOKEN(STR_EDID_ACTIVE), &gEfiEdidActiveProtocolGuid, EdidActiveProtocolDumpInformation},
- {STRING_TOKEN(STR_EDID_OVERRIDE), &gEfiEdidOverrideProtocolGuid, NULL},
- {STRING_TOKEN(STR_CON_IN), &gEfiConsoleInDeviceGuid, NULL},
- {STRING_TOKEN(STR_CON_OUT), &gEfiConsoleOutDeviceGuid, NULL},
- {STRING_TOKEN(STR_STD_ERR), &gEfiStandardErrorDeviceGuid, NULL},
- {STRING_TOKEN(STR_LOAD_FILE), &gEfiLoadFileProtocolGuid, NULL},
- {STRING_TOKEN(STR_LOAD_FILE2), &gEfiLoadFile2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_SIMPLE_FILE_SYS), &gEfiSimpleFileSystemProtocolGuid, NULL},
- {STRING_TOKEN(STR_TAPE_IO), &gEfiTapeIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_DISK_IO), &gEfiDiskIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_BLK_IO), &gEfiBlockIoProtocolGuid, BlockIoProtocolDumpInformation},
- {STRING_TOKEN(STR_UC), &gEfiUnicodeCollationProtocolGuid, NULL},
- {STRING_TOKEN(STR_UC2), &gEfiUnicodeCollation2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, PciRootBridgeIoDumpInformation},
- {STRING_TOKEN(STR_PCI_IO), &gEfiPciIoProtocolGuid, PciIoProtocolDumpInformation},
- {STRING_TOKEN(STR_SCSI_PT), &gEfiScsiPassThruProtocolGuid, NULL},
- {STRING_TOKEN(STR_SCSI_IO), &gEfiScsiIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_SCSI_PT_EXT), &gEfiExtScsiPassThruProtocolGuid, NULL},
- {STRING_TOKEN(STR_ISCSI), &gEfiIScsiInitiatorNameProtocolGuid, NULL},
- {STRING_TOKEN(STR_USB_IO), &gEfiUsbIoProtocolGuid, UsbIoProtocolDumpInformation},
- {STRING_TOKEN(STR_USB_HC), &gEfiUsbHcProtocolGuid, NULL},
- {STRING_TOKEN(STR_USB_HC2), &gEfiUsb2HcProtocolGuid, NULL},
- {STRING_TOKEN(STR_DEBUG_SUPPORT), &gEfiDebugSupportProtocolGuid, DebugSupportProtocolDumpInformation},
- {STRING_TOKEN(STR_DEBUG_PORT), &gEfiDebugPortProtocolGuid, NULL},
- {STRING_TOKEN(STR_DECOMPRESS), &gEfiDecompressProtocolGuid, NULL},
- {STRING_TOKEN(STR_ACPI_TABLE), &gEfiAcpiTableProtocolGuid, NULL},
- {STRING_TOKEN(STR_EBC_INTERPRETER), &gEfiEbcProtocolGuid, NULL},
- {STRING_TOKEN(STR_SNP), &gEfiSimpleNetworkProtocolGuid, NULL},
- {STRING_TOKEN(STR_NII), &gEfiNetworkInterfaceIdentifierProtocolGuid, NULL},
- {STRING_TOKEN(STR_NII_31), &gEfiNetworkInterfaceIdentifierProtocolGuid_31, NULL},
- {STRING_TOKEN(STR_PXE_BC), &gEfiPxeBaseCodeProtocolGuid, NULL},
- {STRING_TOKEN(STR_PXE_CB), &gEfiPxeBaseCodeCallbackProtocolGuid, NULL},
- {STRING_TOKEN(STR_BIS), &gEfiBisProtocolGuid, NULL},
- {STRING_TOKEN(STR_MNP_SB), &gEfiManagedNetworkServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_MNP), &gEfiManagedNetworkProtocolGuid, NULL},
- {STRING_TOKEN(STR_ARP_SB), &gEfiArpServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_ARP), &gEfiArpProtocolGuid, NULL},
- {STRING_TOKEN(STR_DHCPV4_SB), &gEfiDhcp4ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_DHCPV4), &gEfiDhcp4ProtocolGuid, NULL},
- {STRING_TOKEN(STR_TCPV4_SB), &gEfiTcp4ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_TCPV4), &gEfiTcp4ProtocolGuid, NULL},
- {STRING_TOKEN(STR_IPV4_SB), &gEfiIp4ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_IPV4), &gEfiIp4ProtocolGuid, NULL},
- {STRING_TOKEN(STR_IPV4_CFG), &gEfiIp4ConfigProtocolGuid, NULL},
- {STRING_TOKEN(STR_IPV4_CFG2), &gEfiIp4Config2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_UDPV4_SB), &gEfiUdp4ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_UDPV4), &gEfiUdp4ProtocolGuid, NULL},
- {STRING_TOKEN(STR_MTFTPV4_SB), &gEfiMtftp4ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_MTFTPV4), &gEfiMtftp4ProtocolGuid, NULL},
- {STRING_TOKEN(STR_AUTH_INFO), &gEfiAuthenticationInfoProtocolGuid, NULL},
- {STRING_TOKEN(STR_HASH_SB), &gEfiHashServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_HASH), &gEfiHashProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_FONT), &gEfiHiiFontProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_STRING), &gEfiHiiStringProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_IMAGE), &gEfiHiiImageProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_DATABASE), &gEfiHiiDatabaseProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_CONFIG_ROUT), &gEfiHiiConfigRoutingProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_CONFIG_ACC), &gEfiHiiConfigAccessProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_FORM_BROWSER2), &gEfiFormBrowser2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_DRIVER_FAM_OVERRIDE), &gEfiDriverFamilyOverrideProtocolGuid, NULL},
- {STRING_TOKEN(STR_PCD), &gPcdProtocolGuid, NULL},
- {STRING_TOKEN(STR_TCG), &gEfiTcgProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_PACKAGE_LIST), &gEfiHiiPackageListProtocolGuid, NULL},
+STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
+ { STRING_TOKEN (STR_LOADED_IMAGE), &gEfiLoadedImageProtocolGuid, LoadedImageProtocolDumpInformation },
+ { STRING_TOKEN (STR_DEVICE_PATH), &gEfiDevicePathProtocolGuid, DevicePathProtocolDumpInformation },
+ { STRING_TOKEN (STR_IMAGE_PATH), &gEfiLoadedImageDevicePathProtocolGuid, LoadedImageDevicePathProtocolDumpInformation },
+ { STRING_TOKEN (STR_DEVICE_PATH_UTIL), &gEfiDevicePathUtilitiesProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DEVICE_PATH_TXT), &gEfiDevicePathToTextProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DEVICE_PATH_FTXT), &gEfiDevicePathFromTextProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DEVICE_PATH_PC), &gEfiPcAnsiGuid, NULL },
+ { STRING_TOKEN (STR_DEVICE_PATH_VT100), &gEfiVT100Guid, NULL },
+ { STRING_TOKEN (STR_DEVICE_PATH_VT100P), &gEfiVT100PlusGuid, NULL },
+ { STRING_TOKEN (STR_DEVICE_PATH_VTUTF8), &gEfiVTUTF8Guid, NULL },
+ { STRING_TOKEN (STR_DRIVER_BINDING), &gEfiDriverBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PLATFORM_OVERRIDE), &gEfiPlatformDriverOverrideProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BUS_OVERRIDE), &gEfiBusSpecificDriverOverrideProtocolGuid, BusSpecificDriverOverrideProtocolDumpInformation },
+ { STRING_TOKEN (STR_DRIVER_DIAG), &gEfiDriverDiagnosticsProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DRIVER_DIAG2), &gEfiDriverDiagnostics2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DRIVER_CN), &gEfiComponentNameProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DRIVER_CN2), &gEfiComponentName2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PLAT_DRV_CFG), &gEfiPlatformToDriverConfigurationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DRIVER_VERSION), &gEfiDriverSupportedEfiVersionProtocolGuid, DriverEfiVersionProtocolDumpInformation },
+ { STRING_TOKEN (STR_TXT_IN), &gEfiSimpleTextInProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TXT_IN_EX), &gEfiSimpleTextInputExProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TXT_OUT), &gEfiSimpleTextOutProtocolGuid, TxtOutProtocolDumpInformation },
+ { STRING_TOKEN (STR_SIM_POINTER), &gEfiSimplePointerProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ABS_POINTER), &gEfiAbsolutePointerProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SERIAL_IO), &gEfiSerialIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_GRAPHICS_OUTPUT), &gEfiGraphicsOutputProtocolGuid, GraphicsOutputProtocolDumpInformation },
+ { STRING_TOKEN (STR_EDID_DISCOVERED), &gEfiEdidDiscoveredProtocolGuid, EdidDiscoveredProtocolDumpInformation },
+ { STRING_TOKEN (STR_EDID_ACTIVE), &gEfiEdidActiveProtocolGuid, EdidActiveProtocolDumpInformation },
+ { STRING_TOKEN (STR_EDID_OVERRIDE), &gEfiEdidOverrideProtocolGuid, NULL },
+ { STRING_TOKEN (STR_CON_IN), &gEfiConsoleInDeviceGuid, NULL },
+ { STRING_TOKEN (STR_CON_OUT), &gEfiConsoleOutDeviceGuid, NULL },
+ { STRING_TOKEN (STR_STD_ERR), &gEfiStandardErrorDeviceGuid, NULL },
+ { STRING_TOKEN (STR_LOAD_FILE), &gEfiLoadFileProtocolGuid, NULL },
+ { STRING_TOKEN (STR_LOAD_FILE2), &gEfiLoadFile2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SIMPLE_FILE_SYS), &gEfiSimpleFileSystemProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TAPE_IO), &gEfiTapeIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DISK_IO), &gEfiDiskIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BLK_IO), &gEfiBlockIoProtocolGuid, BlockIoProtocolDumpInformation },
+ { STRING_TOKEN (STR_UC), &gEfiUnicodeCollationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UC2), &gEfiUnicodeCollation2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, PciRootBridgeIoDumpInformation },
+ { STRING_TOKEN (STR_PCI_IO), &gEfiPciIoProtocolGuid, PciIoProtocolDumpInformation },
+ { STRING_TOKEN (STR_SCSI_PT), &gEfiScsiPassThruProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SCSI_IO), &gEfiScsiIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SCSI_PT_EXT), &gEfiExtScsiPassThruProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ISCSI), &gEfiIScsiInitiatorNameProtocolGuid, NULL },
+ { STRING_TOKEN (STR_USB_IO), &gEfiUsbIoProtocolGuid, UsbIoProtocolDumpInformation },
+ { STRING_TOKEN (STR_USB_HC), &gEfiUsbHcProtocolGuid, NULL },
+ { STRING_TOKEN (STR_USB_HC2), &gEfiUsb2HcProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DEBUG_SUPPORT), &gEfiDebugSupportProtocolGuid, DebugSupportProtocolDumpInformation },
+ { STRING_TOKEN (STR_DEBUG_PORT), &gEfiDebugPortProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DECOMPRESS), &gEfiDecompressProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ACPI_TABLE), &gEfiAcpiTableProtocolGuid, NULL },
+ { STRING_TOKEN (STR_EBC_INTERPRETER), &gEfiEbcProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SNP), &gEfiSimpleNetworkProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NII), &gEfiNetworkInterfaceIdentifierProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NII_31), &gEfiNetworkInterfaceIdentifierProtocolGuid_31, NULL },
+ { STRING_TOKEN (STR_PXE_BC), &gEfiPxeBaseCodeProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PXE_CB), &gEfiPxeBaseCodeCallbackProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BIS), &gEfiBisProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MNP_SB), &gEfiManagedNetworkServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MNP), &gEfiManagedNetworkProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ARP_SB), &gEfiArpServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ARP), &gEfiArpProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DHCPV4_SB), &gEfiDhcp4ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DHCPV4), &gEfiDhcp4ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TCPV4_SB), &gEfiTcp4ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TCPV4), &gEfiTcp4ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IPV4_SB), &gEfiIp4ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IPV4), &gEfiIp4ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IPV4_CFG), &gEfiIp4ConfigProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IPV4_CFG2), &gEfiIp4Config2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UDPV4_SB), &gEfiUdp4ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UDPV4), &gEfiUdp4ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MTFTPV4_SB), &gEfiMtftp4ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MTFTPV4), &gEfiMtftp4ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_AUTH_INFO), &gEfiAuthenticationInfoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HASH_SB), &gEfiHashServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HASH), &gEfiHashProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_FONT), &gEfiHiiFontProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_STRING), &gEfiHiiStringProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_IMAGE), &gEfiHiiImageProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_DATABASE), &gEfiHiiDatabaseProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_CONFIG_ROUT), &gEfiHiiConfigRoutingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_CONFIG_ACC), &gEfiHiiConfigAccessProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_FORM_BROWSER2), &gEfiFormBrowser2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DRIVER_FAM_OVERRIDE), &gEfiDriverFamilyOverrideProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PCD), &gPcdProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TCG), &gEfiTcgProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_PACKAGE_LIST), &gEfiHiiPackageListProtocolGuid, NULL },
-//
-// the ones under this are deprecated by the current UEFI Spec, but may be found anyways...
-//
- {STRING_TOKEN(STR_SHELL_INTERFACE), &gEfiShellInterfaceGuid, NULL},
- {STRING_TOKEN(STR_SHELL_ENV2), &gEfiShellEnvironment2Guid, NULL},
- {STRING_TOKEN(STR_SHELL_ENV), &gEfiShellEnvironment2Guid, NULL},
- {STRING_TOKEN(STR_DEVICE_IO), &gEfiDeviceIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_UGA_DRAW), &gEfiUgaDrawProtocolGuid, NULL},
- {STRING_TOKEN(STR_UGA_IO), &gEfiUgaIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_ESP), &gEfiPartTypeSystemPartGuid, NULL},
- {STRING_TOKEN(STR_GPT_NBR), &gEfiPartTypeLegacyMbrGuid, NULL},
- {STRING_TOKEN(STR_DRIVER_CONFIG), &gEfiDriverConfigurationProtocolGuid, NULL},
- {STRING_TOKEN(STR_DRIVER_CONFIG2), &gEfiDriverConfiguration2ProtocolGuid, NULL},
+ //
+ // the ones under this are deprecated by the current UEFI Spec, but may be found anyways...
+ //
+ { STRING_TOKEN (STR_SHELL_INTERFACE), &gEfiShellInterfaceGuid, NULL },
+ { STRING_TOKEN (STR_SHELL_ENV2), &gEfiShellEnvironment2Guid, NULL },
+ { STRING_TOKEN (STR_SHELL_ENV), &gEfiShellEnvironment2Guid, NULL },
+ { STRING_TOKEN (STR_DEVICE_IO), &gEfiDeviceIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UGA_DRAW), &gEfiUgaDrawProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UGA_IO), &gEfiUgaIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ESP), &gEfiPartTypeSystemPartGuid, NULL },
+ { STRING_TOKEN (STR_GPT_NBR), &gEfiPartTypeLegacyMbrGuid, NULL },
+ { STRING_TOKEN (STR_DRIVER_CONFIG), &gEfiDriverConfigurationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DRIVER_CONFIG2), &gEfiDriverConfiguration2ProtocolGuid, NULL },
-//
-// these are using local (non-global) definitions to reduce package dependancy.
-//
- {STRING_TOKEN(STR_ISA_IO), (EFI_GUID*)&EfiIsaIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_ISA_ACPI), (EFI_GUID*)&EfiIsaAcpiProtocolGuid, NULL},
+ //
+ // these are using local (non-global) definitions to reduce package dependancy.
+ //
+ { STRING_TOKEN (STR_ISA_IO), (EFI_GUID *)&EfiIsaIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ISA_ACPI), (EFI_GUID *)&EfiIsaAcpiProtocolGuid, NULL },
-//
-// the ones under this are GUID identified structs, not protocols
-//
- {STRING_TOKEN(STR_FILE_INFO), &gEfiFileInfoGuid, NULL},
- {STRING_TOKEN(STR_FILE_SYS_INFO), &gEfiFileSystemInfoGuid, NULL},
+ //
+ // the ones under this are GUID identified structs, not protocols
+ //
+ { STRING_TOKEN (STR_FILE_INFO), &gEfiFileInfoGuid, NULL },
+ { STRING_TOKEN (STR_FILE_SYS_INFO), &gEfiFileSystemInfoGuid, NULL },
-//
-// the ones under this are misc GUIDS.
-//
- {STRING_TOKEN(STR_EFI_GLOBAL_VARIABLE), &gEfiGlobalVariableGuid, NULL},
+ //
+ // the ones under this are misc GUIDS.
+ //
+ { STRING_TOKEN (STR_EFI_GLOBAL_VARIABLE), &gEfiGlobalVariableGuid, NULL },
-//
-// UEFI 2.2
-//
- {STRING_TOKEN(STR_IP6_SB), &gEfiIp6ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_IP6), &gEfiIp6ProtocolGuid, NULL},
- {STRING_TOKEN(STR_IP6_CONFIG), &gEfiIp6ConfigProtocolGuid, NULL},
- {STRING_TOKEN(STR_MTFTP6_SB), &gEfiMtftp6ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_MTFTP6), &gEfiMtftp6ProtocolGuid, NULL},
- {STRING_TOKEN(STR_DHCP6_SB), &gEfiDhcp6ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_DHCP6), &gEfiDhcp6ProtocolGuid, NULL},
- {STRING_TOKEN(STR_UDP6_SB), &gEfiUdp6ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_UDP6), &gEfiUdp6ProtocolGuid, NULL},
- {STRING_TOKEN(STR_TCP6_SB), &gEfiTcp6ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_TCP6), &gEfiTcp6ProtocolGuid, NULL},
- {STRING_TOKEN(STR_VLAN_CONFIG), &gEfiVlanConfigProtocolGuid, NULL},
- {STRING_TOKEN(STR_EAP), &gEfiEapProtocolGuid, NULL},
- {STRING_TOKEN(STR_EAP_MGMT), &gEfiEapManagementProtocolGuid, NULL},
- {STRING_TOKEN(STR_FTP4_SB), &gEfiFtp4ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_FTP4), &gEfiFtp4ProtocolGuid, NULL},
- {STRING_TOKEN(STR_IP_SEC_CONFIG), &gEfiIpSecConfigProtocolGuid, NULL},
- {STRING_TOKEN(STR_DH), &gEfiDriverHealthProtocolGuid, NULL},
- {STRING_TOKEN(STR_DEF_IMG_LOAD), &gEfiDeferredImageLoadProtocolGuid, NULL},
- {STRING_TOKEN(STR_USER_CRED), &gEfiUserCredentialProtocolGuid, NULL},
- {STRING_TOKEN(STR_USER_MNGR), &gEfiUserManagerProtocolGuid, NULL},
- {STRING_TOKEN(STR_ATA_PASS_THRU), &gEfiAtaPassThruProtocolGuid, NULL},
+ //
+ // UEFI 2.2
+ //
+ { STRING_TOKEN (STR_IP6_SB), &gEfiIp6ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IP6), &gEfiIp6ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IP6_CONFIG), &gEfiIp6ConfigProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MTFTP6_SB), &gEfiMtftp6ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MTFTP6), &gEfiMtftp6ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DHCP6_SB), &gEfiDhcp6ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DHCP6), &gEfiDhcp6ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UDP6_SB), &gEfiUdp6ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UDP6), &gEfiUdp6ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TCP6_SB), &gEfiTcp6ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TCP6), &gEfiTcp6ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_VLAN_CONFIG), &gEfiVlanConfigProtocolGuid, NULL },
+ { STRING_TOKEN (STR_EAP), &gEfiEapProtocolGuid, NULL },
+ { STRING_TOKEN (STR_EAP_MGMT), &gEfiEapManagementProtocolGuid, NULL },
+ { STRING_TOKEN (STR_FTP4_SB), &gEfiFtp4ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_FTP4), &gEfiFtp4ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IP_SEC_CONFIG), &gEfiIpSecConfigProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DH), &gEfiDriverHealthProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DEF_IMG_LOAD), &gEfiDeferredImageLoadProtocolGuid, NULL },
+ { STRING_TOKEN (STR_USER_CRED), &gEfiUserCredentialProtocolGuid, NULL },
+ { STRING_TOKEN (STR_USER_MNGR), &gEfiUserManagerProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ATA_PASS_THRU), &gEfiAtaPassThruProtocolGuid, NULL },
-//
-// UEFI 2.3
-//
- {STRING_TOKEN(STR_FW_MGMT), &gEfiFirmwareManagementProtocolGuid, FirmwareManagementDumpInformation},
- {STRING_TOKEN(STR_IP_SEC), &gEfiIpSecProtocolGuid, NULL},
- {STRING_TOKEN(STR_IP_SEC2), &gEfiIpSec2ProtocolGuid, NULL},
+ //
+ // UEFI 2.3
+ //
+ { STRING_TOKEN (STR_FW_MGMT), &gEfiFirmwareManagementProtocolGuid, FirmwareManagementDumpInformation },
+ { STRING_TOKEN (STR_IP_SEC), &gEfiIpSecProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IP_SEC2), &gEfiIpSec2ProtocolGuid, NULL },
-//
-// UEFI 2.3.1
-//
- {STRING_TOKEN(STR_KMS), &gEfiKmsProtocolGuid, NULL},
- {STRING_TOKEN(STR_BLK_IO2), &gEfiBlockIo2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_SSC), &gEfiStorageSecurityCommandProtocolGuid, NULL},
- {STRING_TOKEN(STR_UCRED2), &gEfiUserCredential2ProtocolGuid, NULL},
+ //
+ // UEFI 2.3.1
+ //
+ { STRING_TOKEN (STR_KMS), &gEfiKmsProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BLK_IO2), &gEfiBlockIo2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SSC), &gEfiStorageSecurityCommandProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UCRED2), &gEfiUserCredential2ProtocolGuid, NULL },
-//
-// UEFI 2.4
-//
- {STRING_TOKEN(STR_DISK_IO2), &gEfiDiskIo2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_ADAPTER_INFO), &gEfiAdapterInformationProtocolGuid, AdapterInformationDumpInformation},
+ //
+ // UEFI 2.4
+ //
+ { STRING_TOKEN (STR_DISK_IO2), &gEfiDiskIo2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ADAPTER_INFO), &gEfiAdapterInformationProtocolGuid, AdapterInformationDumpInformation },
-//
-// UEFI2.5
-//
- {STRING_TOKEN(STR_TLS_SB), &gEfiTlsServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_TLS), &gEfiTlsProtocolGuid, NULL},
- {STRING_TOKEN(STR_TLS_CONFIG), &gEfiTlsConfigurationProtocolGuid, NULL},
- {STRING_TOKEN(STR_SUPPLICANT_SB), &gEfiSupplicantServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_SUPPLICANT), &gEfiSupplicantProtocolGuid, NULL},
+ //
+ // UEFI2.5
+ //
+ { STRING_TOKEN (STR_TLS_SB), &gEfiTlsServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TLS), &gEfiTlsProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TLS_CONFIG), &gEfiTlsConfigurationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SUPPLICANT_SB), &gEfiSupplicantServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SUPPLICANT), &gEfiSupplicantProtocolGuid, NULL },
-//
-// UEFI2.6
-//
- {STRING_TOKEN(STR_WIFI2), &gEfiWiFi2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_RAMDISK), &gEfiRamDiskProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_ID), &gEfiHiiImageDecoderProtocolGuid, NULL},
- {STRING_TOKEN(STR_HII_IE), &gEfiHiiImageExProtocolGuid, NULL},
- {STRING_TOKEN(STR_SD_MPT), &gEfiSdMmcPassThruProtocolGuid, NULL},
- {STRING_TOKEN(STR_ERASE_BLOCK), &gEfiEraseBlockProtocolGuid, NULL},
+ //
+ // UEFI2.6
+ //
+ { STRING_TOKEN (STR_WIFI2), &gEfiWiFi2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_RAMDISK), &gEfiRamDiskProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_ID), &gEfiHiiImageDecoderProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HII_IE), &gEfiHiiImageExProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SD_MPT), &gEfiSdMmcPassThruProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ERASE_BLOCK), &gEfiEraseBlockProtocolGuid, NULL },
-//
-// UEFI2.7
-//
- {STRING_TOKEN(STR_BLUETOOTH_ATTR), &gEfiBluetoothAttributeProtocolGuid, NULL},
- {STRING_TOKEN(STR_BLUETOOTH_ATTR_SB), &gEfiBluetoothAttributeServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_BLUETOOTH_LE_CONFIG), &gEfiBluetoothLeConfigProtocolGuid, NULL},
- {STRING_TOKEN(STR_UFS_DEV_CONFIG), &gEfiUfsDeviceConfigProtocolGuid, NULL},
- {STRING_TOKEN(STR_HTTP_BOOT_CALL), &gEfiHttpBootCallbackProtocolGuid, NULL},
- {STRING_TOKEN(STR_RESET_NOTI), &gEfiResetNotificationProtocolGuid, NULL},
- {STRING_TOKEN(STR_PARTITION_INFO), &gEfiPartitionInfoProtocolGuid, PartitionInfoProtocolDumpInformation},
- {STRING_TOKEN(STR_HII_POPUP), &gEfiHiiPopupProtocolGuid, NULL},
+ //
+ // UEFI2.7
+ //
+ { STRING_TOKEN (STR_BLUETOOTH_ATTR), &gEfiBluetoothAttributeProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BLUETOOTH_ATTR_SB), &gEfiBluetoothAttributeServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BLUETOOTH_LE_CONFIG), &gEfiBluetoothLeConfigProtocolGuid, NULL },
+ { STRING_TOKEN (STR_UFS_DEV_CONFIG), &gEfiUfsDeviceConfigProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HTTP_BOOT_CALL), &gEfiHttpBootCallbackProtocolGuid, NULL },
+ { STRING_TOKEN (STR_RESET_NOTI), &gEfiResetNotificationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PARTITION_INFO), &gEfiPartitionInfoProtocolGuid, PartitionInfoProtocolDumpInformation },
+ { STRING_TOKEN (STR_HII_POPUP), &gEfiHiiPopupProtocolGuid, NULL },
-//
-// UEFI 2.8
-//
- {STRING_TOKEN(STR_REST_EX), &gEfiRestExProtocolGuid, NULL},
- {STRING_TOKEN(STR_REDFISH_DISCOVER), &gEfiRedfishDiscoverProtocolGuid, NULL},
+ //
+ // UEFI 2.8
+ //
+ { STRING_TOKEN (STR_REST_EX), &gEfiRestExProtocolGuid, NULL },
+ { STRING_TOKEN (STR_REDFISH_DISCOVER), &gEfiRedfishDiscoverProtocolGuid, NULL },
-//
-// PI Spec ones
-//
- {STRING_TOKEN(STR_IDE_CONT_INIT), &gEfiIdeControllerInitProtocolGuid, NULL},
- {STRING_TOKEN(STR_DISK_INFO), &gEfiDiskInfoProtocolGuid, NULL},
+ //
+ // PI Spec ones
+ //
+ { STRING_TOKEN (STR_IDE_CONT_INIT), &gEfiIdeControllerInitProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DISK_INFO), &gEfiDiskInfoProtocolGuid, NULL },
-//
-// PI Spec 1.0
-//
- {STRING_TOKEN(STR_BDS_ARCH), &gEfiBdsArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_CPU_ARCH), &gEfiCpuArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MET_ARCH), &gEfiMetronomeArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MON_ARCH), &gEfiMonotonicCounterArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_RTC_ARCH), &gEfiRealTimeClockArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_RESET_ARCH), &gEfiResetArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_RT_ARCH), &gEfiRuntimeArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_SEC_ARCH), &gEfiSecurityArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_TIMER_ARCH), &gEfiTimerArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_VAR_ARCH), &gEfiVariableWriteArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_V_ARCH), &gEfiVariableArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_SECP), &gEfiSecurityPolicyProtocolGuid, NULL},
- {STRING_TOKEN(STR_WDT_ARCH), &gEfiWatchdogTimerArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_SCR), &gEfiStatusCodeRuntimeProtocolGuid, NULL},
- {STRING_TOKEN(STR_SMB_HC), &gEfiSmbusHcProtocolGuid, NULL},
- {STRING_TOKEN(STR_FV_2), &gEfiFirmwareVolume2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_FV_BLOCK), &gEfiFirmwareVolumeBlockProtocolGuid, NULL},
- {STRING_TOKEN(STR_CAP_ARCH), &gEfiCapsuleArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MP_SERVICE), &gEfiMpServiceProtocolGuid, NULL},
- {STRING_TOKEN(STR_HBRAP), &gEfiPciHostBridgeResourceAllocationProtocolGuid, NULL},
- {STRING_TOKEN(STR_PCIP), &gEfiPciPlatformProtocolGuid, NULL},
- {STRING_TOKEN(STR_PCIO), &gEfiPciOverrideProtocolGuid, NULL},
- {STRING_TOKEN(STR_PCIE), &gEfiPciEnumerationCompleteProtocolGuid, NULL},
- {STRING_TOKEN(STR_IPCID), &gEfiIncompatiblePciDeviceSupportProtocolGuid, NULL},
- {STRING_TOKEN(STR_PCIHPI), &gEfiPciHotPlugInitProtocolGuid, NULL},
- {STRING_TOKEN(STR_PCIHPR), &gEfiPciHotPlugRequestProtocolGuid, NULL},
- {STRING_TOKEN(STR_SMBIOS), &gEfiSmbiosProtocolGuid, NULL},
- {STRING_TOKEN(STR_S3_SAVE), &gEfiS3SaveStateProtocolGuid, NULL},
- {STRING_TOKEN(STR_S3_S_SMM), &gEfiS3SmmSaveStateProtocolGuid, NULL},
- {STRING_TOKEN(STR_RSC), &gEfiRscHandlerProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_RSC), &gEfiSmmRscHandlerProtocolGuid, NULL},
- {STRING_TOKEN(STR_ACPI_SDT), &gEfiAcpiSdtProtocolGuid, NULL},
- {STRING_TOKEN(STR_SIO), &gEfiSioProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_CPU2), &gEfiSmmCpuIo2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_BASE2), &gEfiSmmBase2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_ACC_2), &gEfiSmmAccess2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_CON_2), &gEfiSmmControl2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_CONFIG), &gEfiSmmConfigurationProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_RTL), &gEfiSmmReadyToLockProtocolGuid, NULL},
- {STRING_TOKEN(STR_DS_RTL), &gEfiDxeSmmReadyToLockProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_COMM), &gEfiSmmCommunicationProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_STAT), &gEfiSmmStatusCodeProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_CPU), &gEfiSmmCpuProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_PCIRBIO), &gEfiSmmPciRootBridgeIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_SWD), &gEfiSmmSwDispatch2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_SXD), &gEfiSmmSxDispatch2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_PTD2), &gEfiSmmPeriodicTimerDispatch2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_UD2), &gEfiSmmUsbDispatch2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_GD2), &gEfiSmmGpiDispatch2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_SBD2), &gEfiSmmStandbyButtonDispatch2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_PBD2), &gEfiSmmPowerButtonDispatch2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S_ITD2), &gEfiSmmIoTrapDispatch2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_PCD), &gEfiPcdProtocolGuid, NULL},
- {STRING_TOKEN(STR_FVB2), &gEfiFirmwareVolumeBlock2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_CPUIO2), &gEfiCpuIo2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_LEGACY_R2), &gEfiLegacyRegion2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_S2ARCH), &gEfiSecurity2ArchProtocolGuid, NULL},
- {STRING_TOKEN(STR_EODXE), &gEfiSmmEndOfDxeProtocolGuid, NULL},
- {STRING_TOKEN(STR_ISAHC), &gEfiIsaHcProtocolGuid, NULL},
- {STRING_TOKEN(STR_ISAHC_B), &gEfiIsaHcServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_SIO_C), &gEfiSioControlProtocolGuid, NULL},
- {STRING_TOKEN(STR_GET_PCD), &gEfiGetPcdInfoProtocolGuid, NULL},
- {STRING_TOKEN(STR_I2C_M), &gEfiI2cMasterProtocolGuid, NULL},
- {STRING_TOKEN(STR_I2CIO), &gEfiI2cIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_I2CEN), &gEfiI2cEnumerateProtocolGuid, NULL},
- {STRING_TOKEN(STR_I2C_H), &gEfiI2cHostProtocolGuid, NULL},
- {STRING_TOKEN(STR_I2C_BCM), &gEfiI2cBusConfigurationManagementProtocolGuid, NULL},
- {STRING_TOKEN(STR_TCG2), &gEfiTcg2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_TIMESTAMP), &gEfiTimestampProtocolGuid, NULL},
- {STRING_TOKEN(STR_RNG), &gEfiRngProtocolGuid, NULL},
- {STRING_TOKEN(STR_NVMEPT), &gEfiNvmExpressPassThruProtocolGuid, NULL},
- {STRING_TOKEN(STR_H2_SB), &gEfiHash2ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_HASH2), &gEfiHash2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_BIO_C), &gEfiBlockIoCryptoProtocolGuid, NULL},
- {STRING_TOKEN(STR_SCR), &gEfiSmartCardReaderProtocolGuid, NULL},
- {STRING_TOKEN(STR_SCE), &gEfiSmartCardEdgeProtocolGuid, NULL},
- {STRING_TOKEN(STR_USB_FIO), &gEfiUsbFunctionIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_BC_HC), &gEfiBluetoothHcProtocolGuid, NULL},
- {STRING_TOKEN(STR_BC_IO_SB), &gEfiBluetoothIoServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_BC_IO), &gEfiBluetoothIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_BC_C), &gEfiBluetoothConfigProtocolGuid, NULL},
- {STRING_TOKEN(STR_REG_EXP), &gEfiRegularExpressionProtocolGuid, NULL},
- {STRING_TOKEN(STR_B_MGR_P), &gEfiBootManagerPolicyProtocolGuid, NULL},
- {STRING_TOKEN(STR_CKH), &gEfiConfigKeywordHandlerProtocolGuid, NULL},
- {STRING_TOKEN(STR_WIFI), &gEfiWiFiProtocolGuid, NULL},
- {STRING_TOKEN(STR_EAP_M), &gEfiEapManagement2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_EAP_C), &gEfiEapConfigurationProtocolGuid, NULL},
- {STRING_TOKEN(STR_PKCS7), &gEfiPkcs7VerifyProtocolGuid, NULL},
- {STRING_TOKEN(STR_NET_DNS4_SB), &gEfiDns4ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_NET_DNS4), &gEfiDns4ProtocolGuid, NULL},
- {STRING_TOKEN(STR_NET_DNS6_SB), &gEfiDns6ServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_NET_DNS6), &gEfiDns6ProtocolGuid, NULL},
- {STRING_TOKEN(STR_NET_HTTP_SB), &gEfiHttpServiceBindingProtocolGuid, NULL},
- {STRING_TOKEN(STR_NET_HTTP), &gEfiHttpProtocolGuid, NULL},
- {STRING_TOKEN(STR_NET_HTTP_U), &gEfiHttpUtilitiesProtocolGuid, NULL},
- {STRING_TOKEN(STR_REST), &gEfiRestProtocolGuid, NULL},
+ //
+ // PI Spec 1.0
+ //
+ { STRING_TOKEN (STR_BDS_ARCH), &gEfiBdsArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_CPU_ARCH), &gEfiCpuArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MET_ARCH), &gEfiMetronomeArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MON_ARCH), &gEfiMonotonicCounterArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_RTC_ARCH), &gEfiRealTimeClockArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_RESET_ARCH), &gEfiResetArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_RT_ARCH), &gEfiRuntimeArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SEC_ARCH), &gEfiSecurityArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TIMER_ARCH), &gEfiTimerArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_VAR_ARCH), &gEfiVariableWriteArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_V_ARCH), &gEfiVariableArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SECP), &gEfiSecurityPolicyProtocolGuid, NULL },
+ { STRING_TOKEN (STR_WDT_ARCH), &gEfiWatchdogTimerArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SCR), &gEfiStatusCodeRuntimeProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SMB_HC), &gEfiSmbusHcProtocolGuid, NULL },
+ { STRING_TOKEN (STR_FV_2), &gEfiFirmwareVolume2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_FV_BLOCK), &gEfiFirmwareVolumeBlockProtocolGuid, NULL },
+ { STRING_TOKEN (STR_CAP_ARCH), &gEfiCapsuleArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MP_SERVICE), &gEfiMpServiceProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HBRAP), &gEfiPciHostBridgeResourceAllocationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PCIP), &gEfiPciPlatformProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PCIO), &gEfiPciOverrideProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PCIE), &gEfiPciEnumerationCompleteProtocolGuid, NULL },
+ { STRING_TOKEN (STR_IPCID), &gEfiIncompatiblePciDeviceSupportProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PCIHPI), &gEfiPciHotPlugInitProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PCIHPR), &gEfiPciHotPlugRequestProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SMBIOS), &gEfiSmbiosProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S3_SAVE), &gEfiS3SaveStateProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S3_S_SMM), &gEfiS3SmmSaveStateProtocolGuid, NULL },
+ { STRING_TOKEN (STR_RSC), &gEfiRscHandlerProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_RSC), &gEfiSmmRscHandlerProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ACPI_SDT), &gEfiAcpiSdtProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SIO), &gEfiSioProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_CPU2), &gEfiSmmCpuIo2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_BASE2), &gEfiSmmBase2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_ACC_2), &gEfiSmmAccess2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_CON_2), &gEfiSmmControl2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_CONFIG), &gEfiSmmConfigurationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_RTL), &gEfiSmmReadyToLockProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DS_RTL), &gEfiDxeSmmReadyToLockProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_COMM), &gEfiSmmCommunicationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_STAT), &gEfiSmmStatusCodeProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_CPU), &gEfiSmmCpuProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_PCIRBIO), &gEfiSmmPciRootBridgeIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_SWD), &gEfiSmmSwDispatch2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_SXD), &gEfiSmmSxDispatch2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_PTD2), &gEfiSmmPeriodicTimerDispatch2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_UD2), &gEfiSmmUsbDispatch2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_GD2), &gEfiSmmGpiDispatch2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_SBD2), &gEfiSmmStandbyButtonDispatch2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_PBD2), &gEfiSmmPowerButtonDispatch2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S_ITD2), &gEfiSmmIoTrapDispatch2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PCD), &gEfiPcdProtocolGuid, NULL },
+ { STRING_TOKEN (STR_FVB2), &gEfiFirmwareVolumeBlock2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_CPUIO2), &gEfiCpuIo2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_LEGACY_R2), &gEfiLegacyRegion2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_S2ARCH), &gEfiSecurity2ArchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_EODXE), &gEfiSmmEndOfDxeProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ISAHC), &gEfiIsaHcProtocolGuid, NULL },
+ { STRING_TOKEN (STR_ISAHC_B), &gEfiIsaHcServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SIO_C), &gEfiSioControlProtocolGuid, NULL },
+ { STRING_TOKEN (STR_GET_PCD), &gEfiGetPcdInfoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_I2C_M), &gEfiI2cMasterProtocolGuid, NULL },
+ { STRING_TOKEN (STR_I2CIO), &gEfiI2cIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_I2CEN), &gEfiI2cEnumerateProtocolGuid, NULL },
+ { STRING_TOKEN (STR_I2C_H), &gEfiI2cHostProtocolGuid, NULL },
+ { STRING_TOKEN (STR_I2C_BCM), &gEfiI2cBusConfigurationManagementProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TCG2), &gEfiTcg2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_TIMESTAMP), &gEfiTimestampProtocolGuid, NULL },
+ { STRING_TOKEN (STR_RNG), &gEfiRngProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NVMEPT), &gEfiNvmExpressPassThruProtocolGuid, NULL },
+ { STRING_TOKEN (STR_H2_SB), &gEfiHash2ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_HASH2), &gEfiHash2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BIO_C), &gEfiBlockIoCryptoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SCR), &gEfiSmartCardReaderProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SCE), &gEfiSmartCardEdgeProtocolGuid, NULL },
+ { STRING_TOKEN (STR_USB_FIO), &gEfiUsbFunctionIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BC_HC), &gEfiBluetoothHcProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BC_IO_SB), &gEfiBluetoothIoServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BC_IO), &gEfiBluetoothIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_BC_C), &gEfiBluetoothConfigProtocolGuid, NULL },
+ { STRING_TOKEN (STR_REG_EXP), &gEfiRegularExpressionProtocolGuid, NULL },
+ { STRING_TOKEN (STR_B_MGR_P), &gEfiBootManagerPolicyProtocolGuid, NULL },
+ { STRING_TOKEN (STR_CKH), &gEfiConfigKeywordHandlerProtocolGuid, NULL },
+ { STRING_TOKEN (STR_WIFI), &gEfiWiFiProtocolGuid, NULL },
+ { STRING_TOKEN (STR_EAP_M), &gEfiEapManagement2ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_EAP_C), &gEfiEapConfigurationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_PKCS7), &gEfiPkcs7VerifyProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NET_DNS4_SB), &gEfiDns4ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NET_DNS4), &gEfiDns4ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NET_DNS6_SB), &gEfiDns6ServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NET_DNS6), &gEfiDns6ProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NET_HTTP_SB), &gEfiHttpServiceBindingProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NET_HTTP), &gEfiHttpProtocolGuid, NULL },
+ { STRING_TOKEN (STR_NET_HTTP_U), &gEfiHttpUtilitiesProtocolGuid, NULL },
+ { STRING_TOKEN (STR_REST), &gEfiRestProtocolGuid, NULL },
-//
-// PI 1.5
-//
- {STRING_TOKEN(STR_MM_EOD), &gEfiMmEndOfDxeProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_ITD), &gEfiMmIoTrapDispatchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_PBD), &gEfiMmPowerButtonDispatchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_SBD), &gEfiMmStandbyButtonDispatchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_GD), &gEfiMmGpiDispatchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_UD), &gEfiMmUsbDispatchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_PTD), &gEfiMmPeriodicTimerDispatchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_SXD), &gEfiMmSxDispatchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_SWD), &gEfiMmSwDispatchProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_PRBI), &gEfiMmPciRootBridgeIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_CPU), &gEfiMmCpuProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_STACODE), &gEfiMmStatusCodeProtocolGuid, NULL},
- {STRING_TOKEN(STR_DXEMM_RTL), &gEfiDxeMmReadyToLockProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_CONFIG), &gEfiMmConfigurationProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_RTL), &gEfiMmReadyToLockProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_CONTROL), &gEfiMmControlProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_ACCESS), &gEfiMmAccessProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_BASE), &gEfiMmBaseProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_CPUIO), &gEfiMmCpuIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_RH), &gEfiMmRscHandlerProtocolGuid, NULL},
- {STRING_TOKEN(STR_MM_COM), &gEfiMmCommunicationProtocolGuid, NULL},
+ //
+ // PI 1.5
+ //
+ { STRING_TOKEN (STR_MM_EOD), &gEfiMmEndOfDxeProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_ITD), &gEfiMmIoTrapDispatchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_PBD), &gEfiMmPowerButtonDispatchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_SBD), &gEfiMmStandbyButtonDispatchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_GD), &gEfiMmGpiDispatchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_UD), &gEfiMmUsbDispatchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_PTD), &gEfiMmPeriodicTimerDispatchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_SXD), &gEfiMmSxDispatchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_SWD), &gEfiMmSwDispatchProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_PRBI), &gEfiMmPciRootBridgeIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_CPU), &gEfiMmCpuProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_STACODE), &gEfiMmStatusCodeProtocolGuid, NULL },
+ { STRING_TOKEN (STR_DXEMM_RTL), &gEfiDxeMmReadyToLockProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_CONFIG), &gEfiMmConfigurationProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_RTL), &gEfiMmReadyToLockProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_CONTROL), &gEfiMmControlProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_ACCESS), &gEfiMmAccessProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_BASE), &gEfiMmBaseProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_CPUIO), &gEfiMmCpuIoProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_RH), &gEfiMmRscHandlerProtocolGuid, NULL },
+ { STRING_TOKEN (STR_MM_COM), &gEfiMmCommunicationProtocolGuid, NULL },
-//
-// UEFI Shell Spec 2.0
-//
- {STRING_TOKEN(STR_SHELL_PARAMETERS), &gEfiShellParametersProtocolGuid, NULL},
- {STRING_TOKEN(STR_SHELL), &gEfiShellProtocolGuid, NULL},
+ //
+ // UEFI Shell Spec 2.0
+ //
+ { STRING_TOKEN (STR_SHELL_PARAMETERS), &gEfiShellParametersProtocolGuid, NULL },
+ { STRING_TOKEN (STR_SHELL), &gEfiShellProtocolGuid, NULL },
-//
-// UEFI Shell Spec 2.1
-//
- {STRING_TOKEN(STR_SHELL_DYNAMIC), &gEfiShellDynamicCommandProtocolGuid, NULL},
+ //
+ // UEFI Shell Spec 2.1
+ //
+ { STRING_TOKEN (STR_SHELL_DYNAMIC), &gEfiShellDynamicCommandProtocolGuid, NULL },
-//
-// Misc
-//
- {STRING_TOKEN(STR_PCDINFOPROT), &gGetPcdInfoProtocolGuid, NULL},
+ //
+ // Misc
+ //
+ { STRING_TOKEN (STR_PCDINFOPROT), &gGetPcdInfoProtocolGuid, NULL },
-//
-// terminator
-//
- {0, NULL, NULL},
+ //
+ // terminator
+ //
+ { 0, NULL, NULL },
};
/**
@@ -2419,33 +2509,35 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = { @return The node.
**/
CONST GUID_INFO_BLOCK *
-InternalShellGetNodeFromGuid(
- IN CONST EFI_GUID* Guid
+InternalShellGetNodeFromGuid (
+ IN CONST EFI_GUID *Guid
)
{
- CONST GUID_INFO_BLOCK *ListWalker;
- UINTN LoopCount;
+ CONST GUID_INFO_BLOCK *ListWalker;
+ UINTN LoopCount;
- ASSERT(Guid != NULL);
+ ASSERT (Guid != NULL);
for (LoopCount = 0, ListWalker = mGuidList; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++, ListWalker++) {
- if (CompareGuid(ListWalker->GuidId, Guid)) {
+ if (CompareGuid (ListWalker->GuidId, Guid)) {
return (ListWalker);
}
}
- if (PcdGetBool(PcdShellIncludeNtGuids)) {
- for (ListWalker = mGuidStringListNT ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) {
- if (CompareGuid(ListWalker->GuidId, Guid)) {
+ if (PcdGetBool (PcdShellIncludeNtGuids)) {
+ for (ListWalker = mGuidStringListNT; ListWalker != NULL && ListWalker->GuidId != NULL; ListWalker++) {
+ if (CompareGuid (ListWalker->GuidId, Guid)) {
return (ListWalker);
}
}
}
- for (ListWalker = mGuidStringList ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) {
- if (CompareGuid(ListWalker->GuidId, Guid)) {
+
+ for (ListWalker = mGuidStringList; ListWalker != NULL && ListWalker->GuidId != NULL; ListWalker++) {
+ if (CompareGuid (ListWalker->GuidId, Guid)) {
return (ListWalker);
}
}
+
return (NULL);
}
@@ -2462,10 +2554,10 @@ Function to add a new GUID/Name mapping. @retval EFI_INVALID_PARAMETER Guid NameId was invalid
**/
EFI_STATUS
-InsertNewGuidNameMapping(
- IN CONST EFI_GUID *Guid,
- IN CONST EFI_STRING_ID NameID,
- IN CONST DUMP_PROTOCOL_INFO DumpFunc OPTIONAL
+InsertNewGuidNameMapping (
+ IN CONST EFI_GUID *Guid,
+ IN CONST EFI_STRING_ID NameID,
+ IN CONST DUMP_PROTOCOL_INFO DumpFunc OPTIONAL
)
{
ASSERT (Guid != NULL);
@@ -2480,6 +2572,7 @@ InsertNewGuidNameMapping( mGuidListCount = 0;
return (EFI_OUT_OF_RESOURCES);
}
+
mGuidListCount++;
mGuidList[mGuidListCount - 1].GuidId = AllocateCopyPool (sizeof (EFI_GUID), Guid);
@@ -2509,30 +2602,30 @@ InsertNewGuidNameMapping( **/
EFI_STATUS
EFIAPI
-AddNewGuidNameMapping(
- IN CONST EFI_GUID *Guid,
- IN CONST CHAR16 *TheName,
- IN CONST CHAR8 *Lang OPTIONAL
+AddNewGuidNameMapping (
+ IN CONST EFI_GUID *Guid,
+ IN CONST CHAR16 *TheName,
+ IN CONST CHAR8 *Lang OPTIONAL
)
{
- EFI_STRING_ID NameID;
+ EFI_STRING_ID NameID;
- HandleParsingHiiInit();
+ HandleParsingHiiInit ();
- if (Guid == NULL || TheName == NULL){
+ if ((Guid == NULL) || (TheName == NULL)) {
return (EFI_INVALID_PARAMETER);
}
- if ((InternalShellGetNodeFromGuid(Guid)) != NULL) {
+ if ((InternalShellGetNodeFromGuid (Guid)) != NULL) {
return (EFI_ACCESS_DENIED);
}
- NameID = HiiSetString(mHandleParsingHiiHandle, 0, (CHAR16*)TheName, Lang);
+ NameID = HiiSetString (mHandleParsingHiiHandle, 0, (CHAR16 *)TheName, Lang);
if (NameID == 0) {
return (EFI_OUT_OF_RESOURCES);
}
- return (InsertNewGuidNameMapping(Guid, NameID, NULL));
+ return (InsertNewGuidNameMapping (Guid, NameID, NULL));
}
/**
@@ -2546,21 +2639,22 @@ AddNewGuidNameMapping( @return pointer to string of the name. The caller
is responsible to free this memory.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-GetStringNameFromGuid(
- IN CONST EFI_GUID *Guid,
- IN CONST CHAR8 *Lang OPTIONAL
+GetStringNameFromGuid (
+ IN CONST EFI_GUID *Guid,
+ IN CONST CHAR8 *Lang OPTIONAL
)
{
- CONST GUID_INFO_BLOCK *Id;
+ CONST GUID_INFO_BLOCK *Id;
- HandleParsingHiiInit();
+ HandleParsingHiiInit ();
- Id = InternalShellGetNodeFromGuid(Guid);
+ Id = InternalShellGetNodeFromGuid (Guid);
if (Id == NULL) {
return NULL;
}
+
return HiiGetString (mHandleParsingHiiHandle, Id->StringId, Lang);
}
@@ -2580,27 +2674,28 @@ GetStringNameFromGuid( @return The pointer to string.
@retval NULL An error was encountered.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-GetProtocolInformationDump(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST EFI_GUID *Guid,
- IN CONST BOOLEAN Verbose
+GetProtocolInformationDump (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST EFI_GUID *Guid,
+ IN CONST BOOLEAN Verbose
)
{
- CONST GUID_INFO_BLOCK *Id;
+ CONST GUID_INFO_BLOCK *Id;
- ASSERT(TheHandle != NULL);
- ASSERT(Guid != NULL);
+ ASSERT (TheHandle != NULL);
+ ASSERT (Guid != NULL);
- if (TheHandle == NULL || Guid == NULL) {
+ if ((TheHandle == NULL) || (Guid == NULL)) {
return (NULL);
}
- Id = InternalShellGetNodeFromGuid(Guid);
- if (Id != NULL && Id->DumpInfo != NULL) {
- return (Id->DumpInfo(TheHandle, Verbose));
+ Id = InternalShellGetNodeFromGuid (Guid);
+ if ((Id != NULL) && (Id->DumpInfo != NULL)) {
+ return (Id->DumpInfo (TheHandle, Verbose));
}
+
return (NULL);
}
@@ -2617,53 +2712,58 @@ GetProtocolInformationDump( **/
EFI_STATUS
EFIAPI
-GetGuidFromStringName(
- IN CONST CHAR16 *Name,
- IN CONST CHAR8 *Lang OPTIONAL,
- OUT EFI_GUID **Guid
+GetGuidFromStringName (
+ IN CONST CHAR16 *Name,
+ IN CONST CHAR8 *Lang OPTIONAL,
+ OUT EFI_GUID **Guid
)
{
CONST GUID_INFO_BLOCK *ListWalker;
- CHAR16 *String;
+ CHAR16 *String;
UINTN LoopCount;
- HandleParsingHiiInit();
+ HandleParsingHiiInit ();
- ASSERT(Guid != NULL);
+ ASSERT (Guid != NULL);
if (Guid == NULL) {
return (EFI_INVALID_PARAMETER);
}
+
*Guid = NULL;
- if (PcdGetBool(PcdShellIncludeNtGuids)) {
- for (ListWalker = mGuidStringListNT ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) {
- String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang);
- if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) {
+ if (PcdGetBool (PcdShellIncludeNtGuids)) {
+ for (ListWalker = mGuidStringListNT; ListWalker != NULL && ListWalker->GuidId != NULL; ListWalker++) {
+ String = HiiGetString (mHandleParsingHiiHandle, ListWalker->StringId, Lang);
+ if ((Name != NULL) && (String != NULL) && (StringNoCaseCompare (&Name, &String) == 0)) {
*Guid = ListWalker->GuidId;
}
- SHELL_FREE_NON_NULL(String);
+
+ SHELL_FREE_NON_NULL (String);
if (*Guid != NULL) {
return (EFI_SUCCESS);
}
}
}
- for (ListWalker = mGuidStringList ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) {
- String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang);
- if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) {
+
+ for (ListWalker = mGuidStringList; ListWalker != NULL && ListWalker->GuidId != NULL; ListWalker++) {
+ String = HiiGetString (mHandleParsingHiiHandle, ListWalker->StringId, Lang);
+ if ((Name != NULL) && (String != NULL) && (StringNoCaseCompare (&Name, &String) == 0)) {
*Guid = ListWalker->GuidId;
}
- SHELL_FREE_NON_NULL(String);
+
+ SHELL_FREE_NON_NULL (String);
if (*Guid != NULL) {
return (EFI_SUCCESS);
}
}
for (LoopCount = 0, ListWalker = mGuidList; mGuidList != NULL && LoopCount < mGuidListCount; LoopCount++, ListWalker++) {
- String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang);
- if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) {
+ String = HiiGetString (mHandleParsingHiiHandle, ListWalker->StringId, Lang);
+ if ((Name != NULL) && (String != NULL) && (StringNoCaseCompare (&Name, &String) == 0)) {
*Guid = ListWalker->GuidId;
}
- SHELL_FREE_NON_NULL(String);
+
+ SHELL_FREE_NON_NULL (String);
if (*Guid != NULL) {
return (EFI_SUCCESS);
}
@@ -2693,12 +2793,12 @@ GetBestLanguageForDriver ( IN BOOLEAN Iso639Language
)
{
- CHAR8 *LanguageVariable;
- CHAR8 *BestLanguage;
+ CHAR8 *LanguageVariable;
+ CHAR8 *BestLanguage;
- GetVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", &gEfiGlobalVariableGuid, (VOID**)&LanguageVariable, NULL);
+ GetVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", &gEfiGlobalVariableGuid, (VOID **)&LanguageVariable, NULL);
- BestLanguage = GetBestLanguage(
+ BestLanguage = GetBestLanguage (
SupportedLanguages,
Iso639Language,
(InputLanguage != NULL) ? InputLanguage : "",
@@ -2724,11 +2824,11 @@ GetBestLanguageForDriver ( @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(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST CHAR8 *Language
+GetStringNameFromHandle (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST CHAR8 *Language
)
{
EFI_COMPONENT_NAME2_PROTOCOL *CompNameStruct;
@@ -2738,41 +2838,47 @@ GetStringNameFromHandle( BestLang = NULL;
- Status = gBS->OpenProtocol(
- TheHandle,
- &gEfiComponentName2ProtocolGuid,
- (VOID**)&CompNameStruct,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status)) {
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiComponentName2ProtocolGuid,
+ (VOID **)&CompNameStruct,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE);
- Status = CompNameStruct->GetDriverName(CompNameStruct, BestLang, &RetVal);
+ Status = CompNameStruct->GetDriverName (CompNameStruct, BestLang, &RetVal);
if (BestLang != NULL) {
FreePool (BestLang);
BestLang = NULL;
}
- if (!EFI_ERROR(Status)) {
+
+ if (!EFI_ERROR (Status)) {
return (RetVal);
}
}
- Status = gBS->OpenProtocol(
- TheHandle,
- &gEfiComponentNameProtocolGuid,
- (VOID**)&CompNameStruct,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status)) {
+
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiComponentNameProtocolGuid,
+ (VOID **)&CompNameStruct,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE);
- Status = CompNameStruct->GetDriverName(CompNameStruct, BestLang, &RetVal);
+ Status = CompNameStruct->GetDriverName (CompNameStruct, BestLang, &RetVal);
if (BestLang != NULL) {
FreePool (BestLang);
}
- if (!EFI_ERROR(Status)) {
+
+ if (!EFI_ERROR (Status)) {
return (RetVal);
}
}
+
return (NULL);
}
@@ -2783,7 +2889,7 @@ GetStringNameFromHandle( @retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
-InternalShellInitHandleList(
+InternalShellInitHandleList (
VOID
)
{
@@ -2795,28 +2901,31 @@ InternalShellInitHandleList( if (mHandleList.NextIndex != 0) {
return EFI_SUCCESS;
}
- InitializeListHead(&mHandleList.List.Link);
+
+ InitializeListHead (&mHandleList.List.Link);
mHandleList.NextIndex = 1;
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- ASSERT_EFI_ERROR(Status);
- if (EFI_ERROR(Status)) {
+ Status = gBS->LocateHandleBuffer (
+ AllHandles,
+ NULL,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
return (Status);
}
- for (mHandleList.NextIndex = 1 ; mHandleList.NextIndex <= HandleCount ; mHandleList.NextIndex++){
- ListWalker = AllocateZeroPool(sizeof(HANDLE_LIST));
+
+ for (mHandleList.NextIndex = 1; mHandleList.NextIndex <= HandleCount; mHandleList.NextIndex++) {
+ ListWalker = AllocateZeroPool (sizeof (HANDLE_LIST));
if (ListWalker != NULL) {
ListWalker->TheHandle = HandleBuffer[mHandleList.NextIndex - 1];
- ListWalker->TheIndex = mHandleList.NextIndex;
+ ListWalker->TheIndex = mHandleList.NextIndex;
InsertTailList (&mHandleList.List.Link, &ListWalker->Link);
}
}
- FreePool(HandleBuffer);
+
+ FreePool (HandleBuffer);
return (EFI_SUCCESS);
}
@@ -2833,8 +2942,8 @@ InternalShellInitHandleList( **/
UINTN
EFIAPI
-ConvertHandleToHandleIndex(
- IN CONST EFI_HANDLE TheHandle
+ConvertHandleToHandleIndex (
+ IN CONST EFI_HANDLE TheHandle
)
{
EFI_STATUS Status;
@@ -2846,17 +2955,18 @@ ConvertHandleToHandleIndex( return 0;
}
- InternalShellInitHandleList();
+ InternalShellInitHandleList ();
- for (ListWalker = (HANDLE_LIST*)GetFirstNode(&mHandleList.List.Link)
- ; !IsNull(&mHandleList.List.Link,&ListWalker->Link)
- ; ListWalker = (HANDLE_LIST*)GetNextNode(&mHandleList.List.Link,&ListWalker->Link)
- ){
+ for (ListWalker = (HANDLE_LIST *)GetFirstNode (&mHandleList.List.Link)
+ ; !IsNull (&mHandleList.List.Link, &ListWalker->Link)
+ ; ListWalker = (HANDLE_LIST *)GetNextNode (&mHandleList.List.Link, &ListWalker->Link)
+ )
+ {
if (ListWalker->TheHandle == TheHandle) {
//
// Verify that TheHandle is still present in the Handle Database
//
- Status = gBS->ProtocolsPerHandle(TheHandle, &ProtocolBuffer, &ProtocolCount);
+ Status = gBS->ProtocolsPerHandle (TheHandle, &ProtocolBuffer, &ProtocolCount);
if (EFI_ERROR (Status)) {
//
// TheHandle is not present in the Handle Database, so delete from the handle list
@@ -2864,6 +2974,7 @@ ConvertHandleToHandleIndex( RemoveEntryList (&ListWalker->Link);
return 0;
}
+
FreePool (ProtocolBuffer);
return (ListWalker->TheIndex);
}
@@ -2872,27 +2983,27 @@ ConvertHandleToHandleIndex( //
// Verify that TheHandle is valid handle
//
- Status = gBS->ProtocolsPerHandle(TheHandle, &ProtocolBuffer, &ProtocolCount);
+ Status = gBS->ProtocolsPerHandle (TheHandle, &ProtocolBuffer, &ProtocolCount);
if (EFI_ERROR (Status)) {
//
// TheHandle is not valid, so do not add to handle list
//
return 0;
}
+
FreePool (ProtocolBuffer);
- ListWalker = AllocateZeroPool(sizeof(HANDLE_LIST));
+ ListWalker = AllocateZeroPool (sizeof (HANDLE_LIST));
if (ListWalker == NULL) {
return 0;
}
+
ListWalker->TheHandle = TheHandle;
ListWalker->TheIndex = mHandleList.NextIndex++;
- InsertTailList(&mHandleList.List.Link,&ListWalker->Link);
+ InsertTailList (&mHandleList.List.Link, &ListWalker->Link);
return (ListWalker->TheIndex);
}
-
-
/**
Function to retrieve the EFI_HANDLE from the human-friendly index.
@@ -2904,30 +3015,31 @@ ConvertHandleToHandleIndex( **/
EFI_HANDLE
EFIAPI
-ConvertHandleIndexToHandle(
- IN CONST UINTN TheIndex
+ConvertHandleIndexToHandle (
+ IN CONST UINTN TheIndex
)
{
EFI_STATUS Status;
EFI_GUID **ProtocolBuffer;
UINTN ProtocolCount;
- HANDLE_LIST *ListWalker;
+ HANDLE_LIST *ListWalker;
- InternalShellInitHandleList();
+ InternalShellInitHandleList ();
if (TheIndex >= mHandleList.NextIndex) {
return NULL;
}
- for (ListWalker = (HANDLE_LIST*)GetFirstNode(&mHandleList.List.Link)
- ; !IsNull(&mHandleList.List.Link,&ListWalker->Link)
- ; ListWalker = (HANDLE_LIST*)GetNextNode(&mHandleList.List.Link,&ListWalker->Link)
- ){
- if (ListWalker->TheIndex == TheIndex && ListWalker->TheHandle != NULL) {
+ for (ListWalker = (HANDLE_LIST *)GetFirstNode (&mHandleList.List.Link)
+ ; !IsNull (&mHandleList.List.Link, &ListWalker->Link)
+ ; ListWalker = (HANDLE_LIST *)GetNextNode (&mHandleList.List.Link, &ListWalker->Link)
+ )
+ {
+ if ((ListWalker->TheIndex == TheIndex) && (ListWalker->TheHandle != NULL)) {
//
// Verify that LinkWalker->TheHandle is valid handle
//
- Status = gBS->ProtocolsPerHandle(ListWalker->TheHandle, &ProtocolBuffer, &ProtocolCount);
+ Status = gBS->ProtocolsPerHandle (ListWalker->TheHandle, &ProtocolBuffer, &ProtocolCount);
if (!EFI_ERROR (Status)) {
FreePool (ProtocolBuffer);
} else {
@@ -2936,9 +3048,11 @@ ConvertHandleIndexToHandle( //
ListWalker->TheHandle = NULL;
}
+
return (ListWalker->TheHandle);
}
}
+
return NULL;
}
@@ -2971,43 +3085,43 @@ ConvertHandleIndexToHandle( EFI_STATUS
EFIAPI
ParseHandleDatabaseByRelationshipWithType (
- IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
- IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
- IN UINTN *HandleCount,
- OUT EFI_HANDLE **HandleBuffer,
- OUT UINTN **HandleType
+ IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
+ IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
+ IN UINTN *HandleCount,
+ OUT EFI_HANDLE **HandleBuffer,
+ OUT UINTN **HandleType
)
{
- EFI_STATUS Status;
- UINTN HandleIndex;
- EFI_GUID **ProtocolGuidArray;
- UINTN ArrayCount;
- UINTN ProtocolIndex;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
- UINTN OpenInfoCount;
- UINTN OpenInfoIndex;
- UINTN ChildIndex;
- INTN DriverBindingHandleIndex;
-
- ASSERT(HandleCount != NULL);
- ASSERT(HandleBuffer != NULL);
- ASSERT(HandleType != NULL);
- ASSERT(DriverBindingHandle != NULL || ControllerHandle != NULL);
-
- *HandleCount = 0;
- *HandleBuffer = NULL;
- *HandleType = NULL;
+ EFI_STATUS Status;
+ UINTN HandleIndex;
+ EFI_GUID **ProtocolGuidArray;
+ UINTN ArrayCount;
+ UINTN ProtocolIndex;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
+ UINTN OpenInfoCount;
+ UINTN OpenInfoIndex;
+ UINTN ChildIndex;
+ INTN DriverBindingHandleIndex;
+
+ ASSERT (HandleCount != NULL);
+ ASSERT (HandleBuffer != NULL);
+ ASSERT (HandleType != NULL);
+ ASSERT (DriverBindingHandle != NULL || ControllerHandle != NULL);
+
+ *HandleCount = 0;
+ *HandleBuffer = NULL;
+ *HandleType = NULL;
//
// Retrieve the list of all handles from the handle database
//
Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- HandleCount,
- HandleBuffer
- );
+ AllHandles,
+ NULL,
+ NULL,
+ HandleCount,
+ HandleBuffer
+ );
if (EFI_ERROR (Status)) {
return (Status);
}
@@ -3021,7 +3135,7 @@ ParseHandleDatabaseByRelationshipWithType ( DriverBindingHandleIndex = -1;
for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) {
- if (DriverBindingHandle != NULL && (*HandleBuffer)[HandleIndex] == DriverBindingHandle) {
+ if ((DriverBindingHandle != NULL) && ((*HandleBuffer)[HandleIndex] == DriverBindingHandle)) {
DriverBindingHandleIndex = (INTN)HandleIndex;
}
}
@@ -3031,38 +3145,38 @@ ParseHandleDatabaseByRelationshipWithType ( // Retrieve the list of all the protocols on each handle
//
Status = gBS->ProtocolsPerHandle (
- (*HandleBuffer)[HandleIndex],
- &ProtocolGuidArray,
- &ArrayCount
- );
+ (*HandleBuffer)[HandleIndex],
+ &ProtocolGuidArray,
+ &ArrayCount
+ );
if (EFI_ERROR (Status)) {
continue;
}
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
-
//
// Set the bit describing what this handle has
//
- if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid) ) {
+ if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_IMAGE_HANDLE;
- } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid) ) {
+ } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_BINDING_HANDLE;
} else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfiguration2ProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_CONFIGURATION_HANDLE;
- } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid) ) {
+ } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_CONFIGURATION_HANDLE;
- } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnostics2ProtocolGuid) ) {
+ } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnostics2ProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_DIAGNOSTICS_HANDLE;
- } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid) ) {
+ } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_DIAGNOSTICS_HANDLE;
- } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentName2ProtocolGuid) ) {
+ } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentName2ProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE;
- } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid) ) {
+ } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE;
- } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid) ) {
+ } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid)) {
(*HandleType)[HandleIndex] |= (UINTN)HR_DEVICE_HANDLE;
}
+
//
// Retrieve the list of agents that have opened each protocol
//
@@ -3071,7 +3185,7 @@ ParseHandleDatabaseByRelationshipWithType ( ProtocolGuidArray[ProtocolIndex],
&OpenInfo,
&OpenInfoCount
- );
+ );
if (EFI_ERROR (Status)) {
continue;
}
@@ -3082,17 +3196,19 @@ ParseHandleDatabaseByRelationshipWithType ( // Return information on all the controller handles that the driver specified by DriverBindingHandle is managing
//
for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
- if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle && (OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
+ if ((OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) && ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0)) {
(*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE);
if (DriverBindingHandleIndex != -1) {
(*HandleType)[DriverBindingHandleIndex] |= (UINTN)HR_DEVICE_DRIVER;
}
}
- if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle && (OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
+
+ if ((OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) && ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0)) {
(*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE);
if (DriverBindingHandleIndex != -1) {
(*HandleType)[DriverBindingHandleIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER);
}
+
for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) {
(*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE);
@@ -3101,7 +3217,8 @@ ParseHandleDatabaseByRelationshipWithType ( }
}
}
- if (DriverBindingHandle == NULL && ControllerHandle != NULL) {
+
+ if ((DriverBindingHandle == NULL) && (ControllerHandle != NULL)) {
if (ControllerHandle == (*HandleBuffer)[HandleIndex]) {
(*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE);
for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
@@ -3112,11 +3229,13 @@ ParseHandleDatabaseByRelationshipWithType ( }
}
}
+
if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) {
(*HandleType)[ChildIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER);
}
+
if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) {
(*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE);
}
@@ -3133,7 +3252,8 @@ ParseHandleDatabaseByRelationshipWithType ( }
}
}
- if (DriverBindingHandle != NULL && ControllerHandle != NULL) {
+
+ if ((DriverBindingHandle != NULL) && (ControllerHandle != NULL)) {
if (ControllerHandle == (*HandleBuffer)[HandleIndex]) {
(*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE);
for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
@@ -3144,6 +3264,7 @@ ParseHandleDatabaseByRelationshipWithType ( }
}
}
+
if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) {
for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) {
@@ -3170,10 +3291,13 @@ ParseHandleDatabaseByRelationshipWithType ( }
}
}
+
FreePool (OpenInfo);
}
+
FreePool (ProtocolGuidArray);
}
+
return EFI_SUCCESS;
}
@@ -3208,27 +3332,27 @@ ParseHandleDatabaseByRelationshipWithType ( EFI_STATUS
EFIAPI
ParseHandleDatabaseByRelationship (
- IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
- IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
- IN CONST UINTN Mask,
- IN UINTN *MatchingHandleCount,
- OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+ IN CONST EFI_HANDLE DriverBindingHandle OPTIONAL,
+ IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
+ IN CONST UINTN Mask,
+ IN UINTN *MatchingHandleCount,
+ OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN *HandleType;
- UINTN HandleIndex;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN *HandleType;
+ UINTN HandleIndex;
- ASSERT(MatchingHandleCount != NULL);
- ASSERT(DriverBindingHandle != NULL || ControllerHandle != NULL);
+ ASSERT (MatchingHandleCount != NULL);
+ ASSERT (DriverBindingHandle != NULL || ControllerHandle != NULL);
if ((Mask & HR_VALID_MASK) != Mask) {
return (EFI_INVALID_PARAMETER);
}
- if ((Mask & HR_CHILD_HANDLE) != 0 && DriverBindingHandle == NULL) {
+ if (((Mask & HR_CHILD_HANDLE) != 0) && (DriverBindingHandle == NULL)) {
return (EFI_INVALID_PARAMETER);
}
@@ -3237,16 +3361,16 @@ ParseHandleDatabaseByRelationship ( *MatchingHandleBuffer = NULL;
}
- HandleBuffer = NULL;
- HandleType = NULL;
+ HandleBuffer = NULL;
+ HandleType = NULL;
Status = ParseHandleDatabaseByRelationshipWithType (
- DriverBindingHandle,
- ControllerHandle,
- &HandleCount,
- &HandleBuffer,
- &HandleType
- );
+ DriverBindingHandle,
+ ControllerHandle,
+ &HandleCount,
+ &HandleBuffer,
+ &HandleType
+ );
if (!EFI_ERROR (Status)) {
//
// Count the number of handles that match the attributes in Mask
@@ -3256,13 +3380,13 @@ ParseHandleDatabaseByRelationship ( (*MatchingHandleCount)++;
}
}
+
//
// If no handles match the attributes in Mask then return EFI_NOT_FOUND
//
if (*MatchingHandleCount == 0) {
Status = EFI_NOT_FOUND;
} else {
-
if (MatchingHandleBuffer == NULL) {
//
// Someone just wanted the count...
@@ -3277,9 +3401,10 @@ ParseHandleDatabaseByRelationship ( Status = EFI_OUT_OF_RESOURCES;
} else {
for (HandleIndex = 0, *MatchingHandleCount = 0
- ; HandleIndex < HandleCount
- ; HandleIndex++
- ) {
+ ; HandleIndex < HandleCount
+ ; HandleIndex++
+ )
+ {
//
// Fill the allocated buffer with the handles that matched the attributes in Mask
//
@@ -3307,9 +3432,11 @@ ParseHandleDatabaseByRelationship ( FreePool (HandleType);
}
- ASSERT ((MatchingHandleBuffer == NULL) ||
- (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||
- (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL));
+ ASSERT (
+ (MatchingHandleBuffer == NULL) ||
+ (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||
+ (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL)
+ );
return Status;
}
@@ -3327,10 +3454,10 @@ ParseHandleDatabaseByRelationship ( **/
EFI_STATUS
EFIAPI
-ParseHandleDatabaseForChildControllers(
- IN CONST EFI_HANDLE ControllerHandle,
- OUT UINTN *MatchingHandleCount,
- OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+ParseHandleDatabaseForChildControllers (
+ IN CONST EFI_HANDLE ControllerHandle,
+ OUT UINTN *MatchingHandleCount,
+ OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
)
{
EFI_STATUS Status;
@@ -3346,13 +3473,14 @@ ParseHandleDatabaseForChildControllers( if (MatchingHandleCount == NULL) {
return (EFI_INVALID_PARAMETER);
}
+
*MatchingHandleCount = 0;
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
- ControllerHandle,
- &DriverBindingHandleCount,
- &DriverBindingHandleBuffer
- );
+ ControllerHandle,
+ &DriverBindingHandleCount,
+ &DriverBindingHandleBuffer
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -3360,7 +3488,7 @@ ParseHandleDatabaseForChildControllers( //
// Get a buffer big enough for all the controllers.
//
- HandleBufferForReturn = GetHandleListByProtocol(NULL);
+ HandleBufferForReturn = GetHandleListByProtocol (NULL);
if (HandleBufferForReturn == NULL) {
FreePool (DriverBindingHandleBuffer);
return (EFI_NOT_FOUND);
@@ -3368,11 +3496,11 @@ ParseHandleDatabaseForChildControllers( for (DriverBindingHandleIndex = 0; DriverBindingHandleIndex < DriverBindingHandleCount; DriverBindingHandleIndex++) {
Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
- DriverBindingHandleBuffer[DriverBindingHandleIndex],
- ControllerHandle,
- &ChildControllerHandleCount,
- &ChildControllerHandleBuffer
- );
+ DriverBindingHandleBuffer[DriverBindingHandleIndex],
+ ControllerHandle,
+ &ChildControllerHandleCount,
+ &ChildControllerHandleBuffer
+ );
if (EFI_ERROR (Status)) {
continue;
}
@@ -3380,12 +3508,14 @@ ParseHandleDatabaseForChildControllers( for (ChildControllerHandleIndex = 0;
ChildControllerHandleIndex < ChildControllerHandleCount;
ChildControllerHandleIndex++
- ) {
+ )
+ {
for (HandleIndex = 0; HandleIndex < *MatchingHandleCount; HandleIndex++) {
if (HandleBufferForReturn[HandleIndex] == ChildControllerHandleBuffer[ChildControllerHandleIndex]) {
break;
}
}
+
if (HandleIndex >= *MatchingHandleCount) {
HandleBufferForReturn[(*MatchingHandleCount)++] = ChildControllerHandleBuffer[ChildControllerHandleIndex];
}
@@ -3396,7 +3526,7 @@ ParseHandleDatabaseForChildControllers( FreePool (DriverBindingHandleBuffer);
- if (MatchingHandleBuffer == NULL || *MatchingHandleCount == 0) {
+ if ((MatchingHandleBuffer == NULL) || (*MatchingHandleCount == 0)) {
//
// The caller is not interested in the actual handles, or we've found none.
//
@@ -3408,9 +3538,11 @@ ParseHandleDatabaseForChildControllers( *MatchingHandleBuffer = HandleBufferForReturn;
}
- ASSERT ((MatchingHandleBuffer == NULL) ||
- (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||
- (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL));
+ ASSERT (
+ (MatchingHandleBuffer == NULL) ||
+ (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||
+ (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL)
+ );
return (EFI_SUCCESS);
}
@@ -3430,7 +3562,7 @@ ParseHandleDatabaseForChildControllers( @retval NULL A parameter was invalid.
@return A pointer to (*DestinationBuffer).
**/
-VOID*
+VOID *
BuffernCatGrow (
IN OUT VOID **DestinationBuffer,
IN OUT UINTN *DestinationSize,
@@ -3438,12 +3570,12 @@ BuffernCatGrow ( IN UINTN SourceSize
)
{
- UINTN LocalDestinationSize;
- UINTN LocalDestinationFinalSize;
+ UINTN LocalDestinationSize;
+ UINTN LocalDestinationFinalSize;
- ASSERT(DestinationBuffer != NULL);
+ ASSERT (DestinationBuffer != NULL);
- if (SourceSize == 0 || SourceBuffer == NULL) {
+ if ((SourceSize == 0) || (SourceBuffer == NULL)) {
return (*DestinationBuffer);
}
@@ -3461,16 +3593,16 @@ BuffernCatGrow ( if (LocalDestinationSize == 0) {
// allcoate
- *DestinationBuffer = AllocateZeroPool(LocalDestinationFinalSize);
+ *DestinationBuffer = AllocateZeroPool (LocalDestinationFinalSize);
} else {
// reallocate
- *DestinationBuffer = ReallocatePool(LocalDestinationSize, LocalDestinationFinalSize, *DestinationBuffer);
+ *DestinationBuffer = ReallocatePool (LocalDestinationSize, LocalDestinationFinalSize, *DestinationBuffer);
}
- ASSERT(*DestinationBuffer != NULL);
+ ASSERT (*DestinationBuffer != NULL);
// copy
- return (CopyMem(((UINT8*)(*DestinationBuffer)) + LocalDestinationSize, SourceBuffer, SourceSize));
+ return (CopyMem (((UINT8 *)(*DestinationBuffer)) + LocalDestinationSize, SourceBuffer, SourceSize));
}
/**
@@ -3486,66 +3618,68 @@ BuffernCatGrow ( **/
EFI_STATUS
EFIAPI
-ParseHandleDatabaseForChildDevices(
- IN CONST EFI_HANDLE DriverHandle,
- IN UINTN *MatchingHandleCount,
- OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
+ParseHandleDatabaseForChildDevices (
+ IN CONST EFI_HANDLE DriverHandle,
+ IN UINTN *MatchingHandleCount,
+ OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
)
{
- EFI_HANDLE *Buffer;
- EFI_HANDLE *Buffer2;
- UINTN Count1;
- UINTN Count2;
- UINTN HandleIndex;
- EFI_STATUS Status;
- UINTN HandleBufferSize;
+ EFI_HANDLE *Buffer;
+ EFI_HANDLE *Buffer2;
+ UINTN Count1;
+ UINTN Count2;
+ UINTN HandleIndex;
+ EFI_STATUS Status;
+ UINTN HandleBufferSize;
- ASSERT(MatchingHandleCount != NULL);
+ ASSERT (MatchingHandleCount != NULL);
- HandleBufferSize = 0;
- Buffer = NULL;
- Buffer2 = NULL;
- *MatchingHandleCount = 0;
+ HandleBufferSize = 0;
+ Buffer = NULL;
+ Buffer2 = NULL;
+ *MatchingHandleCount = 0;
Status = PARSE_HANDLE_DATABASE_DEVICES (
- DriverHandle,
- &Count1,
- &Buffer
- );
+ DriverHandle,
+ &Count1,
+ &Buffer
+ );
if (!EFI_ERROR (Status)) {
for (HandleIndex = 0; HandleIndex < Count1; HandleIndex++) {
//
// now find the children
//
Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
- DriverHandle,
- Buffer[HandleIndex],
- &Count2,
- &Buffer2
- );
- if (EFI_ERROR(Status)) {
+ DriverHandle,
+ Buffer[HandleIndex],
+ &Count2,
+ &Buffer2
+ );
+ if (EFI_ERROR (Status)) {
break;
}
+
//
// save out required and optional data elements
//
*MatchingHandleCount += Count2;
if (MatchingHandleBuffer != NULL) {
- *MatchingHandleBuffer = BuffernCatGrow((VOID**)MatchingHandleBuffer, &HandleBufferSize, Buffer2, Count2 * sizeof(Buffer2[0]));
+ *MatchingHandleBuffer = BuffernCatGrow ((VOID **)MatchingHandleBuffer, &HandleBufferSize, Buffer2, Count2 * sizeof (Buffer2[0]));
}
//
// free the memory
//
if (Buffer2 != NULL) {
- FreePool(Buffer2);
+ FreePool (Buffer2);
}
}
}
if (Buffer != NULL) {
- FreePool(Buffer);
+ FreePool (Buffer);
}
+
return (Status);
}
@@ -3558,49 +3692,54 @@ ParseHandleDatabaseForChildDevices( @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
+ IN CONST EFI_GUID *ProtocolGuid OPTIONAL
)
{
- EFI_HANDLE *HandleList;
- UINTN Size;
- EFI_STATUS Status;
+ EFI_HANDLE *HandleList;
+ UINTN Size;
+ EFI_STATUS Status;
- Size = 0;
+ Size = 0;
HandleList = NULL;
//
// We cannot use LocateHandleBuffer since we need that NULL item on the ends of the list!
//
if (ProtocolGuid == NULL) {
- Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList);
+ Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleList);
if (Status == EFI_BUFFER_TOO_SMALL) {
- HandleList = AllocateZeroPool(Size + sizeof(EFI_HANDLE));
+ HandleList = AllocateZeroPool (Size + sizeof (EFI_HANDLE));
if (HandleList == NULL) {
return (NULL);
}
- Status = gBS->LocateHandle(AllHandles, NULL, NULL, &Size, HandleList);
- HandleList[Size/sizeof(EFI_HANDLE)] = NULL;
+
+ Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleList);
+ HandleList[Size/sizeof (EFI_HANDLE)] = NULL;
}
} else {
- Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList);
+ Status = gBS->LocateHandle (ByProtocol, (EFI_GUID *)ProtocolGuid, NULL, &Size, HandleList);
if (Status == EFI_BUFFER_TOO_SMALL) {
- HandleList = AllocateZeroPool(Size + sizeof(EFI_HANDLE));
+ HandleList = AllocateZeroPool (Size + sizeof (EFI_HANDLE));
if (HandleList == NULL) {
return (NULL);
}
- Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)ProtocolGuid, NULL, &Size, HandleList);
- HandleList[Size/sizeof(EFI_HANDLE)] = NULL;
+
+ Status = gBS->LocateHandle (ByProtocol, (EFI_GUID *)ProtocolGuid, NULL, &Size, HandleList);
+ HandleList[Size/sizeof (EFI_HANDLE)] = NULL;
}
}
- if (EFI_ERROR(Status)) {
+
+ if (EFI_ERROR (Status)) {
if (HandleList != NULL) {
- FreePool(HandleList);
+ FreePool (HandleList);
}
+
return (NULL);
}
+
return (HandleList);
}
@@ -3613,27 +3752,27 @@ 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
+ IN CONST EFI_GUID **ProtocolGuids
)
{
- EFI_HANDLE *HandleList;
- UINTN Size;
- UINTN TotalSize;
- UINTN TempSize;
- EFI_STATUS Status;
- CONST EFI_GUID **GuidWalker;
- EFI_HANDLE *HandleWalker1;
- EFI_HANDLE *HandleWalker2;
+ EFI_HANDLE *HandleList;
+ UINTN Size;
+ UINTN TotalSize;
+ UINTN TempSize;
+ EFI_STATUS Status;
+ CONST EFI_GUID **GuidWalker;
+ EFI_HANDLE *HandleWalker1;
+ EFI_HANDLE *HandleWalker2;
- Size = 0;
- HandleList = NULL;
- TotalSize = sizeof(EFI_HANDLE);
+ Size = 0;
+ HandleList = NULL;
+ TotalSize = sizeof (EFI_HANDLE);
- for (GuidWalker = ProtocolGuids ; GuidWalker != NULL && *GuidWalker != NULL ; GuidWalker++,Size = 0){
- Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)(*GuidWalker), NULL, &Size, NULL);
+ for (GuidWalker = ProtocolGuids; GuidWalker != NULL && *GuidWalker != NULL; GuidWalker++, Size = 0) {
+ Status = gBS->LocateHandle (ByProtocol, (EFI_GUID *)(*GuidWalker), NULL, &Size, NULL);
if (Status == EFI_BUFFER_TOO_SMALL) {
TotalSize += Size;
}
@@ -3642,36 +3781,37 @@ GetHandleListByProtocolList ( //
// No handles were found...
//
- if (TotalSize == sizeof(EFI_HANDLE)) {
+ if (TotalSize == sizeof (EFI_HANDLE)) {
return (NULL);
}
- HandleList = AllocateZeroPool(TotalSize);
+ HandleList = AllocateZeroPool (TotalSize);
if (HandleList == NULL) {
return (NULL);
}
Size = 0;
- for (GuidWalker = ProtocolGuids ; GuidWalker != NULL && *GuidWalker != NULL ; GuidWalker++){
+ for (GuidWalker = ProtocolGuids; GuidWalker != NULL && *GuidWalker != NULL; GuidWalker++) {
TempSize = TotalSize - Size;
- Status = gBS->LocateHandle(ByProtocol, (EFI_GUID*)(*GuidWalker), NULL, &TempSize, HandleList+(Size/sizeof(EFI_HANDLE)));
+ Status = gBS->LocateHandle (ByProtocol, (EFI_GUID *)(*GuidWalker), NULL, &TempSize, HandleList+(Size/sizeof (EFI_HANDLE)));
//
// Allow for missing protocols... Only update the 'used' size upon success.
//
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Size += TempSize;
}
}
- ASSERT(HandleList[(TotalSize/sizeof(EFI_HANDLE))-1] == NULL);
- for (HandleWalker1 = HandleList ; HandleWalker1 != NULL && *HandleWalker1 != NULL ; HandleWalker1++) {
- for (HandleWalker2 = HandleWalker1 + 1; HandleWalker2 != NULL && *HandleWalker2 != NULL ; HandleWalker2++) {
+ ASSERT (HandleList[(TotalSize/sizeof (EFI_HANDLE))-1] == NULL);
+
+ for (HandleWalker1 = HandleList; HandleWalker1 != NULL && *HandleWalker1 != NULL; HandleWalker1++) {
+ for (HandleWalker2 = HandleWalker1 + 1; HandleWalker2 != NULL && *HandleWalker2 != NULL; HandleWalker2++) {
if (*HandleWalker1 == *HandleWalker2) {
//
// copy memory back 1 handle width.
//
- CopyMem(HandleWalker2, HandleWalker2 + 1, TotalSize - ((HandleWalker2-HandleList+1)*sizeof(EFI_HANDLE)));
+ CopyMem (HandleWalker2, HandleWalker2 + 1, TotalSize - ((HandleWalker2-HandleList+1)*sizeof (EFI_HANDLE)));
}
}
}
@@ -3693,13 +3833,13 @@ GetHandleListByProtocolList ( EFI_STATUS
EFIAPI
GetAllMappingGuids (
- OUT EFI_GUID *Guids,
- IN OUT UINTN *Count
+ OUT EFI_GUID *Guids,
+ IN OUT UINTN *Count
)
{
- UINTN GuidCount;
- UINTN NtGuidCount;
- UINTN Index;
+ UINTN GuidCount;
+ UINTN NtGuidCount;
+ UINTN Index;
if (Count == NULL) {
return EFI_INVALID_PARAMETER;
@@ -3709,7 +3849,8 @@ GetAllMappingGuids ( if (PcdGetBool (PcdShellIncludeNtGuids)) {
NtGuidCount = ARRAY_SIZE (mGuidStringListNT) - 1;
}
- GuidCount = ARRAY_SIZE (mGuidStringList) - 1;
+
+ GuidCount = ARRAY_SIZE (mGuidStringList) - 1;
if (*Count < NtGuidCount + GuidCount + mGuidListCount) {
*Count = NtGuidCount + GuidCount + mGuidListCount;
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h index d91857b8b0..6be0d78c4c 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h @@ -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>
@@ -150,8 +150,8 @@ #include <Library/ShellCommandLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
-#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1 1
-#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2 2
+#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1 1
+#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2 2
///
/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec < 2.4a
@@ -161,32 +161,32 @@ typedef struct { /// A unique number identifying the firmware image within the device. The number is
/// between 1 and DescriptorCount.
///
- UINT8 ImageIndex;
+ UINT8 ImageIndex;
///
/// A unique number identifying the firmware image type.
///
- EFI_GUID ImageTypeId;
+ EFI_GUID ImageTypeId;
///
/// A unique number identifying the firmware image.
///
- UINT64 ImageId;
+ UINT64 ImageId;
///
/// A pointer to a null-terminated string representing the firmware image name.
///
- CHAR16 *ImageIdName;
+ CHAR16 *ImageIdName;
///
/// Identifies the version of the device firmware. The format is vendor specific and new
/// version must have a greater value than an old version.
///
- UINT32 Version;
+ UINT32 Version;
///
/// A pointer to a null-terminated string representing the firmware image version name.
///
- CHAR16 *VersionName;
+ CHAR16 *VersionName;
///
/// Size of the image in bytes. If size=0, then only ImageIndex and ImageTypeId are valid.
///
- UINTN Size;
+ UINTN Size;
///
/// Image attributes that are supported by this device. See 'Image Attribute Definitions'
/// for possible returned values of this parameter. A value of 1 indicates the attribute is
@@ -194,20 +194,19 @@ typedef struct { /// value of 0 indicates the attribute is not supported and the current setting value in
/// AttributesSetting is meaningless.
///
- UINT64 AttributesSupported;
+ UINT64 AttributesSupported;
///
/// Image attributes. See 'Image Attribute Definitions' for possible returned values of
/// this parameter.
///
- UINT64 AttributesSetting;
+ UINT64 AttributesSetting;
///
/// Image compatibilities. See 'Image Compatibility Definitions' for possible returned
/// values of this parameter.
///
- UINT64 Compatibilities;
+ UINT64 Compatibilities;
} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1;
-
///
/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec > 2.4a and < 2.5
///
@@ -216,32 +215,32 @@ typedef struct { /// A unique number identifying the firmware image within the device. The number is
/// between 1 and DescriptorCount.
///
- UINT8 ImageIndex;
+ UINT8 ImageIndex;
///
/// A unique number identifying the firmware image type.
///
- EFI_GUID ImageTypeId;
+ EFI_GUID ImageTypeId;
///
/// A unique number identifying the firmware image.
///
- UINT64 ImageId;
+ UINT64 ImageId;
///
/// A pointer to a null-terminated string representing the firmware image name.
///
- CHAR16 *ImageIdName;
+ CHAR16 *ImageIdName;
///
/// Identifies the version of the device firmware. The format is vendor specific and new
/// version must have a greater value than an old version.
///
- UINT32 Version;
+ UINT32 Version;
///
/// A pointer to a null-terminated string representing the firmware image version name.
///
- CHAR16 *VersionName;
+ CHAR16 *VersionName;
///
/// Size of the image in bytes. If size=0, then only ImageIndex and ImageTypeId are valid.
///
- UINTN Size;
+ UINTN Size;
///
/// Image attributes that are supported by this device. See 'Image Attribute Definitions'
/// for possible returned values of this parameter. A value of 1 indicates the attribute is
@@ -249,32 +248,32 @@ typedef struct { /// value of 0 indicates the attribute is not supported and the current setting value in
/// AttributesSetting is meaningless.
///
- UINT64 AttributesSupported;
+ UINT64 AttributesSupported;
///
/// Image attributes. See 'Image Attribute Definitions' for possible returned values of
/// this parameter.
///
- UINT64 AttributesSetting;
+ UINT64 AttributesSetting;
///
/// Image compatibilities. See 'Image Compatibility Definitions' for possible returned
/// values of this parameter.
///
- UINT64 Compatibilities;
+ UINT64 Compatibilities;
///
/// Describes the lowest ImageDescriptor version that the device will accept. Only
/// present in version 2 or higher.
- UINT32 LowestSupportedImageVersion;
+ UINT32 LowestSupportedImageVersion;
} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V2;
typedef struct {
- LIST_ENTRY Link;
- EFI_HANDLE TheHandle;
- UINTN TheIndex;
-}HANDLE_LIST;
+ LIST_ENTRY Link;
+ EFI_HANDLE TheHandle;
+ UINTN TheIndex;
+} HANDLE_LIST;
typedef struct {
- HANDLE_LIST List;
- UINTN NextIndex;
+ HANDLE_LIST List;
+ UINTN NextIndex;
} HANDLE_INDEX_LIST;
typedef
@@ -284,11 +283,10 @@ CHAR16 * IN CONST BOOLEAN Verbose
);
-typedef struct _GUID_INFO_BLOCK{
- EFI_STRING_ID StringId;
- EFI_GUID *GuidId;
- DUMP_PROTOCOL_INFO DumpInfo;
+typedef struct _GUID_INFO_BLOCK {
+ EFI_STRING_ID StringId;
+ EFI_GUID *GuidId;
+ DUMP_PROTOCOL_INFO DumpInfo;
} GUID_INFO_BLOCK;
#endif
-
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 74056e72c3..cb193a5ea4 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -12,16 +12,16 @@ #include "AcpiView.h"
#include "AcpiViewConfig.h"
-STATIC UINT32 gIndent;
-STATIC UINT32 mTableErrorCount;
-STATIC UINT32 mTableWarningCount;
+STATIC UINT32 gIndent;
+STATIC UINT32 mTableErrorCount;
+STATIC UINT32 mTableWarningCount;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
An ACPI_PARSER array describing the ACPI header.
**/
-STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {
+STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo)
};
@@ -113,21 +113,21 @@ IncrementWarningCount ( BOOLEAN
EFIAPI
VerifyChecksum (
- IN BOOLEAN Log,
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN BOOLEAN Log,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
- UINTN ByteCount;
- UINT8 Checksum;
- UINTN OriginalAttribute;
+ UINTN ByteCount;
+ UINT8 Checksum;
+ UINTN OriginalAttribute;
//
// set local variables to suppress incorrect compiler/analyzer warnings
//
OriginalAttribute = 0;
- ByteCount = 0;
- Checksum = 0;
+ ByteCount = 0;
+ Checksum = 0;
while (ByteCount < Length) {
Checksum += *(Ptr++);
@@ -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,16 +180,16 @@ VerifyChecksum ( VOID
EFIAPI
DumpRaw (
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
- UINTN ByteCount;
- UINTN PartLineChars;
- UINTN AsciiBufferIndex;
- CHAR8 AsciiBuffer[17];
+ UINTN ByteCount;
+ UINTN PartLineChars;
+ UINTN AsciiBufferIndex;
+ CHAR8 AsciiBuffer[17];
- ByteCount = 0;
+ ByteCount = 0;
AsciiBufferIndex = 0;
Print (L"Address : 0x%p\n", Ptr);
@@ -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,19 +292,19 @@ 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
// on ARM platforms if the compiler generates LDRD instructions.
// Perform word access so that LDRD instructions are not generated.
- UINT64 Val;
+ 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 (
@@ -454,9 +462,9 @@ Dump12Chars ( VOID
EFIAPI
PrintFieldName (
- IN UINT32 Indent,
- IN CONST CHAR16* FieldName
-)
+ IN UINT32 Indent,
+ IN CONST CHAR16 *FieldName
+ )
{
Print (
L"%*a%-*s : ",
@@ -498,38 +506,41 @@ 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;
- BOOLEAN HighLight;
- UINTN OriginalAttribute;
+ UINT32 Index;
+ UINT32 Offset;
+ BOOLEAN HighLight;
+ UINTN OriginalAttribute;
//
// set local variables to suppress incorrect compiler/analyzer warnings
//
OriginalAttribute = 0;
- Offset = 0;
+ Offset = 0;
// 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,11 +566,12 @@ ParseAcpi ( }
if (GetConsistencyChecking () &&
- (Offset != Parser[Index].Offset)) {
+ (Offset != Parser[Index].Offset))
+ {
IncrementErrorCount ();
Print (
L"\nERROR: %a: Offset Mismatch for %s\n"
- L"CurrentOffset = %d FieldOffset = %d\n",
+ L"CurrentOffset = %d FieldOffset = %d\n",
AsciiName,
Parser[Index].NameStr,
Offset,
@@ -597,20 +608,23 @@ 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;
+ Ptr += Parser[Index].Length;
Offset += Parser[Index].Length;
} // for
@@ -624,12 +638,12 @@ ParseAcpi ( The GasParser array is used by the ParseAcpi function to parse and/or trace
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}
+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 }
};
/**
@@ -644,9 +658,9 @@ STATIC CONST ACPI_PARSER GasParser[] = { UINT32
EFIAPI
DumpGasStruct (
- IN UINT8* Ptr,
- IN UINT32 Indent,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Indent,
+ IN UINT32 Length
)
{
Print (L"\n");
@@ -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,13 +729,13 @@ 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;
+ UINT32 BytesParsed;
BytesParsed = ParseAcpi (
FALSE,
@@ -733,8 +747,8 @@ ParseAcpiHeader ( );
*Signature = AcpiHdrInfo.Signature;
- *Length = AcpiHdrInfo.Length;
- *Revision = AcpiHdrInfo.Revision;
+ *Length = AcpiHdrInfo.Length;
+ *Revision = AcpiHdrInfo.Revision;
return BytesParsed;
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 5e34a70c8b..5c916a4720 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -50,9 +50,9 @@ IncrementWarningCount ( BOOLEAN
EFIAPI
VerifyChecksum (
- IN BOOLEAN Log,
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN BOOLEAN Log,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -64,8 +64,8 @@ VerifyChecksum ( VOID
EFIAPI
DumpRaw (
- IN UINT8* Ptr,
- IN UINT32 Length
+ 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
);
/**
@@ -215,8 +215,8 @@ Dump12Chars ( VOID
EFIAPI
PrintFieldName (
- IN UINT32 Indent,
- IN CONST CHAR16* FieldName
+ IN UINT32 Indent,
+ 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,48 +258,47 @@ 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)
- UINT32 Length;
+ UINT32 Length;
/// The offset of the field from the start of the table.
/// (Byte Offset column from ACPI table spec)
- UINT32 Offset;
+ UINT32 Offset;
/// 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.
/// If not used this must be set to NULL.
/// The Format string is passed to the PrintFormatter function
/// but may be ignored by the implementation code.
- FNPTR_PRINT_FORMATTER PrintFormatter;
+ FNPTR_PRINT_FORMATTER PrintFormatter;
/// Optional pointer which may be set to request the parser to update
/// 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
/// and invoke the appropriate counter update function.
/// If not used this parameter must be set to NULL.
- FNPTR_FIELD_VALIDATOR FieldValidator;
+ FNPTR_FIELD_VALIDATOR FieldValidator;
/// Optional pointer to context specific information,
/// which the Field Validator function can use to determine
/// 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
);
@@ -371,7 +370,7 @@ ParseAcpi ( @param [in] Parser The name of the ACPI_PARSER array describing the
ACPI table fields.
**/
-#define PARSER_PARAMS(Parser) Parser, sizeof (Parser) / sizeof (Parser[0])
+#define PARSER_PARAMS(Parser) Parser, sizeof (Parser) / sizeof (Parser[0])
/**
This is a helper macro for describing the ACPI header fields.
@@ -410,9 +409,9 @@ ParseAcpi ( UINT32
EFIAPI
DumpGasStruct (
- IN UINT8* Ptr,
- IN UINT32 Indent,
- IN UINT32 Length
+ 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
);
/**
@@ -478,10 +477,10 @@ ParseAcpiHeader ( VOID
EFIAPI
ParseAcpiAest (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -499,10 +498,10 @@ ParseAcpiAest ( VOID
EFIAPI
ParseAcpiBgrt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -520,10 +519,10 @@ ParseAcpiBgrt ( VOID
EFIAPI
ParseAcpiDbg2 (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -541,10 +540,10 @@ ParseAcpiDbg2 ( VOID
EFIAPI
ParseAcpiDsdt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -562,10 +561,10 @@ ParseAcpiDsdt ( VOID
EFIAPI
ParseAcpiFacs (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -583,10 +582,10 @@ ParseAcpiFacs ( VOID
EFIAPI
ParseAcpiFadt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -608,10 +607,10 @@ ParseAcpiFadt ( VOID
EFIAPI
ParseAcpiGtdt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -634,10 +633,10 @@ ParseAcpiGtdt ( VOID
EFIAPI
ParseAcpiHmat (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -663,10 +662,10 @@ ParseAcpiHmat ( VOID
EFIAPI
ParseAcpiIort (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -692,10 +691,10 @@ ParseAcpiIort ( VOID
EFIAPI
ParseAcpiMadt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -713,10 +712,10 @@ ParseAcpiMadt ( VOID
EFIAPI
ParseAcpiMcfg (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -735,10 +734,10 @@ ParseAcpiMcfg ( VOID
EFIAPI
ParseAcpiPcct (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -756,10 +755,10 @@ ParseAcpiPcct ( VOID
EFIAPI
ParseAcpiPptt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -779,10 +778,10 @@ ParseAcpiPptt ( VOID
EFIAPI
ParseAcpiRsdp (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -803,10 +802,10 @@ ParseAcpiRsdp ( VOID
EFIAPI
ParseAcpiSlit (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -824,10 +823,10 @@ ParseAcpiSlit ( VOID
EFIAPI
ParseAcpiSpcr (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -851,10 +850,10 @@ ParseAcpiSpcr ( VOID
EFIAPI
ParseAcpiSrat (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -872,10 +871,10 @@ ParseAcpiSrat ( VOID
EFIAPI
ParseAcpiSsdt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
/**
@@ -892,10 +891,10 @@ ParseAcpiSsdt ( VOID
EFIAPI
ParseAcpiXsdt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
);
#endif // ACPIPARSER_H_
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index 4b618f131e..75b949429e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -19,14 +19,14 @@ #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
/**
A list of registered ACPI table parsers.
**/
-STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS];
+STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS];
/**
Register the ACPI table Parser
@@ -46,11 +46,11 @@ STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS]; EFI_STATUS
EFIAPI
RegisterParser (
- IN UINT32 Signature,
- IN PARSE_ACPI_TABLE_PROC ParserProc
+ IN UINT32 Signature,
+ IN PARSE_ACPI_TABLE_PROC ParserProc
)
{
- UINT32 Index;
+ UINT32 Index;
if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
return EFI_INVALID_PARAMETER;
@@ -70,12 +70,12 @@ RegisterParser ( // Find the first free slot and register the parser
for (Index = 0;
- Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
- Index++)
+ Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
+ Index++)
{
if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) {
mTableParserList[Index].Signature = Signature;
- mTableParserList[Index].Parser = ParserProc;
+ mTableParserList[Index].Parser = ParserProc;
return EFI_SUCCESS;
}
}
@@ -98,10 +98,10 @@ RegisterParser ( EFI_STATUS
EFIAPI
DeregisterParser (
- IN UINT32 Signature
+ IN UINT32 Signature
)
{
- UINT32 Index;
+ UINT32 Index;
if (Signature == ACPI_PARSER_SIGNATURE_NULL) {
return EFI_INVALID_PARAMETER;
@@ -113,7 +113,7 @@ DeregisterParser ( {
if (Signature == mTableParserList[Index].Signature) {
mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL;
- mTableParserList[Index].Parser = NULL;
+ mTableParserList[Index].Parser = NULL;
return EFI_SUCCESS;
}
}
@@ -138,11 +138,11 @@ DeregisterParser ( EFI_STATUS
EFIAPI
GetParser (
- IN UINT32 Signature,
- OUT PARSE_ACPI_TABLE_PROC * ParserProc
+ IN UINT32 Signature,
+ OUT PARSE_ACPI_TABLE_PROC *ParserProc
)
{
- UINT32 Index;
+ UINT32 Index;
if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
return EFI_INVALID_PARAMETER;
@@ -179,16 +179,16 @@ 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;
- PARSE_ACPI_TABLE_PROC ParserProc;
+ EFI_STATUS Status;
+ BOOLEAN Trace;
+ CONST UINT32 *AcpiTableSignature;
+ CONST UINT32 *AcpiTableLength;
+ CONST UINT8 *AcpiTableRevision;
+ CONST UINT8 *SignaturePtr;
+ PARSE_ACPI_TABLE_PROC ParserProc;
ParseAcpiHeader (
Ptr,
@@ -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;
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h index 0ebf79fb65..cd8aa27d9e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h @@ -11,11 +11,11 @@ /**
The maximum number of ACPI table parsers.
*/
-#define MAX_ACPI_TABLE_PARSERS 32
+#define MAX_ACPI_TABLE_PARSERS 32
/** An invalid/NULL signature value.
*/
-#define ACPI_PARSER_SIGNATURE_NULL 0
+#define ACPI_PARSER_SIGNATURE_NULL 0
/**
A function that parses the ACPI table.
@@ -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
);
@@ -39,10 +39,10 @@ VOID **/
typedef struct AcpiTableParser {
/// ACPI table signature
- UINT32 Signature;
+ UINT32 Signature;
/// The ACPI table parser function.
- PARSE_ACPI_TABLE_PROC Parser;
+ PARSE_ACPI_TABLE_PROC Parser;
} ACPI_TABLE_PARSER;
/**
@@ -63,8 +63,8 @@ typedef struct AcpiTableParser { EFI_STATUS
EFIAPI
RegisterParser (
- IN UINT32 Signature,
- IN PARSE_ACPI_TABLE_PROC ParserProc
+ IN UINT32 Signature,
+ IN PARSE_ACPI_TABLE_PROC ParserProc
);
/**
@@ -81,7 +81,7 @@ RegisterParser ( EFI_STATUS
EFIAPI
DeregisterParser (
- IN UINT32 Signature
+ IN UINT32 Signature
);
/**
@@ -101,7 +101,7 @@ DeregisterParser ( VOID
EFIAPI
ProcessAcpiTable (
- IN UINT8* Ptr
+ IN UINT8 *Ptr
);
/**
@@ -120,8 +120,8 @@ ProcessAcpiTable ( EFI_STATUS
EFIAPI
GetParser (
- IN UINT32 Signature,
- OUT PARSE_ACPI_TABLE_PROC * ParserProc
+ IN UINT32 Signature,
+ OUT PARSE_ACPI_TABLE_PROC *ParserProc
);
#endif // ACPITABLEPARSER_H_
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 9a5b013fb2..9cdfcb3fae 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -23,12 +23,12 @@ #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;
-STATIC UINT32 mBinTableCount;
+STATIC UINT32 mTableCount;
+STATIC UINT32 mBinTableCount;
/**
This function dumps the ACPI table to a file.
@@ -42,13 +42,13 @@ STATIC UINT32 mBinTableCount; STATIC
BOOLEAN
DumpAcpiTableToFile (
- IN CONST UINT8* Ptr,
- IN CONST UINTN Length
+ IN CONST UINT8 *Ptr,
+ IN CONST UINTN Length
)
{
- CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
- UINTN TransferBytes;
- SELECTED_ACPI_TABLE *SelectedTable;
+ CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
+ UINTN TransferBytes;
+ SELECTED_ACPI_TABLE *SelectedTable;
GetSelectedAcpiTable (&SelectedTable);
@@ -78,7 +78,7 @@ DumpAcpiTableToFile ( BOOLEAN
ProcessTableReportOptions (
IN CONST UINT32 Signature,
- IN CONST UINT8* TablePtr,
+ IN CONST UINT8 *TablePtr,
IN CONST UINT32 Length
)
{
@@ -92,9 +92,9 @@ ProcessTableReportOptions ( // set local variables to suppress incorrect compiler/analyzer warnings
//
OriginalAttribute = 0;
- SignaturePtr = (UINT8*)(UINTN)&Signature;
- Log = FALSE;
- HighLight = GetColourHighlighting ();
+ SignaturePtr = (UINT8 *)(UINTN)&Signature;
+ Log = FALSE;
+ HighLight = GetColourHighlighting ();
GetSelectedAcpiTable (&SelectedTable);
switch (GetReportOption ()) {
@@ -103,9 +103,10 @@ ProcessTableReportOptions ( break;
case ReportSelected:
if (Signature == SelectedTable->Type) {
- Log = TRUE;
+ 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;
@@ -203,10 +210,10 @@ AcpiView ( // set local variables to suppress incorrect compiler/analyzer warnings
//
EfiConfigurationTable = NULL;
- OriginalAttribute = 0;
+ OriginalAttribute = 0;
// Reset Table counts
- mTableCount = 0;
+ mTableCount = 0;
mBinTableCount = 0;
// Reset The error/warning counters
@@ -219,16 +226,19 @@ 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;
+ FoundAcpiTable = TRUE;
break;
}
}
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,45 +284,50 @@ 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");
if (GetColourHighlighting ()) {
PrintAttribute = (GetErrorCount () > 0) ?
- EFI_TEXT_ATTR (
- EFI_RED,
- ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
- ) :
- OriginalAttribute;
+ EFI_TEXT_ATTR (
+ EFI_RED,
+ ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+ ) :
+ OriginalAttribute;
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
}
+
Print (L"\t%d Error(s)\n", GetErrorCount ());
if (GetColourHighlighting ()) {
PrintAttribute = (GetWarningCount () > 0) ?
- EFI_TEXT_ATTR (
- EFI_RED,
- ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
- ) :
- OriginalAttribute;
+ EFI_TEXT_ATTR (
+ EFI_RED,
+ ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
+ ) :
+ OriginalAttribute;
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
}
+
Print (L"\t%d Warning(s)\n", GetWarningCount ());
if (GetColourHighlighting ()) {
@@ -320,5 +335,6 @@ AcpiView ( }
}
}
+
return EFI_SUCCESS;
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index d5b95f5ee7..5f1bc0ebb0 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -11,17 +11,17 @@ /**
A macro to define the max file name length
**/
-#define MAX_FILE_NAME_LEN 128
+#define MAX_FILE_NAME_LEN 128
/**
Offset to the RSDP revision from the start of the RSDP
**/
-#define RSDP_REVISION_OFFSET 15
+#define RSDP_REVISION_OFFSET 15
/**
Offset to the RSDP length from the start of the RSDP
**/
-#define RSDP_LENGTH_OFFSET 20
+#define RSDP_LENGTH_OFFSET 20
/**
This function resets the ACPI table error counter to Zero.
@@ -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_
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c index 759a915928..8f6823f64b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c @@ -11,14 +11,14 @@ #include "AcpiViewConfig.h"
// Report variables
-STATIC BOOLEAN mConsistencyCheck;
-STATIC BOOLEAN mColourHighlighting;
-STATIC EREPORT_OPTION mReportType;
-STATIC BOOLEAN mMandatoryTableValidate;
-STATIC UINTN mMandatoryTableSpec;
+STATIC BOOLEAN mConsistencyCheck;
+STATIC BOOLEAN mColourHighlighting;
+STATIC EREPORT_OPTION mReportType;
+STATIC BOOLEAN mMandatoryTableValidate;
+STATIC UINTN mMandatoryTableSpec;
// User selection of which ACPI table should be checked
-SELECTED_ACPI_TABLE mSelectedAcpiTable;
+SELECTED_ACPI_TABLE mSelectedAcpiTable;
/**
Reset the AcpiView user configuration to defaults
@@ -29,13 +29,13 @@ AcpiConfigSetDefaults ( VOID
)
{
- mReportType = ReportAll;
- mSelectedAcpiTable.Type = 0;
- mSelectedAcpiTable.Name = NULL;
+ mReportType = ReportAll;
+ mSelectedAcpiTable.Type = 0;
+ mSelectedAcpiTable.Name = NULL;
mSelectedAcpiTable.Found = FALSE;
- mConsistencyCheck = TRUE;
- mMandatoryTableValidate = FALSE;
- mMandatoryTableSpec = 0;
+ mConsistencyCheck = TRUE;
+ mMandatoryTableValidate = FALSE;
+ mMandatoryTableSpec = 0;
}
/**
@@ -49,25 +49,27 @@ AcpiConfigSetDefaults ( STATIC
UINT32
ConvertStrToAcpiSignature (
- IN CONST CHAR16 *Str
+ IN CONST CHAR16 *Str
)
{
- UINT8 Index;
- CHAR8 Ptr[4];
+ UINT8 Index;
+ CHAR8 Ptr[4];
ZeroMem (Ptr, sizeof (Ptr));
Index = 0;
// 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;
}
/**
@@ -80,7 +82,7 @@ ConvertStrToAcpiSignature ( VOID
EFIAPI
SelectAcpiTable (
- IN CONST CHAR16 *TableName
+ IN CONST CHAR16 *TableName
)
{
ASSERT (TableName != NULL);
@@ -97,7 +99,7 @@ SelectAcpiTable ( VOID
EFIAPI
GetSelectedAcpiTable (
- OUT SELECTED_ACPI_TABLE **SelectedAcpiTable
+ OUT SELECTED_ACPI_TABLE **SelectedAcpiTable
)
{
*SelectedAcpiTable = &mSelectedAcpiTable;
@@ -125,7 +127,7 @@ GetColourHighlighting ( VOID
EFIAPI
SetColourHighlighting (
- BOOLEAN Highlight
+ BOOLEAN Highlight
)
{
mColourHighlighting = Highlight;
@@ -153,7 +155,7 @@ GetConsistencyChecking ( VOID
EFIAPI
SetConsistencyChecking (
- BOOLEAN ConsistencyChecking
+ BOOLEAN ConsistencyChecking
)
{
mConsistencyCheck = ConsistencyChecking;
@@ -181,7 +183,7 @@ GetReportOption ( VOID
EFIAPI
SetReportOption (
- EREPORT_OPTION ReportType
+ EREPORT_OPTION ReportType
)
{
mReportType = ReportType;
@@ -209,7 +211,7 @@ GetMandatoryTableValidate ( VOID
EFIAPI
SetMandatoryTableValidate (
- BOOLEAN Validate
+ BOOLEAN Validate
)
{
mMandatoryTableValidate = Validate;
@@ -239,7 +241,7 @@ GetMandatoryTableSpec ( VOID
EFIAPI
SetMandatoryTableSpec (
- UINTN Spec
+ UINTN Spec
)
{
mMandatoryTableSpec = Spec;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h index 2db4a65415..c58755bf1d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h @@ -27,7 +27,7 @@ GetColourHighlighting ( VOID
EFIAPI
SetColourHighlighting (
- BOOLEAN Highlight
+ BOOLEAN Highlight
);
/**
@@ -49,7 +49,7 @@ GetConsistencyChecking ( VOID
EFIAPI
SetConsistencyChecking (
- BOOLEAN ConsistencyChecking
+ BOOLEAN ConsistencyChecking
);
/**
@@ -71,7 +71,7 @@ GetMandatoryTableValidate ( VOID
EFIAPI
SetMandatoryTableValidate (
- BOOLEAN Validate
+ BOOLEAN Validate
);
/**
@@ -95,7 +95,7 @@ GetMandatoryTableSpec ( VOID
EFIAPI
SetMandatoryTableSpec (
- UINTN Spec
+ UINTN Spec
);
/**
@@ -128,7 +128,7 @@ GetReportOption ( VOID
EFIAPI
SetReportOption (
- EREPORT_OPTION ReportType
+ EREPORT_OPTION ReportType
);
/**
@@ -136,9 +136,9 @@ SetReportOption ( ACPI table is to be examined by the AcpiView code.
**/
typedef struct {
- UINT32 Type; ///< 32bit signature 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.
+ UINT32 Type; ///< 32bit signature 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
);
/**
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.c index d3284417fa..5b0e578af9 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.c @@ -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
@@ -32,7 +32,7 @@ STATIC CONST CHAR8* ArmSbbrVersions[ArmSbbrVersionMax] = { /**
SBBR 1.0 mandatory ACPI tables
**/
-STATIC CONST UINT32 ArmSbbr10Mandatory[] = {
+STATIC CONST UINT32 ArmSbbr10Mandatory[] = {
EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@@ -45,7 +45,7 @@ STATIC CONST UINT32 ArmSbbr10Mandatory[] = { /**
SBBR 1.1 mandatory ACPI tables
**/
-STATIC CONST UINT32 ArmSbbr11Mandatory[] = {
+STATIC CONST UINT32 ArmSbbr11Mandatory[] = {
EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@@ -59,7 +59,7 @@ STATIC CONST UINT32 ArmSbbr11Mandatory[] = { /**
SBBR 1.2 mandatory ACPI tables
**/
-STATIC CONST UINT32 ArmSbbr12Mandatory[] = {
+STATIC CONST UINT32 ArmSbbr12Mandatory[] = {
EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@@ -74,7 +74,7 @@ STATIC CONST UINT32 ArmSbbr12Mandatory[] = { /**
Mandatory ACPI tables for every SBBR specification version.
**/
-STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
+STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
{ ArmSbbr10Mandatory, ARRAY_SIZE (ArmSbbr10Mandatory) }, // SBBR v1.0
{ ArmSbbr11Mandatory, ARRAY_SIZE (ArmSbbr11Mandatory) }, // SBBR v1.1
{ ArmSbbr12Mandatory, ARRAY_SIZE (ArmSbbr12Mandatory) } // SBBR v1.2
@@ -84,16 +84,16 @@ STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = { Data structure to track instance counts for all ACPI tables which are
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}
+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 }
};
/**
@@ -105,7 +105,7 @@ ArmSbbrResetTableCounts ( VOID
)
{
- UINT32 Table;
+ UINT32 Table;
for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
ArmSbbrTableCounts[Table].Count = 0;
@@ -124,10 +124,10 @@ ArmSbbrResetTableCounts ( BOOLEAN
EFIAPI
ArmSbbrIncrementTableCount (
- UINT32 Signature
+ UINT32 Signature
)
{
- UINT32 Table;
+ UINT32 Table;
for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
if (Signature == ArmSbbrTableCounts[Table].Signature) {
@@ -154,14 +154,14 @@ ArmSbbrIncrementTableCount ( EFI_STATUS
EFIAPI
ArmSbbrReqsValidate (
- ARM_SBBR_VERSION Version
+ ARM_SBBR_VERSION Version
)
{
- UINT32 Table;
- UINT32 Index;
- UINT32 MandatoryTable;
- CONST UINT8* SignaturePtr;
- BOOLEAN IsArmSbbrViolated;
+ UINT32 Table;
+ UINT32 Index;
+ UINT32 MandatoryTable;
+ CONST UINT8 *SignaturePtr;
+ BOOLEAN IsArmSbbrViolated;
if (Version >= ArmSbbrVersionMax) {
return EFI_INVALID_PARAMETER;
@@ -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++;
}
@@ -185,7 +186,7 @@ ArmSbbrReqsValidate ( IncrementErrorCount ();
Print (
L"\nERROR: SBBR v%a: Mandatory %c%c%c%c table's instance count not " \
- L"found\n",
+ L"found\n",
ArmSbbrVersions[Version],
SignaturePtr[0],
SignaturePtr[1],
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.h index 3135f74fcb..b6d46af776 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Arm/SbbrValidator.h @@ -24,26 +24,26 @@ Arm SBBR specification versions.
**/
typedef enum {
- ArmSbbrVersion_1_0 = 0,
- ArmSbbrVersion_1_1 = 1,
- ArmSbbrVersion_1_2 = 2,
- ArmSbbrVersionMax = 3
+ ArmSbbrVersion_1_0 = 0,
+ ArmSbbrVersion_1_1 = 1,
+ ArmSbbrVersion_1_2 = 2,
+ ArmSbbrVersionMax = 3
} ARM_SBBR_VERSION;
/**
The ACPI table instance counter.
**/
typedef struct AcpiTableCounter {
- CONST UINT32 Signature; /// ACPI table signature
- UINT32 Count; /// Instance count
+ CONST UINT32 Signature; /// ACPI table signature
+ UINT32 Count; /// Instance count
} ACPI_TABLE_COUNTER;
/**
ACPI table SBBR requirements.
**/
typedef struct AcpiSbbrReq {
- CONST UINT32* Tables; /// List of required tables
- CONST UINT32 TableCount; /// Number of elements in Tables
+ CONST UINT32 *Tables; /// List of required tables
+ CONST UINT32 TableCount; /// Number of elements in Tables
} ACPI_SBBR_REQ;
/**
@@ -67,7 +67,7 @@ ArmSbbrResetTableCounts ( BOOLEAN
EFIAPI
ArmSbbrIncrementTableCount (
- UINT32 Signature
+ UINT32 Signature
);
/**
@@ -85,7 +85,7 @@ ArmSbbrIncrementTableCount ( EFI_STATUS
EFIAPI
ArmSbbrReqsValidate (
- ARM_SBBR_VERSION Version
+ ARM_SBBR_VERSION Version
);
#endif // SBBR_VALIDATOR_H_
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c index 7aa8c8fd21..48f71484fb 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c @@ -18,16 +18,16 @@ #include "AcpiViewConfig.h"
// 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 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;
/**
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;
+ 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 (
@@ -183,27 +185,27 @@ DumpVendorSpecificData ( /**
An ACPI_PARSER array describing the ACPI AEST Table.
**/
-STATIC CONST ACPI_PARSER AestParser[] = {
+STATIC CONST ACPI_PARSER AestParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo)
};
/**
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}
+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 }
// Node specific data...
// Node interface...
// Node interrupt array...
@@ -212,100 +214,100 @@ 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},
+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 },
// Resource specific data...
};
/**
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}
+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 }
};
/**
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}
+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 }
};
/**
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}
+STATIC CONST ACPI_PARSER AestProcessorGenericResourceSubstructure[] = {
+ { 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}
+STATIC CONST ACPI_PARSER AestMemoryControllerStructure[] = {
+ { 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}
+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 }
};
/**
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}
+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 }
};
/**
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}
+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}
};
/**
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}
+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 }
};
/**
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}
+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 }
};
/**
@@ -318,11 +320,11 @@ STATIC CONST ACPI_PARSER AestNodeInterrupt[] = { STATIC
VOID
DumpProcessorNode (
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
- UINT32 Offset;
+ UINT32 Offset;
Offset = ParseAcpi (
TRUE,
@@ -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,8 +396,8 @@ DumpProcessorNode ( STATIC
VOID
DumpMemoryControllerNode (
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
ParseAcpi (
@@ -416,8 +419,8 @@ DumpMemoryControllerNode ( STATIC
VOID
DumpSmmuNode (
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
ParseAcpi (
@@ -439,8 +442,8 @@ DumpSmmuNode ( STATIC
VOID
DumpVendorDefinedNode (
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
ParseAcpi (
@@ -462,8 +465,8 @@ DumpVendorDefinedNode ( STATIC
VOID
DumpGicNode (
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
ParseAcpi (
@@ -485,8 +488,8 @@ DumpGicNode ( STATIC
VOID
DumpNodeInterface (
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
ParseAcpi (
@@ -509,19 +512,19 @@ DumpNodeInterface ( STATIC
VOID
DumpNodeInterrupts (
- IN UINT8* Ptr,
- IN UINT32 Length,
- IN UINT32 InterruptCount
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN UINT32 InterruptCount
)
{
- UINT32 Offset;
- UINT32 Index;
- CHAR8 Buffer[64];
+ UINT32 Offset;
+ UINT32 Index;
+ CHAR8 Buffer[64];
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,
@@ -573,9 +576,9 @@ DumpAestNodeStructure ( IN UINT32 InterruptCount
)
{
- UINT32 Offset;
- UINT32 RemainingLength;
- UINT8* NodeDataPtr;
+ UINT32 Offset;
+ UINT32 RemainingLength;
+ 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,
@@ -620,7 +623,7 @@ DumpAestNodeStructure ( }
// Parse Node Data Field.
- NodeDataPtr = Ptr + DataOffset;
+ NodeDataPtr = Ptr + DataOffset;
RemainingLength = Length - DataOffset;
switch (NodeType) {
case EFI_ACPI_AEST_NODE_TYPE_PROCESSOR:
@@ -675,14 +678,14 @@ DumpAestNodeStructure ( VOID
EFIAPI
ParseAcpiAest (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ 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,11 +732,12 @@ ParseAcpiAest ( // Validate AEST Node length
if ((*AestNodeLength == 0) ||
- ((Offset + (*AestNodeLength)) > AcpiTableLength)) {
+ ((Offset + (*AestNodeLength)) > AcpiTableLength))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Invalid AEST Node length. " \
- L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+ L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*AestNodeLength,
Offset,
AcpiTableLength
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c index 1a180271a4..afadde2aae 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c @@ -14,19 +14,19 @@ #include "AcpiTableParser.h"
// Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
An ACPI_PARSER array describing the ACPI BDRT Table.
**/
-STATIC CONST ACPI_PARSER BgrtParser[] = {
+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 }
};
/**
@@ -44,10 +44,10 @@ STATIC CONST ACPI_PARSER BgrtParser[] = { VOID
EFIAPI
ParseAcpiBgrt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
if (!Trace) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c index 9df111ecaa..d25d4d84f8 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -14,17 +14,17 @@ #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 ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+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;
/**
This function validates the NameSpace string length.
@@ -37,64 +37,64 @@ STATIC VOID
EFIAPI
ValidateNameSpaceStrLen (
- IN UINT8* Ptr,
- IN VOID* Context
+ IN UINT8 *Ptr,
+ IN VOID *Context
)
{
- UINT16 NameSpaceStrLen;
+ UINT16 NameSpaceStrLen;
- NameSpaceStrLen = *(UINT16*)Ptr;
+ NameSpaceStrLen = *(UINT16 *)Ptr;
if (NameSpaceStrLen < 2) {
IncrementErrorCount ();
Print (
L"\nERROR: NamespaceString Length = %d. If no Namespace device exists, " \
- L"NamespaceString[] must contain a period '.'",
+ L"NamespaceString[] must contain a period '.'",
NameSpaceStrLen
);
}
}
/// An ACPI_PARSER array describing the ACPI DBG2 table.
-STATIC CONST ACPI_PARSER Dbg2Parser[] = {
+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}
+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 }
};
/// 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"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"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}
+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"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"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,8 +107,8 @@ STATIC VOID
EFIAPI
DumpDbgDeviceInfo (
- IN UINT8* Ptr,
- IN UINT16 Length
+ IN UINT8 *Ptr,
+ IN UINT16 Length
)
{
UINT16 Index;
@@ -131,21 +131,23 @@ DumpDbgDeviceInfo ( (OEMDataLength == NULL) ||
(OEMDataOffset == NULL) ||
(BaseAddrRegOffset == NULL) ||
- (AddrSizeOffset == NULL)) {
+ (AddrSizeOffset == NULL))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Insufficient Debug Device Information Structure length. " \
- L"Length = %d.\n",
+ L"Length = %d.\n",
Length
);
return;
}
// GAS
- Index = 0;
+ Index = 0;
Offset = *BaseAddrRegOffset;
while ((Index++ < *GasCount) &&
- (Offset < Length)) {
+ (Offset < Length))
+ {
PrintFieldName (4, L"BaseAddressRegister");
Offset += (UINT16)DumpGasStruct (
Ptr + Offset,
@@ -160,7 +162,7 @@ DumpDbgDeviceInfo ( IncrementErrorCount ();
Print (
L"ERROR: Invalid GAS count. GasCount = %d. RemainingBufferLength = %d. " \
- L"Parsing of the Debug Device Information structure aborted.\n",
+ L"Parsing of the Debug Device Information structure aborted.\n",
*GasCount,
Length - *AddrSizeOffset
);
@@ -168,39 +170,45 @@ DumpDbgDeviceInfo ( }
// Address Size
- Index = 0;
+ 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);
}
// NameSpace String
- Index = 0;
+ Index = 0;
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
if (*OEMDataOffset != 0) {
- Index = 0;
+ Index = 0;
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");
}
}
@@ -220,14 +228,14 @@ DumpDbgDeviceInfo ( VOID
EFIAPI
ParseAcpiDbg2 (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT32 Index;
+ UINT32 Offset;
+ UINT32 Index;
if (!Trace) {
return;
@@ -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",
@@ -255,10 +264,9 @@ ParseAcpiDbg2 ( }
Offset = *OffsetDbgDeviceInfo;
- Index = 0;
+ Index = 0;
while (Index++ < *NumberDbgDeviceInfo) {
-
// Parse the Debug Device Information Structure header to obtain Length
ParseAcpi (
FALSE,
@@ -275,8 +283,8 @@ ParseAcpiDbg2 ( IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
- L"Debug Device Information structure's 'Length' field. " \
- L"RemainingTableBufferLength = %d.\n",
+ L"Debug Device Information structure's 'Length' field. " \
+ L"RemainingTableBufferLength = %d.\n",
AcpiTableLength - Offset
);
return;
@@ -284,11 +292,12 @@ 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. " \
- L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+ L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*DbgDevInfoLen,
Offset,
AcpiTableLength
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c index 6d43974f54..e75e462223 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c @@ -28,10 +28,10 @@ VOID
EFIAPI
ParseAcpiDsdt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
if (!Trace) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c index d6bea86bdb..d4c00ba891 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c @@ -16,23 +16,23 @@ /**
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}
+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 }
};
/**
@@ -50,10 +50,10 @@ STATIC CONST ACPI_PARSER FacsParser[] = { VOID
EFIAPI
ParseAcpiFacs (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
if (!Trace) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c index d86718bab6..f8fbb4bcb8 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -15,33 +15,33 @@ #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 ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+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;
/**
A macro defining the Hardware reduced ACPI flag
**/
-#define HW_REDUCED_ACPI BIT20
+#define HW_REDUCED_ACPI BIT20
/**
Offset to the FACS signature from the start of the FACS.
**/
-#define FACS_SIGNATURE_OFFSET 0
+#define FACS_SIGNATURE_OFFSET 0
/**
Offset to the FACS revision from the start of the FACS.
**/
-#define FACS_VERSION_OFFSET 32
+#define FACS_VERSION_OFFSET 32
/**
Offset to the FACS length from the start of the FACS.
**/
-#define FACS_LENGTH_OFFSET 4
+#define FACS_LENGTH_OFFSET 4
/**
Get the ACPI XSDT header info.
@@ -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,83 +115,84 @@ 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
}
/**
An ACPI_PARSER array describing the ACPI FADT Table.
**/
-STATIC CONST ACPI_PARSER FadtParser[] = {
+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 }
};
/**
@@ -206,19 +209,19 @@ STATIC CONST ACPI_PARSER FadtParser[] = { VOID
EFIAPI
ParseAcpiFadt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- EFI_STATUS Status;
- UINT8* DsdtPtr;
- UINT8* FirmwareCtrlPtr;
- UINT32 FacsSignature;
- UINT32 FacsLength;
- UINT8 FacsRevision;
- PARSE_ACPI_TABLE_PROC FacsParserProc;
+ EFI_STATUS Status;
+ UINT8 *DsdtPtr;
+ UINT8 *FirmwareCtrlPtr;
+ UINT32 FacsSignature;
+ UINT32 FacsLength;
+ UINT8 FacsRevision;
+ PARSE_ACPI_TABLE_PROC FacsParserProc;
ParseAcpi (
Trace,
@@ -233,7 +236,7 @@ ParseAcpiFadt ( if (FadtMinorRevision != NULL) {
Print (L"\nSummary:\n");
PrintFieldName (2, L"FADT Version");
- Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision);
+ Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision);
}
if (*GetAcpiXsdtHeaderInfo ()->OemTableId != *AcpiHdrInfo.OemTableId) {
@@ -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;
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index d00eaafe60..e62927098a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -15,16 +15,16 @@ #include "AcpiViewConfig.h"
// "The number of GT Block Timers must be less than or equal to 8"
-#define GT_BLOCK_TIMER_COUNT_MAX 8
+#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 ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+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;
/**
This function validates the GT Block timer count.
@@ -37,13 +37,13 @@ STATIC VOID
EFIAPI
ValidateGtBlockTimerCount (
- IN UINT8* Ptr,
- IN VOID* Context
+ IN UINT8 *Ptr,
+ IN VOID *Context
)
{
- UINT32 BlockTimerCount;
+ 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;
+ UINT8 FrameNumber;
- FrameNumber = *(UINT8*)Ptr;
+ FrameNumber = *(UINT8 *)Ptr;
if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) {
IncrementErrorCount ();
@@ -87,82 +87,82 @@ ValidateGtFrameNumber ( /**
An ACPI_PARSER array describing the ACPI GTDT Table.
**/
-STATIC CONST ACPI_PARSER GtdtParser[] = {
+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"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"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"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"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"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}
+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 }
};
/**
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}
+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 }
};
/**
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}
+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 }
};
/**
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}
+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 }
};
/**
@@ -174,12 +174,12 @@ STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = { STATIC
VOID
DumpGTBlock (
- IN UINT8* Ptr,
- IN UINT16 Length
+ IN UINT8 *Ptr,
+ IN UINT16 Length
)
{
- UINT32 Index;
- UINT32 Offset;
+ UINT32 Index;
+ UINT32 Offset;
ParseAcpi (
TRUE,
@@ -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",
@@ -203,12 +204,13 @@ DumpGTBlock ( }
Offset = *GtBlockTimerOffset;
- Index = 0;
+ Index = 0;
// 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,8 +231,8 @@ DumpGTBlock ( STATIC
VOID
DumpWatchdogTimer (
- IN UINT8* Ptr,
- IN UINT16 Length
+ IN UINT8 *Ptr,
+ IN UINT16 Length
)
{
ParseAcpi (
@@ -262,15 +264,15 @@ DumpWatchdogTimer ( VOID
EFIAPI
ParseAcpiGtdt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Index;
- UINT32 Offset;
- UINT8* TimerPtr;
+ UINT32 Index;
+ UINT32 Offset;
+ 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",
@@ -298,13 +301,14 @@ ParseAcpiGtdt ( }
TimerPtr = Ptr + *GtdtPlatformTimerOffset;
- Offset = *GtdtPlatformTimerOffset;
- Index = 0;
+ Offset = *GtdtPlatformTimerOffset;
+ Index = 0;
// 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,11 +322,12 @@ 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 " \
- L"Platform Timer Structure header. Length = %d.\n",
+ L"Platform Timer Structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@@ -330,11 +335,12 @@ ParseAcpiGtdt ( // Validate Platform Timer Structure length
if ((*PlatformTimerLength == 0) ||
- ((Offset + (*PlatformTimerLength)) > AcpiTableLength)) {
+ ((Offset + (*PlatformTimerLength)) > AcpiTableLength))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Invalid Platform Timer Structure length. " \
- L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+ L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*PlatformTimerLength,
Offset,
AcpiTableLength
@@ -359,6 +365,6 @@ ParseAcpiGtdt ( } // switch
TimerPtr += *PlatformTimerLength;
- Offset += *PlatformTimerLength;
+ Offset += *PlatformTimerLength;
} // while
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c index cf4432c654..2a1357c853 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c @@ -21,27 +21,27 @@ #include "AcpiView.h"
// Maximum Memory Domain matrix print size.
-#define MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX 10
+#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;
+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*
- 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*
- 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");
@@ -137,55 +140,55 @@ DumpCacheAttributes ( /**
An ACPI_PARSER array describing the ACPI HMAT Table.
*/
-STATIC CONST ACPI_PARSER HmatParser[] = {
+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}
+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 }
};
/**
An ACPI PARSER array describing the Memory Proximity Domain Attributes
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}
+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 }
};
/**
An ACPI PARSER array describing the System Locality Latency and Bandwidth
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}
+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 }
// initiator Proximity Domain list ...
// target Proximity Domain list ...
// Latency/Bandwidth matrix ...
@@ -195,18 +198,18 @@ STATIC CONST ACPI_PARSER SllbiParser[] = { An ACPI PARSER array describing the Memory Side Cache Information
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}
+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 }
// SMBIOS handles List ...
};
@@ -222,8 +225,8 @@ STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = { STATIC
VOID
DumpMpda (
- IN UINT8* Ptr,
- IN UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
ParseAcpi (
@@ -248,13 +251,13 @@ DumpMpda ( STATIC
VOID
DumpSllbi (
- IN UINT8* Ptr,
- IN UINT32 Length
+ 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,11 +281,12 @@ DumpSllbi ( if ((SllbiFlags == NULL) ||
(SllbiDataType == NULL) ||
(NumberInitiatorProximityDomain == NULL) ||
- (NumberTargetProximityDomain == NULL)) {
+ (NumberTargetProximityDomain == NULL))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
- L"SLLBI structure header. Length = %d.\n",
+ L"SLLBI structure header. Length = %d.\n",
Length
);
return;
@@ -306,10 +310,10 @@ DumpSllbi ( return;
}
- InitiatorProximityDomainList = (UINT32*) (Ptr + Offset);
- TargetProximityDomainList = InitiatorProximityDomainList +
- *NumberInitiatorProximityDomain;
- LatencyBandwidthMatrix = (UINT16*) (TargetProximityDomainList +
+ InitiatorProximityDomainList = (UINT32 *)(Ptr + Offset);
+ TargetProximityDomainList = InitiatorProximityDomainList +
+ *NumberInitiatorProximityDomain;
+ 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 UINT32 Length
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
- CONST UINT16* SMBIOSHandlesList;
+ CONST UINT16 *SMBIOSHandlesList;
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
UINT32 Offset;
UINT16 Index;
@@ -498,7 +512,7 @@ DumpMsci ( IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
- L"MSCI structure header. Length = %d.\n",
+ L"MSCI structure header. Length = %d.\n",
Length
);
return;
@@ -515,7 +529,7 @@ DumpMsci ( return;
}
- SMBIOSHandlesList = (UINT16*) (Ptr + Offset);
+ SMBIOSHandlesList = (UINT16 *)(Ptr + Offset);
for (Index = 0; Index < *NumberSMBIOSHandles; Index++) {
UnicodeSPrint (
@@ -553,14 +567,14 @@ DumpMsci ( VOID
EFIAPI
ParseAcpiHmat (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT8* HmatStructurePtr;
+ UINT32 Offset;
+ UINT8 *HmatStructurePtr;
if (!Trace) {
return;
@@ -591,11 +605,12 @@ 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 " \
- L"HMAT structure header. Length = %d.\n",
+ L"HMAT structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@@ -603,11 +618,12 @@ ParseAcpiHmat ( // Validate HMAT Structure length.
if ((*HmatStructureLength == 0) ||
- ((Offset + (*HmatStructureLength)) > AcpiTableLength)) {
+ ((Offset + (*HmatStructureLength)) > AcpiTableLength))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Invalid HMAT Structure length. " \
- L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+ L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*HmatStructureLength,
Offset,
AcpiTableLength
@@ -629,7 +645,7 @@ ParseAcpiHmat ( );
break;
case EFI_ACPI_6_4_HMAT_TYPE_MEMORY_SIDE_CACHE_INFO:
- DumpMsci (
+ DumpMsci (
HmatStructurePtr,
*HmatStructureLength
);
@@ -638,7 +654,7 @@ ParseAcpiHmat ( IncrementErrorCount ();
Print (
L"ERROR: Unknown HMAT structure:"
- L" Type = %d, Length = %d\n",
+ L" Type = %d, Length = %d\n",
*HmatStructureType,
*HmatStructureLength
);
@@ -646,6 +662,6 @@ ParseAcpiHmat ( } // switch
HmatStructurePtr += *HmatStructureLength;
- Offset += *HmatStructureLength;
+ Offset += *HmatStructureLength;
} // while
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index f7447947b2..81bfacd83a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -16,22 +16,22 @@ #include "AcpiViewConfig.h"
// Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+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.");
}
@@ -119,135 +119,135 @@ ValidateItsIdArrayReference ( /**
An ACPI_PARSER array describing the ACPI IORT Table
**/
-STATIC CONST ACPI_PARSER IortParser[] = {
+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 }
};
/**
An ACPI_PARSER array describing the IORT node header structure.
**/
-STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = {
+STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = {
PARSE_IORT_NODE_HEADER (NULL, NULL)
};
/**
An ACPI_PARSER array describing the IORT SMMUv1/2 node.
**/
-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},
+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 },
// 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}
+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 }
};
/**
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}
+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 }
};
/**
An ACPI_PARSER array describing the IORT SMMUv3 node.
**/
-STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = {
+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 }
};
/**
An ACPI_PARSER array describing the IORT ITS node.
**/
-STATIC CONST ACPI_PARSER IortNodeItsParser[] = {
+STATIC CONST ACPI_PARSER IortNodeItsParser[] = {
PARSE_IORT_NODE_HEADER (
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 }
};
/**
An ACPI_PARSER array describing the ITS ID.
**/
-STATIC CONST ACPI_PARSER ItsIdParser[] = {
+STATIC CONST ACPI_PARSER ItsIdParser[] = {
{ L"GIC ITS Identifier", 4, 0, L"%d", NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the IORT Names Component node.
**/
-STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = {
+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 }
};
/**
An ACPI_PARSER array describing the IORT Root Complex node.
**/
-STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = {
+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 }
};
/**
An ACPI_PARSER array describing the IORT PMCG node.
**/
-STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
+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,20 +260,21 @@ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = { STATIC
VOID
DumpIortNodeIdMappings (
- IN UINT8* Ptr,
- IN UINT32 Length,
- IN UINT32 MappingCount
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN UINT32 MappingCount
)
{
- UINT32 Index;
- UINT32 Offset;
- CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi
+ UINT32 Index;
+ UINT32 Offset;
+ CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi
- Index = 0;
+ Index = 0;
Offset = 0;
while ((Index < MappingCount) &&
- (Offset < Length)) {
+ (Offset < Length))
+ {
AsciiSPrint (
Buffer,
sizeof (Buffer),
@@ -304,15 +305,15 @@ DumpIortNodeIdMappings ( STATIC
VOID
DumpIortNodeSmmuV1V2 (
- IN UINT8* Ptr,
- IN UINT16 Length,
- IN UINT32 MappingCount,
- IN UINT32 MappingOffset
+ IN UINT8 *Ptr,
+ IN UINT16 Length,
+ IN UINT32 MappingCount,
+ IN UINT32 MappingOffset
)
{
- UINT32 Index;
- UINT32 Offset;
- CHAR8 Buffer[50]; // Used for AsciiName param of ParseAcpi
+ UINT32 Index;
+ UINT32 Offset;
+ CHAR8 Buffer[50]; // Used for AsciiName param of ParseAcpi
ParseAcpi (
TRUE,
@@ -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",
@@ -338,10 +340,11 @@ DumpIortNodeSmmuV1V2 ( }
Offset = *InterruptContextOffset;
- Index = 0;
+ Index = 0;
while ((Index < *InterruptContextCount) &&
- (Offset < Length)) {
+ (Offset < Length))
+ {
AsciiSPrint (
Buffer,
sizeof (Buffer),
@@ -360,10 +363,11 @@ DumpIortNodeSmmuV1V2 ( }
Offset = *PmuInterruptOffset;
- Index = 0;
+ Index = 0;
while ((Index < *PmuInterruptCount) &&
- (Offset < Length)) {
+ (Offset < Length))
+ {
AsciiSPrint (
Buffer,
sizeof (Buffer),
@@ -400,10 +404,10 @@ DumpIortNodeSmmuV1V2 ( STATIC
VOID
DumpIortNodeSmmuV3 (
- IN UINT8* Ptr,
- IN UINT16 Length,
- IN UINT32 MappingCount,
- IN UINT32 MappingOffset
+ IN UINT8 *Ptr,
+ IN UINT16 Length,
+ IN UINT32 MappingCount,
+ IN UINT32 MappingOffset
)
{
ParseAcpi (
@@ -431,22 +435,22 @@ DumpIortNodeSmmuV3 ( STATIC
VOID
DumpIortNodeIts (
- IN UINT8* Ptr,
- IN UINT16 Length
+ IN UINT8 *Ptr,
+ IN UINT16 Length
)
{
- UINT32 Offset;
- UINT32 Index;
- CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
+ UINT32 Offset;
+ UINT32 Index;
+ CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
Offset = ParseAcpi (
- TRUE,
- 2,
- "ITS Node",
- Ptr,
- Length,
- PARSER_PARAMS (IortNodeItsParser)
- );
+ TRUE,
+ 2,
+ "ITS Node",
+ Ptr,
+ Length,
+ PARSER_PARAMS (IortNodeItsParser)
+ );
// Check if the values used to control the parsing logic have been
// successfully read.
@@ -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,13 +500,13 @@ DumpIortNodeIts ( STATIC
VOID
DumpIortNodeNamedComponent (
- IN UINT8* Ptr,
- IN UINT16 Length,
- IN UINT32 MappingCount,
- IN UINT32 MappingOffset
+ IN UINT8 *Ptr,
+ IN UINT16 Length,
+ IN UINT32 MappingCount,
+ IN UINT32 MappingOffset
)
{
- UINT32 Offset;
+ UINT32 Offset;
Offset = ParseAcpi (
TRUE,
@@ -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,10 +548,10 @@ DumpIortNodeNamedComponent ( STATIC
VOID
DumpIortNodeRootComplex (
- IN UINT8* Ptr,
- IN UINT16 Length,
- IN UINT32 MappingCount,
- IN UINT32 MappingOffset
+ IN UINT8 *Ptr,
+ IN UINT16 Length,
+ IN UINT32 MappingCount,
+ IN UINT32 MappingOffset
)
{
ParseAcpi (
@@ -576,11 +582,11 @@ DumpIortNodeRootComplex ( STATIC
VOID
DumpIortNodePmcg (
- IN UINT8* Ptr,
- IN UINT16 Length,
- IN UINT32 MappingCount,
- IN UINT32 MappingOffset
-)
+ IN UINT8 *Ptr,
+ IN UINT16 Length,
+ IN UINT32 MappingCount,
+ IN UINT32 MappingOffset
+ )
{
ParseAcpi (
TRUE,
@@ -620,15 +626,15 @@ DumpIortNodePmcg ( VOID
EFIAPI
ParseAcpiIort (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT32 Index;
- UINT8* NodePtr;
+ UINT32 Offset;
+ UINT32 Index;
+ 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",
@@ -655,14 +662,15 @@ ParseAcpiIort ( return;
}
- Offset = *IortNodeOffset;
+ Offset = *IortNodeOffset;
NodePtr = Ptr + Offset;
- Index = 0;
+ Index = 0;
// 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,11 +686,12 @@ ParseAcpiIort ( if ((IortNodeType == NULL) ||
(IortNodeLength == NULL) ||
(IortIdMappingCount == NULL) ||
- (IortIdMappingOffset == NULL)) {
+ (IortIdMappingOffset == NULL))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
- L"IORT node header. Length = %d.\n",
+ L"IORT node header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@@ -690,11 +699,12 @@ ParseAcpiIort ( // Validate IORT Node length
if ((*IortNodeLength == 0) ||
- ((Offset + (*IortNodeLength)) > AcpiTableLength)) {
+ ((Offset + (*IortNodeLength)) > AcpiTableLength))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Invalid IORT Node length. " \
- L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+ L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*IortNodeLength,
Offset,
AcpiTableLength
@@ -750,7 +760,7 @@ ParseAcpiIort ( *IortNodeLength,
*IortIdMappingCount,
*IortIdMappingOffset
- );
+ );
break;
default:
@@ -759,6 +769,6 @@ ParseAcpiIort ( } // switch
NodePtr += (*IortNodeLength);
- Offset += (*IortNodeLength);
+ Offset += (*IortNodeLength);
} // while
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index 2ba8c9ae52..aaa68c99f5 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -19,9 +19,9 @@ #include "MadtParser.h"
// Local Variables
-STATIC CONST UINT8* MadtInterruptControllerType;
-STATIC CONST UINT8* MadtInterruptControllerLength;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT8 *MadtInterruptControllerType;
+STATIC CONST UINT8 *MadtInterruptControllerLength;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the System Vector Base in the GICD.
@@ -34,15 +34,15 @@ 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;
+ UINT16 SpeOverflowInterrupt;
- SpeOverflowInterrupt = *(UINT16*)Ptr;
+ SpeOverflowInterrupt = *(UINT16 *)Ptr;
// SPE not supported by this processor
if (SpeOverflowInterrupt == 0) {
@@ -73,183 +73,183 @@ 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 "
- L"ranges of %d-%d or %d-%d (for GICv3.1 or later).",
+ L"ranges of %d-%d or %d-%d (for GICv3.1 or later).",
SpeOverflowInterrupt,
ARM_PPI_ID_MIN,
ARM_PPI_ID_MAX,
ARM_PPI_ID_EXTENDED_MIN,
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.",
+ L"Level 3 PPI ID assignment: %d.",
SpeOverflowInterrupt,
ARM_PPI_ID_PMBIRQ
- );
+ );
}
}
/**
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"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}
+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"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 }
};
/**
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"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}
+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"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},
+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"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"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}
+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"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"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}
+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"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}
+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 }
};
/**
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}
+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 }
};
-
/**
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"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}
+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"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"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}
+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"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 }
};
/**
An ACPI_PARSER array describing the ACPI MADT Table.
**/
-STATIC CONST ACPI_PARSER MadtParser[] = {
+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}
+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 }
};
/**
@@ -275,15 +275,15 @@ STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = { VOID
EFIAPI
ParseAcpiMadt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT8* InterruptContollerPtr;
- UINT32 GICDCount;
+ UINT32 Offset;
+ UINT8 *InterruptContollerPtr;
+ UINT32 GICDCount;
GICDCount = 0;
@@ -315,11 +315,12 @@ 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 " \
- L"Interrupt Controller Structure header. Length = %d.\n",
+ L"Interrupt Controller Structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@@ -327,11 +328,12 @@ ParseAcpiMadt ( // Validate Interrupt Controller Structure length
if ((*MadtInterruptControllerLength == 0) ||
- ((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength)) {
+ ((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Invalid Interrupt Controller Structure length. " \
- L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+ L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*MadtInterruptControllerLength,
Offset,
AcpiTableLength
@@ -340,7 +342,8 @@ ParseAcpiMadt ( }
switch (*MadtInterruptControllerType) {
- case EFI_ACPI_6_3_GIC: {
+ case EFI_ACPI_6_3_GIC:
+ {
ParseAcpi (
TRUE,
2,
@@ -352,15 +355,17 @@ ParseAcpiMadt ( break;
}
- case EFI_ACPI_6_3_GICD: {
+ case EFI_ACPI_6_3_GICD:
+ {
if (++GICDCount > 1) {
IncrementErrorCount ();
Print (
L"ERROR: Only one GICD must be present,"
- L" GICDCount = %d\n",
+ L" GICDCount = %d\n",
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,11 +468,12 @@ ParseAcpiMadt ( break;
}
- default: {
+ default:
+ {
IncrementErrorCount ();
Print (
L"ERROR: Unknown Interrupt Controller Structure,"
- L" Type = %d, Length = %d\n",
+ L" Type = %d, Length = %d\n",
*MadtInterruptControllerType,
*MadtInterruptControllerLength
);
@@ -468,6 +481,6 @@ ParseAcpiMadt ( } // switch
InterruptContollerPtr += *MadtInterruptControllerLength;
- Offset += *MadtInterruptControllerLength;
+ Offset += *MadtInterruptControllerLength;
} // while
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h index fbbc43e09a..33ed85821b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h @@ -16,25 +16,25 @@ ///
/// Level 3 base server system Private Peripheral Inerrupt (PPI) ID assignments
///
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP 30
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS 29
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV 28
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV 27
-#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP 26
-#define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT 25
-#define ARM_PPI_ID_CTIIRQ 24
-#define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT 23
-#define ARM_PPI_ID_COMMIRQ 22
-#define ARM_PPI_ID_PMBIRQ 21
-#define ARM_PPI_ID_CNTHPS 20
-#define ARM_PPI_ID_CNTHVS 19
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP 30
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS 29
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV 28
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV 27
+#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP 26
+#define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT 25
+#define ARM_PPI_ID_CTIIRQ 24
+#define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT 23
+#define ARM_PPI_ID_COMMIRQ 22
+#define ARM_PPI_ID_PMBIRQ 21
+#define ARM_PPI_ID_CNTHPS 20
+#define ARM_PPI_ID_CNTHVS 19
///
/// PPI ID allowed ranges
///
-#define ARM_PPI_ID_MAX 31
-#define ARM_PPI_ID_MIN 16
-#define ARM_PPI_ID_EXTENDED_MAX 1119
-#define ARM_PPI_ID_EXTENDED_MIN 1056
+#define ARM_PPI_ID_MAX 31
+#define ARM_PPI_ID_MIN 16
+#define ARM_PPI_ID_EXTENDED_MAX 1119
+#define ARM_PPI_ID_EXTENDED_MIN 1056
#endif // MADT_PARSER_H_
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c index 9da4d60e84..16e99c25de 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c @@ -14,25 +14,25 @@ #include "AcpiTableParser.h"
// Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
An ACPI_PARSER array describing the ACPI MCFG Table.
**/
-STATIC CONST ACPI_PARSER McfgParser[] = {
+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}
+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 }
};
/**
@@ -50,15 +50,15 @@ STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = { VOID
EFIAPI
ParseAcpiMcfg (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT32 PciCfgOffset;
- UINT8* PciCfgSpacePtr;
+ UINT32 Offset;
+ UINT32 PciCfgOffset;
+ UINT8 *PciCfgSpacePtr;
if (!Trace) {
return;
@@ -85,6 +85,6 @@ ParseAcpiMcfg ( PARSER_PARAMS (PciCfgSpaceBaseAddrParser)
);
PciCfgSpacePtr += PciCfgOffset;
- Offset += PciCfgOffset;
+ Offset += PciCfgOffset;
}
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c index 6beee70b23..8cffdaaf07 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c @@ -17,12 +17,12 @@ #include "PcctParser.h"
// Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+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
@@ -183,12 +184,14 @@ ValidatePccIntAckGas ( if (((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
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) ==
+ 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,19 +233,20 @@ 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" \
- L" if a PCC type 4 structure is present in PCCT."
+ L" if a PCC type 4 structure is present in PCCT."
);
}
}
@@ -250,17 +254,17 @@ ValidatePlatInterrupt ( /**
An ACPI_PARSER array describing the ACPI PCCT Table.
*/
-STATIC CONST ACPI_PARSER PcctParser[] = {
+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 }
};
/**
An ACPI_PARSER array describing the platform communications channel subspace
structure header.
*/
-STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {
+STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {
PCC_SUBSPACE_HEADER ()
// ... Type Specific Fields ...
};
@@ -268,126 +272,126 @@ STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = { /**
An ACPI_PARSER array describing the Generic Communications Subspace - Type 0
*/
-STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {
+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 }
};
/**
An ACPI_PARSER array describing the HW-Reduced Communications Subspace
- Type 1
*/
-STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] = {
+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 }
};
/**
An ACPI_PARSER array describing the HW-Reduced Communications Subspace
- Type 2
*/
-STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] = {
+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 },
};
/**
An ACPI_PARSER array describing the Extended PCC Subspaces - Type 3/4
*/
-STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {
+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 },
};
/**
An ACPI_PARSER array describing the HW Registers based Communications
Subspace Structure - Type 5
*/
-STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
+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
)
{
@@ -544,15 +548,15 @@ DumpPccSubspaceType5 ( VOID
EFIAPI
ParseAcpiPcct (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT8* PccSubspacePtr;
- UINTN SubspaceCount;
+ UINT32 Offset;
+ UINT8 *PccSubspacePtr;
+ UINTN SubspaceCount;
if (!Trace) {
return;
@@ -584,11 +588,12 @@ 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 " \
- L"structure header. Length = %u.\n",
+ L"structure header. Length = %u.\n",
AcpiTableLength - Offset
);
return;
@@ -596,11 +601,12 @@ ParseAcpiPcct ( // Validate Structure length
if ((*PccSubspaceLength == 0) ||
- ((Offset + (*PccSubspaceLength)) > AcpiTableLength)) {
+ ((Offset + (*PccSubspaceLength)) > AcpiTableLength))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Invalid Structure length. " \
- L"Length = %u. Offset = %u. AcpiTableLength = %u.\n",
+ L"Length = %u. Offset = %u. AcpiTableLength = %u.\n",
*PccSubspaceLength,
Offset,
AcpiTableLength
@@ -649,14 +655,14 @@ ParseAcpiPcct ( IncrementErrorCount ();
Print (
L"ERROR: Unknown PCC subspace structure:"
- L" Type = %u, Length = %u\n",
+ L" Type = %u, Length = %u\n",
PccSubspaceType,
*PccSubspaceLength
);
}
PccSubspacePtr += *PccSubspaceLength;
- Offset += *PccSubspaceLength;
+ Offset += *PccSubspaceLength;
SubspaceCount++;
} // while
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h index 278dc83c5d..5b92ffee3f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h @@ -11,17 +11,17 @@ /**
Minimum value for the 'length' field in subspaces of types 0, 1 and 2.
*/
-#define MIN_MEMORY_RANGE_LENGTH 8
+#define MIN_MEMORY_RANGE_LENGTH 8
/**
Minimum value for the 'length' field in subspaces of types 3 and 4.
*/
-#define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN 16
+#define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN 16
/**
Maximum number of PCC subspaces.
*/
-#define MAX_PCC_SUBSPACES 256
+#define MAX_PCC_SUBSPACES 256
/**
Parser for the header of any type of PCC subspace.
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c index acd2b81bb3..f47b92f8c5 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -17,10 +17,10 @@ #include "PpttParser.h"
// Local variables
-STATIC CONST UINT8* ProcessorTopologyStructureType;
-STATIC CONST UINT8* ProcessorTopologyStructureLength;
-STATIC CONST UINT32* NumberOfPrivateResources;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT8 *ProcessorTopologyStructureType;
+STATIC CONST UINT8 *ProcessorTopologyStructureLength;
+STATIC CONST UINT32 *NumberOfPrivateResources;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the Cache Type Structure (Type 1) 'Number of sets'
@@ -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;
+ UINT32 NumberOfSets;
+
+ NumberOfSets = *(UINT32 *)Ptr;
if (NumberOfSets == 0) {
IncrementErrorCount ();
@@ -47,12 +48,12 @@ 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 (
L"\nERROR: When ARMv8.3-CCIDX is implemented the maximum cache number of "
- L"sets must be less than or equal to %d",
+ L"sets must be less than or equal to %d",
PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX
);
return;
@@ -62,14 +63,14 @@ ValidateCacheNumberOfSets ( IncrementWarningCount ();
Print (
L"\nWARNING: Without ARMv8.3-CCIDX, the maximum cache number of sets "
- L"must be less than or equal to %d. Ignore this message if "
- L"ARMv8.3-CCIDX is implemented",
+ L"must be less than or equal to %d. Ignore this message if "
+ L"ARMv8.3-CCIDX is implemented",
PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX
);
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;
+ UINT8 Associativity;
+
+ Associativity = *(UINT8 *)Ptr;
if (Associativity == 0) {
IncrementErrorCount ();
@@ -109,25 +111,26 @@ 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;
+ UINT16 LineSize;
+ 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"
- L" on ARM Platforms.",
+ L" on ARM Platforms.",
PPTT_ARM_CACHE_LINE_SIZE_MIN,
PPTT_ARM_CACHE_LINE_SIZE_MAX
);
@@ -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;
+ UINT8 Attributes;
+
+ Attributes = *(UINT8 *)Ptr;
if ((Attributes & 0xE0) != 0) {
IncrementErrorCount ();
@@ -175,67 +180,67 @@ ValidateCacheAttributes ( /**
An ACPI_PARSER array describing the ACPI PPTT Table.
**/
-STATIC CONST ACPI_PARSER PpttParser[] = {
+STATIC CONST ACPI_PARSER PpttParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo)
};
/**
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}
+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 }
};
/**
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"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}
+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"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"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}
+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"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"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},
+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"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,13 +253,13 @@ STATIC CONST ACPI_PARSER IdStructureParser[] = { STATIC
VOID
DumpProcessorHierarchyNodeStructure (
- IN UINT8* Ptr,
+ IN UINT8 *Ptr,
IN UINT8 Length
)
{
- UINT32 Offset;
- UINT32 Index;
- CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
+ UINT32 Offset;
+ UINT32 Index;
+ CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
Offset = ParseAcpi (
TRUE,
@@ -281,8 +286,8 @@ DumpProcessorHierarchyNodeStructure ( IncrementErrorCount ();
Print (
L"ERROR: Invalid Number of Private Resources. " \
- L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \
- L"Parsing of this structure aborted.\n",
+ L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \
+ L"Parsing of this structure aborted.\n",
*NumberOfPrivateResources,
Length - Offset
);
@@ -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,8 +349,8 @@ DumpCacheTypeStructure ( STATIC
VOID
DumpIDStructure (
- IN UINT8* Ptr,
- IN UINT8 Length
+ IN UINT8 *Ptr,
+ IN UINT8 Length
)
{
ParseAcpi (
@@ -378,14 +383,14 @@ DumpIDStructure ( VOID
EFIAPI
ParseAcpiPptt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT8* ProcessorTopologyStructurePtr;
+ UINT32 Offset;
+ UINT8 *ProcessorTopologyStructurePtr;
if (!Trace) {
return;
@@ -416,11 +421,12 @@ 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 " \
- L"processor topology structure header. Length = %d.\n",
+ L"processor topology structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@@ -428,11 +434,12 @@ ParseAcpiPptt ( // Validate Processor Topology Structure length
if ((*ProcessorTopologyStructureLength == 0) ||
- ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) {
+ ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength))
+ {
IncrementErrorCount ();
Print (
L"ERROR: Invalid Processor Topology Structure length. " \
- L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+ L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*ProcessorTopologyStructureLength,
Offset,
AcpiTableLength
@@ -466,13 +473,13 @@ ParseAcpiPptt ( IncrementErrorCount ();
Print (
L"ERROR: Unknown processor topology structure:"
- L" Type = %d, Length = %d\n",
+ L" Type = %d, Length = %d\n",
*ProcessorTopologyStructureType,
*ProcessorTopologyStructureLength
);
}
ProcessorTopologyStructurePtr += *ProcessorTopologyStructureLength;
- Offset += *ProcessorTopologyStructureLength;
+ Offset += *ProcessorTopologyStructureLength;
} // while
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h index 2a671203fb..6bee88084c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h @@ -16,22 +16,22 @@ /// Cache parameters allowed by the architecture with
/// ARMv8.3-CCIDX (Cache extended number of sets)
/// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0001
-#define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX (1 << 24)
-#define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX (1 << 21)
+#define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX (1 << 24)
+#define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX (1 << 21)
/// Cache parameters allowed by the architecture without
/// ARMv8.3-CCIDX (Cache extended number of sets)
/// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0000
-#define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX (1 << 15)
-#define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX (1 << 10)
+#define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX (1 << 15)
+#define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX (1 << 10)
/// Common cache parameters
/// Derived from CCSIDR_EL1
/// The LineSize is represented by bits 2:0
/// (Log2(Number of bytes in cache line)) - 4 is used to represent
/// the LineSize bits.
-#define PPTT_ARM_CACHE_LINE_SIZE_MAX (1 << 11)
-#define PPTT_ARM_CACHE_LINE_SIZE_MIN (1 << 4)
+#define PPTT_ARM_CACHE_LINE_SIZE_MAX (1 << 11)
+#define PPTT_ARM_CACHE_LINE_SIZE_MIN (1 << 4)
#endif // if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index f4a8732a7d..bddf276356 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -13,7 +13,7 @@ #include "AcpiTableParser.h"
// Local Variables
-STATIC CONST UINT64* XsdtAddress;
+STATIC CONST UINT64 *XsdtAddress;
/**
This function validates the RSDT Address.
@@ -26,19 +26,19 @@ 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.
// - Within the RSDP, the RsdtAddress field must be null (zero) and the
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
- UINT32 RsdtAddr;
+ UINT32 RsdtAddr;
- RsdtAddr = *(UINT32*)Ptr;
+ RsdtAddr = *(UINT32 *)Ptr;
if (RsdtAddr != 0) {
IncrementErrorCount ();
@@ -47,7 +47,8 @@ ValidateRsdtAddress ( RsdtAddr
);
}
-#endif
+
+ #endif
}
/**
@@ -61,19 +62,19 @@ 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.
// - Within the RSDP, the RsdtAddress field must be null (zero) and the
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
- UINT64 XsdtAddr;
+ 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}
+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 }
};
/**
@@ -118,10 +120,10 @@ STATIC CONST ACPI_PARSER RsdpParser[] = { VOID
EFIAPI
ParseAcpiRsdp (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
if (Trace) {
@@ -144,7 +146,7 @@ ParseAcpiRsdp ( IncrementErrorCount ();
Print (
L"ERROR: Insufficient table length. AcpiTableLength = %d." \
- L"RSDP parsing aborted.\n",
+ L"RSDP parsing aborted.\n",
AcpiTableLength
);
return;
@@ -160,5 +162,5 @@ ParseAcpiRsdp ( return;
}
- ProcessAcpiTable ((UINT8*)(UINTN)(*XsdtAddress));
+ ProcessAcpiTable ((UINT8 *)(UINTN)(*XsdtAddress));
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c index e4625ee8b1..71cc12cc2b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -15,22 +15,22 @@ #include "AcpiTableParser.h"
// Local Variables
-STATIC CONST UINT64* SlitSystemLocalityCount;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT64 *SlitSystemLocalityCount;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
An ACPI_PARSER array describing the ACPI SLIT table.
**/
-STATIC CONST ACPI_PARSER SlitParser[] = {
+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 }
};
/**
Macro to get the value of a System Locality
**/
-#define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)
+#define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)
/**
This function parses the ACPI SLIT table.
@@ -50,18 +50,18 @@ STATIC CONST ACPI_PARSER SlitParser[] = { VOID
EFIAPI
ParseAcpiSlit (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT32 Count;
- UINT32 Index;
- UINT32 LocalityCount;
- UINT8* LocalityPtr;
- CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi
+ UINT32 Offset;
+ UINT32 Count;
+ UINT32 Index;
+ UINT32 LocalityCount;
+ UINT8 *LocalityPtr;
+ CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi
if (!Trace) {
return;
@@ -103,8 +103,8 @@ ParseAcpiSlit ( IncrementErrorCount ();
Print (
L"ERROR: The Number of System Localities provided can't be represented " \
- L"in the SLIT table. SlitSystemLocalityCount = %ld. " \
- L"MaxLocalityCountAllowed = %d.\n",
+ L"in the SLIT table. SlitSystemLocalityCount = %ld. " \
+ L"MaxLocalityCountAllowed = %d.\n",
*SlitSystemLocalityCount,
MAX_UINT16
);
@@ -118,7 +118,7 @@ ParseAcpiSlit ( IncrementErrorCount ();
Print (
L"ERROR: Invalid Number of System Localities. " \
- L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n",
+ L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n",
*SlitSystemLocalityCount,
AcpiTableLength
);
@@ -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,23 +160,25 @@ 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)."
- L" Normalized Value is not 10\n",
+ L" Normalized Value is not 10\n",
Count,
Index,
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"
- L"Element[0x%lx][0x%lx] (%3d) do not match.\n",
+ L"Element[0x%lx][0x%lx] (%3d) do not match.\n",
Count,
Index,
SLIT_ELEMENT (LocalityPtr, Count, Index),
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c index 3b06b05dee..e5267b1d04 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -16,7 +16,7 @@ #include "AcpiTableParser.h"
// Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the Interrupt Type.
@@ -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)
- UINT8 InterruptType;
+ #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,12 +62,12 @@ 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)
- UINT8 Irq;
+ #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ UINT8 Irq;
Irq = *Ptr;
@@ -76,35 +78,36 @@ ValidateIrq ( Irq
);
}
-#endif
+
+ #endif
}
/**
An ACPI_PARSER array describing the ACPI SPCR Table.
**/
-STATIC CONST ACPI_PARSER SpcrParser[] = {
+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"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"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 }
};
/**
@@ -122,10 +125,10 @@ STATIC CONST ACPI_PARSER SpcrParser[] = { VOID
EFIAPI
ParseAcpiSpcr (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
if (!Trace) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index b9b67820b8..2980704479 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -16,10 +16,10 @@ #include "AcpiViewConfig.h"
// Local Variables
-STATIC CONST UINT8* SratRAType;
-STATIC CONST UINT8* SratRALength;
-STATIC CONST UINT8* SratDeviceHandleType;
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC CONST UINT8 *SratRAType;
+STATIC CONST UINT8 *SratRALength;
+STATIC CONST UINT8 *SratDeviceHandleType;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the Reserved field in the SRAT table header.
@@ -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,11 +54,11 @@ STATIC VOID
EFIAPI
ValidateSratDeviceHandleType (
- IN UINT8* Ptr,
- IN VOID* Context
+ IN UINT8 *Ptr,
+ IN VOID *Context
)
{
- UINT8 DeviceHandleType;
+ UINT8 DeviceHandleType;
DeviceHandleType = *Ptr;
@@ -82,11 +82,11 @@ STATIC VOID
EFIAPI
DumpSratPciBdfNumber (
- IN CONST CHAR16* Format,
- IN UINT8* Ptr
+ IN CONST CHAR16 *Format,
+ IN UINT8 *Ptr
)
{
- CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
+ CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
Print (L"\n");
@@ -143,20 +143,20 @@ 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}
+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 }
};
/**
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}
+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 }
};
/**
@@ -170,9 +170,9 @@ STATIC VOID
EFIAPI
DumpSratDeviceHandle (
- IN CONST CHAR16* Format,
- IN UINT8* Ptr
- )
+ IN CONST CHAR16 *Format,
+ IN UINT8 *Ptr
+ )
{
if (SratDeviceHandleType == NULL) {
IncrementErrorCount ();
@@ -213,11 +213,11 @@ STATIC VOID
EFIAPI
DumpSratApicProximity (
- IN CONST CHAR16* Format,
- IN UINT8* Ptr
- )
+ IN CONST CHAR16 *Format,
+ IN UINT8 *Ptr
+ )
{
- UINT32 ProximityDomain;
+ UINT32 ProximityDomain;
ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16);
@@ -227,108 +227,108 @@ DumpSratApicProximity ( /**
An ACPI_PARSER array describing the SRAT Table.
**/
-STATIC CONST ACPI_PARSER SratParser[] = {
+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}
+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 }
};
/**
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"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}
+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"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},
+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"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"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}
+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"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"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}
+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"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"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}
+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"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"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}
+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"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 }
};
/**
@@ -352,28 +352,28 @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = { VOID
EFIAPI
ParseAcpiSrat (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT8* ResourcePtr;
- UINT32 GicCAffinityIndex;
- UINT32 GicITSAffinityIndex;
- UINT32 GenericInitiatorAffinityIndex;
- UINT32 MemoryAffinityIndex;
- UINT32 ApicSapicAffinityIndex;
- UINT32 X2ApicAffinityIndex;
- CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
-
- GicCAffinityIndex = 0;
- GicITSAffinityIndex = 0;
+ UINT32 Offset;
+ UINT8 *ResourcePtr;
+ UINT32 GicCAffinityIndex;
+ UINT32 GicITSAffinityIndex;
+ UINT32 GenericInitiatorAffinityIndex;
+ UINT32 MemoryAffinityIndex;
+ UINT32 ApicSapicAffinityIndex;
+ UINT32 X2ApicAffinityIndex;
+ CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
+
+ GicCAffinityIndex = 0;
+ GicITSAffinityIndex = 0;
GenericInitiatorAffinityIndex = 0;
- MemoryAffinityIndex = 0;
- ApicSapicAffinityIndex = 0;
- X2ApicAffinityIndex = 0;
+ MemoryAffinityIndex = 0;
+ ApicSapicAffinityIndex = 0;
+ X2ApicAffinityIndex = 0;
if (!Trace) {
return;
@@ -403,11 +403,12 @@ 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 " \
- L"Static Resource Allocation structure header. Length = %d.\n",
+ L"Static Resource Allocation structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@@ -415,11 +416,12 @@ 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. " \
- L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
+ L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*SratRALength,
Offset,
AcpiTableLength
@@ -451,7 +453,7 @@ ParseAcpiSrat ( sizeof (Buffer),
"GIC ITS Affinity Structure [%d]",
GicITSAffinityIndex++
- );
+ );
ParseAcpi (
TRUE,
2,
@@ -468,7 +470,7 @@ ParseAcpiSrat ( sizeof (Buffer),
"Generic Initiator Affinity Structure [%d]",
GenericInitiatorAffinityIndex++
- );
+ );
ParseAcpi (
TRUE,
2,
@@ -476,7 +478,7 @@ ParseAcpiSrat ( ResourcePtr,
*SratRALength,
PARSER_PARAMS (SratGenericInitiatorAffinityParser)
- );
+ );
break;
case EFI_ACPI_6_3_MEMORY_AFFINITY:
@@ -537,6 +539,6 @@ ParseAcpiSrat ( }
ResourcePtr += (*SratRALength);
- Offset += (*SratRALength);
+ Offset += (*SratRALength);
}
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c index f18664b8a6..1fc8f2f4a6 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c @@ -28,10 +28,10 @@ VOID
EFIAPI
ParseAcpiSsdt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
if (!Trace) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c index e39061f8e2..ff09f3ca7f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c @@ -15,11 +15,11 @@ #include "AcpiTableParser.h"
// Local variables
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/** An ACPI_PARSER array describing the ACPI XSDT table.
*/
-STATIC CONST ACPI_PARSER XsdtParser[] = {
+STATIC CONST ACPI_PARSER XsdtParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo)
};
@@ -30,7 +30,7 @@ CONST ACPI_DESCRIPTION_HEADER_INFO * EFIAPI
GetAcpiXsdtHeaderInfo (
VOID
-)
+ )
{
return &AcpiHdrInfo;
}
@@ -48,17 +48,17 @@ GetAcpiXsdtHeaderInfo ( VOID
EFIAPI
ParseAcpiXsdt (
- IN BOOLEAN Trace,
- IN UINT8* Ptr,
- IN UINT32 AcpiTableLength,
- IN UINT8 AcpiTableRevision
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
)
{
- UINT32 Offset;
- UINT32 TableOffset;
- UINT64* TablePointer;
- UINTN EntryIndex;
- CHAR16 Buffer[32];
+ UINT32 Offset;
+ UINT32 TableOffset;
+ UINT64 *TablePointer;
+ UINTN EntryIndex;
+ CHAR16 Buffer[32];
Offset = ParseAcpi (
Trace,
@@ -72,24 +72,24 @@ ParseAcpiXsdt ( TableOffset = Offset;
if (Trace) {
- EntryIndex = 0;
- TablePointer = (UINT64*)(Ptr + TableOffset);
+ EntryIndex = 0;
+ 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,18 +122,20 @@ ParseAcpiXsdt ( *TablePointer
);
}
+
Offset += sizeof (UINT64);
TablePointer++;
} // while
}
// Process the tables
- Offset = TableOffset;
- TablePointer = (UINT64*)(Ptr + TableOffset);
+ Offset = 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
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c index d725cad14c..0ad7bf4c84 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c @@ -25,20 +25,20 @@ #include "AcpiView.h"
#include "AcpiViewConfig.h"
-CONST CHAR16 gShellAcpiViewFileName[] = L"ShellCommand";
-EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;
+CONST CHAR16 gShellAcpiViewFileName[] = L"ShellCommand";
+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}
+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 }
};
/**
@@ -46,30 +46,30 @@ 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}
+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 }
};
/**
@@ -86,11 +86,11 @@ EFI_STATUS RegisterAllParsers (
)
{
- EFI_STATUS Status;
- UINTN Count;
+ EFI_STATUS Status;
+ UINTN Count;
Status = EFI_SUCCESS;
- Count = sizeof (ParserList) / sizeof (ParserList[0]);
+ Count = sizeof (ParserList) / sizeof (ParserList[0]);
while (Count-- != 0) {
Status = RegisterParser (
@@ -101,6 +101,7 @@ RegisterAllParsers ( return Status;
}
}
+
return Status;
}
@@ -116,14 +117,14 @@ RegisterAllParsers ( UINTN
EFIAPI
ShellDumpBufferToFile (
- IN CONST CHAR16* FileNameBuffer,
- IN CONST VOID* Buffer,
+ IN CONST CHAR16 *FileNameBuffer,
+ IN CONST VOID *Buffer,
IN CONST UINTN BufferSize
)
{
- EFI_STATUS Status;
- SHELL_FILE_HANDLE DumpFileHandle;
- UINTN TransferBytes;
+ EFI_STATUS Status;
+ SHELL_FILE_HANDLE DumpFileHandle;
+ UINTN TransferBytes;
Status = ShellOpenFileByName (
FileNameBuffer,
@@ -145,11 +146,11 @@ ShellDumpBufferToFile ( }
TransferBytes = BufferSize;
- Status = ShellWriteFile (
- DumpFileHandle,
- &TransferBytes,
- (VOID *) Buffer
- );
+ Status = ShellWriteFile (
+ DumpFileHandle,
+ &TransferBytes,
+ (VOID *)Buffer
+ );
if (EFI_ERROR (Status)) {
Print (L"ERROR: Failed to write binary file.\n");
@@ -167,7 +168,7 @@ ShellDumpBufferToFile ( @return The string pointer to the file name.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameAcpiView (
VOID
@@ -190,27 +191,27 @@ 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 ();
- ShellStatus = SHELL_SUCCESS;
- Package = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ Package = NULL;
TmpDumpFileHandle = NULL;
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,18 +286,19 @@ ShellCommandRunAcpiView ( );
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetFlag (Package, L"-d") &&
- !ShellCommandLineGetFlag (Package, L"-s")) {
- ShellPrintHiiEx (
- -1,
- -1,
- NULL,
- STRING_TOKEN (STR_GEN_MISSING_OPTION),
- gShellAcpiViewHiiHandle,
- L"acpiview",
- L"-s",
- L"-d"
- );
- ShellStatus = SHELL_INVALID_PARAMETER;
+ !ShellCommandLineGetFlag (Package, L"-s"))
+ {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_GEN_MISSING_OPTION),
+ gShellAcpiViewHiiHandle,
+ L"acpiview",
+ L"-s",
+ L"-d"
+ );
+ ShellStatus = SHELL_INVALID_PARAMETER;
} else {
// Turn on colour highlighting if requested
SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h"));
@@ -316,9 +322,9 @@ ShellCommandRunAcpiView ( SelectAcpiTable (SelectedTableName);
SetReportOption (ReportSelected);
- if (ShellCommandLineGetFlag (Package, L"-d")) {
+ if (ShellCommandLineGetFlag (Package, L"-d")) {
// Create a temporary file to check if the media is writable.
- CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
+ CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
SetReportOption (ReportDumpBinFile);
UnicodeSPrint (
@@ -337,7 +343,7 @@ ShellCommandRunAcpiView ( );
if (EFI_ERROR (Status)) {
- ShellStatus = SHELL_INVALID_PARAMETER;
+ ShellStatus = SHELL_INVALID_PARAMETER;
TmpDumpFileHandle = NULL;
ShellPrintHiiEx (
-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;
}
@@ -389,7 +397,8 @@ UefiShellAcpiViewCommandLibConstructor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ 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;
}
diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c index 52d90e3c97..4a19794b9f 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c @@ -7,7 +7,6 @@ **/
-
#include <Uefi.h>
#include <Guid/GlobalVariable.h>
@@ -37,40 +36,40 @@ #include <Library/DevicePathLib.h>
#include <Library/UefiBootManagerLib.h>
-STATIC CONST CHAR16 mFileName[] = L"ShellCommands";
-STATIC EFI_HII_HANDLE gShellBcfgHiiHandle = NULL;
+STATIC CONST CHAR16 mFileName[] = L"ShellCommands";
+STATIC EFI_HII_HANDLE gShellBcfgHiiHandle = NULL;
typedef enum {
- BcfgTargetBootOrder = 0,
- BcfgTargetDriverOrder = 1,
- BcfgTargetMax = 2
+ BcfgTargetBootOrder = 0,
+ BcfgTargetDriverOrder = 1,
+ BcfgTargetMax = 2
} BCFG_OPERATION_TARGET;
typedef enum {
- BcfgTypeDump = 0,
- BcfgTypeAdd = 1,
- BcfgTypeAddp = 2,
- BcfgTypeAddh = 3,
- BcfgTypeRm = 4,
- BcfgTypeMv = 5,
- BcfgTypeOpt = 6,
- BcfgTypeMod = 7,
- BcfgTypeModf = 8,
- BcfgTypeModp = 9,
- BcfgTypeModh = 10,
- BcfgTypeMax = 11
+ BcfgTypeDump = 0,
+ BcfgTypeAdd = 1,
+ BcfgTypeAddp = 2,
+ BcfgTypeAddh = 3,
+ BcfgTypeRm = 4,
+ BcfgTypeMv = 5,
+ BcfgTypeOpt = 6,
+ BcfgTypeMod = 7,
+ BcfgTypeModf = 8,
+ BcfgTypeModp = 9,
+ BcfgTypeModh = 10,
+ BcfgTypeMax = 11
} BCFG_OPERATION_TYPE;
typedef struct {
- BCFG_OPERATION_TARGET Target;
- BCFG_OPERATION_TYPE Type;
- UINT16 Number1;
- UINT16 Number2;
- UINTN HandleIndex;
- CHAR16 *FileName;
- CHAR16 *Description;
- UINT16 *Order;
- CONST CHAR16 *OptData;
+ BCFG_OPERATION_TARGET Target;
+ BCFG_OPERATION_TYPE Type;
+ UINT16 Number1;
+ UINT16 Number2;
+ UINTN HandleIndex;
+ CHAR16 *FileName;
+ CHAR16 *Description;
+ UINT16 *Order;
+ CONST CHAR16 *OptData;
} BGFG_OPERATION;
/**
@@ -87,7 +86,7 @@ typedef struct { @retval other A error occurred.
**/
EFI_STATUS
-UpdateOptionalData(
+UpdateOptionalData (
UINT16 Index,
UINTN DataSize,
UINT8 *Data,
@@ -102,64 +101,68 @@ UpdateOptionalData( UINT8 *NewData;
UINTN OriginalOptionDataSize;
- UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Target == BcfgTargetBootOrder?L"Boot":L"Driver", Index);
+ UnicodeSPrint (VariableName, sizeof (VariableName), L"%s%04x", Target == BcfgTargetBootOrder ? L"Boot" : L"Driver", Index);
OriginalSize = 0;
OriginalData = NULL;
NewData = NULL;
NewSize = 0;
- Status = gRT->GetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- &OriginalSize,
- OriginalData);
+ Status = gRT->GetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ NULL,
+ &OriginalSize,
+ OriginalData
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- OriginalData = AllocateZeroPool(OriginalSize);
+ OriginalData = AllocateZeroPool (OriginalSize);
if (OriginalData == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- Status = gRT->GetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- &OriginalSize,
- OriginalData);
+
+ Status = gRT->GetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ NULL,
+ &OriginalSize,
+ OriginalData
+ );
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
//
// Allocate new struct and discard old optional data.
//
ASSERT (OriginalData != NULL);
- OriginalOptionDataSize = sizeof(UINT32) + sizeof(UINT16) + StrSize(((CHAR16*)(OriginalData + sizeof(UINT32) + sizeof(UINT16))));
- OriginalOptionDataSize += (*(UINT16*)(OriginalData + sizeof(UINT32)));
+ OriginalOptionDataSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (((CHAR16 *)(OriginalData + sizeof (UINT32) + sizeof (UINT16))));
+ OriginalOptionDataSize += (*(UINT16 *)(OriginalData + sizeof (UINT32)));
OriginalOptionDataSize -= OriginalSize;
- NewSize = OriginalSize - OriginalOptionDataSize + DataSize;
- NewData = AllocatePool(NewSize);
+ NewSize = OriginalSize - OriginalOptionDataSize + DataSize;
+ NewData = AllocatePool (NewSize);
if (NewData == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
CopyMem (NewData, OriginalData, OriginalSize - OriginalOptionDataSize);
- CopyMem(NewData + OriginalSize - OriginalOptionDataSize, Data, DataSize);
+ CopyMem (NewData + OriginalSize - OriginalOptionDataSize, Data, DataSize);
}
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
//
// put the data back under the variable
//
- Status = gRT->SetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- NewSize,
- NewData);
+ Status = gRT->SetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
+ NewSize,
+ NewData
+ );
}
- SHELL_FREE_NON_NULL(OriginalData);
- SHELL_FREE_NON_NULL(NewData);
+ SHELL_FREE_NON_NULL (OriginalData);
+ SHELL_FREE_NON_NULL (NewData);
return (Status);
}
@@ -173,9 +176,9 @@ UpdateOptionalData( @retval other A error occurred.
**/
EFI_STATUS
-GetBootOptionCrc(
- UINT32 *Crc,
- UINT16 BootIndex
+GetBootOptionCrc (
+ UINT32 *Crc,
+ UINT16 BootIndex
)
{
CHAR16 VariableName[12];
@@ -183,37 +186,39 @@ GetBootOptionCrc( UINT8 *Buffer;
UINTN BufferSize;
- Buffer = NULL;
- BufferSize = 0;
+ Buffer = NULL;
+ BufferSize = 0;
//
// Get the data Buffer
//
- UnicodeSPrint(VariableName, sizeof(VariableName), L"%Boot%04x", BootIndex);
- Status = gRT->GetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- &BufferSize,
- NULL);
+ UnicodeSPrint (VariableName, sizeof (VariableName), L"%Boot%04x", BootIndex);
+ Status = gRT->GetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ NULL,
+ &BufferSize,
+ NULL
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- Buffer = AllocateZeroPool(BufferSize);
- Status = gRT->GetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- &BufferSize,
- Buffer);
+ Buffer = AllocateZeroPool (BufferSize);
+ Status = gRT->GetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ NULL,
+ &BufferSize,
+ Buffer
+ );
}
//
// Get the CRC computed
//
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = gBS->CalculateCrc32 (Buffer, BufferSize, Crc);
}
- SHELL_FREE_NON_NULL(Buffer);
+ SHELL_FREE_NON_NULL (Buffer);
return EFI_SUCCESS;
}
@@ -230,47 +235,51 @@ GetBootOptionCrc( **/
EFI_STATUS
GetDevicePathForDriverHandle (
- IN EFI_HANDLE TheHandle,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath
+ IN EFI_HANDLE TheHandle,
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath
)
{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**)&LoadedImage,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->OpenProtocol (
- LoadedImage->DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&ImageDevicePath,
+ TheHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage,
gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ LoadedImage->DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&ImageDevicePath,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
-// *DevPath = DuplicateDevicePath (ImageDevicePath);
-// *FilePath = DuplicateDevicePath (LoadedImage->FilePath);
- *FilePath = AppendDevicePath(ImageDevicePath,LoadedImage->FilePath);
- gBS->CloseProtocol(
- LoadedImage->DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- gImageHandle,
- NULL);
+ // *DevPath = DuplicateDevicePath (ImageDevicePath);
+ // *FilePath = DuplicateDevicePath (LoadedImage->FilePath);
+ *FilePath = AppendDevicePath (ImageDevicePath, LoadedImage->FilePath);
+ gBS->CloseProtocol (
+ LoadedImage->DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ gImageHandle,
+ NULL
+ );
}
- gBS->CloseProtocol(
- TheHandle,
- &gEfiLoadedImageProtocolGuid,
- gImageHandle,
- NULL);
+
+ gBS->CloseProtocol (
+ TheHandle,
+ &gEfiLoadedImageProtocolGuid,
+ gImageHandle,
+ NULL
+ );
}
+
return (Status);
}
@@ -286,18 +295,18 @@ GetDevicePathForDriverHandle ( @retval SHELL_SUCCESS Get device path successfully.
**/
SHELL_STATUS
-GetDevicePathByHandle(
- IN EFI_HANDLE TheHandle,
- IN BCFG_OPERATION_TARGET Target,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+GetDevicePathByHandle (
+ IN EFI_HANDLE TheHandle,
+ IN BCFG_OPERATION_TARGET Target,
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
- UINTN DriverBindingHandleCount;
- UINTN ParentControllerHandleCount;
- UINTN ChildControllerHandleCount;
+ UINTN DriverBindingHandleCount;
+ UINTN ParentControllerHandleCount;
+ UINTN ChildControllerHandleCount;
ShellStatus = SHELL_SUCCESS;
@@ -307,7 +316,7 @@ GetDevicePathByHandle( }
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (TheHandle, &DriverBindingHandleCount, NULL);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
DriverBindingHandleCount = 0;
}
@@ -321,13 +330,14 @@ GetDevicePathByHandle( ChildControllerHandleCount = 0;
}
- Status = gBS->HandleProtocol (TheHandle, &gEfiDevicePathProtocolGuid, (VOID**)DevicePath);
+ Status = gBS->HandleProtocol (TheHandle, &gEfiDevicePathProtocolGuid, (VOID **)DevicePath);
- if ( DriverBindingHandleCount > 0 ||
- ParentControllerHandleCount > 0 ||
- ChildControllerHandleCount > 0 ||
- !EFI_ERROR(Status)
- ) {
+ if ((DriverBindingHandleCount > 0) ||
+ (ParentControllerHandleCount > 0) ||
+ (ChildControllerHandleCount > 0) ||
+ !EFI_ERROR (Status)
+ )
+ {
//
// The handle points to a real controller which has a device path.
//
@@ -335,11 +345,12 @@ GetDevicePathByHandle( ShellPrintHiiEx (
-1,
-1,
- NULL,STRING_TOKEN (STR_GEN_PARAM_INV),
+ NULL,
+ STRING_TOKEN (STR_GEN_PARAM_INV),
gShellBcfgHiiHandle,
L"bcfg",
L"Handle should point to driver image."
- );
+ );
ShellStatus = SHELL_NOT_FOUND;
}
} else {
@@ -355,7 +366,7 @@ GetDevicePathByHandle( gShellBcfgHiiHandle,
L"bcfg",
L"Handle should point to controller."
- );
+ );
ShellStatus = SHELL_NOT_FOUND;
} else {
if (EFI_ERROR (GetDevicePathForDriverHandle (TheHandle, DevicePath))) {
@@ -379,8 +390,8 @@ GetDevicePathByHandle( **/
SHELL_STATUS
BcfgMod (
- IN CONST BGFG_OPERATION *BcfgOperation,
- IN CONST UINTN OrderCount
+ IN CONST BGFG_OPERATION *BcfgOperation,
+ IN CONST UINTN OrderCount
)
{
EFI_STATUS Status;
@@ -394,29 +405,30 @@ BcfgMod ( EFI_DEVICE_PATH_PROTOCOL *DevicePathWalker;
EFI_BOOT_MANAGER_LOAD_OPTION LoadOption;
- ShellStatus = SHELL_SUCCESS;
- FileList = NULL;
- DevicePath = NULL;
- DevicePathBuffer = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ FileList = NULL;
+ DevicePath = NULL;
+ DevicePathBuffer = NULL;
- ZeroMem (&LoadOption, sizeof(EFI_BOOT_MANAGER_LOAD_OPTION));
+ ZeroMem (&LoadOption, sizeof (EFI_BOOT_MANAGER_LOAD_OPTION));
- if ( (BcfgOperation->Type == BcfgTypeMod && BcfgOperation->Description == NULL) ||
- (BcfgOperation->Type == BcfgTypeModf && BcfgOperation->FileName == NULL) ||
- (BcfgOperation->Type == BcfgTypeModp && BcfgOperation->FileName == NULL) ||
- (BcfgOperation->Type == BcfgTypeModh && BcfgOperation->HandleIndex == 0) ||
- (BcfgOperation->Number1 > OrderCount)
- ) {
+ if (((BcfgOperation->Type == BcfgTypeMod) && (BcfgOperation->Description == NULL)) ||
+ ((BcfgOperation->Type == BcfgTypeModf) && (BcfgOperation->FileName == NULL)) ||
+ ((BcfgOperation->Type == BcfgTypeModp) && (BcfgOperation->FileName == NULL)) ||
+ ((BcfgOperation->Type == BcfgTypeModh) && (BcfgOperation->HandleIndex == 0)) ||
+ (BcfgOperation->Number1 > OrderCount)
+ )
+ {
return (SHELL_INVALID_PARAMETER);
}
if (BcfgOperation->Type == BcfgTypeModh) {
- CurHandle = ConvertHandleIndexToHandle (BcfgOperation->HandleIndex);
+ CurHandle = ConvertHandleIndexToHandle (BcfgOperation->HandleIndex);
ShellStatus = GetDevicePathByHandle (CurHandle, BcfgOperation->Target, &DevicePathBuffer);
if (ShellStatus == SHELL_SUCCESS) {
DevicePath = DuplicateDevicePath (DevicePathBuffer);
}
- } else if (BcfgOperation->Type == BcfgTypeModf || BcfgOperation->Type == BcfgTypeModp) {
+ } else if ((BcfgOperation->Type == BcfgTypeModf) || (BcfgOperation->Type == BcfgTypeModp)) {
//
// Get Device Path by FileName.
//
@@ -427,8 +439,7 @@ BcfgMod ( //
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellBcfgHiiHandle, L"bcfg", BcfgOperation->FileName);
ShellStatus = SHELL_INVALID_PARAMETER;
- }
- else if (FileList->Link.ForwardLink != FileList->Link.BackLink) {
+ } else if (FileList->Link.ForwardLink != FileList->Link.BackLink) {
//
// If the name of file expanded to multiple names, it's fail.
//
@@ -450,17 +461,18 @@ BcfgMod ( if (ShellStatus == SHELL_SUCCESS) {
if (BcfgOperation->Type == BcfgTypeModp) {
- ShellStatus = SHELL_INVALID_PARAMETER;
+ ShellStatus = SHELL_INVALID_PARAMETER;
DevicePathWalker = DevicePathBuffer;
while (!IsDevicePathEnd (DevicePathWalker)) {
- if ( DevicePathType (DevicePathWalker) == MEDIA_DEVICE_PATH &&
- DevicePathSubType (DevicePathWalker) == MEDIA_HARDDRIVE_DP
- ) {
+ if ((DevicePathType (DevicePathWalker) == MEDIA_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePathWalker) == MEDIA_HARDDRIVE_DP)
+ )
+ {
//
// We found the portion of device path starting with the hard driver partition.
//
ShellStatus = SHELL_SUCCESS;
- DevicePath = DuplicateDevicePath (DevicePathWalker);
+ DevicePath = DuplicateDevicePath (DevicePathWalker);
break;
} else {
DevicePathWalker = NextDevicePathNode (DevicePathWalker);
@@ -480,8 +492,9 @@ BcfgMod ( } else {
UnicodeSPrint (OptionStr, sizeof (OptionStr), L"Driver%04x", BcfgOperation->Order[BcfgOperation->Number1]);
}
+
Status = EfiBootManagerVariableToLoadOption (OptionStr, &LoadOption);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NONE), gShellBcfgHiiHandle);
ShellStatus = SHELL_NOT_FOUND;
}
@@ -497,7 +510,7 @@ BcfgMod ( }
Status = EfiBootManagerLoadOptionToVariable (&LoadOption);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", OptionStr);
ShellStatus = SHELL_INVALID_PARAMETER;
}
@@ -533,7 +546,7 @@ BcfgMod ( @retval SHELL_INVALID_PARAMETER A parameter was invalid.
**/
SHELL_STATUS
-BcfgAdd(
+BcfgAdd (
IN UINTN Position,
IN CONST CHAR16 *File,
IN CONST CHAR16 *Desc,
@@ -568,7 +581,7 @@ BcfgAdd( UINT16 *NewOrder;
if (!UseHandle) {
- if (File == NULL || Desc == NULL) {
+ if ((File == NULL) || (Desc == NULL)) {
return (SHELL_INVALID_PARAMETER);
}
} else {
@@ -581,86 +594,97 @@ BcfgAdd( Position = OrderCount;
}
- Str = NULL;
- FilePath = NULL;
- FileList = NULL;
- Handles = NULL;
- ShellStatus = SHELL_SUCCESS;
- TargetLocation = 0xFFFF;
+ Str = NULL;
+ FilePath = NULL;
+ FileList = NULL;
+ Handles = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ TargetLocation = 0xFFFF;
if (UseHandle) {
- CurHandle = ConvertHandleIndexToHandle(HandleNumber);
+ CurHandle = ConvertHandleIndexToHandle (HandleNumber);
if (CurHandle == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (Target == BcfgTargetBootOrder) {
//
- //Make sure that the handle should point to a real controller
+ // Make sure that the handle should point to a real controller
//
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
CurHandle,
&DriverBindingHandleCount,
- NULL);
+ NULL
+ );
Status = PARSE_HANDLE_DATABASE_PARENTS (
CurHandle,
&ParentControllerHandleCount,
- NULL);
+ NULL
+ );
Status = ParseHandleDatabaseForChildControllers (
CurHandle,
&ChildControllerHandleCount,
- NULL);
+ NULL
+ );
- if (DriverBindingHandleCount > 0
- || ParentControllerHandleCount > 0
- || ChildControllerHandleCount > 0) {
+ if ( (DriverBindingHandleCount > 0)
+ || (ParentControllerHandleCount > 0)
+ || (ChildControllerHandleCount > 0))
+ {
FilePath = NULL;
- Status = gBS->HandleProtocol (
- CurHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&FilePath);
+ Status = gBS->HandleProtocol (
+ CurHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&FilePath
+ );
}
+
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_HANDLE), gShellBcfgHiiHandle, L"bcfg", HandleNumber);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_HANDLE), gShellBcfgHiiHandle, L"bcfg", HandleNumber);
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else {
//
- //Make sure that the handle should point to driver, not a controller.
+ // Make sure that the handle should point to driver, not a controller.
//
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
CurHandle,
&DriverBindingHandleCount,
- NULL);
+ NULL
+ );
Status = PARSE_HANDLE_DATABASE_PARENTS (
CurHandle,
&ParentControllerHandleCount,
- NULL);
+ NULL
+ );
Status = ParseHandleDatabaseForChildControllers (
CurHandle,
&ChildControllerHandleCount,
- NULL);
+ NULL
+ );
Status = gBS->HandleProtocol (
- CurHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&FilePath);
-
- if (DriverBindingHandleCount > 0
- || ParentControllerHandleCount > 0
- || ChildControllerHandleCount > 0
- || !EFI_ERROR(Status) ) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number");
+ CurHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&FilePath
+ );
+
+ if ( (DriverBindingHandleCount > 0)
+ || (ParentControllerHandleCount > 0)
+ || (ChildControllerHandleCount > 0)
+ || !EFI_ERROR (Status))
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// Get the DevicePath from the loaded image information.
//
- Status = GetDevicePathForDriverHandle(CurHandle, &FilePath);
+ Status = GetDevicePathForDriverHandle (CurHandle, &FilePath);
}
}
}
@@ -668,24 +692,24 @@ BcfgAdd( //
// Get file info
//
- ShellOpenFileMetaArg ((CHAR16*)File, EFI_FILE_MODE_READ, &FileList);
+ ShellOpenFileMetaArg ((CHAR16 *)File, EFI_FILE_MODE_READ, &FileList);
if (FileList == NULL) {
//
// If filename matched nothing fail
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellBcfgHiiHandle, L"bcfg", File);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellBcfgHiiHandle, L"bcfg", File);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (FileList->Link.ForwardLink != FileList->Link.BackLink) {
//
// If filename expanded to multiple names, fail
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE), gShellBcfgHiiHandle, L"bcfg", File);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE), gShellBcfgHiiHandle, L"bcfg", File);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Arg = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link);
- if (EFI_ERROR(Arg->Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_OPEN), gShellBcfgHiiHandle, L"bcfg", File);
+ Arg = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link);
+ if (EFI_ERROR (Arg->Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_OPEN), gShellBcfgHiiHandle, L"bcfg", File);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
@@ -695,18 +719,18 @@ BcfgAdd( //
// get the device path
//
- DevicePath = gEfiShellProtocol->GetDevicePathFromFilePath(Arg->FullName);
+ DevicePath = gEfiShellProtocol->GetDevicePathFromFilePath (Arg->FullName);
if (DevicePath == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_DP), gShellBcfgHiiHandle, L"bcfg", Arg->FullName);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_DP), gShellBcfgHiiHandle, L"bcfg", Arg->FullName);
ShellStatus = SHELL_UNSUPPORTED;
} else {
if (UsePath) {
DevPath = DevicePath;
ShellStatus = SHELL_INVALID_PARAMETER;
- while (!IsDevicePathEnd(DevPath)) {
- if ((DevicePathType(DevPath) == MEDIA_DEVICE_PATH) &&
- (DevicePathSubType(DevPath) == MEDIA_HARDDRIVE_DP)) {
-
+ while (!IsDevicePathEnd (DevPath)) {
+ if ((DevicePathType (DevPath) == MEDIA_DEVICE_PATH) &&
+ (DevicePathSubType (DevPath) == MEDIA_HARDDRIVE_DP))
+ {
//
// If we find it use it instead
//
@@ -714,26 +738,27 @@ BcfgAdd( FilePath = DuplicateDevicePath (DevPath);
break;
}
- DevPath = NextDevicePathNode(DevPath);
+
+ DevPath = NextDevicePathNode (DevPath);
}
} else {
- FilePath = DuplicateDevicePath(DevicePath);
+ FilePath = DuplicateDevicePath (DevicePath);
}
- FreePool(DevicePath);
+
+ FreePool (DevicePath);
}
}
}
}
-
if (ShellStatus == SHELL_SUCCESS) {
//
// Find a free target ,a brute force implementation
//
Found = FALSE;
- for (TargetLocation=0; TargetLocation < 0xFFFF; TargetLocation++) {
+ for (TargetLocation = 0; TargetLocation < 0xFFFF; TargetLocation++) {
Found = TRUE;
- for (Index=0; Index < OrderCount; Index++) {
+ for (Index = 0; Index < OrderCount; Index++) {
if (CurrentOrder[Index] == TargetLocation) {
Found = FALSE;
break;
@@ -746,9 +771,9 @@ BcfgAdd( }
if (TargetLocation == 0xFFFF) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_TARGET_NF), gShellBcfgHiiHandle, L"bcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_TARGET_NF), gShellBcfgHiiHandle, L"bcfg");
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_TARGET), gShellBcfgHiiHandle, TargetLocation);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_TARGET), gShellBcfgHiiHandle, TargetLocation);
}
}
@@ -756,39 +781,39 @@ BcfgAdd( //
// Add the option
//
- DescSize = StrSize(Desc);
+ DescSize = StrSize (Desc);
FilePathSize = GetDevicePathSize (FilePath);
- TempByteBuffer = AllocateZeroPool(sizeof(UINT32) + sizeof(UINT16) + DescSize + FilePathSize);
+ TempByteBuffer = AllocateZeroPool (sizeof (UINT32) + sizeof (UINT16) + DescSize + FilePathSize);
if (TempByteBuffer != NULL) {
- TempByteStart = TempByteBuffer;
- *((UINT32 *) TempByteBuffer) = LOAD_OPTION_ACTIVE; // Attributes
- TempByteBuffer += sizeof (UINT32);
+ TempByteStart = TempByteBuffer;
+ *((UINT32 *)TempByteBuffer) = LOAD_OPTION_ACTIVE; // Attributes
+ TempByteBuffer += sizeof (UINT32);
- *((UINT16 *) TempByteBuffer) = (UINT16)FilePathSize; // FilePathListLength
- TempByteBuffer += sizeof (UINT16);
+ *((UINT16 *)TempByteBuffer) = (UINT16)FilePathSize; // FilePathListLength
+ TempByteBuffer += sizeof (UINT16);
CopyMem (TempByteBuffer, Desc, DescSize);
TempByteBuffer += DescSize;
ASSERT (FilePath != NULL);
CopyMem (TempByteBuffer, FilePath, FilePathSize);
- UnicodeSPrint (OptionStr, sizeof(OptionStr), L"%s%04x", Target == BcfgTargetBootOrder?L"Boot":L"Driver", TargetLocation);
+ UnicodeSPrint (OptionStr, sizeof (OptionStr), L"%s%04x", Target == BcfgTargetBootOrder ? L"Boot" : L"Driver", TargetLocation);
Status = gRT->SetVariable (
- OptionStr,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof(UINT32) + sizeof(UINT16) + DescSize + FilePathSize,
- TempByteStart
- );
-
- FreePool(TempByteStart);
+ OptionStr,
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
+ sizeof (UINT32) + sizeof (UINT16) + DescSize + FilePathSize,
+ TempByteStart
+ );
+
+ FreePool (TempByteStart);
} else {
Status = EFI_OUT_OF_RESOURCES;
}
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", OptionStr);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", OptionStr);
} else {
NewOrder = AllocateZeroPool ((OrderCount + 1) * sizeof (NewOrder[0]));
if (NewOrder != NULL) {
@@ -801,14 +826,14 @@ BcfgAdd( NewOrder[Index] = NewOrder[Index - 1];
}
- NewOrder[Position] = (UINT16) TargetLocation;
- Status = gRT->SetVariable (
- Target == BcfgTargetBootOrder ? L"BootOrder" : L"DriverOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- (OrderCount + 1) * sizeof (UINT16),
- NewOrder
- );
+ NewOrder[Position] = (UINT16)TargetLocation;
+ Status = gRT->SetVariable (
+ Target == BcfgTargetBootOrder ? L"BootOrder" : L"DriverOrder",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ (OrderCount + 1) * sizeof (UINT16),
+ NewOrder
+ );
FreePool (NewOrder);
@@ -822,15 +847,15 @@ BcfgAdd( }
}
-//
-//If always Free FilePath, will free devicepath in system when use "addh"
-//
- if (FilePath!=NULL && !UseHandle) {
+ //
+ // If always Free FilePath, will free devicepath in system when use "addh"
+ //
+ if ((FilePath != NULL) && !UseHandle) {
FreePool (FilePath);
}
if (Str != NULL) {
- FreePool(Str);
+ FreePool (Str);
}
if (Handles != NULL) {
@@ -856,7 +881,7 @@ BcfgAdd( @retval SHELL_INVALID_PARAMETER A parameter was invalid.
**/
SHELL_STATUS
-BcfgRemove(
+BcfgRemove (
IN CONST BCFG_OPERATION_TARGET Target,
IN CONST UINT16 *CurrentOrder,
IN CONST UINTN OrderCount,
@@ -868,38 +893,43 @@ BcfgRemove( EFI_STATUS Status;
UINTN NewCount;
- UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Target == BcfgTargetBootOrder?L"Boot":L"Driver", CurrentOrder[Location]);
- Status = gRT->SetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- 0,
- NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
+ UnicodeSPrint (VariableName, sizeof (VariableName), L"%s%04x", Target == BcfgTargetBootOrder ? L"Boot" : L"Driver", CurrentOrder[Location]);
+ Status = gRT->SetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
+ 0,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
return (SHELL_INVALID_PARAMETER);
}
- NewOrder = AllocateZeroPool(OrderCount*sizeof(CurrentOrder[0]));
+
+ NewOrder = AllocateZeroPool (OrderCount*sizeof (CurrentOrder[0]));
if (NewOrder != NULL) {
NewCount = OrderCount;
- CopyMem(NewOrder, CurrentOrder, OrderCount*sizeof(CurrentOrder[0]));
- CopyMem(NewOrder+Location, NewOrder+Location+1, (OrderCount - Location - 1)*sizeof(CurrentOrder[0]));
+ CopyMem (NewOrder, CurrentOrder, OrderCount*sizeof (CurrentOrder[0]));
+ CopyMem (NewOrder+Location, NewOrder+Location+1, (OrderCount - Location - 1)*sizeof (CurrentOrder[0]));
NewCount--;
- Status = gRT->SetVariable(
- Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- NewCount*sizeof(NewOrder[0]),
- NewOrder);
- FreePool(NewOrder);
+ Status = gRT->SetVariable (
+ Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder",
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
+ NewCount*sizeof (NewOrder[0]),
+ NewOrder
+ );
+ FreePool (NewOrder);
} else {
Status = EFI_OUT_OF_RESOURCES;
}
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder");
+
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder");
return (SHELL_INVALID_PARAMETER);
}
+
return (SHELL_SUCCESS);
}
@@ -916,7 +946,7 @@ BcfgRemove( @retval SHELL_INVALID_PARAMETER A parameter was invalid.
**/
SHELL_STATUS
-BcfgMove(
+BcfgMove (
IN CONST BCFG_OPERATION_TARGET Target,
IN CONST UINT16 *CurrentOrder,
IN CONST UINTN OrderCount,
@@ -924,11 +954,11 @@ BcfgMove( IN UINT16 NewLocation
)
{
- UINT16 *NewOrder;
- EFI_STATUS Status;
- UINT16 Temp;
+ UINT16 *NewOrder;
+ EFI_STATUS Status;
+ UINT16 Temp;
- NewOrder = AllocateCopyPool(OrderCount*sizeof(CurrentOrder[0]), CurrentOrder);
+ NewOrder = AllocateCopyPool (OrderCount*sizeof (CurrentOrder[0]), CurrentOrder);
if (NewOrder == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
@@ -945,23 +975,25 @@ BcfgMove( }
Temp = CurrentOrder[OldLocation];
- CopyMem(NewOrder+OldLocation, NewOrder+OldLocation+1, (OrderCount - OldLocation - 1)*sizeof(CurrentOrder[0]));
- CopyMem(NewOrder+NewLocation+1, NewOrder+NewLocation, (OrderCount - NewLocation - 1)*sizeof(CurrentOrder[0]));
+ CopyMem (NewOrder+OldLocation, NewOrder+OldLocation+1, (OrderCount - OldLocation - 1)*sizeof (CurrentOrder[0]));
+ CopyMem (NewOrder+NewLocation+1, NewOrder+NewLocation, (OrderCount - NewLocation - 1)*sizeof (CurrentOrder[0]));
NewOrder[NewLocation] = Temp;
- Status = gRT->SetVariable(
- Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- OrderCount*sizeof(CurrentOrder[0]),
- NewOrder);
+ Status = gRT->SetVariable (
+ Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder",
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
+ OrderCount*sizeof (CurrentOrder[0]),
+ NewOrder
+ );
- FreePool(NewOrder);
+ FreePool (NewOrder);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder");
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder");
return (SHELL_INVALID_PARAMETER);
}
+
return (SHELL_SUCCESS);
}
@@ -976,7 +1008,7 @@ BcfgMove( @retval SHELL_SUCCESS The operation was succesful.
**/
SHELL_STATUS
-BcfgAddOpt(
+BcfgAddOpt (
IN CONST CHAR16 *OptData,
IN CONST UINT16 *CurrentOrder,
IN CONST UINTN OrderCount,
@@ -984,7 +1016,7 @@ BcfgAddOpt( )
{
EFI_KEY_OPTION NewKeyOption;
- EFI_KEY_OPTION *KeyOptionBuffer;
+ EFI_KEY_OPTION *KeyOptionBuffer;
SHELL_STATUS ShellStatus;
EFI_STATUS Status;
UINT16 OptionIndex;
@@ -999,7 +1031,7 @@ BcfgAddOpt( CHAR16 VariableName[12];
VOID *VariableData;
- SHELL_FILE_HANDLE FileHandle;
+ SHELL_FILE_HANDLE FileHandle;
Status = EFI_SUCCESS;
ShellStatus = SHELL_SUCCESS;
@@ -1009,29 +1041,31 @@ BcfgAddOpt( KeyOptionBuffer = NULL;
VariableData = NULL;
- ZeroMem(&NewKeyOption, sizeof(EFI_KEY_OPTION));
- ZeroMem(VariableName, sizeof(VariableName));
+ ZeroMem (&NewKeyOption, sizeof (EFI_KEY_OPTION));
+ ZeroMem (VariableName, sizeof (VariableName));
- while(Walker[0] == L' ') {
+ while (Walker[0] == L' ') {
Walker++;
}
//
// Get the index of the variable we are changing.
//
- Status = ShellConvertStringToUint64(Walker, &Intermediate, TRUE, TRUE);
- if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL || ((UINT16)Intermediate) > ((UINT16)OrderCount)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Option Index");
+ Status = ShellConvertStringToUint64 (Walker, &Intermediate, TRUE, TRUE);
+ if (EFI_ERROR (Status) || (((UINT16)Intermediate) != Intermediate) || (StrStr (Walker, L" ") == NULL) || (((UINT16)Intermediate) > ((UINT16)OrderCount))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Option Index");
ShellStatus = SHELL_INVALID_PARAMETER;
return (ShellStatus);
}
+
OptionIndex = (UINT16)Intermediate;
- Temp = StrStr(Walker, L" ");
+ Temp = StrStr (Walker, L" ");
if (Temp != NULL) {
Walker = Temp;
}
- while(Walker[0] == L' ') {
+
+ while (Walker[0] == L' ') {
Walker++;
}
@@ -1042,52 +1076,54 @@ BcfgAddOpt( //
// quoted filename or quoted information.
//
- Temp = StrStr(Walker+1, L"\"");
- if (Temp == NULL || StrLen(Temp) != 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
+ Temp = StrStr (Walker+1, L"\"");
+ if ((Temp == NULL) || (StrLen (Temp) != 1)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- FileName = StrnCatGrow(&FileName, NULL, Walker+1, 0);
+ FileName = StrnCatGrow (&FileName, NULL, Walker+1, 0);
if (FileName == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellBcfgHiiHandle, L"bcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_OUT_OF_RESOURCES;
return (ShellStatus);
}
- Temp2 = StrStr(FileName, L"\"");
- ASSERT(Temp2 != NULL);
+
+ Temp2 = StrStr (FileName, L"\"");
+ ASSERT (Temp2 != NULL);
Temp2[0] = CHAR_NULL;
Temp2++;
- if (StrLen(Temp2)>0) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
+ if (StrLen (Temp2) > 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- if (EFI_ERROR(ShellFileExists(Walker))) {
+
+ if (EFI_ERROR (ShellFileExists (Walker))) {
//
// Not a file. must be misc information.
//
Data = FileName;
FileName = NULL;
} else {
- FileName = StrnCatGrow(&FileName, NULL, Walker, 0);
+ FileName = StrnCatGrow (&FileName, NULL, Walker, 0);
}
}
} else {
//
// filename or hot key information.
//
- if (StrStr(Walker, L" ") == NULL) {
+ if (StrStr (Walker, L" ") == NULL) {
//
// filename
//
- if (EFI_ERROR(ShellFileExists(Walker))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FIND_FAIL), gShellBcfgHiiHandle, L"bcfg", Walker);
+ if (EFI_ERROR (ShellFileExists (Walker))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FIND_FAIL), gShellBcfgHiiHandle, L"bcfg", Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- FileName = StrnCatGrow(&FileName, NULL, Walker, 0);
+ FileName = StrnCatGrow (&FileName, NULL, Walker, 0);
}
} else {
if (Target != BcfgTargetBootOrder) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_BOOT_ONLY), gShellBcfgHiiHandle, L"bcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_BOOT_ONLY), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
@@ -1095,17 +1131,19 @@ BcfgAddOpt( //
// Get hot key information
//
- Status = ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TRUE);
- if (EFI_ERROR(Status) || (((UINT32)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
+ Status = ShellConvertStringToUint64 (Walker, &Intermediate, FALSE, TRUE);
+ if (EFI_ERROR (Status) || (((UINT32)Intermediate) != Intermediate) || (StrStr (Walker, L" ") == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate;
- Temp = StrStr(Walker, L" ");
+ Temp = StrStr (Walker, L" ");
if (Temp != NULL) {
Walker = Temp;
}
- while(Walker[0] == L' ') {
+
+ while (Walker[0] == L' ') {
Walker++;
}
}
@@ -1115,46 +1153,52 @@ BcfgAddOpt( // Now we know how many EFI_INPUT_KEY structs we need to attach to the end of the EFI_KEY_OPTION struct.
// Re-allocate with the added information.
//
- KeyOptionBuffer = AllocatePool (sizeof(EFI_KEY_OPTION) + (sizeof(EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount));
+ KeyOptionBuffer = AllocatePool (sizeof (EFI_KEY_OPTION) + (sizeof (EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount));
if (KeyOptionBuffer == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellBcfgHiiHandle, L"bcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_OUT_OF_RESOURCES;
return ShellStatus;
}
- CopyMem (KeyOptionBuffer, &NewKeyOption, sizeof(EFI_KEY_OPTION));
+
+ CopyMem (KeyOptionBuffer, &NewKeyOption, sizeof (EFI_KEY_OPTION));
}
- for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter < NewKeyOption.KeyData.Options.InputKeyCount; LoopCounter++) {
+
+ for (LoopCounter = 0; ShellStatus == SHELL_SUCCESS && LoopCounter < NewKeyOption.KeyData.Options.InputKeyCount; LoopCounter++) {
//
// ScanCode
//
- Status = ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TRUE);
- if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
+ Status = ShellConvertStringToUint64 (Walker, &Intermediate, FALSE, TRUE);
+ if (EFI_ERROR (Status) || (((UINT16)Intermediate) != Intermediate) || (StrStr (Walker, L" ") == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- ((EFI_INPUT_KEY*)(((UINT8*)KeyOptionBuffer) + sizeof(EFI_KEY_OPTION)))[LoopCounter].ScanCode = (UINT16)Intermediate;
- Temp = StrStr(Walker, L" ");
+
+ ((EFI_INPUT_KEY *)(((UINT8 *)KeyOptionBuffer) + sizeof (EFI_KEY_OPTION)))[LoopCounter].ScanCode = (UINT16)Intermediate;
+ Temp = StrStr (Walker, L" ");
if (Temp != NULL) {
Walker = Temp;
}
- while(Walker[0] == L' ') {
+
+ while (Walker[0] == L' ') {
Walker++;
}
//
// UnicodeChar
//
- Status = ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TRUE);
- if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
+ Status = ShellConvertStringToUint64 (Walker, &Intermediate, FALSE, TRUE);
+ if (EFI_ERROR (Status) || (((UINT16)Intermediate) != Intermediate)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- ((EFI_INPUT_KEY*)(((UINT8*)KeyOptionBuffer) + sizeof(EFI_KEY_OPTION)))[LoopCounter].UnicodeChar = (UINT16)Intermediate;
- Temp = StrStr(Walker, L" ");
+
+ ((EFI_INPUT_KEY *)(((UINT8 *)KeyOptionBuffer) + sizeof (EFI_KEY_OPTION)))[LoopCounter].UnicodeChar = (UINT16)Intermediate;
+ Temp = StrStr (Walker, L" ");
if (Temp != NULL) {
Walker = Temp;
}
- while(Walker[0] == L' ') {
+
+ while (Walker[0] == L' ') {
Walker++;
}
}
@@ -1164,41 +1208,45 @@ BcfgAddOpt( // Now do the BootOption / BootOptionCrc
//
ASSERT (OptionIndex <= OrderCount);
- KeyOptionBuffer->BootOption = CurrentOrder[OptionIndex];
- Status = GetBootOptionCrc(&(KeyOptionBuffer->BootOptionCrc), KeyOptionBuffer->BootOption);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Option Index");
+ KeyOptionBuffer->BootOption = CurrentOrder[OptionIndex];
+ Status = GetBootOptionCrc (&(KeyOptionBuffer->BootOptionCrc), KeyOptionBuffer->BootOption);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Option Index");
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
if (ShellStatus == SHELL_SUCCESS) {
- for (Temp2 = NULL, KeyIndex = 0 ; KeyIndex <= 0xFFFF ; KeyIndex++) {
- UnicodeSPrint(VariableName, sizeof(VariableName), L"Key%04x", KeyIndex);
+ for (Temp2 = NULL, KeyIndex = 0; KeyIndex <= 0xFFFF; KeyIndex++) {
+ UnicodeSPrint (VariableName, sizeof (VariableName), L"Key%04x", KeyIndex);
Status = GetEfiGlobalVariable2 (VariableName, &VariableData, NULL);
if (Status == EFI_NOT_FOUND) {
break;
}
- if (!EFI_ERROR(Status)) {
- SHELL_FREE_NON_NULL(VariableData);
+
+ if (!EFI_ERROR (Status)) {
+ SHELL_FREE_NON_NULL (VariableData);
}
}
+
if (KeyIndex <= 0xFFFF) {
- Status = gRT->SetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof(EFI_KEY_OPTION) + (sizeof(EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount),
- KeyOptionBuffer);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
+ Status = gRT->SetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
+ sizeof (EFI_KEY_OPTION) + (sizeof (EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount),
+ KeyOptionBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_VAR_NO_NUM), gShellBcfgHiiHandle, L"bcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_VAR_NO_NUM), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
- ASSERT(FileName == NULL && Data == NULL);
+
+ ASSERT (FileName == NULL && Data == NULL);
}
}
}
@@ -1206,49 +1254,53 @@ BcfgAddOpt( //
// Shouldn't be possible to have have both. Neither is ok though.
//
- ASSERT(FileName == NULL || Data == NULL);
+ ASSERT (FileName == NULL || Data == NULL);
- if (ShellStatus == SHELL_SUCCESS && (FileName != NULL || Data != NULL)) {
+ if ((ShellStatus == SHELL_SUCCESS) && ((FileName != NULL) || (Data != NULL))) {
if (FileName != NULL) {
//
// Open the file and populate the data buffer.
//
- Status = ShellOpenFileByName(
- FileName,
- &FileHandle,
- EFI_FILE_MODE_READ,
- 0);
- if (!EFI_ERROR(Status)) {
- Status = ShellGetFileSize(FileHandle, &Intermediate);
+ Status = ShellOpenFileByName (
+ FileName,
+ &FileHandle,
+ EFI_FILE_MODE_READ,
+ 0
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = ShellGetFileSize (FileHandle, &Intermediate);
}
- Data = AllocateZeroPool((UINTN)Intermediate);
+
+ Data = AllocateZeroPool ((UINTN)Intermediate);
if (Data == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellBcfgHiiHandle, L"bcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_OUT_OF_RESOURCES;
}
- if (!EFI_ERROR(Status)) {
- Status = ShellReadFile(FileHandle, (UINTN *)&Intermediate, Data);
+
+ if (!EFI_ERROR (Status)) {
+ Status = ShellReadFile (FileHandle, (UINTN *)&Intermediate, Data);
}
} else {
- Intermediate = StrSize(Data);
+ Intermediate = StrSize (Data);
}
- if (!EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS && Data != NULL) {
- Status = UpdateOptionalData(CurrentOrder[OptionIndex], (UINTN)Intermediate, (UINT8*)Data, Target);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
+ if (!EFI_ERROR (Status) && (ShellStatus == SHELL_SUCCESS) && (Data != NULL)) {
+ Status = UpdateOptionalData (CurrentOrder[OptionIndex], (UINTN)Intermediate, (UINT8 *)Data, Target);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
- if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
+
+ if (EFI_ERROR (Status) && (ShellStatus == SHELL_SUCCESS)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
- SHELL_FREE_NON_NULL(Data);
- SHELL_FREE_NON_NULL(KeyOptionBuffer);
- SHELL_FREE_NON_NULL(FileName);
+ SHELL_FREE_NON_NULL (Data);
+ SHELL_FREE_NON_NULL (KeyOptionBuffer);
+ SHELL_FREE_NON_NULL (FileName);
return ShellStatus;
}
@@ -1264,58 +1316,60 @@ BcfgAddOpt( @retval SHELL_INVALID_PARAMETER A parameter was invalid.
**/
SHELL_STATUS
-BcfgDisplayDump(
+BcfgDisplayDump (
IN CONST CHAR16 *Op,
IN CONST UINTN OrderCount,
IN CONST UINT16 *CurrentOrder,
IN CONST BOOLEAN VerboseOutput
)
{
- EFI_STATUS Status;
- UINT8 *Buffer;
- UINTN BufferSize;
- CHAR16 VariableName[12];
- UINTN LoopVar;
- CHAR16 *DevPathString;
- VOID *FilePathList;
- UINTN Errors;
- EFI_LOAD_OPTION *LoadOption;
- CHAR16 *Description;
- UINTN DescriptionSize;
- UINTN OptionalDataOffset;
+ EFI_STATUS Status;
+ UINT8 *Buffer;
+ UINTN BufferSize;
+ CHAR16 VariableName[12];
+ UINTN LoopVar;
+ CHAR16 *DevPathString;
+ VOID *FilePathList;
+ UINTN Errors;
+ EFI_LOAD_OPTION *LoadOption;
+ CHAR16 *Description;
+ UINTN DescriptionSize;
+ UINTN OptionalDataOffset;
if (OrderCount == 0) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg");
return (SHELL_SUCCESS);
}
Errors = 0;
- for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) {
+ for (LoopVar = 0; LoopVar < OrderCount; LoopVar++) {
Buffer = NULL;
BufferSize = 0;
DevPathString = NULL;
- UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Op, CurrentOrder[LoopVar]);
+ UnicodeSPrint (VariableName, sizeof (VariableName), L"%s%04x", Op, CurrentOrder[LoopVar]);
- Status = gRT->GetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- &BufferSize,
- Buffer);
+ Status = gRT->GetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ NULL,
+ &BufferSize,
+ Buffer
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- Buffer = AllocateZeroPool(BufferSize);
- Status = gRT->GetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- &BufferSize,
- Buffer);
+ Buffer = AllocateZeroPool (BufferSize);
+ Status = gRT->GetVariable (
+ VariableName,
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ NULL,
+ &BufferSize,
+ Buffer
+ );
}
- if (EFI_ERROR(Status) || Buffer == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_READ_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
+ if (EFI_ERROR (Status) || (Buffer == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_READ_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
++Errors;
goto Cleanup;
}
@@ -1339,22 +1393,22 @@ BcfgDisplayDump( }
LoadOption = (EFI_LOAD_OPTION *)Buffer;
- Description = (CHAR16*)(Buffer + sizeof (EFI_LOAD_OPTION));
+ Description = (CHAR16 *)(Buffer + sizeof (EFI_LOAD_OPTION));
DescriptionSize = StrSize (Description);
if (LoadOption->FilePathListLength != 0) {
- FilePathList = (UINT8 *)Description + DescriptionSize;
- DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE);
+ FilePathList = (UINT8 *)Description + DescriptionSize;
+ DevPathString = ConvertDevicePathToText (FilePathList, TRUE, FALSE);
}
OptionalDataOffset = sizeof *LoadOption + DescriptionSize +
LoadOption->FilePathListLength;
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_BCFG_LOAD_OPTIONS),
+ STRING_TOKEN (STR_BCFG_LOAD_OPTIONS),
gShellBcfgHiiHandle,
LoopVar,
VariableName,
@@ -1373,12 +1427,14 @@ BcfgDisplayDump( Cleanup:
if (Buffer != NULL) {
- FreePool(Buffer);
+ FreePool (Buffer);
}
+
if (DevPathString != NULL) {
- FreePool(DevPathString);
+ FreePool (DevPathString);
}
}
+
return (Errors > 0) ? SHELL_INVALID_PARAMETER : SHELL_SUCCESS;
}
@@ -1388,11 +1444,11 @@ Cleanup: @param[in] Struct The stuct to initialize.
**/
VOID
-InitBcfgStruct(
- IN BGFG_OPERATION *Struct
+InitBcfgStruct (
+ IN BGFG_OPERATION *Struct
)
{
- ASSERT(Struct != NULL);
+ ASSERT (Struct != NULL);
Struct->Target = BcfgTargetMax;
Struct->Type = BcfgTypeMax;
Struct->Number1 = 0;
@@ -1404,12 +1460,11 @@ InitBcfgStruct( Struct->OptData = NULL;
}
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-v", TypeFlag},
- {L"-opt", TypeMaxValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-v", TypeFlag },
+ { L"-opt", TypeMaxValue },
+ { NULL, TypeMax }
+};
/**
Function for 'bcfg' command.
@@ -1424,243 +1479,252 @@ ShellCommandRunBcfg ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINTN ParamNumber;
- CONST CHAR16 *CurrentParam;
- BGFG_OPERATION CurrentOperation;
- UINTN Length;
- UINT64 Intermediate;
- UINT16 Count;
-
- Length = 0;
- ProblemParam = NULL;
- Package = NULL;
- ShellStatus = SHELL_SUCCESS;
-
- InitBcfgStruct(&CurrentOperation);
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamNumber;
+ CONST CHAR16 *CurrentParam;
+ BGFG_OPERATION CurrentOperation;
+ UINTN Length;
+ UINT64 Intermediate;
+ UINT16 Count;
+
+ Length = 0;
+ ProblemParam = NULL;
+ Package = NULL;
+ ShellStatus = SHELL_SUCCESS;
+
+ InitBcfgStruct (&CurrentOperation);
//
// 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), gShellBcfgHiiHandle, L"bcfg", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellBcfgHiiHandle, L"bcfg", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// Read in if we are doing -OPT
//
- if (ShellCommandLineGetFlag(Package, L"-opt")) {
- CurrentOperation.OptData = ShellCommandLineGetValue(Package, L"-opt");
+ if (ShellCommandLineGetFlag (Package, L"-opt")) {
+ CurrentOperation.OptData = ShellCommandLineGetValue (Package, L"-opt");
if (CurrentOperation.OptData == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellBcfgHiiHandle, L"bcfg", L"-opt");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellBcfgHiiHandle, L"bcfg", L"-opt");
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
CurrentOperation.Type = BcfgTypeOpt;
}
//
// small block to read the target of the operation
//
- if ((ShellCommandLineGetCount(Package) < 3 && CurrentOperation.Type != BcfgTypeOpt) ||
- (ShellCommandLineGetCount(Package) < 2 && CurrentOperation.Type == BcfgTypeOpt)
- ){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
+ if (((ShellCommandLineGetCount (Package) < 3) && (CurrentOperation.Type != BcfgTypeOpt)) ||
+ ((ShellCommandLineGetCount (Package) < 2) && (CurrentOperation.Type == BcfgTypeOpt))
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)ShellCommandLineGetRawValue(Package, 1), L"driver") == 0) {
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)ShellCommandLineGetRawValue (Package, 1), L"driver") == 0) {
CurrentOperation.Target = BcfgTargetDriverOrder;
- } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)ShellCommandLineGetRawValue(Package, 1), L"boot") == 0) {
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)ShellCommandLineGetRawValue (Package, 1), L"boot") == 0) {
CurrentOperation.Target = BcfgTargetBootOrder;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_DRIVER_BOOT), gShellBcfgHiiHandle, L"bcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_DRIVER_BOOT), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
-
//
// Read in the boot or driver order environment variable (not needed for opt)
//
- if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax) {
+ if ((ShellStatus == SHELL_SUCCESS) && (CurrentOperation.Target < BcfgTargetMax)) {
Length = 0;
- Status = gRT->GetVariable(
- CurrentOperation.Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- &Length,
- CurrentOperation.Order);
+ Status = gRT->GetVariable (
+ CurrentOperation.Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder",
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ NULL,
+ &Length,
+ CurrentOperation.Order
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- CurrentOperation.Order = AllocateZeroPool(Length+(4*sizeof(CurrentOperation.Order[0])));
+ CurrentOperation.Order = AllocateZeroPool (Length+(4*sizeof (CurrentOperation.Order[0])));
if (CurrentOperation.Order == NULL) {
ShellStatus = SHELL_OUT_OF_RESOURCES;
} else {
- Status = gRT->GetVariable(
- CurrentOperation.Target == BcfgTargetBootOrder?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- &Length,
- CurrentOperation.Order);
+ Status = gRT->GetVariable (
+ CurrentOperation.Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder",
+ (EFI_GUID *)&gEfiGlobalVariableGuid,
+ NULL,
+ &Length,
+ CurrentOperation.Order
+ );
}
}
}
- Count = (UINT16) (Length / sizeof(CurrentOperation.Order[0]));
+ Count = (UINT16)(Length / sizeof (CurrentOperation.Order[0]));
//
// large block to read the type of operation and verify parameter types for the info.
//
- if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax) {
- for (ParamNumber = 2 ; ParamNumber < ShellCommandLineGetCount(Package) && ShellStatus == SHELL_SUCCESS; ParamNumber++) {
- CurrentParam = ShellCommandLineGetRawValue(Package, ParamNumber);
- if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"dump") == 0) {
+ if ((ShellStatus == SHELL_SUCCESS) && (CurrentOperation.Target < BcfgTargetMax)) {
+ for (ParamNumber = 2; ParamNumber < ShellCommandLineGetCount (Package) && ShellStatus == SHELL_SUCCESS; ParamNumber++) {
+ CurrentParam = ShellCommandLineGetRawValue (Package, ParamNumber);
+ if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"dump") == 0) {
CurrentOperation.Type = BcfgTypeDump;
- if (ShellCommandLineGetCount(Package) > 3) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellBcfgHiiHandle, L"bcfg");
+ if (ShellCommandLineGetCount (Package) > 3) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
- } else if (ShellCommandLineGetFlag(Package, L"-v")) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"-v (without dump)");
+ } else if (ShellCommandLineGetFlag (Package, L"-v")) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"-v (without dump)");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"add") == 0) {
- if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"add") == 0) {
+ if ((ParamNumber + 3) >= ShellCommandLineGetCount (Package)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
CurrentOperation.Type = BcfgTypeAdd;
- CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE);
- CurrentOperation.Number1 = (UINT16)Intermediate;
- ASSERT(CurrentOperation.FileName == NULL);
- CurrentOperation.FileName = StrnCatGrow(&CurrentOperation.FileName , NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);
- ASSERT(CurrentOperation.Description == NULL);
- CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ CurrentOperation.Number1 = (UINT16)Intermediate;
+ ASSERT (CurrentOperation.FileName == NULL);
+ CurrentOperation.FileName = StrnCatGrow (&CurrentOperation.FileName, NULL, ShellCommandLineGetRawValue (Package, ++ParamNumber), 0);
+ ASSERT (CurrentOperation.Description == NULL);
+ CurrentOperation.Description = StrnCatGrow (&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue (Package, ++ParamNumber), 0);
}
- } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"addp") == 0) {
- if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"addp") == 0) {
+ if ((ParamNumber + 3) >= ShellCommandLineGetCount (Package)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
CurrentOperation.Type = BcfgTypeAddp;
- CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE);
- CurrentOperation.Number1 = (UINT16)Intermediate;
- ASSERT(CurrentOperation.FileName == NULL);
- CurrentOperation.FileName = StrnCatGrow(&CurrentOperation.FileName , NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);
- ASSERT(CurrentOperation.Description == NULL);
- CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ CurrentOperation.Number1 = (UINT16)Intermediate;
+ ASSERT (CurrentOperation.FileName == NULL);
+ CurrentOperation.FileName = StrnCatGrow (&CurrentOperation.FileName, NULL, ShellCommandLineGetRawValue (Package, ++ParamNumber), 0);
+ ASSERT (CurrentOperation.Description == NULL);
+ CurrentOperation.Description = StrnCatGrow (&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue (Package, ++ParamNumber), 0);
}
- } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"addh") == 0) {
- if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"addh") == 0) {
+ if ((ParamNumber + 3) >= ShellCommandLineGetCount (Package)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
CurrentOperation.Type = BcfgTypeAddh;
- CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE);
- CurrentOperation.Number1 = (UINT16)Intermediate;
- CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ CurrentOperation.Number1 = (UINT16)Intermediate;
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
CurrentOperation.HandleIndex = (UINT16)Intermediate;
- ASSERT(CurrentOperation.Description == NULL);
- CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);
+ ASSERT (CurrentOperation.Description == NULL);
+ CurrentOperation.Description = StrnCatGrow (&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue (Package, ++ParamNumber), 0);
}
}
- } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"rm") == 0) {
- if ((ParamNumber + 1) >= ShellCommandLineGetCount(Package)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"rm") == 0) {
+ if ((ParamNumber + 1) >= ShellCommandLineGetCount (Package)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
CurrentOperation.Type = BcfgTypeRm;
- CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE);
- CurrentOperation.Number1 = (UINT16)Intermediate;
- if (CurrentOperation.Number1 >= Count){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ CurrentOperation.Number1 = (UINT16)Intermediate;
+ if (CurrentOperation.Number1 >= Count) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
- } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"mv") == 0) {
- if ((ParamNumber + 2) >= ShellCommandLineGetCount(Package)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"mv") == 0) {
+ if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
CurrentOperation.Type = BcfgTypeMv;
- CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE);
- CurrentOperation.Number1 = (UINT16)Intermediate;
- if (CurrentOperation.Number1 >= Count){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ CurrentOperation.Number1 = (UINT16)Intermediate;
+ if (CurrentOperation.Number1 >= Count) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64(CurrentParam, &Intermediate, TRUE, FALSE);
- CurrentOperation.Number2 = (UINT16)Intermediate;
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ CurrentOperation.Number2 = (UINT16)Intermediate;
}
- if (CurrentOperation.Number2 == CurrentOperation.Number1
- ||CurrentOperation.Number2 >= Count
- ){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
+
+ if ( (CurrentOperation.Number2 == CurrentOperation.Number1)
+ || (CurrentOperation.Number2 >= Count)
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
}
- }
- else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"mod") == 0) {
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"mod") == 0) {
if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
CurrentOperation.Type = BcfgTypeMod;
- CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
CurrentOperation.Number1 = (UINT16)Intermediate;
if (CurrentOperation.Number1 >= Count) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
@@ -1671,18 +1735,18 @@ ShellCommandRunBcfg ( }
}
}
- } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"modf") == 0) {
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"modf") == 0) {
if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
CurrentOperation.Type = BcfgTypeModf;
- CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
CurrentOperation.Number1 = (UINT16)Intermediate;
if (CurrentOperation.Number1 >= Count) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
@@ -1693,18 +1757,18 @@ ShellCommandRunBcfg ( }
}
}
- } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"modp") == 0) {
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"modp") == 0) {
if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
CurrentOperation.Type = BcfgTypeModp;
- CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
CurrentOperation.Number1 = (UINT16)Intermediate;
if (CurrentOperation.Number1 >= Count) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
@@ -1715,97 +1779,102 @@ ShellCommandRunBcfg ( }
}
}
- } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"modh") == 0) {
+ } else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"modh") == 0) {
if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
CurrentOperation.Type = BcfgTypeModh;
- CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
- }
- else {
- Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ } else {
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
CurrentOperation.Number1 = (UINT16)Intermediate;
if (CurrentOperation.Number1 >= Count) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
- if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
+ if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
+ Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
CurrentOperation.HandleIndex = (UINT16)Intermediate;
}
}
}
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
}
- if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax && CurrentOperation.Type < BcfgTypeMax) {
+
+ if ((ShellStatus == SHELL_SUCCESS) && (CurrentOperation.Target < BcfgTargetMax) && (CurrentOperation.Type < BcfgTypeMax)) {
//
// we have all the info. Do the work
//
switch (CurrentOperation.Type) {
- case BcfgTypeDump:
- ShellStatus = BcfgDisplayDump(
- CurrentOperation.Target == BcfgTargetBootOrder?L"Boot":L"Driver",
- Count,
- CurrentOperation.Order,
- ShellCommandLineGetFlag(Package, L"-v"));
+ case BcfgTypeDump:
+ ShellStatus = BcfgDisplayDump (
+ CurrentOperation.Target == BcfgTargetBootOrder ? L"Boot" : L"Driver",
+ Count,
+ CurrentOperation.Order,
+ ShellCommandLineGetFlag (Package, L"-v")
+ );
break;
- case BcfgTypeMv:
- ShellStatus = BcfgMove(
- CurrentOperation.Target,
- CurrentOperation.Order,
- Count,
- CurrentOperation.Number1,
- CurrentOperation.Number2);
+ case BcfgTypeMv:
+ ShellStatus = BcfgMove (
+ CurrentOperation.Target,
+ CurrentOperation.Order,
+ Count,
+ CurrentOperation.Number1,
+ CurrentOperation.Number2
+ );
break;
- case BcfgTypeRm:
- ShellStatus = BcfgRemove(
- CurrentOperation.Target,
- CurrentOperation.Order,
- Count,
- CurrentOperation.Number1);
+ case BcfgTypeRm:
+ ShellStatus = BcfgRemove (
+ CurrentOperation.Target,
+ CurrentOperation.Order,
+ Count,
+ CurrentOperation.Number1
+ );
break;
- case BcfgTypeAdd:
- case BcfgTypeAddp:
- case BcfgTypeAddh:
- ShellStatus = BcfgAdd(
- CurrentOperation.Number1,
- CurrentOperation.FileName,
- CurrentOperation.Description==NULL?L"":CurrentOperation.Description,
- CurrentOperation.Order,
- Count,
- CurrentOperation.Target,
- (BOOLEAN)(CurrentOperation.Type == BcfgTypeAddh),
- (BOOLEAN)(CurrentOperation.Type == BcfgTypeAddp),
- CurrentOperation.HandleIndex);
+ case BcfgTypeAdd:
+ case BcfgTypeAddp:
+ case BcfgTypeAddh:
+ ShellStatus = BcfgAdd (
+ CurrentOperation.Number1,
+ CurrentOperation.FileName,
+ CurrentOperation.Description == NULL ? L"" : CurrentOperation.Description,
+ CurrentOperation.Order,
+ Count,
+ CurrentOperation.Target,
+ (BOOLEAN)(CurrentOperation.Type == BcfgTypeAddh),
+ (BOOLEAN)(CurrentOperation.Type == BcfgTypeAddp),
+ CurrentOperation.HandleIndex
+ );
break;
- case BcfgTypeMod:
- case BcfgTypeModf:
- case BcfgTypeModp:
- case BcfgTypeModh:
+ case BcfgTypeMod:
+ case BcfgTypeModf:
+ case BcfgTypeModp:
+ case BcfgTypeModh:
ShellStatus = BcfgMod (&CurrentOperation, Count);
break;
- case BcfgTypeOpt:
- ShellStatus = BcfgAddOpt(
- CurrentOperation.OptData,
- CurrentOperation.Order,
- Count,
- CurrentOperation.Target);
+ case BcfgTypeOpt:
+ ShellStatus = BcfgAddOpt (
+ CurrentOperation.OptData,
+ CurrentOperation.Order,
+ Count,
+ CurrentOperation.Target
+ );
break;
default:
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
}
}
@@ -1813,26 +1882,28 @@ ShellCommandRunBcfg ( if (Package != NULL) {
ShellCommandLineFreeVarList (Package);
}
+
if (CurrentOperation.FileName != NULL) {
- FreePool(CurrentOperation.FileName);
+ FreePool (CurrentOperation.FileName);
}
+
if (CurrentOperation.Description != NULL) {
- FreePool(CurrentOperation.Description);
+ FreePool (CurrentOperation.Description);
}
+
if (CurrentOperation.Order != NULL) {
- FreePool(CurrentOperation.Order);
+ FreePool (CurrentOperation.Order);
}
return (ShellStatus);
}
-
/**
Function to get the filename with help context if HII will not be used.
@return The filename with help text in it.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameBcfg (
VOID
@@ -1873,7 +1944,7 @@ BcfgLibraryRegisterBcfgCommand ( //
// install our shell command handler
//
- ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfg , ShellCommandGetManFileNameBcfg, 0, Name, FALSE, gShellBcfgHiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG));
+ ShellCommandRegisterCommandName (L"bcfg", ShellCommandRunBcfg, ShellCommandGetManFileNameBcfg, 0, Name, FALSE, gShellBcfgHiiHandle, STRING_TOKEN (STR_GET_HELP_BCFG));
return (EFI_SUCCESS);
}
@@ -1892,9 +1963,9 @@ BcfgLibraryUnregisterBcfgCommand ( )
{
if (gShellBcfgHiiHandle != NULL) {
- HiiRemovePackages(gShellBcfgHiiHandle);
+ HiiRemovePackages (gShellBcfgHiiHandle);
}
+
gShellBcfgHiiHandle = NULL;
return (EFI_SUCCESS);
}
-
diff --git a/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c b/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c index ab5613da54..17e48443ac 100644 --- a/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c +++ b/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c @@ -43,51 +43,54 @@ ShellCEntryLib ( )
{
INTN ReturnFromMain;
- EFI_SHELL_PARAMETERS_PROTOCOL *EfiShellParametersProtocol;
- EFI_SHELL_INTERFACE *EfiShellInterface;
- EFI_STATUS Status;
+ EFI_SHELL_PARAMETERS_PROTOCOL *EfiShellParametersProtocol;
+ EFI_SHELL_INTERFACE *EfiShellInterface;
+ EFI_STATUS Status;
- ReturnFromMain = -1;
+ ReturnFromMain = -1;
EfiShellParametersProtocol = NULL;
- EfiShellInterface = NULL;
+ EfiShellInterface = NULL;
- Status = SystemTable->BootServices->OpenProtocol(ImageHandle,
- &gEfiShellParametersProtocolGuid,
- (VOID **)&EfiShellParametersProtocol,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR(Status)) {
+ Status = SystemTable->BootServices->OpenProtocol (
+ ImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ (VOID **)&EfiShellParametersProtocol,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
//
// use shell 2.0 interface
//
ReturnFromMain = ShellAppMain (
EfiShellParametersProtocol->Argc,
EfiShellParametersProtocol->Argv
- );
+ );
} else {
//
// try to get shell 1.0 interface instead.
//
- Status = SystemTable->BootServices->OpenProtocol(ImageHandle,
- &gEfiShellInterfaceGuid,
- (VOID **)&EfiShellInterface,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR(Status)) {
+ Status = SystemTable->BootServices->OpenProtocol (
+ ImageHandle,
+ &gEfiShellInterfaceGuid,
+ (VOID **)&EfiShellInterface,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
//
// use shell 1.0 interface
//
ReturnFromMain = ShellAppMain (
EfiShellInterface->Argc,
EfiShellInterface->Argv
- );
+ );
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
}
+
return ReturnFromMain;
}
diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c index 8278388f3c..1767a7dc4a 100755 --- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c +++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c @@ -13,8 +13,6 @@ #include <Protocol/BlockIo.h>
#include <Protocol/SimpleFileSystem.h>
-
-
typedef enum {
MTDTypeUnknown,
MTDTypeFloppy,
@@ -24,20 +22,20 @@ typedef enum { } MTD_TYPE;
typedef struct {
- CHAR16 *Str;
- UINTN Len;
+ CHAR16 *Str;
+ UINTN Len;
} POOL_PRINT;
typedef struct {
- UINTN Hi;
- MTD_TYPE Mtd;
- POOL_PRINT Csd;
- BOOLEAN Digital;
+ UINTN Hi;
+ MTD_TYPE Mtd;
+ POOL_PRINT Csd;
+ BOOLEAN Digital;
} DEVICE_CONSIST_MAPPING_INFO;
typedef struct {
- MTD_TYPE MTDType;
- CHAR16 *Name;
+ MTD_TYPE MTDType;
+ CHAR16 *Name;
} MTD_NAME;
/**
@@ -53,19 +51,18 @@ typedef struct { typedef
EFI_STATUS
(*SERIAL_DECODE_FUNCTION) (
- EFI_DEVICE_PATH_PROTOCOL *DevPath,
- DEVICE_CONSIST_MAPPING_INFO *MapInfo,
- EFI_DEVICE_PATH_PROTOCOL *OrigDevPath
+ EFI_DEVICE_PATH_PROTOCOL *DevPath,
+ DEVICE_CONSIST_MAPPING_INFO *MapInfo,
+ EFI_DEVICE_PATH_PROTOCOL *OrigDevPath
);
typedef struct {
- UINT8 Type;
- UINT8 SubType;
- SERIAL_DECODE_FUNCTION SerialFun;
- INTN (EFIAPI *CompareFun) (EFI_DEVICE_PATH_PROTOCOL *DevPath, EFI_DEVICE_PATH_PROTOCOL *DevPath2);
+ UINT8 Type;
+ UINT8 SubType;
+ SERIAL_DECODE_FUNCTION SerialFun;
+ 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.
@@ -81,15 +78,15 @@ typedef struct { EFI_STATUS
EFIAPI
CatPrint (
- IN OUT POOL_PRINT *Str,
- IN CHAR16 *Fmt,
+ IN OUT POOL_PRINT *Str,
+ IN CHAR16 *Fmt,
...
)
{
- UINT16 *AppendStr;
- VA_LIST Args;
- UINTN StringSize;
- CHAR16 *NewStr;
+ UINT16 *AppendStr;
+ VA_LIST Args;
+ UINTN StringSize;
+ CHAR16 *NewStr;
AppendStr = AllocateZeroPool (0x1000);
if (AppendStr == NULL) {
@@ -101,9 +98,9 @@ CatPrint ( VA_END (Args);
if (NULL == Str->Str) {
StringSize = StrSize (AppendStr);
- NewStr = AllocateZeroPool (StringSize);
+ NewStr = AllocateZeroPool (StringSize);
} else {
- StringSize = StrSize (AppendStr);
+ StringSize = StrSize (AppendStr);
StringSize += (StrSize (Str->Str) - sizeof (UINT16));
NewStr = ReallocatePool (
@@ -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);
@@ -159,13 +157,13 @@ MTD_NAME mMTDName[] = { **/
EFI_STATUS
AppendCSDNum2 (
- IN OUT POOL_PRINT *Str,
- IN UINT64 Num
+ IN OUT POOL_PRINT *Str,
+ IN UINT64 Num
)
{
- EFI_STATUS Status;
- UINT64 Result;
- UINT32 Rem;
+ EFI_STATUS Status;
+ UINT64 Result;
+ UINT32 Rem;
ASSERT (Str != NULL);
@@ -192,11 +190,12 @@ AppendCSDNum2 ( **/
EFI_STATUS
AppendCSDNum (
- IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem,
- IN UINT64 Num
+ IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN UINT64 Num
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
ASSERT (MappingItem != NULL);
if (MappingItem->Digital) {
@@ -223,12 +222,12 @@ AppendCSDNum ( **/
EFI_STATUS
AppendCSDStr (
- IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem,
- IN CHAR16 *Str
+ IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN CHAR16 *Str
)
{
- CHAR16 *Index;
- EFI_STATUS Status;
+ CHAR16 *Index;
+ EFI_STATUS Status;
ASSERT (Str != NULL && MappingItem != NULL);
@@ -242,39 +241,39 @@ AppendCSDStr ( //
for (Index = Str; *Index != 0; Index++) {
switch (*Index) {
- case '0':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- Status = CatPrint (&MappingItem->Csd, L"%c", *Index);
- break;
+ case '0':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ Status = CatPrint (&MappingItem->Csd, L"%c", *Index);
+ break;
- case '1':
- Status = CatPrint (&MappingItem->Csd, L"16");
- break;
+ case '1':
+ Status = CatPrint (&MappingItem->Csd, L"16");
+ break;
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- Status = CatPrint (&MappingItem->Csd, L"1%c", *Index - 'a' + '0');
- break;
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ Status = CatPrint (&MappingItem->Csd, L"1%c", *Index - 'a' + '0');
+ break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- Status = CatPrint (&MappingItem->Csd, L"1%c", *Index - 'A' + '0');
- break;
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ Status = CatPrint (&MappingItem->Csd, L"1%c", *Index - 'A' + '0');
+ break;
}
if (EFI_ERROR (Status)) {
@@ -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);
}
@@ -318,8 +317,8 @@ AppendCSDStr ( **/
EFI_STATUS
AppendCSDGuid (
- DEVICE_CONSIST_MAPPING_INFO *MappingItem,
- EFI_GUID *Guid
+ DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ EFI_GUID *Guid
)
{
CHAR16 Buffer[64];
@@ -331,7 +330,7 @@ AppendCSDGuid ( 0,
L"%g",
Guid
- );
+ );
return AppendCSDStr (MappingItem, Buffer);
}
@@ -348,24 +347,24 @@ AppendCSDGuid ( INTN
EFIAPI
DevPathCompareAcpi (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
)
{
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;
}
@@ -384,23 +383,23 @@ DevPathCompareAcpi ( INTN
EFIAPI
DevPathComparePci (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
)
{
- PCI_DEVICE_PATH *Pci1;
- PCI_DEVICE_PATH *Pci2;
+ 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;
}
@@ -420,18 +419,18 @@ DevPathComparePci ( INTN
EFIAPI
DevPathCompareDefault (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
)
{
- UINTN DevPathSize1;
- UINTN DevPathSize2;
+ UINTN DevPathSize1;
+ UINTN DevPathSize2;
- ASSERT(DevicePath1 != NULL);
- ASSERT(DevicePath2 != NULL);
+ ASSERT (DevicePath1 != NULL);
+ ASSERT (DevicePath2 != NULL);
- DevPathSize1 = DevicePathNodeLength (DevicePath1);
- DevPathSize2 = DevicePathNodeLength (DevicePath2);
+ DevPathSize1 = DevicePathNodeLength (DevicePath1);
+ DevPathSize2 = DevicePathNodeLength (DevicePath2);
if (DevPathSize1 > DevPathSize2) {
return 1;
} else if (DevPathSize1 < DevPathSize2) {
@@ -458,12 +457,12 @@ DevPathSerialHardDrive ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- HARDDRIVE_DEVICE_PATH *Hd;
+ 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;
}
@@ -488,12 +487,12 @@ DevPathSerialAtapi ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- ATAPI_DEVICE_PATH *Atapi;
+ 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));
}
@@ -514,13 +513,13 @@ DevPathSerialCdRom ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- CDROM_DEVICE_PATH *Cd;
+ CDROM_DEVICE_PATH *Cd;
- ASSERT(DevicePathNode != NULL);
- ASSERT(MappingItem != NULL);
+ ASSERT (DevicePathNode != NULL);
+ ASSERT (MappingItem != NULL);
- Cd = (CDROM_DEVICE_PATH *) DevicePathNode;
- MappingItem->Mtd = MTDTypeCDRom;
+ 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;
}
@@ -572,23 +572,26 @@ DevPathSerialUart ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- EFI_STATUS Status;
- UART_DEVICE_PATH *Uart;
+ 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 );
- UsbIo = NULL;
- if (!EFI_ERROR(Status)) {
- Status = gBS->OpenProtocol(TempHandle, &gEfiUsbIoProtocolGuid, (VOID**)&UsbIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ 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)) {
- 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;
@@ -650,13 +652,14 @@ DevPathSerialUsb ( MappingItem->Mtd = MTDTypeFloppy;
break;
case USB_MASS_STORE_8020I:
- MappingItem->Mtd = MTDTypeCDRom;
+ MappingItem->Mtd = MTDTypeCDRom;
break;
}
}
}
}
}
+
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;
}
@@ -759,12 +766,12 @@ DevPathSerialLun ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- DEVICE_LOGICAL_UNIT_DEVICE_PATH *Lun;
+ 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;
}
@@ -881,12 +896,12 @@ DevPathSerialI2O ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- I2O_DEVICE_PATH *DevicePath_I20;
+ 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;
}
@@ -1126,13 +1151,13 @@ DevPathSerial1394 ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- F1394_DEVICE_PATH *DevicePath_F1394;
- CHAR16 Buffer[20];
+ 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;
}
@@ -1328,25 +1354,25 @@ DEV_PATH_CONSIST_MAPPING_TABLE DevPathConsistMappingTable[] = { **/
BOOLEAN
IsHIDevicePathNode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
)
{
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:
- case 0x0501:
- case 0x0604:
- return FALSE;
+ case 0x0301:
+ case 0x0401:
+ case 0x0501:
+ case 0x0604:
+ return FALSE;
}
return TRUE;
@@ -1364,7 +1390,7 @@ IsHIDevicePathNode ( **/
EFI_DEVICE_PATH_PROTOCOL *
GetHIDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
UINTN NonHIDevicePathNodeCount;
@@ -1373,17 +1399,17 @@ GetHIDevicePath ( EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
- ASSERT(DevicePath != NULL);
+ ASSERT (DevicePath != NULL);
- NonHIDevicePathNodeCount = 0;
+ NonHIDevicePathNodeCount = 0;
- HIDevicePath = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL));
+ HIDevicePath = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL));
SetDevicePathEndNode (HIDevicePath);
- Node.DevPath.Type = END_DEVICE_PATH_TYPE;
- Node.DevPath.SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
- Node.DevPath.Length[0] = (UINT8)sizeof (EFI_DEVICE_PATH_PROTOCOL);
- Node.DevPath.Length[1] = 0;
+ Node.DevPath.Type = END_DEVICE_PATH_TYPE;
+ Node.DevPath.SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
+ Node.DevPath.Length[0] = (UINT8)sizeof (EFI_DEVICE_PATH_PROTOCOL);
+ Node.DevPath.Length[1] = 0;
while (!IsDevicePathEnd (DevicePath)) {
if (IsHIDevicePathNode (DevicePath)) {
@@ -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;
@@ -1418,8 +1445,8 @@ GetHIDevicePath ( **/
EFI_STATUS
GetDeviceConsistMappingInfo (
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_STATUS Status;
@@ -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;
@@ -1473,37 +1500,37 @@ GetDeviceConsistMappingInfo ( EFI_STATUS
EFIAPI
ShellCommandConsistMappingInitialize (
- OUT EFI_DEVICE_PATH_PROTOCOL ***Table
+ OUT EFI_DEVICE_PATH_PROTOCOL ***Table
)
{
- EFI_HANDLE *HandleBuffer;
- UINTN HandleNum;
- UINTN HandleLoop;
- EFI_DEVICE_PATH_PROTOCOL **TempTable;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- UINTN Index;
- EFI_STATUS Status;
-
- HandleBuffer = NULL;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleNum;
+ UINTN HandleLoop;
+ EFI_DEVICE_PATH_PROTOCOL **TempTable;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
+ UINTN Index;
+ EFI_STATUS Status;
+
+ HandleBuffer = NULL;
Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDevicePathProtocolGuid,
- NULL,
- &HandleNum,
- &HandleBuffer
- );
- ASSERT_EFI_ERROR(Status);
-
- TempTable = AllocateZeroPool ((HandleNum + 1) * sizeof (EFI_DEVICE_PATH_PROTOCOL *));
+ ByProtocol,
+ &gEfiDevicePathProtocolGuid,
+ NULL,
+ &HandleNum,
+ &HandleBuffer
+ );
+ 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],
- &gEfiBlockIoProtocolGuid,
- (VOID **)&BlockIo
- );
- if (EFI_ERROR(Status)) {
- Status = gBS->HandleProtocol( HandleBuffer[HandleLoop],
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID **)&SimpleFileSystem
- );
- if (EFI_ERROR(Status)) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[HandleLoop],
+ &gEfiBlockIoProtocolGuid,
+ (VOID **)&BlockIo
+ );
+ if (EFI_ERROR (Status)) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[HandleLoop],
+ &gEfiSimpleFileSystemProtocolGuid,
+ (VOID **)&SimpleFileSystem
+ );
+ 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) {
@@ -1564,12 +1595,12 @@ ShellCommandConsistMappingInitialize ( EFI_STATUS
EFIAPI
ShellCommandConsistMappingUnInitialize (
- EFI_DEVICE_PATH_PROTOCOL **Table
+ EFI_DEVICE_PATH_PROTOCOL **Table
)
{
- UINTN Index;
+ UINTN Index;
- ASSERT(Table != NULL);
+ ASSERT (Table != NULL);
for (Index = 0; Table[Index] != NULL; Index++) {
FreePool (Table[Index]);
@@ -1595,18 +1626,18 @@ ShellCommandConsistMappingUnInitialize ( CHAR16 *
EFIAPI
ShellCommandConsistMappingGenMappingName (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL **Table
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN EFI_DEVICE_PATH_PROTOCOL **Table
)
{
- EFI_STATUS Status;
- POOL_PRINT Str;
- DEVICE_CONSIST_MAPPING_INFO MappingInfo;
- EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
- UINTN Index;
+ EFI_STATUS Status;
+ POOL_PRINT Str;
+ DEVICE_CONSIST_MAPPING_INFO MappingInfo;
+ 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;
@@ -1673,20 +1706,20 @@ ShellCommandConsistMappingGenMappingName ( SHELL_MAP_LIST *
EFIAPI
ShellCommandFindMapItem (
- IN CONST CHAR16 *MapKey
+ IN CONST CHAR16 *MapKey
)
{
- SHELL_MAP_LIST *MapListItem;
+ 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);
}
-
-
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c index 81923c8ae7..36cf46fb2c 100644 --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c @@ -21,11 +21,11 @@ STATIC UINT64 mExitCode; STATIC BOOLEAN mExitScript;
STATIC CHAR16 *mProfileList;
STATIC UINTN mProfileListSize;
-STATIC UINTN mFsMaxCount = 0;
+STATIC UINTN mFsMaxCount = 0;
STATIC UINTN mBlkMaxCount = 0;
STATIC BUFFER_LIST mFileHandleList;
-STATIC CONST CHAR8 Hex[] = {
+STATIC CONST CHAR8 Hex[] = {
'0',
'1',
'2',
@@ -45,11 +45,11 @@ STATIC CONST CHAR8 Hex[] = { };
// global variables required by library class.
-EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation = NULL;
-SHELL_MAP_LIST gShellMapList;
-SHELL_MAP_LIST *gShellCurMapping = NULL;
+EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation = NULL;
+SHELL_MAP_LIST gShellMapList;
+SHELL_MAP_LIST *gShellCurMapping = NULL;
-CONST CHAR16* SupportLevel[] = {
+CONST CHAR16 *SupportLevel[] = {
L"Minimal",
L"Scripting",
L"Basic",
@@ -62,7 +62,7 @@ CONST CHAR16* SupportLevel[] = { **/
EFI_STATUS
EFIAPI
-CommandInit(
+CommandInit (
VOID
)
{
@@ -75,8 +75,7 @@ CommandInit( CHAR8 *PlatformLang;
if (gUnicodeCollation == NULL) {
-
- GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID**)&PlatformLang, NULL);
+ GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID **)&PlatformLang, NULL);
Status = gBS->LocateHandleBuffer (
ByProtocol,
@@ -89,6 +88,7 @@ CommandInit( NumHandles = 0;
Handles = NULL;
}
+
for (Index = 0; Index < NumHandles; Index++) {
//
// Open Unicode Collation Protocol
@@ -96,7 +96,7 @@ CommandInit( Status = gBS->OpenProtocol (
Handles[Index],
&gEfiUnicodeCollation2ProtocolGuid,
- (VOID **) &Uc,
+ (VOID **)&Uc,
gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -113,6 +113,7 @@ CommandInit( if (gUnicodeCollation == NULL) {
gUnicodeCollation = Uc;
}
+
if (PlatformLang == NULL) {
break;
}
@@ -133,9 +134,11 @@ CommandInit( break;
}
}
+
if (Handles != NULL) {
FreePool (Handles);
}
+
if (PlatformLang != NULL) {
FreePool (PlatformLang);
}
@@ -161,18 +164,19 @@ ShellCommandLibConstructor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- InitializeListHead(&gShellMapList.Link);
- InitializeListHead(&mCommandList.Link);
- InitializeListHead(&mAliasList.Link);
- InitializeListHead(&mScriptList.Link);
- InitializeListHead(&mFileHandleList.Link);
+ EFI_STATUS Status;
+
+ InitializeListHead (&gShellMapList.Link);
+ InitializeListHead (&mCommandList.Link);
+ InitializeListHead (&mAliasList.Link);
+ InitializeListHead (&mScriptList.Link);
+ InitializeListHead (&mFileHandleList.Link);
mEchoState = TRUE;
- mExitRequested = FALSE;
- mExitScript = FALSE;
- mProfileListSize = 0;
- mProfileList = NULL;
+ mExitRequested = FALSE;
+ mExitScript = FALSE;
+ mProfileListSize = 0;
+ mProfileList = NULL;
Status = CommandInit ();
if (EFI_ERROR (Status)) {
@@ -189,26 +193,28 @@ ShellCommandLibConstructor ( **/
VOID
FreeFileHandleList (
- IN BUFFER_LIST *List
+ IN BUFFER_LIST *List
)
{
- BUFFER_LIST *BufferListEntry;
+ BUFFER_LIST *BufferListEntry;
- if (List == NULL){
+ if (List == NULL) {
return;
}
+
//
// enumerate through the buffer list and free all memory
//
- for ( BufferListEntry = ( BUFFER_LIST *)GetFirstNode(&List->Link)
- ; !IsListEmpty (&List->Link)
- ; BufferListEntry = (BUFFER_LIST *)GetFirstNode(&List->Link)
- ){
- RemoveEntryList(&BufferListEntry->Link);
- ASSERT(BufferListEntry->Buffer != NULL);
- SHELL_FREE_NON_NULL(((SHELL_COMMAND_FILE_HANDLE*)(BufferListEntry->Buffer))->Path);
- SHELL_FREE_NON_NULL(BufferListEntry->Buffer);
- SHELL_FREE_NON_NULL(BufferListEntry);
+ for ( BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
+ ; !IsListEmpty (&List->Link)
+ ; BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
+ )
+ {
+ RemoveEntryList (&BufferListEntry->Link);
+ ASSERT (BufferListEntry->Buffer != NULL);
+ SHELL_FREE_NON_NULL (((SHELL_COMMAND_FILE_HANDLE *)(BufferListEntry->Buffer))->Path);
+ SHELL_FREE_NON_NULL (BufferListEntry->Buffer);
+ SHELL_FREE_NON_NULL (BufferListEntry);
}
}
@@ -227,69 +233,76 @@ ShellCommandLibDestructor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
- ALIAS_LIST *Node2;
- SCRIPT_FILE_LIST *Node3;
- SHELL_MAP_LIST *MapNode;
+ SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
+ ALIAS_LIST *Node2;
+ SCRIPT_FILE_LIST *Node3;
+ SHELL_MAP_LIST *MapNode;
+
//
// enumerate throught the list and free all the memory
//
while (!IsListEmpty (&mCommandList.Link)) {
- Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link);
- RemoveEntryList(&Node->Link);
- SHELL_FREE_NON_NULL(Node->CommandString);
- FreePool(Node);
- DEBUG_CODE(Node = NULL;);
+ Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link);
+ RemoveEntryList (&Node->Link);
+ SHELL_FREE_NON_NULL (Node->CommandString);
+ FreePool (Node);
+ DEBUG_CODE (
+ Node = NULL;
+ );
}
//
// enumerate through the alias list and free all memory
//
while (!IsListEmpty (&mAliasList.Link)) {
- Node2 = (ALIAS_LIST *)GetFirstNode(&mAliasList.Link);
- RemoveEntryList(&Node2->Link);
- SHELL_FREE_NON_NULL(Node2->CommandString);
- SHELL_FREE_NON_NULL(Node2->Alias);
- SHELL_FREE_NON_NULL(Node2);
- DEBUG_CODE(Node2 = NULL;);
+ Node2 = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link);
+ RemoveEntryList (&Node2->Link);
+ SHELL_FREE_NON_NULL (Node2->CommandString);
+ SHELL_FREE_NON_NULL (Node2->Alias);
+ SHELL_FREE_NON_NULL (Node2);
+ DEBUG_CODE (
+ Node2 = NULL;
+ );
}
//
// enumerate throught the list and free all the memory
//
while (!IsListEmpty (&mScriptList.Link)) {
- Node3 = (SCRIPT_FILE_LIST *)GetFirstNode(&mScriptList.Link);
- RemoveEntryList(&Node3->Link);
- DeleteScriptFileStruct(Node3->Data);
- FreePool(Node3);
+ Node3 = (SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link);
+ RemoveEntryList (&Node3->Link);
+ DeleteScriptFileStruct (Node3->Data);
+ FreePool (Node3);
}
//
// enumerate throught the mappings list and free all the memory
//
- if (!IsListEmpty(&gShellMapList.Link)) {
- for (MapNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
+ if (!IsListEmpty (&gShellMapList.Link)) {
+ for (MapNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
; !IsListEmpty (&gShellMapList.Link)
- ; MapNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
- ){
- ASSERT(MapNode != NULL);
- RemoveEntryList(&MapNode->Link);
- SHELL_FREE_NON_NULL(MapNode->DevicePath);
- SHELL_FREE_NON_NULL(MapNode->MapName);
- SHELL_FREE_NON_NULL(MapNode->CurrentDirectoryPath);
- FreePool(MapNode);
+ ; MapNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
+ )
+ {
+ ASSERT (MapNode != NULL);
+ RemoveEntryList (&MapNode->Link);
+ SHELL_FREE_NON_NULL (MapNode->DevicePath);
+ SHELL_FREE_NON_NULL (MapNode->MapName);
+ SHELL_FREE_NON_NULL (MapNode->CurrentDirectoryPath);
+ FreePool (MapNode);
}
}
- if (!IsListEmpty(&mFileHandleList.Link)){
- FreeFileHandleList(&mFileHandleList);
+
+ if (!IsListEmpty (&mFileHandleList.Link)) {
+ FreeFileHandleList (&mFileHandleList);
}
if (mProfileList != NULL) {
- FreePool(mProfileList);
+ FreePool (mProfileList);
}
- gUnicodeCollation = NULL;
- gShellCurMapping = NULL;
+ gUnicodeCollation = NULL;
+ gShellCurMapping = NULL;
return (RETURN_SUCCESS);
}
@@ -304,7 +317,7 @@ ShellCommandLibDestructor ( **/
CONST EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *
ShellCommandFindDynamicCommand (
- IN CONST CHAR16 *CommandString
+ IN CONST CHAR16 *CommandString
)
{
EFI_STATUS Status;
@@ -312,7 +325,7 @@ ShellCommandFindDynamicCommand ( EFI_HANDLE *NextCommand;
EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand;
- CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid);
+ CommandHandleList = GetHandleListByProtocol (&gEfiShellDynamicCommandProtocolGuid);
if (CommandHandleList == NULL) {
//
// not found or out of resources
@@ -321,27 +334,29 @@ ShellCommandFindDynamicCommand ( }
for (NextCommand = CommandHandleList; *NextCommand != NULL; NextCommand++) {
- Status = gBS->HandleProtocol(
- *NextCommand,
- &gEfiShellDynamicCommandProtocolGuid,
- (VOID **)&DynamicCommand
- );
+ Status = gBS->HandleProtocol (
+ *NextCommand,
+ &gEfiShellDynamicCommandProtocolGuid,
+ (VOID **)&DynamicCommand
+ );
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
continue;
}
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandString,
- (CHAR16*)DynamicCommand->CommandName) == 0
- ){
- FreePool(CommandHandleList);
- return (DynamicCommand);
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandString,
+ (CHAR16 *)DynamicCommand->CommandName
+ ) == 0
+ )
+ {
+ FreePool (CommandHandleList);
+ return (DynamicCommand);
}
}
- FreePool(CommandHandleList);
+ FreePool (CommandHandleList);
return (NULL);
}
@@ -352,10 +367,10 @@ ShellCommandFindDynamicCommand ( **/
BOOLEAN
ShellCommandDynamicCommandExists (
- IN CONST CHAR16 *CommandString
+ IN CONST CHAR16 *CommandString
)
{
- return (BOOLEAN) ((ShellCommandFindDynamicCommand(CommandString) != NULL));
+ return (BOOLEAN)((ShellCommandFindDynamicCommand (CommandString) != NULL));
}
/**
@@ -364,33 +379,37 @@ ShellCommandDynamicCommandExists ( @param[in] CommandString The command string to check for on the list.
**/
BOOLEAN
-ShellCommandIsCommandOnInternalList(
- IN CONST CHAR16 *CommandString
+ShellCommandIsCommandOnInternalList (
+ IN CONST CHAR16 *CommandString
)
{
- SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
+ SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
//
// assert for NULL parameter
//
- ASSERT(CommandString != NULL);
+ ASSERT (CommandString != NULL);
//
// check for the command
//
- for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link)
- ; !IsNull(&mCommandList.Link, &Node->Link)
- ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode(&mCommandList.Link, &Node->Link)
- ){
- ASSERT(Node->CommandString != NULL);
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandString,
- Node->CommandString) == 0
- ){
+ for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
+ ; !IsNull (&mCommandList.Link, &Node->Link)
+ ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
+ )
+ {
+ ASSERT (Node->CommandString != NULL);
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandString,
+ Node->CommandString
+ ) == 0
+ )
+ {
return (TRUE);
}
}
+
return (FALSE);
}
@@ -401,15 +420,15 @@ ShellCommandIsCommandOnInternalList( **/
BOOLEAN
EFIAPI
-ShellCommandIsCommandOnList(
- IN CONST CHAR16 *CommandString
+ShellCommandIsCommandOnList (
+ IN CONST CHAR16 *CommandString
)
{
- if (ShellCommandIsCommandOnInternalList(CommandString)) {
+ if (ShellCommandIsCommandOnInternalList (CommandString)) {
return TRUE;
}
- return ShellCommandDynamicCommandExists(CommandString);
+ return ShellCommandDynamicCommandExists (CommandString);
}
/**
@@ -420,14 +439,14 @@ ShellCommandIsCommandOnList( @retval NULL No help text was found.
@return String of help text. Caller required to free.
**/
-CHAR16*
-ShellCommandGetDynamicCommandHelp(
- IN CONST CHAR16 *CommandString
+CHAR16 *
+ShellCommandGetDynamicCommandHelp (
+ IN CONST CHAR16 *CommandString
)
{
EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand;
- DynamicCommand = (EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *)ShellCommandFindDynamicCommand(CommandString);
+ DynamicCommand = (EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *)ShellCommandFindDynamicCommand (CommandString);
if (DynamicCommand == NULL) {
return (NULL);
}
@@ -435,7 +454,7 @@ ShellCommandGetDynamicCommandHelp( //
// TODO: how to get proper language?
//
- return DynamicCommand->GetHelp(DynamicCommand, "en");
+ return DynamicCommand->GetHelp (DynamicCommand, "en");
}
/**
@@ -446,34 +465,38 @@ ShellCommandGetDynamicCommandHelp( @retval NULL No help text was found.
@return String of help text. Caller reuiqred to free.
**/
-CHAR16*
-ShellCommandGetInternalCommandHelp(
- IN CONST CHAR16 *CommandString
+CHAR16 *
+ShellCommandGetInternalCommandHelp (
+ IN CONST CHAR16 *CommandString
)
{
- SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
+ SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
//
// assert for NULL parameter
//
- ASSERT(CommandString != NULL);
+ ASSERT (CommandString != NULL);
//
// check for the command
//
- for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link)
- ; !IsNull(&mCommandList.Link, &Node->Link)
- ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode(&mCommandList.Link, &Node->Link)
- ){
- ASSERT(Node->CommandString != NULL);
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandString,
- Node->CommandString) == 0
- ){
- return (HiiGetString(Node->HiiHandle, Node->ManFormatHelp, NULL));
+ for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
+ ; !IsNull (&mCommandList.Link, &Node->Link)
+ ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
+ )
+ {
+ ASSERT (Node->CommandString != NULL);
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandString,
+ Node->CommandString
+ ) == 0
+ )
+ {
+ return (HiiGetString (Node->HiiHandle, Node->ManFormatHelp, NULL));
}
}
+
return (NULL);
}
@@ -485,23 +508,23 @@ ShellCommandGetInternalCommandHelp( @retval NULL No help text was found.
@return String of help text.Caller reuiqred to free.
**/
-CHAR16*
+CHAR16 *
EFIAPI
ShellCommandGetCommandHelp (
- IN CONST CHAR16 *CommandString
+ IN CONST CHAR16 *CommandString
)
{
- CHAR16 *HelpStr;
- HelpStr = ShellCommandGetInternalCommandHelp(CommandString);
+ CHAR16 *HelpStr;
+
+ HelpStr = ShellCommandGetInternalCommandHelp (CommandString);
if (HelpStr == NULL) {
- HelpStr = ShellCommandGetDynamicCommandHelp(CommandString);
+ HelpStr = ShellCommandGetDynamicCommandHelp (CommandString);
}
return HelpStr;
}
-
/**
Registers handlers of type SHELL_RUN_COMMAND and
SHELL_GET_MAN_FILENAME for each shell command.
@@ -552,82 +575,85 @@ ShellCommandGetCommandHelp ( RETURN_STATUS
EFIAPI
ShellCommandRegisterCommandName (
- IN CONST CHAR16 *CommandString,
- IN SHELL_RUN_COMMAND CommandHandler,
- IN SHELL_GET_MAN_FILENAME GetManFileName,
- IN UINT32 ShellMinSupportLevel,
- IN CONST CHAR16 *ProfileName,
- IN CONST BOOLEAN CanAffectLE,
- IN CONST EFI_HII_HANDLE HiiHandle,
- IN CONST EFI_STRING_ID ManFormatHelp
+ IN CONST CHAR16 *CommandString,
+ IN SHELL_RUN_COMMAND CommandHandler,
+ IN SHELL_GET_MAN_FILENAME GetManFileName,
+ IN UINT32 ShellMinSupportLevel,
+ IN CONST CHAR16 *ProfileName,
+ IN CONST BOOLEAN CanAffectLE,
+ IN CONST EFI_HII_HANDLE HiiHandle,
+ IN CONST EFI_STRING_ID ManFormatHelp
)
{
- SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
- SHELL_COMMAND_INTERNAL_LIST_ENTRY *Command;
- SHELL_COMMAND_INTERNAL_LIST_ENTRY *PrevCommand;
- INTN LexicalMatchValue;
+ SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
+ SHELL_COMMAND_INTERNAL_LIST_ENTRY *Command;
+ SHELL_COMMAND_INTERNAL_LIST_ENTRY *PrevCommand;
+ INTN LexicalMatchValue;
//
// Initialize local variables.
//
- Command = NULL;
- PrevCommand = NULL;
+ Command = NULL;
+ PrevCommand = NULL;
LexicalMatchValue = 0;
//
// ASSERTs for NULL parameters
//
- ASSERT(CommandString != NULL);
- ASSERT(GetManFileName != NULL);
- ASSERT(CommandHandler != NULL);
- ASSERT(ProfileName != NULL);
+ ASSERT (CommandString != NULL);
+ ASSERT (GetManFileName != NULL);
+ ASSERT (CommandHandler != NULL);
+ ASSERT (ProfileName != NULL);
//
// check for shell support level
//
- if (PcdGet8(PcdShellSupportLevel) < ShellMinSupportLevel) {
+ if (PcdGet8 (PcdShellSupportLevel) < ShellMinSupportLevel) {
return (RETURN_UNSUPPORTED);
}
//
// check for already on the list
//
- if (ShellCommandIsCommandOnList(CommandString)) {
+ if (ShellCommandIsCommandOnList (CommandString)) {
return (RETURN_ALREADY_STARTED);
}
//
// allocate memory for new struct
//
- Node = AllocateZeroPool(sizeof(SHELL_COMMAND_INTERNAL_LIST_ENTRY));
+ Node = AllocateZeroPool (sizeof (SHELL_COMMAND_INTERNAL_LIST_ENTRY));
if (Node == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
- Node->CommandString = AllocateCopyPool(StrSize(CommandString), CommandString);
+
+ Node->CommandString = AllocateCopyPool (StrSize (CommandString), CommandString);
if (Node->CommandString == NULL) {
FreePool (Node);
return RETURN_OUT_OF_RESOURCES;
}
- Node->GetManFileName = GetManFileName;
- Node->CommandHandler = CommandHandler;
- Node->LastError = CanAffectLE;
- Node->HiiHandle = HiiHandle;
- Node->ManFormatHelp = ManFormatHelp;
-
- if ( StrLen(ProfileName)>0
- && ((mProfileList != NULL
- && StrStr(mProfileList, ProfileName) == NULL) || mProfileList == NULL)
- ){
- ASSERT((mProfileList == NULL && mProfileListSize == 0) || (mProfileList != NULL));
+ Node->GetManFileName = GetManFileName;
+ Node->CommandHandler = CommandHandler;
+ Node->LastError = CanAffectLE;
+ Node->HiiHandle = HiiHandle;
+ Node->ManFormatHelp = ManFormatHelp;
+
+ if ( (StrLen (ProfileName) > 0)
+ && (( (mProfileList != NULL)
+ && (StrStr (mProfileList, ProfileName) == NULL)) || (mProfileList == NULL))
+ )
+ {
+ ASSERT ((mProfileList == NULL && mProfileListSize == 0) || (mProfileList != NULL));
if (mProfileList == NULL) {
//
// If this is the first make a leading ';'
//
- StrnCatGrow(&mProfileList, &mProfileListSize, L";", 0);
+ StrnCatGrow (&mProfileList, &mProfileListSize, L";", 0);
}
- StrnCatGrow(&mProfileList, &mProfileListSize, ProfileName, 0);
- StrnCatGrow(&mProfileList, &mProfileListSize, L";", 0);
+
+ StrnCatGrow (&mProfileList, &mProfileListSize, ProfileName, 0);
+ StrnCatGrow (&mProfileList, &mProfileListSize, L";", 0);
}
//
@@ -639,10 +665,10 @@ ShellCommandRegisterCommandName ( // Move a new registered command to its sorted ordered location in the list
//
for (Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link),
- PrevCommand = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
- ; !IsNull (&mCommandList.Link, &Command->Link)
- ; Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Command->Link)) {
-
+ PrevCommand = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
+ ; !IsNull (&mCommandList.Link, &Command->Link)
+ ; Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Command->Link))
+ {
//
// Get Lexical Comparison Value between PrevCommand and Command list entry
//
@@ -656,8 +682,8 @@ ShellCommandRegisterCommandName ( // Swap PrevCommand and Command list entry if PrevCommand list entry
// is alphabetically greater than Command list entry
//
- if (LexicalMatchValue > 0){
- Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *) SwapListEntries (&PrevCommand->Link, &Command->Link);
+ if (LexicalMatchValue > 0) {
+ Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)SwapListEntries (&PrevCommand->Link, &Command->Link);
} else if (LexicalMatchValue < 0) {
//
// PrevCommand entry is lexically lower than Command entry
@@ -711,9 +737,9 @@ ShellCommandGetProfileList ( RETURN_STATUS
EFIAPI
ShellCommandRunCommandHandler (
- IN CONST CHAR16 *CommandString,
- IN OUT SHELL_STATUS *RetVal,
- IN OUT BOOLEAN *CanAffectLE OPTIONAL
+ IN CONST CHAR16 *CommandString,
+ IN OUT SHELL_STATUS *RetVal,
+ IN OUT BOOLEAN *CanAffectLE OPTIONAL
)
{
SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
@@ -722,29 +748,34 @@ ShellCommandRunCommandHandler ( //
// assert for NULL parameters
//
- ASSERT(CommandString != NULL);
+ ASSERT (CommandString != NULL);
//
// check for the command
//
- for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link)
- ; !IsNull(&mCommandList.Link, &Node->Link)
- ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode(&mCommandList.Link, &Node->Link)
- ){
- ASSERT(Node->CommandString != NULL);
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandString,
- Node->CommandString) == 0
- ){
+ for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
+ ; !IsNull (&mCommandList.Link, &Node->Link)
+ ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
+ )
+ {
+ ASSERT (Node->CommandString != NULL);
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandString,
+ Node->CommandString
+ ) == 0
+ )
+ {
if (CanAffectLE != NULL) {
*CanAffectLE = Node->LastError;
}
+
if (RetVal != NULL) {
- *RetVal = Node->CommandHandler(NULL, gST);
+ *RetVal = Node->CommandHandler (NULL, gST);
} else {
- Node->CommandHandler(NULL, gST);
+ Node->CommandHandler (NULL, gST);
}
+
return (RETURN_SUCCESS);
}
}
@@ -752,13 +783,14 @@ ShellCommandRunCommandHandler ( //
// An internal command was not found, try to find a dynamic command
//
- DynamicCommand = (EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *)ShellCommandFindDynamicCommand(CommandString);
+ DynamicCommand = (EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *)ShellCommandFindDynamicCommand (CommandString);
if (DynamicCommand != NULL) {
if (RetVal != NULL) {
- *RetVal = DynamicCommand->Handler(DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol);
+ *RetVal = DynamicCommand->Handler (DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol);
} else {
- DynamicCommand->Handler(DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol);
+ DynamicCommand->Handler (DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol);
}
+
return (RETURN_SUCCESS);
}
@@ -778,35 +810,39 @@ ShellCommandRunCommandHandler ( @return other the name of the MAN file.
@sa SHELL_GET_MAN_FILENAME
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameHandler (
- IN CONST CHAR16 *CommandString
+ IN CONST CHAR16 *CommandString
)
{
- SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
+ SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
//
// assert for NULL parameters
//
- ASSERT(CommandString != NULL);
+ ASSERT (CommandString != NULL);
//
// check for the command
//
- for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode(&mCommandList.Link)
- ; !IsNull(&mCommandList.Link, &Node->Link)
- ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode(&mCommandList.Link, &Node->Link)
- ){
- ASSERT(Node->CommandString != NULL);
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandString,
- Node->CommandString) == 0
- ){
- return (Node->GetManFileName());
+ for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
+ ; !IsNull (&mCommandList.Link, &Node->Link)
+ ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
+ )
+ {
+ ASSERT (Node->CommandString != NULL);
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandString,
+ Node->CommandString
+ ) == 0
+ )
+ {
+ return (Node->GetManFileName ());
}
}
+
return (NULL);
}
@@ -819,16 +855,16 @@ ShellCommandGetManFileNameHandler ( @return a Linked list of all available shell commands.
**/
-CONST COMMAND_LIST*
+CONST COMMAND_LIST *
EFIAPI
ShellCommandGetCommandList (
- IN CONST BOOLEAN Sort
+ IN CONST BOOLEAN Sort
)
{
-// if (!Sort) {
-// return ((COMMAND_LIST*)(&mCommandList));
-// }
- return ((COMMAND_LIST*)(&mCommandList));
+ // if (!Sort) {
+ // return ((COMMAND_LIST*)(&mCommandList));
+ // }
+ return ((COMMAND_LIST *)(&mCommandList));
}
/**
@@ -847,34 +883,36 @@ ShellCommandGetCommandList ( RETURN_STATUS
EFIAPI
ShellCommandRegisterAlias (
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Alias
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias
)
{
- ALIAS_LIST *Node;
- ALIAS_LIST *CommandAlias;
- ALIAS_LIST *PrevCommandAlias;
- INTN LexicalMatchValue;
+ ALIAS_LIST *Node;
+ ALIAS_LIST *CommandAlias;
+ ALIAS_LIST *PrevCommandAlias;
+ INTN LexicalMatchValue;
//
// Asserts for NULL
//
- ASSERT(Command != NULL);
- ASSERT(Alias != NULL);
+ ASSERT (Command != NULL);
+ ASSERT (Alias != NULL);
//
// allocate memory for new struct
//
- Node = AllocateZeroPool(sizeof(ALIAS_LIST));
+ Node = AllocateZeroPool (sizeof (ALIAS_LIST));
if (Node == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
- Node->CommandString = AllocateCopyPool(StrSize(Command), Command);
+
+ Node->CommandString = AllocateCopyPool (StrSize (Command), Command);
if (Node->CommandString == NULL) {
FreePool (Node);
return RETURN_OUT_OF_RESOURCES;
}
- Node->Alias = AllocateCopyPool(StrSize(Alias), Alias);
+
+ Node->Alias = AllocateCopyPool (StrSize (Alias), Alias);
if (Node->Alias == NULL) {
FreePool (Node->CommandString);
FreePool (Node);
@@ -887,9 +925,10 @@ ShellCommandRegisterAlias ( // Move a new pre-defined registered alias to its sorted ordered location in the list
//
for ( CommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link),
- PrevCommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link)
- ; !IsNull (&mAliasList.Link, &CommandAlias->Link)
- ; CommandAlias = (ALIAS_LIST *) GetNextNode (&mAliasList.Link, &CommandAlias->Link) ) {
+ PrevCommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link)
+ ; !IsNull (&mAliasList.Link, &CommandAlias->Link)
+ ; CommandAlias = (ALIAS_LIST *)GetNextNode (&mAliasList.Link, &CommandAlias->Link))
+ {
//
// Get Lexical comparison value between PrevCommandAlias and CommandAlias List Entry
//
@@ -904,7 +943,7 @@ ShellCommandRegisterAlias ( // is alphabetically greater than CommandAlias list entry
//
if (LexicalMatchValue > 0) {
- CommandAlias = (ALIAS_LIST *) SwapListEntries (&PrevCommandAlias->Link, &CommandAlias->Link);
+ CommandAlias = (ALIAS_LIST *)SwapListEntries (&PrevCommandAlias->Link, &CommandAlias->Link);
} else if (LexicalMatchValue < 0) {
//
// PrevCommandAlias entry is lexically lower than CommandAlias entry
@@ -923,13 +962,13 @@ ShellCommandRegisterAlias ( @return a Linked list of all requested shell alias'.
**/
-CONST ALIAS_LIST*
+CONST ALIAS_LIST *
EFIAPI
ShellCommandGetInitAliasList (
VOID
)
{
- return (&mAliasList);
+ return (&mAliasList);
}
/**
@@ -942,41 +981,48 @@ ShellCommandGetInitAliasList ( **/
BOOLEAN
EFIAPI
-ShellCommandIsOnAliasList(
- IN CONST CHAR16 *Alias
+ShellCommandIsOnAliasList (
+ IN CONST CHAR16 *Alias
)
{
- ALIAS_LIST *Node;
+ ALIAS_LIST *Node;
//
// assert for NULL parameter
//
- ASSERT(Alias != NULL);
+ ASSERT (Alias != NULL);
//
// check for the Alias
//
- for ( Node = (ALIAS_LIST *)GetFirstNode(&mAliasList.Link)
- ; !IsNull(&mAliasList.Link, &Node->Link)
- ; Node = (ALIAS_LIST *)GetNextNode(&mAliasList.Link, &Node->Link)
- ){
- ASSERT(Node->CommandString != NULL);
- ASSERT(Node->Alias != NULL);
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)Alias,
- Node->CommandString) == 0
- ){
+ for ( Node = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link)
+ ; !IsNull (&mAliasList.Link, &Node->Link)
+ ; Node = (ALIAS_LIST *)GetNextNode (&mAliasList.Link, &Node->Link)
+ )
+ {
+ ASSERT (Node->CommandString != NULL);
+ ASSERT (Node->Alias != NULL);
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)Alias,
+ Node->CommandString
+ ) == 0
+ )
+ {
return (TRUE);
}
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)Alias,
- Node->Alias) == 0
- ){
+
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)Alias,
+ Node->Alias
+ ) == 0
+ )
+ {
return (TRUE);
}
}
+
return (FALSE);
}
@@ -989,7 +1035,7 @@ ShellCommandIsOnAliasList( **/
BOOLEAN
EFIAPI
-ShellCommandGetEchoState(
+ShellCommandGetEchoState (
VOID
)
{
@@ -1007,8 +1053,8 @@ ShellCommandGetEchoState( **/
VOID
EFIAPI
-ShellCommandSetEchoState(
- IN BOOLEAN State
+ShellCommandSetEchoState (
+ IN BOOLEAN State
)
{
mEchoState = State;
@@ -1023,16 +1069,17 @@ ShellCommandSetEchoState( VOID
EFIAPI
ShellCommandRegisterExit (
- IN BOOLEAN ScriptOnly,
- IN CONST UINT64 ErrorCode
+ IN BOOLEAN ScriptOnly,
+ IN CONST UINT64 ErrorCode
)
{
mExitRequested = (BOOLEAN)(!mExitRequested);
if (mExitRequested) {
- mExitScript = ScriptOnly;
+ mExitScript = ScriptOnly;
} else {
- mExitScript = FALSE;
+ mExitScript = FALSE;
}
+
mExitCode = ErrorCode;
}
@@ -1066,6 +1113,7 @@ ShellCommandGetExitCode ( {
return (mExitCode);
}
+
/**
Retrieve the Exit script indicator.
@@ -1091,37 +1139,42 @@ ShellCommandGetScriptExit ( VOID
EFIAPI
DeleteScriptFileStruct (
- IN SCRIPT_FILE *Script
+ IN SCRIPT_FILE *Script
)
{
- UINT8 LoopVar;
+ UINT8 LoopVar;
if (Script == NULL) {
return;
}
- for (LoopVar = 0 ; LoopVar < Script->Argc ; LoopVar++) {
- SHELL_FREE_NON_NULL(Script->Argv[LoopVar]);
+ for (LoopVar = 0; LoopVar < Script->Argc; LoopVar++) {
+ SHELL_FREE_NON_NULL (Script->Argv[LoopVar]);
}
+
if (Script->Argv != NULL) {
- SHELL_FREE_NON_NULL(Script->Argv);
+ SHELL_FREE_NON_NULL (Script->Argv);
}
+
Script->CurrentCommand = NULL;
while (!IsListEmpty (&Script->CommandList)) {
- Script->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode(&Script->CommandList);
+ Script->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode (&Script->CommandList);
if (Script->CurrentCommand != NULL) {
- RemoveEntryList(&Script->CurrentCommand->Link);
+ RemoveEntryList (&Script->CurrentCommand->Link);
if (Script->CurrentCommand->Cl != NULL) {
- SHELL_FREE_NON_NULL(Script->CurrentCommand->Cl);
+ SHELL_FREE_NON_NULL (Script->CurrentCommand->Cl);
}
+
if (Script->CurrentCommand->Data != NULL) {
- SHELL_FREE_NON_NULL(Script->CurrentCommand->Data);
+ SHELL_FREE_NON_NULL (Script->CurrentCommand->Data);
}
- SHELL_FREE_NON_NULL(Script->CurrentCommand);
+
+ SHELL_FREE_NON_NULL (Script->CurrentCommand);
}
}
- SHELL_FREE_NON_NULL(Script->ScriptName);
- SHELL_FREE_NON_NULL(Script);
+
+ SHELL_FREE_NON_NULL (Script->ScriptName);
+ SHELL_FREE_NON_NULL (Script);
}
/**
@@ -1130,17 +1183,19 @@ DeleteScriptFileStruct ( @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
)
{
- SCRIPT_FILE_LIST *List;
+ SCRIPT_FILE_LIST *List;
+
if (IsListEmpty (&mScriptList.Link)) {
return (NULL);
}
- List = ((SCRIPT_FILE_LIST*)GetFirstNode(&mScriptList.Link));
+
+ List = ((SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link));
return (List->Data);
}
@@ -1155,30 +1210,34 @@ ShellCommandGetCurrentScriptFile ( @return A pointer to the current running script file after this
change. NULL if removing the final script.
**/
-SCRIPT_FILE*
+SCRIPT_FILE *
EFIAPI
ShellCommandSetNewScript (
- IN SCRIPT_FILE *Script OPTIONAL
+ IN SCRIPT_FILE *Script OPTIONAL
)
{
- SCRIPT_FILE_LIST *Node;
+ SCRIPT_FILE_LIST *Node;
+
if (Script == NULL) {
if (IsListEmpty (&mScriptList.Link)) {
return (NULL);
}
- Node = (SCRIPT_FILE_LIST *)GetFirstNode(&mScriptList.Link);
- RemoveEntryList(&Node->Link);
- DeleteScriptFileStruct(Node->Data);
- FreePool(Node);
+
+ Node = (SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link);
+ RemoveEntryList (&Node->Link);
+ DeleteScriptFileStruct (Node->Data);
+ FreePool (Node);
} else {
- Node = AllocateZeroPool(sizeof(SCRIPT_FILE_LIST));
+ Node = AllocateZeroPool (sizeof (SCRIPT_FILE_LIST));
if (Node == NULL) {
return (NULL);
}
+
Node->Data = Script;
- InsertHeadList(&mScriptList.Link, &Node->Link);
+ InsertHeadList (&mScriptList.Link, &Node->Link);
}
- return (ShellCommandGetCurrentScriptFile());
+
+ return (ShellCommandGetCurrentScriptFile ());
}
/**
@@ -1191,23 +1250,25 @@ ShellCommandSetNewScript ( @retval NULL a memory allocation failed.
@return a new map name string
**/
-CHAR16*
+CHAR16 *
EFIAPI
-ShellCommandCreateNewMappingName(
- IN CONST SHELL_MAPPING_TYPE Type
+ShellCommandCreateNewMappingName (
+ IN CONST SHELL_MAPPING_TYPE Type
)
{
CHAR16 *String;
- ASSERT(Type < MappingTypeMax);
+
+ ASSERT (Type < MappingTypeMax);
String = NULL;
- String = AllocateZeroPool(PcdGet8(PcdShellMapNameLength) * sizeof(String[0]));
- UnicodeSPrint(
+ String = AllocateZeroPool (PcdGet8 (PcdShellMapNameLength) * sizeof (String[0]));
+ UnicodeSPrint (
String,
- PcdGet8(PcdShellMapNameLength) * sizeof(String[0]),
- Type == MappingTypeFileSystem?L"FS%d:":L"BLK%d:",
- Type == MappingTypeFileSystem?mFsMaxCount++:mBlkMaxCount++);
+ PcdGet8 (PcdShellMapNameLength) * sizeof (String[0]),
+ Type == MappingTypeFileSystem ? L"FS%d:" : L"BLK%d:",
+ Type == MappingTypeFileSystem ? mFsMaxCount++ : mBlkMaxCount++
+ );
return (String);
}
@@ -1231,11 +1292,11 @@ ShellCommandCreateNewMappingName( **/
EFI_STATUS
EFIAPI
-ShellCommandAddMapItemAndUpdatePath(
- IN CONST CHAR16 *Name,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST UINT64 Flags,
- IN CONST BOOLEAN Path
+ShellCommandAddMapItemAndUpdatePath (
+ IN CONST CHAR16 *Name,
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CONST UINT64 Flags,
+ IN CONST BOOLEAN Path
)
{
EFI_STATUS Status;
@@ -1244,56 +1305,61 @@ ShellCommandAddMapItemAndUpdatePath( CHAR16 *NewPath;
UINTN NewPathSize;
- NewPathSize = 0;
- NewPath = NULL;
+ NewPathSize = 0;
+ NewPath = NULL;
OriginalPath = NULL;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
- MapListNode = AllocateZeroPool(sizeof(SHELL_MAP_LIST));
+ MapListNode = AllocateZeroPool (sizeof (SHELL_MAP_LIST));
if (MapListNode == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
- MapListNode->Flags = Flags;
- MapListNode->MapName = AllocateCopyPool(StrSize(Name), Name);
- MapListNode->DevicePath = DuplicateDevicePath(DevicePath);
- if ((MapListNode->MapName == NULL) || (MapListNode->DevicePath == NULL)){
+ MapListNode->Flags = Flags;
+ MapListNode->MapName = AllocateCopyPool (StrSize (Name), Name);
+ MapListNode->DevicePath = DuplicateDevicePath (DevicePath);
+ if ((MapListNode->MapName == NULL) || (MapListNode->DevicePath == NULL)) {
Status = EFI_OUT_OF_RESOURCES;
} else {
- InsertTailList(&gShellMapList.Link, &MapListNode->Link);
+ InsertTailList (&gShellMapList.Link, &MapListNode->Link);
}
}
- if (EFI_ERROR(Status)) {
+
+ if (EFI_ERROR (Status)) {
if (MapListNode != NULL) {
if (MapListNode->DevicePath != NULL) {
- FreePool(MapListNode->DevicePath);
+ FreePool (MapListNode->DevicePath);
}
+
if (MapListNode->MapName != NULL) {
- FreePool(MapListNode->MapName);
+ FreePool (MapListNode->MapName);
}
- FreePool(MapListNode);
+
+ FreePool (MapListNode);
}
} else if (Path) {
//
// Since there was no error and Path was TRUE
// Now add the correct path for that mapping
//
- OriginalPath = gEfiShellProtocol->GetEnv(L"path");
- ASSERT((NewPath == NULL && NewPathSize == 0) || (NewPath != NULL));
+ OriginalPath = gEfiShellProtocol->GetEnv (L"path");
+ ASSERT ((NewPath == NULL && NewPathSize == 0) || (NewPath != NULL));
if (OriginalPath != NULL) {
- StrnCatGrow(&NewPath, &NewPathSize, OriginalPath, 0);
- StrnCatGrow(&NewPath, &NewPathSize, L";", 0);
+ StrnCatGrow (&NewPath, &NewPathSize, OriginalPath, 0);
+ StrnCatGrow (&NewPath, &NewPathSize, L";", 0);
}
- StrnCatGrow(&NewPath, &NewPathSize, Name, 0);
- StrnCatGrow(&NewPath, &NewPathSize, L"\\efi\\tools\\;", 0);
- StrnCatGrow(&NewPath, &NewPathSize, Name, 0);
- StrnCatGrow(&NewPath, &NewPathSize, L"\\efi\\boot\\;", 0);
- StrnCatGrow(&NewPath, &NewPathSize, Name, 0);
- StrnCatGrow(&NewPath, &NewPathSize, L"\\", 0);
-
- Status = gEfiShellProtocol->SetEnv(L"path", NewPath, TRUE);
- ASSERT_EFI_ERROR(Status);
- FreePool(NewPath);
+
+ StrnCatGrow (&NewPath, &NewPathSize, Name, 0);
+ StrnCatGrow (&NewPath, &NewPathSize, L"\\efi\\tools\\;", 0);
+ StrnCatGrow (&NewPath, &NewPathSize, Name, 0);
+ StrnCatGrow (&NewPath, &NewPathSize, L"\\efi\\boot\\;", 0);
+ StrnCatGrow (&NewPath, &NewPathSize, Name, 0);
+ StrnCatGrow (&NewPath, &NewPathSize, L"\\", 0);
+
+ Status = gEfiShellProtocol->SetEnv (L"path", NewPath, TRUE);
+ ASSERT_EFI_ERROR (Status);
+ FreePool (NewPath);
}
+
return (Status);
}
@@ -1316,7 +1382,7 @@ ShellCommandAddMapItemAndUpdatePath( **/
EFI_STATUS
EFIAPI
-ShellCommandCreateInitialMappingsAndPaths(
+ShellCommandCreateInitialMappingsAndPaths (
VOID
)
{
@@ -1341,110 +1407,115 @@ ShellCommandCreateInitialMappingsAndPaths( //
// Reset the static members back to zero
//
- mFsMaxCount = 0;
+ mFsMaxCount = 0;
mBlkMaxCount = 0;
- gEfiShellProtocol->SetEnv(L"path", L"", TRUE);
+ gEfiShellProtocol->SetEnv (L"path", L"", TRUE);
//
// First empty out the existing list.
//
- if (!IsListEmpty(&gShellMapList.Link)) {
- for ( MapListNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
- ; !IsListEmpty(&gShellMapList.Link)
- ; MapListNode = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
- ){
- RemoveEntryList(&MapListNode->Link);
- SHELL_FREE_NON_NULL(MapListNode->DevicePath);
- SHELL_FREE_NON_NULL(MapListNode->MapName);
- SHELL_FREE_NON_NULL(MapListNode->CurrentDirectoryPath);
- FreePool(MapListNode);
+ if (!IsListEmpty (&gShellMapList.Link)) {
+ for ( MapListNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
+ ; !IsListEmpty (&gShellMapList.Link)
+ ; MapListNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
+ )
+ {
+ RemoveEntryList (&MapListNode->Link);
+ SHELL_FREE_NON_NULL (MapListNode->DevicePath);
+ SHELL_FREE_NON_NULL (MapListNode->MapName);
+ SHELL_FREE_NON_NULL (MapListNode->CurrentDirectoryPath);
+ FreePool (MapListNode);
} // for loop
}
//
// Find each handle with Simple File System
//
- HandleList = GetHandleListByProtocol(&gEfiSimpleFileSystemProtocolGuid);
+ HandleList = GetHandleListByProtocol (&gEfiSimpleFileSystemProtocolGuid);
if (HandleList != NULL) {
//
// Do a count of the handles
//
- for (Count = 0 ; HandleList[Count] != NULL ; Count++);
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
+ }
//
// Get all Device Paths
//
- DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count);
+ DevicePathList = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL *) * Count);
if (DevicePathList == NULL) {
SHELL_FREE_NON_NULL (HandleList);
return EFI_OUT_OF_RESOURCES;
}
- for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
- DevicePathList[Count] = DevicePathFromHandle(HandleList[Count]);
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
+ DevicePathList[Count] = DevicePathFromHandle (HandleList[Count]);
}
//
// Sort all DevicePaths
//
- PerformQuickSort(DevicePathList, Count, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare);
+ PerformQuickSort (DevicePathList, Count, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
- ShellCommandConsistMappingInitialize(&ConsistMappingTable);
+ ShellCommandConsistMappingInitialize (&ConsistMappingTable);
//
// Assign new Mappings to all...
//
- for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
//
// Get default name first
//
- NewDefaultName = ShellCommandCreateNewMappingName(MappingTypeFileSystem);
- ASSERT(NewDefaultName != NULL);
- Status = ShellCommandAddMapItemAndUpdatePath(NewDefaultName, DevicePathList[Count], 0, TRUE);
- ASSERT_EFI_ERROR(Status);
- FreePool(NewDefaultName);
+ NewDefaultName = ShellCommandCreateNewMappingName (MappingTypeFileSystem);
+ ASSERT (NewDefaultName != NULL);
+ Status = ShellCommandAddMapItemAndUpdatePath (NewDefaultName, DevicePathList[Count], 0, TRUE);
+ ASSERT_EFI_ERROR (Status);
+ FreePool (NewDefaultName);
//
// Now do consistent name
//
- NewConsistName = ShellCommandConsistMappingGenMappingName(DevicePathList[Count], ConsistMappingTable);
+ NewConsistName = ShellCommandConsistMappingGenMappingName (DevicePathList[Count], ConsistMappingTable);
if (NewConsistName != NULL) {
- Status = ShellCommandAddMapItemAndUpdatePath(NewConsistName, DevicePathList[Count], 0, FALSE);
- ASSERT_EFI_ERROR(Status);
- FreePool(NewConsistName);
+ Status = ShellCommandAddMapItemAndUpdatePath (NewConsistName, DevicePathList[Count], 0, FALSE);
+ ASSERT_EFI_ERROR (Status);
+ FreePool (NewConsistName);
}
}
- ShellCommandConsistMappingUnInitialize(ConsistMappingTable);
+ ShellCommandConsistMappingUnInitialize (ConsistMappingTable);
- SHELL_FREE_NON_NULL(HandleList);
- SHELL_FREE_NON_NULL(DevicePathList);
+ SHELL_FREE_NON_NULL (HandleList);
+ SHELL_FREE_NON_NULL (DevicePathList);
HandleList = NULL;
//
- //gShellCurMapping point to node of current file system in the gShellMapList. When reset all mappings,
- //all nodes in the gShellMapList will be free. Then gShellCurMapping will be a dangling pointer, So,
- //after created new mappings, we should reset the gShellCurMapping pointer back to node of current file system.
+ // gShellCurMapping point to node of current file system in the gShellMapList. When reset all mappings,
+ // all nodes in the gShellMapList will be free. Then gShellCurMapping will be a dangling pointer, So,
+ // after created new mappings, we should reset the gShellCurMapping pointer back to node of current file system.
//
if (gShellCurMapping != NULL) {
gShellCurMapping = NULL;
- CurDir = gEfiShellProtocol->GetEnv(L"cwd");
+ CurDir = gEfiShellProtocol->GetEnv (L"cwd");
if (CurDir != NULL) {
- MapName = AllocateCopyPool (StrSize(CurDir), CurDir);
+ MapName = AllocateCopyPool (StrSize (CurDir), CurDir);
if (MapName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
SplitCurDir = StrStr (MapName, L":");
if (SplitCurDir == NULL) {
SHELL_FREE_NON_NULL (MapName);
return EFI_UNSUPPORTED;
}
+
*(SplitCurDir + 1) = CHAR_NULL;
- MapListItem = ShellCommandFindMapItem (MapName);
+ MapListItem = ShellCommandFindMapItem (MapName);
if (MapListItem != NULL) {
gShellCurMapping = MapListItem;
}
+
SHELL_FREE_NON_NULL (MapName);
}
}
@@ -1455,44 +1526,45 @@ ShellCommandCreateInitialMappingsAndPaths( //
// Find each handle with Block Io
//
- HandleList = GetHandleListByProtocol(&gEfiBlockIoProtocolGuid);
+ HandleList = GetHandleListByProtocol (&gEfiBlockIoProtocolGuid);
if (HandleList != NULL) {
- for (Count = 0 ; HandleList[Count] != NULL ; Count++);
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
+ }
//
// Get all Device Paths
//
- DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count);
+ DevicePathList = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL *) * Count);
if (DevicePathList == NULL) {
SHELL_FREE_NON_NULL (HandleList);
return EFI_OUT_OF_RESOURCES;
}
- for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
- DevicePathList[Count] = DevicePathFromHandle(HandleList[Count]);
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
+ DevicePathList[Count] = DevicePathFromHandle (HandleList[Count]);
}
//
// Sort all DevicePaths
//
- PerformQuickSort(DevicePathList, Count, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare);
+ PerformQuickSort (DevicePathList, Count, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
//
// Assign new Mappings to all...
//
- for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
//
// Get default name first
//
- NewDefaultName = ShellCommandCreateNewMappingName(MappingTypeBlockIo);
- ASSERT(NewDefaultName != NULL);
- Status = ShellCommandAddMapItemAndUpdatePath(NewDefaultName, DevicePathList[Count], 0, FALSE);
- ASSERT_EFI_ERROR(Status);
- FreePool(NewDefaultName);
+ NewDefaultName = ShellCommandCreateNewMappingName (MappingTypeBlockIo);
+ ASSERT (NewDefaultName != NULL);
+ Status = ShellCommandAddMapItemAndUpdatePath (NewDefaultName, DevicePathList[Count], 0, FALSE);
+ ASSERT_EFI_ERROR (Status);
+ FreePool (NewDefaultName);
}
- SHELL_FREE_NON_NULL(HandleList);
- SHELL_FREE_NON_NULL(DevicePathList);
+ SHELL_FREE_NON_NULL (HandleList);
+ SHELL_FREE_NON_NULL (DevicePathList);
} else if (Count == (UINTN)-1) {
return (EFI_NOT_FOUND);
}
@@ -1519,8 +1591,8 @@ ShellCommandUpdateMapping ( CHAR16 *NewConsistName;
EFI_DEVICE_PATH_PROTOCOL **ConsistMappingTable;
- HandleList = NULL;
- Status = EFI_SUCCESS;
+ HandleList = NULL;
+ Status = EFI_SUCCESS;
//
// remove mappings that represent removed devices.
@@ -1529,46 +1601,48 @@ ShellCommandUpdateMapping ( //
// Find each handle with Simple File System
//
- HandleList = GetHandleListByProtocol(&gEfiSimpleFileSystemProtocolGuid);
+ HandleList = GetHandleListByProtocol (&gEfiSimpleFileSystemProtocolGuid);
if (HandleList != NULL) {
//
// Do a count of the handles
//
- for (Count = 0 ; HandleList[Count] != NULL ; Count++);
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
+ }
//
// Get all Device Paths
//
- DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count);
+ DevicePathList = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL *) * Count);
if (DevicePathList == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- for (Count = 0 ; HandleList[Count] != NULL ; Count++) {
- DevicePathList[Count] = DevicePathFromHandle(HandleList[Count]);
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
+ DevicePathList[Count] = DevicePathFromHandle (HandleList[Count]);
}
//
// Sort all DevicePaths
//
- PerformQuickSort(DevicePathList, Count, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare);
+ PerformQuickSort (DevicePathList, Count, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
- ShellCommandConsistMappingInitialize(&ConsistMappingTable);
+ ShellCommandConsistMappingInitialize (&ConsistMappingTable);
//
// Assign new Mappings to remainders
//
- for (Count = 0 ; !EFI_ERROR(Status) && HandleList[Count] != NULL && !EFI_ERROR(Status); Count++) {
+ for (Count = 0; !EFI_ERROR (Status) && HandleList[Count] != NULL && !EFI_ERROR (Status); Count++) {
//
// Skip ones that already have
//
- if (gEfiShellProtocol->GetMapFromDevicePath(&DevicePathList[Count]) != NULL) {
+ if (gEfiShellProtocol->GetMapFromDevicePath (&DevicePathList[Count]) != NULL) {
continue;
}
+
//
// Get default name
//
- NewDefaultName = ShellCommandCreateNewMappingName(MappingTypeFileSystem);
+ NewDefaultName = ShellCommandCreateNewMappingName (MappingTypeFileSystem);
if (NewDefaultName == NULL) {
Status = EFI_OUT_OF_RESOURCES;
break;
@@ -1577,29 +1651,31 @@ ShellCommandUpdateMapping ( //
// Call shell protocol SetMap function now...
//
- Status = gEfiShellProtocol->SetMap(DevicePathList[Count], NewDefaultName);
+ Status = gEfiShellProtocol->SetMap (DevicePathList[Count], NewDefaultName);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
//
// Now do consistent name
//
- NewConsistName = ShellCommandConsistMappingGenMappingName(DevicePathList[Count], ConsistMappingTable);
+ NewConsistName = ShellCommandConsistMappingGenMappingName (DevicePathList[Count], ConsistMappingTable);
if (NewConsistName != NULL) {
- Status = gEfiShellProtocol->SetMap(DevicePathList[Count], NewConsistName);
- FreePool(NewConsistName);
+ Status = gEfiShellProtocol->SetMap (DevicePathList[Count], NewConsistName);
+ FreePool (NewConsistName);
}
}
- FreePool(NewDefaultName);
+ FreePool (NewDefaultName);
}
- ShellCommandConsistMappingUnInitialize(ConsistMappingTable);
- SHELL_FREE_NON_NULL(HandleList);
- SHELL_FREE_NON_NULL(DevicePathList);
+
+ ShellCommandConsistMappingUnInitialize (ConsistMappingTable);
+ SHELL_FREE_NON_NULL (HandleList);
+ SHELL_FREE_NON_NULL (DevicePathList);
HandleList = NULL;
} else {
Count = (UINTN)-1;
}
+
//
// Do it all over again for gEfiBlockIoProtocolGuid
//
@@ -1614,13 +1690,13 @@ ShellCommandUpdateMapping ( @return a EFI_FILE_PROTOCOL* representing the same file.
**/
-EFI_FILE_PROTOCOL*
+EFI_FILE_PROTOCOL *
EFIAPI
-ConvertShellHandleToEfiFileProtocol(
- IN CONST SHELL_FILE_HANDLE Handle
+ConvertShellHandleToEfiFileProtocol (
+ IN CONST SHELL_FILE_HANDLE Handle
)
{
- return ((EFI_FILE_PROTOCOL*)(Handle));
+ return ((EFI_FILE_PROTOCOL *)(Handle));
}
/**
@@ -1634,35 +1710,39 @@ ConvertShellHandleToEfiFileProtocol( **/
SHELL_FILE_HANDLE
EFIAPI
-ConvertEfiFileProtocolToShellHandle(
- IN CONST EFI_FILE_PROTOCOL *Handle,
- IN CONST CHAR16 *Path
+ConvertEfiFileProtocolToShellHandle (
+ IN CONST EFI_FILE_PROTOCOL *Handle,
+ IN CONST CHAR16 *Path
)
{
- SHELL_COMMAND_FILE_HANDLE *Buffer;
- BUFFER_LIST *NewNode;
+ SHELL_COMMAND_FILE_HANDLE *Buffer;
+ BUFFER_LIST *NewNode;
if (Path != NULL) {
- Buffer = AllocateZeroPool(sizeof(SHELL_COMMAND_FILE_HANDLE));
+ Buffer = AllocateZeroPool (sizeof (SHELL_COMMAND_FILE_HANDLE));
if (Buffer == NULL) {
return (NULL);
}
- NewNode = AllocateZeroPool(sizeof(BUFFER_LIST));
+
+ NewNode = AllocateZeroPool (sizeof (BUFFER_LIST));
if (NewNode == NULL) {
- SHELL_FREE_NON_NULL(Buffer);
+ SHELL_FREE_NON_NULL (Buffer);
return (NULL);
}
- Buffer->FileHandle = (EFI_FILE_PROTOCOL*)Handle;
- Buffer->Path = StrnCatGrow(&Buffer->Path, NULL, Path, 0);
+
+ Buffer->FileHandle = (EFI_FILE_PROTOCOL *)Handle;
+ Buffer->Path = StrnCatGrow (&Buffer->Path, NULL, Path, 0);
if (Buffer->Path == NULL) {
- SHELL_FREE_NON_NULL(NewNode);
- SHELL_FREE_NON_NULL(Buffer);
+ SHELL_FREE_NON_NULL (NewNode);
+ SHELL_FREE_NON_NULL (Buffer);
return (NULL);
}
- NewNode->Buffer = Buffer;
- InsertHeadList(&mFileHandleList.Link, &NewNode->Link);
+ NewNode->Buffer = Buffer;
+
+ InsertHeadList (&mFileHandleList.Link, &NewNode->Link);
}
+
return ((SHELL_FILE_HANDLE)(Handle));
}
@@ -1673,22 +1753,24 @@ ConvertEfiFileProtocolToShellHandle( @return A pointer to the path for the file.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
-ShellFileHandleGetPath(
- IN CONST SHELL_FILE_HANDLE Handle
+ShellFileHandleGetPath (
+ IN CONST SHELL_FILE_HANDLE Handle
)
{
- BUFFER_LIST *Node;
-
- for (Node = (BUFFER_LIST*)GetFirstNode(&mFileHandleList.Link)
- ; !IsNull(&mFileHandleList.Link, &Node->Link)
- ; Node = (BUFFER_LIST*)GetNextNode(&mFileHandleList.Link, &Node->Link)
- ){
- if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)){
+ BUFFER_LIST *Node;
+
+ for (Node = (BUFFER_LIST *)GetFirstNode (&mFileHandleList.Link)
+ ; !IsNull (&mFileHandleList.Link, &Node->Link)
+ ; Node = (BUFFER_LIST *)GetNextNode (&mFileHandleList.Link, &Node->Link)
+ )
+ {
+ if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)) {
return (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path);
}
}
+
return (NULL);
}
@@ -1702,24 +1784,26 @@ ShellFileHandleGetPath( **/
BOOLEAN
EFIAPI
-ShellFileHandleRemove(
- IN CONST SHELL_FILE_HANDLE Handle
+ShellFileHandleRemove (
+ IN CONST SHELL_FILE_HANDLE Handle
)
{
- BUFFER_LIST *Node;
-
- for (Node = (BUFFER_LIST*)GetFirstNode(&mFileHandleList.Link)
- ; !IsNull(&mFileHandleList.Link, &Node->Link)
- ; Node = (BUFFER_LIST*)GetNextNode(&mFileHandleList.Link, &Node->Link)
- ){
- if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)){
- RemoveEntryList(&Node->Link);
- SHELL_FREE_NON_NULL(((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path);
- SHELL_FREE_NON_NULL(Node->Buffer);
- SHELL_FREE_NON_NULL(Node);
+ BUFFER_LIST *Node;
+
+ for (Node = (BUFFER_LIST *)GetFirstNode (&mFileHandleList.Link)
+ ; !IsNull (&mFileHandleList.Link, &Node->Link)
+ ; Node = (BUFFER_LIST *)GetNextNode (&mFileHandleList.Link, &Node->Link)
+ )
+ {
+ if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)) {
+ RemoveEntryList (&Node->Link);
+ SHELL_FREE_NON_NULL (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path);
+ SHELL_FREE_NON_NULL (Node->Buffer);
+ SHELL_FREE_NON_NULL (Node);
return (TRUE);
}
}
+
return (FALSE);
}
@@ -1737,22 +1821,22 @@ ShellFileHandleRemove( **/
BOOLEAN
EFIAPI
-ShellFileHandleEof(
- IN SHELL_FILE_HANDLE Handle
+ShellFileHandleEof (
+ IN SHELL_FILE_HANDLE Handle
)
{
- EFI_FILE_INFO *Info;
- UINT64 Pos;
- BOOLEAN RetVal;
+ EFI_FILE_INFO *Info;
+ UINT64 Pos;
+ BOOLEAN RetVal;
//
// ASSERT if Handle is NULL
//
- ASSERT(Handle != NULL);
+ ASSERT (Handle != NULL);
- gEfiShellProtocol->GetFilePosition(Handle, &Pos);
+ gEfiShellProtocol->GetFilePosition (Handle, &Pos);
Info = gEfiShellProtocol->GetFileInfo (Handle);
- gEfiShellProtocol->SetFilePosition(Handle, Pos);
+ gEfiShellProtocol->SetFilePosition (Handle, Pos);
if (Info == NULL) {
return (FALSE);
@@ -1777,26 +1861,29 @@ ShellFileHandleEof( VOID
EFIAPI
FreeBufferList (
- IN BUFFER_LIST *List
+ IN BUFFER_LIST *List
)
{
- BUFFER_LIST *BufferListEntry;
+ BUFFER_LIST *BufferListEntry;
- if (List == NULL){
+ if (List == NULL) {
return;
}
+
//
// enumerate through the buffer list and free all memory
//
- for ( BufferListEntry = ( BUFFER_LIST *)GetFirstNode(&List->Link)
- ; !IsListEmpty (&List->Link)
- ; BufferListEntry = (BUFFER_LIST *)GetFirstNode(&List->Link)
- ){
- RemoveEntryList(&BufferListEntry->Link);
+ for ( BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
+ ; !IsListEmpty (&List->Link)
+ ; BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
+ )
+ {
+ RemoveEntryList (&BufferListEntry->Link);
if (BufferListEntry->Buffer != NULL) {
- FreePool(BufferListEntry->Buffer);
+ FreePool (BufferListEntry->Buffer);
}
- FreePool(BufferListEntry);
+
+ FreePool (BufferListEntry);
}
}
@@ -1811,21 +1898,21 @@ FreeBufferList ( VOID
EFIAPI
DumpHex (
- IN UINTN Indent,
- IN UINTN Offset,
- IN UINTN DataSize,
- IN VOID *UserData
+ IN UINTN Indent,
+ IN UINTN Offset,
+ IN UINTN DataSize,
+ IN VOID *UserData
)
{
- UINT8 *Data;
+ UINT8 *Data;
- CHAR8 Val[50];
+ CHAR8 Val[50];
- CHAR8 Str[20];
+ CHAR8 Str[20];
- UINT8 TempByte;
- UINTN Size;
- UINTN Index;
+ UINT8 TempByte;
+ UINTN Size;
+ UINTN Index;
Data = UserData;
while (DataSize != 0) {
@@ -1835,19 +1922,19 @@ DumpHex ( }
for (Index = 0; Index < Size; Index += 1) {
- TempByte = Data[Index];
- Val[Index * 3 + 0] = Hex[TempByte >> 4];
- Val[Index * 3 + 1] = Hex[TempByte & 0xF];
- Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' ');
- Str[Index] = (CHAR8) ((TempByte < ' ' || TempByte > '~') ? '.' : TempByte);
+ TempByte = Data[Index];
+ Val[Index * 3 + 0] = Hex[TempByte >> 4];
+ Val[Index * 3 + 1] = Hex[TempByte & 0xF];
+ Val[Index * 3 + 2] = (CHAR8)((Index == 7) ? '-' : ' ');
+ Str[Index] = (CHAR8)((TempByte < ' ' || TempByte > '~') ? '.' : TempByte);
}
- Val[Index * 3] = 0;
- Str[Index] = 0;
- ShellPrintEx(-1, -1, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str);
+ Val[Index * 3] = 0;
+ Str[Index] = 0;
+ ShellPrintEx (-1, -1, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str);
- Data += Size;
- Offset += Size;
+ Data += Size;
+ Offset += Size;
DataSize -= Size;
}
}
@@ -1861,7 +1948,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,
@@ -1880,7 +1967,7 @@ CatSDumpHex ( CHAR16 *RetVal;
CHAR16 *TempRetVal;
- Data = UserData;
+ Data = UserData;
RetVal = Buffer;
while (DataSize != 0) {
Size = 16;
@@ -1889,21 +1976,21 @@ CatSDumpHex ( }
for (Index = 0; Index < Size; Index += 1) {
- TempByte = Data[Index];
- Val[Index * 3 + 0] = Hex[TempByte >> 4];
- Val[Index * 3 + 1] = Hex[TempByte & 0xF];
- Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' ');
- Str[Index] = (CHAR8) ((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte);
+ TempByte = Data[Index];
+ Val[Index * 3 + 0] = Hex[TempByte >> 4];
+ Val[Index * 3 + 1] = Hex[TempByte & 0xF];
+ Val[Index * 3 + 2] = (CHAR8)((Index == 7) ? '-' : ' ');
+ Str[Index] = (CHAR8)((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte);
}
- Val[Index * 3] = 0;
- Str[Index] = 0;
- TempRetVal = CatSPrint (RetVal, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str);
+ Val[Index * 3] = 0;
+ Str[Index] = 0;
+ TempRetVal = CatSPrint (RetVal, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str);
SHELL_FREE_NON_NULL (RetVal);
RetVal = TempRetVal;
- Data += Size;
- Offset += Size;
+ Data += Size;
+ Offset += Size;
DataSize -= Size;
}
@@ -1929,12 +2016,12 @@ STATIC INTN
EFIAPI
UniqueNameCompare (
- IN CONST VOID *Unique1AsVoid,
- IN CONST VOID *Unique2AsVoid
+ IN CONST VOID *Unique1AsVoid,
+ IN CONST VOID *Unique2AsVoid
)
{
- CONST SHELL_SORT_UNIQUE_NAME *Unique1;
- CONST SHELL_SORT_UNIQUE_NAME *Unique2;
+ CONST SHELL_SORT_UNIQUE_NAME *Unique1;
+ CONST SHELL_SORT_UNIQUE_NAME *Unique2;
Unique1 = Unique1AsVoid;
Unique2 = Unique2AsVoid;
@@ -1968,12 +2055,12 @@ STATIC INTN
EFIAPI
UniqueNameAliasCompare (
- IN CONST VOID *UniqueAliasAsVoid,
- IN CONST VOID *UniqueAsVoid
+ IN CONST VOID *UniqueAliasAsVoid,
+ IN CONST VOID *UniqueAsVoid
)
{
- CONST CHAR16 *UniqueAlias;
- CONST SHELL_SORT_UNIQUE_NAME *Unique;
+ CONST CHAR16 *UniqueAlias;
+ CONST SHELL_SORT_UNIQUE_NAME *Unique;
UniqueAlias = UniqueAliasAsVoid;
Unique = UniqueAsVoid;
@@ -2047,24 +2134,24 @@ UniqueNameAliasCompare ( EFI_STATUS
EFIAPI
ShellSortFileList (
- IN OUT EFI_SHELL_FILE_INFO **FileList,
- OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL,
- IN SHELL_SORT_FILE_LIST Order
+ IN OUT EFI_SHELL_FILE_INFO **FileList,
+ OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL,
+ IN SHELL_SORT_FILE_LIST Order
)
{
- LIST_ENTRY *FilesHead;
- ORDERED_COLLECTION *Sort;
- LIST_ENTRY *FileEntry;
- EFI_SHELL_FILE_INFO *FileInfo;
- SHELL_SORT_UNIQUE_NAME *Unique;
- EFI_STATUS Status;
- EFI_SHELL_FILE_INFO *Dupes;
- LIST_ENTRY *NextFileEntry;
- CONST CHAR16 *Alias;
- ORDERED_COLLECTION_ENTRY *SortEntry;
- LIST_ENTRY *TargetFileList;
- ORDERED_COLLECTION_ENTRY *NextSortEntry;
- VOID *UniqueAsVoid;
+ LIST_ENTRY *FilesHead;
+ ORDERED_COLLECTION *Sort;
+ LIST_ENTRY *FileEntry;
+ EFI_SHELL_FILE_INFO *FileInfo;
+ SHELL_SORT_UNIQUE_NAME *Unique;
+ EFI_STATUS Status;
+ EFI_SHELL_FILE_INFO *Dupes;
+ LIST_ENTRY *NextFileEntry;
+ CONST CHAR16 *Alias;
+ ORDERED_COLLECTION_ENTRY *SortEntry;
+ LIST_ENTRY *TargetFileList;
+ ORDERED_COLLECTION_ENTRY *NextSortEntry;
+ VOID *UniqueAsVoid;
if ((UINTN)Order >= (UINTN)ShellSortFileListMax) {
return EFI_INVALID_PARAMETER;
@@ -2077,12 +2164,14 @@ ShellSortFileList ( if (Duplicates != NULL) {
*Duplicates = NULL;
}
+
return EFI_SUCCESS;
}
if (*FileList == NULL) {
return EFI_INVALID_PARAMETER;
}
+
FilesHead = &(*FileList)->Link;
//
@@ -2104,6 +2193,7 @@ ShellSortFileList ( Status = EFI_OUT_OF_RESOURCES;
goto UninitSort;
}
+
Unique->Alias = ((Order == ShellSortFileListByFileName) ?
FileInfo->FileName :
FileInfo->FullName);
@@ -2124,6 +2214,7 @@ ShellSortFileList ( if (Status == EFI_OUT_OF_RESOURCES) {
goto UninitSort;
}
+
ASSERT (Status == EFI_ALREADY_STARTED);
}
}
@@ -2143,6 +2234,7 @@ ShellSortFileList ( Status = EFI_OUT_OF_RESOURCES;
goto UninitSort;
}
+
InitializeListHead (&Dupes->Link);
}
@@ -2176,7 +2268,8 @@ ShellSortFileList ( //
for (SortEntry = OrderedCollectionMin (Sort);
SortEntry != NULL;
- SortEntry = OrderedCollectionNext (SortEntry)) {
+ SortEntry = OrderedCollectionNext (SortEntry))
+ {
Unique = OrderedCollectionUserStruct (SortEntry);
//
// The first FileInfo encountered for each unique name goes back on
@@ -2207,6 +2300,7 @@ ShellSortFileList ( *Duplicates = Dupes;
}
}
+
Status = EFI_SUCCESS;
//
@@ -2215,13 +2309,15 @@ ShellSortFileList ( UninitSort:
for (SortEntry = OrderedCollectionMin (Sort);
SortEntry != NULL;
- SortEntry = NextSortEntry) {
+ SortEntry = NextSortEntry)
+ {
NextSortEntry = OrderedCollectionNext (SortEntry);
OrderedCollectionDelete (Sort, SortEntry, &UniqueAsVoid);
Unique = UniqueAsVoid;
ASSERT (IsListEmpty (&Unique->SameNameList));
FreePool (Unique);
}
+
OrderedCollectionUninit (Sort);
return Status;
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h index 0ca291e4f9..beffdd67b2 100644 --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h @@ -41,24 +41,24 @@ #include <Library/UefiLib.h>
#include <Library/OrderedCollectionLib.h>
-typedef struct{
- LIST_ENTRY Link;
- CHAR16 *CommandString;
- SHELL_GET_MAN_FILENAME GetManFileName;
- SHELL_RUN_COMMAND CommandHandler;
- BOOLEAN LastError;
- EFI_HII_HANDLE HiiHandle;
- EFI_STRING_ID ManFormatHelp;
+typedef struct {
+ LIST_ENTRY Link;
+ CHAR16 *CommandString;
+ SHELL_GET_MAN_FILENAME GetManFileName;
+ SHELL_RUN_COMMAND CommandHandler;
+ BOOLEAN LastError;
+ EFI_HII_HANDLE HiiHandle;
+ EFI_STRING_ID ManFormatHelp;
} SHELL_COMMAND_INTERNAL_LIST_ENTRY;
typedef struct {
- LIST_ENTRY Link;
- SCRIPT_FILE *Data;
+ LIST_ENTRY Link;
+ SCRIPT_FILE *Data;
} SCRIPT_FILE_LIST;
typedef struct {
- EFI_FILE_PROTOCOL *FileHandle;
- CHAR16 *Path;
+ EFI_FILE_PROTOCOL *FileHandle;
+ CHAR16 *Path;
} SHELL_COMMAND_FILE_HANDLE;
//
@@ -72,13 +72,12 @@ typedef struct { // instead, it *aliases* the FileName or FullName field of the
// EFI_SHELL_FILE_INFO object that was first encountered with this name.
//
- CONST CHAR16 *Alias;
+ CONST CHAR16 *Alias;
//
// A list of EFI_SHELL_FILE_INFO objects whose FileName or FullName fields
// compare equal to Alias, according to gUnicodeCollation->StriColl().
//
- LIST_ENTRY SameNameList;
+ LIST_ENTRY SameNameList;
} SHELL_SORT_UNIQUE_NAME;
#endif //_UEFI_COMMAND_LIB_INTERNAL_HEADER_
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c index 0df0b31493..e94236d0b9 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c @@ -9,11 +9,11 @@ #include "UefiShellDebug1CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-n", TypeValue},
- {L"-s", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-n", TypeValue },
+ { L"-s", TypeValue },
+ { NULL, TypeMax }
+};
typedef enum {
OutOfDiffPoint,
@@ -25,10 +25,10 @@ typedef enum { // Buffer type, for reading both file operands in chunks.
//
typedef struct {
- UINT8 *Data; // dynamically allocated buffer
- UINTN Allocated; // the allocated size of Data
- UINTN Next; // next position in Data to fetch a byte at
- UINTN Left; // number of bytes left in Data for fetching at Next
+ UINT8 *Data; // dynamically allocated buffer
+ UINTN Allocated; // the allocated size of Data
+ UINTN Next; // next position in Data to fetch a byte at
+ UINTN Left; // number of bytes left in Data for fetching at Next
} FILE_BUFFER;
/**
@@ -43,7 +43,7 @@ typedef struct { **/
VOID
-PrintDifferentPoint(
+PrintDifferentPoint (
CONST CHAR16 *FileName,
CHAR16 *FileTag,
UINT8 *Buffer,
@@ -52,7 +52,7 @@ PrintDifferentPoint( UINT64 DifferentBytes
)
{
- UINTN Index;
+ UINTN Index;
ShellPrintEx (-1, -1, L"%s: %s\r\n %08x:", FileTag, FileName, Address);
@@ -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 {
//
@@ -97,7 +97,7 @@ PrintDifferentPoint( STATIC
VOID
FileBufferInit (
- OUT FILE_BUFFER *FileBuffer
+ OUT FILE_BUFFER *FileBuffer
)
{
FileBuffer->Allocated = PcdGet32 (PcdShellFileOperationSize);
@@ -116,7 +116,7 @@ FileBufferInit ( STATIC
VOID
FileBufferUninit (
- IN OUT FILE_BUFFER *FileBuffer
+ IN OUT FILE_BUFFER *FileBuffer
)
{
SHELL_FREE_NON_NULL (FileBuffer->Data);
@@ -154,26 +154,31 @@ FileBufferUninit ( STATIC
EFI_STATUS
FileBufferReadByte (
- IN SHELL_FILE_HANDLE FileHandle,
- IN OUT FILE_BUFFER *FileBuffer,
- OUT UINTN *BytesRead,
- OUT UINT8 *Byte
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN OUT FILE_BUFFER *FileBuffer,
+ OUT UINTN *BytesRead,
+ OUT UINT8 *Byte
)
{
- UINTN ReadSize;
- EFI_STATUS Status;
+ UINTN ReadSize;
+ EFI_STATUS Status;
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;
}
@@ -199,112 +204,114 @@ ShellCommandRunComp ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- CHAR16 *FileName1;
- CHAR16 *FileName2;
- CONST CHAR16 *TempParam;
- SHELL_STATUS ShellStatus;
- SHELL_FILE_HANDLE FileHandle1;
- SHELL_FILE_HANDLE FileHandle2;
- UINT64 Size1;
- UINT64 Size2;
- UINT64 DifferentBytes;
- UINT64 DifferentCount;
- UINT8 DiffPointNumber;
- UINT8 OneByteFromFile1;
- UINT8 OneByteFromFile2;
- UINT8 *DataFromFile1;
- UINT8 *DataFromFile2;
- FILE_BUFFER FileBuffer1;
- FILE_BUFFER FileBuffer2;
- UINTN InsertPosition1;
- UINTN InsertPosition2;
- UINTN DataSizeFromFile1;
- UINTN DataSizeFromFile2;
- UINTN TempAddress;
- UINTN Index;
- UINTN DiffPointAddress;
- READ_STATUS ReadStatus;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- FileName1 = NULL;
- FileName2 = NULL;
- FileHandle1 = NULL;
- FileHandle2 = NULL;
- DataFromFile1 = NULL;
- DataFromFile2 = NULL;
- ReadStatus = OutOfDiffPoint;
- DifferentCount = 10;
- DifferentBytes = 4;
- DiffPointNumber = 0;
- InsertPosition1 = 0;
- InsertPosition2 = 0;
- TempAddress = 0;
- DiffPointAddress = 0;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ CHAR16 *FileName1;
+ CHAR16 *FileName2;
+ CONST CHAR16 *TempParam;
+ SHELL_STATUS ShellStatus;
+ SHELL_FILE_HANDLE FileHandle1;
+ SHELL_FILE_HANDLE FileHandle2;
+ UINT64 Size1;
+ UINT64 Size2;
+ UINT64 DifferentBytes;
+ UINT64 DifferentCount;
+ UINT8 DiffPointNumber;
+ UINT8 OneByteFromFile1;
+ UINT8 OneByteFromFile2;
+ UINT8 *DataFromFile1;
+ UINT8 *DataFromFile2;
+ FILE_BUFFER FileBuffer1;
+ FILE_BUFFER FileBuffer2;
+ UINTN InsertPosition1;
+ UINTN InsertPosition2;
+ UINTN DataSizeFromFile1;
+ UINTN DataSizeFromFile2;
+ UINTN TempAddress;
+ UINTN Index;
+ UINTN DiffPointAddress;
+ READ_STATUS ReadStatus;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ FileName1 = NULL;
+ FileName2 = NULL;
+ FileHandle1 = NULL;
+ FileHandle2 = NULL;
+ DataFromFile1 = NULL;
+ DataFromFile2 = NULL;
+ ReadStatus = OutOfDiffPoint;
+ DifferentCount = 10;
+ DifferentBytes = 4;
+ DiffPointNumber = 0;
+ InsertPosition1 = 0;
+ InsertPosition2 = 0;
+ TempAddress = 0;
+ DiffPointAddress = 0;
//
// 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);
@@ -362,13 +370,21 @@ ShellCommandRunComp ( while (DiffPointNumber < DifferentCount) {
DataSizeFromFile1 = 1;
DataSizeFromFile2 = 1;
- OneByteFromFile1 = 0;
- OneByteFromFile2 = 0;
- Status = FileBufferReadByte (FileHandle1, &FileBuffer1,
- &DataSizeFromFile1, &OneByteFromFile1);
+ OneByteFromFile1 = 0;
+ OneByteFromFile2 = 0;
+ 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,19 +394,21 @@ 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;
}
if (ReadStatus == OutOfDiffPoint) {
if (OneByteFromFile1 != OneByteFromFile2) {
- ReadStatus = InDiffPoint;
+ ReadStatus = InDiffPoint;
DiffPointAddress = TempAddress;
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,9 +457,9 @@ 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;
+ ReadStatus = InDiffPoint;
DiffPointAddress += Index;
break;
}
@@ -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);
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c index 4d9a6fb467..c76805ed30 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c @@ -22,36 +22,36 @@ //
// Macro Definitions
//
-typedef INT16 NODE;
-#define UINT8_MAX 0xff
-#define UINT8_BIT 8
-#define THRESHOLD 3
-#define INIT_CRC 0
-#define WNDBIT 13
-#define WNDSIZ (1U << WNDBIT)
-#define MAXMATCH 256
-#define BLKSIZ (1U << 14) // 16 * 1024U
-#define PERC_FLAG 0x8000U
-#define CODE_BIT 16
-#define NIL 0
-#define MAX_HASH_VAL (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)
-#define HASH(LoopVar7, LoopVar5) ((LoopVar7) + ((LoopVar5) << (WNDBIT - 9)) + WNDSIZ * 2)
-#define CRCPOLY 0xA001
-#define UPDATE_CRC(LoopVar5) mCrc = mCrcTable[(mCrc ^ (LoopVar5)) & 0xFF] ^ (mCrc >> UINT8_BIT)
+typedef INT16 NODE;
+#define UINT8_MAX 0xff
+#define UINT8_BIT 8
+#define THRESHOLD 3
+#define INIT_CRC 0
+#define WNDBIT 13
+#define WNDSIZ (1U << WNDBIT)
+#define MAXMATCH 256
+#define BLKSIZ (1U << 14) // 16 * 1024U
+#define PERC_FLAG 0x8000U
+#define CODE_BIT 16
+#define NIL 0
+#define MAX_HASH_VAL (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)
+#define HASH(LoopVar7, LoopVar5) ((LoopVar7) + ((LoopVar5) << (WNDBIT - 9)) + WNDSIZ * 2)
+#define CRCPOLY 0xA001
+#define UPDATE_CRC(LoopVar5) mCrc = mCrcTable[(mCrc ^ (LoopVar5)) & 0xFF] ^ (mCrc >> UINT8_BIT)
//
// C: the Char&Len Set; P: the Position Set; T: the exTra Set
//
-#define NC (UINT8_MAX + MAXMATCH + 2 - THRESHOLD)
-#define CBIT 9
-#define NP (WNDBIT + 1)
-#define PBIT 4
-#define NT (CODE_BIT + 3)
-#define TBIT 5
+#define NC (UINT8_MAX + MAXMATCH + 2 - THRESHOLD)
+#define CBIT 9
+#define NP (WNDBIT + 1)
+#define PBIT 4
+#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,8 +63,8 @@ typedef INT16 NODE; @param[in] Data The dword to put.
**/
VOID
-PutDword(
- IN UINT32 Data
+PutDword (
+ IN UINT32 Data
);
//
@@ -75,47 +75,47 @@ STATIC UINT8 *mDst; STATIC UINT8 *mSrcUpperLimit;
STATIC UINT8 *mDstUpperLimit;
-STATIC UINT8 *mLevel;
-STATIC UINT8 *mText;
-STATIC UINT8 *mChildCount;
-STATIC UINT8 *mBuf;
-STATIC UINT8 mCLen[NC];
-STATIC UINT8 mPTLen[NPT];
-STATIC UINT8 *mLen;
-STATIC INT16 mHeap[NC + 1];
-STATIC INT32 mRemainder;
-STATIC INT32 mMatchLen;
-STATIC INT32 mBitCount;
-STATIC INT32 mHeapSize;
-STATIC INT32 mTempInt32;
-STATIC UINT32 mBufSiz = 0;
-STATIC UINT32 mOutputPos;
-STATIC UINT32 mOutputMask;
-STATIC UINT32 mSubBitBuf;
-STATIC UINT32 mCrc;
-STATIC UINT32 mCompSize;
-STATIC UINT32 mOrigSize;
-
-STATIC UINT16 *mFreq;
-STATIC UINT16 *mSortPtr;
-STATIC UINT16 mLenCnt[17];
-STATIC UINT16 mLeft[2 * NC - 1];
-STATIC UINT16 mRight[2 * NC - 1];
-STATIC UINT16 mCrcTable[UINT8_MAX + 1];
-STATIC UINT16 mCFreq[2 * NC - 1];
-STATIC UINT16 mCCode[NC];
-STATIC UINT16 mPFreq[2 * NP - 1];
-STATIC UINT16 mPTCode[NPT];
-STATIC UINT16 mTFreq[2 * NT - 1];
-
-STATIC NODE mPos;
-STATIC NODE mMatchPos;
-STATIC NODE mAvail;
-STATIC NODE *mPosition;
-STATIC NODE *mParent;
-STATIC NODE *mPrev;
-STATIC NODE *mNext = NULL;
-INT32 mHuffmanDepth = 0;
+STATIC UINT8 *mLevel;
+STATIC UINT8 *mText;
+STATIC UINT8 *mChildCount;
+STATIC UINT8 *mBuf;
+STATIC UINT8 mCLen[NC];
+STATIC UINT8 mPTLen[NPT];
+STATIC UINT8 *mLen;
+STATIC INT16 mHeap[NC + 1];
+STATIC INT32 mRemainder;
+STATIC INT32 mMatchLen;
+STATIC INT32 mBitCount;
+STATIC INT32 mHeapSize;
+STATIC INT32 mTempInt32;
+STATIC UINT32 mBufSiz = 0;
+STATIC UINT32 mOutputPos;
+STATIC UINT32 mOutputMask;
+STATIC UINT32 mSubBitBuf;
+STATIC UINT32 mCrc;
+STATIC UINT32 mCompSize;
+STATIC UINT32 mOrigSize;
+
+STATIC UINT16 *mFreq;
+STATIC UINT16 *mSortPtr;
+STATIC UINT16 mLenCnt[17];
+STATIC UINT16 mLeft[2 * NC - 1];
+STATIC UINT16 mRight[2 * NC - 1];
+STATIC UINT16 mCrcTable[UINT8_MAX + 1];
+STATIC UINT16 mCFreq[2 * NC - 1];
+STATIC UINT16 mCCode[NC];
+STATIC UINT16 mPFreq[2 * NP - 1];
+STATIC UINT16 mPTCode[NPT];
+STATIC UINT16 mTFreq[2 * NT - 1];
+
+STATIC NODE mPos;
+STATIC NODE mMatchPos;
+STATIC NODE mAvail;
+STATIC NODE *mPosition;
+STATIC NODE *mParent;
+STATIC NODE *mPrev;
+STATIC NODE *mNext = NULL;
+INT32 mHuffmanDepth = 0;
/**
Make a CRC table.
@@ -142,7 +142,7 @@ MakeCrcTable ( }
}
- mCrcTable[LoopVar1] = (UINT16) LoopVar4;
+ mCrcTable[LoopVar1] = (UINT16)LoopVar4;
}
}
@@ -153,23 +153,23 @@ MakeCrcTable ( **/
VOID
PutDword (
- IN UINT32 Data
+ IN UINT32 Data
)
{
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);
}
}
@@ -192,8 +192,8 @@ AllocateMemory ( mPrev = AllocateZeroPool (WNDSIZ * 2 * sizeof (*mPrev));
mNext = AllocateZeroPool ((MAX_HASH_VAL + 1) * sizeof (*mNext));
- mBufSiz = BLKSIZ;
- mBuf = AllocateZeroPool (mBufSiz);
+ mBufSiz = BLKSIZ;
+ mBuf = AllocateZeroPool (mBufSiz);
while (mBuf == NULL) {
mBufSiz = (mBufSiz / 10U) * 9U;
if (mBufSiz < 4 * 1024U) {
@@ -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;
@@ -269,8 +269,8 @@ Child ( {
NODE LoopVar4;
- LoopVar4 = mNext[HASH (LoopVar6, LoopVar5)];
- mParent[NIL] = LoopVar6; /* sentinel */
+ LoopVar4 = mNext[HASH (LoopVar6, LoopVar5)];
+ mParent[NIL] = LoopVar6; /* sentinel */
while (mParent[LoopVar4] != LoopVar6) {
LoopVar4 = mNext[LoopVar4];
}
@@ -296,13 +296,13 @@ MakeChild ( NODE LoopVar10;
- LoopVar12 = (NODE) HASH (LoopVar6, LoopVar5);
- LoopVar10 = mNext[LoopVar12];
- mNext[LoopVar12] = LoopVar4;
- mNext[LoopVar4] = LoopVar10;
- mPrev[LoopVar10] = LoopVar4;
- mPrev[LoopVar4] = LoopVar12;
- mParent[LoopVar4] = LoopVar6;
+ LoopVar12 = (NODE)HASH (LoopVar6, LoopVar5);
+ LoopVar10 = mNext[LoopVar12];
+ mNext[LoopVar12] = LoopVar4;
+ mNext[LoopVar4] = LoopVar10;
+ mPrev[LoopVar10] = LoopVar4;
+ mPrev[LoopVar4] = LoopVar12;
+ mParent[LoopVar4] = LoopVar6;
mChildCount[LoopVar6]++;
}
@@ -313,25 +313,25 @@ MakeChild ( **/
VOID
Split (
- IN NODE Old
+ IN NODE Old
)
{
NODE New;
NODE LoopVar10;
- New = mAvail;
- mAvail = mNext[New];
- mChildCount[New] = 0;
- LoopVar10 = mPrev[Old];
- mPrev[New] = LoopVar10;
- mNext[LoopVar10] = New;
- LoopVar10 = mNext[Old];
- mNext[New] = LoopVar10;
- mPrev[LoopVar10] = New;
- mParent[New] = mParent[Old];
- mLevel[New] = (UINT8) mMatchLen;
- mPosition[New] = mPos;
+ New = mAvail;
+ mAvail = mNext[New];
+ mChildCount[New] = 0;
+ LoopVar10 = mPrev[Old];
+ mPrev[New] = LoopVar10;
+ mNext[LoopVar10] = New;
+ LoopVar10 = mNext[Old];
+ mNext[New] = LoopVar10;
+ mPrev[LoopVar10] = New;
+ mParent[New] = mParent[Old];
+ mLevel[New] = (UINT8)mMatchLen;
+ mPosition[New] = mPos;
MakeChild (New, mText[mMatchPos + mMatchLen], Old);
MakeChild (New, mText[mPos + mMatchLen], mPos);
}
@@ -351,10 +351,10 @@ InsertNode ( NODE LoopVar2;
- NODE LoopVar10;
- UINT8 LoopVar5;
- UINT8 *TempString3;
- UINT8 *TempString2;
+ NODE LoopVar10;
+ UINT8 LoopVar5;
+ UINT8 *TempString3;
+ UINT8 *TempString2;
if (mMatchLen >= 4) {
//
@@ -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];
@@ -379,52 +379,53 @@ InsertNode ( LoopVar10 = LoopVar6;
while (mPosition[LoopVar10] < 0) {
- mPosition[LoopVar10] = mPos;
- LoopVar10 = mParent[LoopVar10];
+ mPosition[LoopVar10] = mPos;
+ LoopVar10 = mParent[LoopVar10];
}
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;
+ LoopVar2 = MAXMATCH;
mMatchPos = LoopVar4;
} else {
- LoopVar2 = mLevel[LoopVar4];
- mMatchPos = (NODE) (mPosition[LoopVar4] & ~PERC_FLAG);
+ LoopVar2 = mLevel[LoopVar4];
+ mMatchPos = (NODE)(mPosition[LoopVar4] & ~PERC_FLAG);
}
if (mMatchPos >= mPos) {
mMatchPos -= WNDSIZ;
}
- TempString3 = &mText[mPos + mMatchLen];
- TempString2 = &mText[mMatchPos + mMatchLen];
+ TempString3 = &mText[mPos + mMatchLen];
+ TempString2 = &mText[mMatchPos + mMatchLen];
while (mMatchLen < LoopVar2) {
if (*TempString3 != *TempString2) {
Split (LoopVar4);
- return ;
+ return;
}
mMatchLen++;
@@ -436,31 +437,30 @@ InsertNode ( break;
}
- mPosition[LoopVar4] = mPos;
- LoopVar6 = LoopVar4;
- LoopVar4 = Child (LoopVar6, *TempString3);
+ mPosition[LoopVar4] = mPos;
+ LoopVar6 = LoopVar4;
+ LoopVar4 = Child (LoopVar6, *TempString3);
if (LoopVar4 == NIL) {
MakeChild (LoopVar6, *TempString3, mPos);
- return ;
+ return;
}
mMatchLen++;
}
- LoopVar10 = mPrev[LoopVar4];
- mPrev[mPos] = LoopVar10;
- mNext[LoopVar10] = mPos;
- LoopVar10 = mNext[LoopVar4];
- mNext[mPos] = LoopVar10;
- mPrev[LoopVar10] = mPos;
- mParent[mPos] = LoopVar6;
- mParent[LoopVar4] = NIL;
+ LoopVar10 = mPrev[LoopVar4];
+ mPrev[mPos] = LoopVar10;
+ mNext[LoopVar10] = mPos;
+ LoopVar10 = mNext[LoopVar4];
+ mNext[mPos] = LoopVar10;
+ mPrev[LoopVar10] = mPos;
+ mParent[mPos] = LoopVar6;
+ mParent[LoopVar4] = NIL;
//
// Special usage of 'next'
//
mNext[LoopVar4] = mPos;
-
}
/**
@@ -484,33 +484,33 @@ DeleteNode ( NODE LoopVar9;
if (mParent[mPos] == NIL) {
- return ;
+ return;
}
- LoopVar4 = mPrev[mPos];
- LoopVar11 = mNext[mPos];
- mNext[LoopVar4] = LoopVar11;
- mPrev[LoopVar11] = LoopVar4;
- LoopVar4 = mParent[mPos];
- mParent[mPos] = NIL;
+ LoopVar4 = mPrev[mPos];
+ LoopVar11 = mNext[mPos];
+ mNext[LoopVar4] = LoopVar11;
+ mPrev[LoopVar11] = LoopVar4;
+ 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;
}
LoopVar11 = LoopVar10;
- LoopVar6 = mParent[LoopVar4];
- LoopVar9 = mPosition[LoopVar6];
- while ((LoopVar9 & PERC_FLAG) != 0){
+ LoopVar6 = mParent[LoopVar4];
+ LoopVar9 = mPosition[LoopVar6];
+ while ((LoopVar9 & PERC_FLAG) != 0) {
LoopVar9 &= ~PERC_FLAG;
if (LoopVar9 >= mPos) {
LoopVar9 -= WNDSIZ;
@@ -520,9 +520,9 @@ DeleteNode ( LoopVar11 = LoopVar9;
}
- mPosition[LoopVar6] = (NODE) (LoopVar11 | WNDSIZ);
- LoopVar6 = mParent[LoopVar6];
- LoopVar9 = mPosition[LoopVar6];
+ mPosition[LoopVar6] = (NODE)(LoopVar11 | WNDSIZ);
+ LoopVar6 = mParent[LoopVar6];
+ LoopVar9 = mPosition[LoopVar6];
}
if (LoopVar6 < WNDSIZ) {
@@ -534,24 +534,24 @@ DeleteNode ( LoopVar11 = LoopVar9;
}
- mPosition[LoopVar6] = (NODE) (LoopVar11 | WNDSIZ | PERC_FLAG);
+ mPosition[LoopVar6] = (NODE)(LoopVar11 | WNDSIZ | PERC_FLAG);
}
- LoopVar11 = Child (LoopVar4, mText[LoopVar10 + mLevel[LoopVar4]]);
- LoopVar10 = mPrev[LoopVar11];
+ LoopVar11 = Child (LoopVar4, mText[LoopVar10 + mLevel[LoopVar4]]);
+ LoopVar10 = mPrev[LoopVar11];
LoopVar9 = mNext[LoopVar11];
- mNext[LoopVar10] = LoopVar9;
+ mNext[LoopVar10] = LoopVar9;
mPrev[LoopVar9] = LoopVar10;
- LoopVar10 = mPrev[LoopVar4];
- mNext[LoopVar10] = LoopVar11;
- mPrev[LoopVar11] = LoopVar10;
- LoopVar10 = mNext[LoopVar4];
- mPrev[LoopVar10] = LoopVar11;
- mNext[LoopVar11] = LoopVar10;
- mParent[LoopVar11] = mParent[LoopVar4];
+ LoopVar10 = mPrev[LoopVar4];
+ mNext[LoopVar10] = LoopVar11;
+ mPrev[LoopVar11] = LoopVar10;
+ LoopVar10 = mNext[LoopVar4];
+ mPrev[LoopVar10] = LoopVar11;
+ mNext[LoopVar11] = LoopVar10;
+ mParent[LoopVar11] = mParent[LoopVar4];
mParent[LoopVar4] = NIL;
mNext[LoopVar4] = mAvail;
- mAvail = LoopVar4;
+ mAvail = LoopVar4;
}
/**
@@ -564,11 +564,11 @@ DeleteNode ( **/
INT32
FreadCrc (
- OUT UINT8 *LoopVar7,
- IN INT32 LoopVar8
+ OUT UINT8 *LoopVar7,
+ IN INT32 LoopVar8
)
{
- INT32 LoopVar1;
+ INT32 LoopVar1;
for (LoopVar1 = 0; mSrc < mSrcUpperLimit && LoopVar1 < LoopVar8; LoopVar1++) {
*LoopVar7++ = *mSrc++;
@@ -576,7 +576,7 @@ FreadCrc ( LoopVar8 = LoopVar1;
- LoopVar7 -= LoopVar8;
+ LoopVar7 -= LoopVar8;
mOrigSize += LoopVar8;
LoopVar1--;
while (LoopVar1 >= 0) {
@@ -599,8 +599,8 @@ GetNextMatch ( VOID
)
{
- INT32 LoopVar8;
- VOID *Temp;
+ INT32 LoopVar8;
+ VOID *Temp;
mRemainder--;
mPos++;
@@ -609,12 +609,13 @@ GetNextMatch ( if (Temp == NULL) {
return (FALSE);
}
+
CopyMem (Temp, &mText[WNDSIZ], WNDSIZ + MAXMATCH);
CopyMem (&mText[0], Temp, WNDSIZ + MAXMATCH);
FreePool (Temp);
- LoopVar8 = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ);
+ LoopVar8 = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ);
mRemainder += LoopVar8;
- mPos = WNDSIZ;
+ mPos = WNDSIZ;
}
DeleteNode ();
@@ -630,12 +631,12 @@ GetNextMatch ( **/
VOID
DownHeap (
- IN INT32 i
+ IN INT32 i
)
{
- INT32 LoopVar1;
+ INT32 LoopVar1;
- INT32 LoopVar2;
+ INT32 LoopVar2;
//
// priority queue: send i-th entry down heap
@@ -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++;
}
@@ -651,12 +652,12 @@ DownHeap ( break;
}
- mHeap[i] = mHeap[LoopVar1];
- i = LoopVar1;
- LoopVar1 = 2 * i;
+ mHeap[i] = mHeap[LoopVar1];
+ i = LoopVar1;
+ LoopVar1 = 2 * i;
}
- mHeap[i] = (INT16) LoopVar2;
+ mHeap[i] = (INT16)LoopVar2;
}
/**
@@ -666,7 +667,7 @@ DownHeap ( **/
VOID
CountLen (
- IN INT32 LoopVar1
+ IN INT32 LoopVar1
)
{
if (LoopVar1 < mTempInt32) {
@@ -686,10 +687,10 @@ CountLen ( **/
VOID
MakeLen (
- IN INT32 Root
+ IN INT32 Root
)
{
- INT32 LoopVar1;
+ INT32 LoopVar1;
INT32 LoopVar2;
UINT32 Cum;
@@ -726,7 +727,7 @@ MakeLen ( LoopVar2 = mLenCnt[LoopVar1];
LoopVar2--;
while (LoopVar2 >= 0) {
- mLen[*mSortPtr++] = (UINT8) LoopVar1;
+ mLen[*mSortPtr++] = (UINT8)LoopVar1;
LoopVar2--;
}
}
@@ -741,9 +742,9 @@ MakeLen ( **/
VOID
MakeCode (
- IN INT32 LoopVar8,
- IN UINT8 Len[ ],
- OUT UINT16 Code[ ]
+ IN INT32 LoopVar8,
+ 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++) {
@@ -771,34 +772,34 @@ MakeCode ( **/
INT32
MakeTree (
- IN INT32 NParm,
- IN UINT16 FreqParm[ ],
- OUT UINT8 LenParm[ ],
- OUT UINT16 CodeParm[ ]
+ IN INT32 NParm,
+ IN UINT16 FreqParm[],
+ OUT UINT8 LenParm[],
+ OUT UINT16 CodeParm[]
)
{
- INT32 LoopVar1;
+ INT32 LoopVar1;
- INT32 LoopVar2;
+ INT32 LoopVar2;
- INT32 LoopVar3;
+ INT32 LoopVar3;
- INT32 Avail;
+ INT32 Avail;
//
// make tree, calculate len[], return root
//
- mTempInt32 = NParm;
- mFreq = FreqParm;
- mLen = LenParm;
- Avail = mTempInt32;
- mHeapSize = 0;
- mHeap[1] = 0;
+ mTempInt32 = NParm;
+ mFreq = FreqParm;
+ mLen = LenParm;
+ Avail = mTempInt32;
+ mHeapSize = 0;
+ mHeap[1] = 0;
for (LoopVar1 = 0; LoopVar1 < mTempInt32; LoopVar1++) {
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;
+ LoopVar3 = Avail++;
+ 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;
@@ -854,30 +855,30 @@ MakeTree ( **/
VOID
PutBits (
- IN INT32 LoopVar8,
- IN UINT32 x
+ IN INT32 LoopVar8,
+ IN UINT32 x
)
{
- UINT8 Temp;
+ UINT8 Temp;
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);
@@ -892,7 +893,7 @@ PutBits ( **/
VOID
EncodeC (
- IN INT32 LoopVar5
+ IN INT32 LoopVar5
)
{
PutBits (mCLen[LoopVar5], mCCode[LoopVar5]);
@@ -905,7 +906,7 @@ EncodeC ( **/
VOID
EncodeP (
- IN UINT32 LoopVar7
+ IN UINT32 LoopVar7
)
{
UINT32 LoopVar5;
@@ -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)));
}
}
@@ -934,13 +935,13 @@ CountTFreq ( VOID
)
{
- INT32 LoopVar1;
+ INT32 LoopVar1;
- INT32 LoopVar3;
+ INT32 LoopVar3;
- INT32 LoopVar8;
+ INT32 LoopVar8;
- INT32 Count;
+ INT32 Count;
for (LoopVar1 = 0; LoopVar1 < NT; LoopVar1++) {
mTFreq[LoopVar1] = 0;
@@ -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]++;
}
}
@@ -988,14 +989,14 @@ CountTFreq ( **/
VOID
WritePTLen (
- IN INT32 LoopVar8,
- IN INT32 nbit,
- IN INT32 Special
+ IN INT32 LoopVar8,
+ IN INT32 nbit,
+ IN INT32 Special
)
{
- INT32 LoopVar1;
+ INT32 LoopVar1;
- INT32 LoopVar3;
+ INT32 LoopVar3;
while (LoopVar8 > 0 && mPTLen[LoopVar8 - 1] == 0) {
LoopVar8--;
@@ -1029,13 +1030,13 @@ WriteCLen ( VOID
)
{
- INT32 LoopVar1;
+ INT32 LoopVar1;
- INT32 LoopVar3;
+ INT32 LoopVar3;
- INT32 LoopVar8;
+ INT32 LoopVar8;
- INT32 Count;
+ INT32 Count;
LoopVar8 = NC;
while (LoopVar8 > 0 && mCLen[LoopVar8 - 1] == 0) {
@@ -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,10 +1096,11 @@ SendBlock ( UINT32 Pos;
UINT32 Size;
+
Flags = 0;
- Root = MakeTree (NC, mCFreq, mCLen, mCCode);
- Size = mCFreq[Root];
+ Root = MakeTree (NC, mCFreq, mCLen, mCCode);
+ Size = mCFreq[Root];
PutBits (16, Size);
if (Root >= NC) {
CountTFreq ();
@@ -1133,9 +1135,10 @@ SendBlock ( } else {
Flags <<= 1;
}
- if ((Flags & (1U << (UINT8_BIT - 1))) != 0){
- EncodeC(mBuf[Pos++] + (1U << UINT8_BIT));
- LoopVar3 = mBuf[Pos++] << UINT8_BIT;
+
+ if ((Flags & (1U << (UINT8_BIT - 1))) != 0) {
+ EncodeC (mBuf[Pos++] + (1U << UINT8_BIT));
+ LoopVar3 = mBuf[Pos++] << UINT8_BIT;
LoopVar3 += mBuf[Pos++];
EncodeP (LoopVar3);
@@ -1162,8 +1165,8 @@ HufEncodeStart ( mOutputPos = mOutputMask = 0;
- mBitCount = UINT8_BIT;
- mSubBitBuf = 0;
+ mBitCount = UINT8_BIT;
+ mSubBitBuf = 0;
}
/**
@@ -1175,11 +1178,11 @@ HufEncodeStart ( **/
VOID
CompressOutput (
- IN UINT32 LoopVar5,
- IN UINT32 LoopVar7
+ IN UINT32 LoopVar5,
+ IN UINT32 LoopVar7
)
{
- STATIC UINT32 CPos;
+ STATIC UINT32 CPos;
if ((mOutputMask >>= 1) == 0) {
mOutputMask = 1U << (UINT8_BIT - 1);
@@ -1188,20 +1191,22 @@ CompressOutput ( mOutputPos = 0;
}
- CPos = mOutputPos++;
- mBuf[CPos] = 0;
+ 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[CPos] = (UINT8)(mBuf[CPos]|mOutputMask);
mBuf[mOutputPos++] = (UINT8)(LoopVar7 >> UINT8_BIT);
- mBuf[mOutputPos++] = (UINT8) LoopVar7;
- LoopVar5 = 0;
- while (LoopVar7!=0) {
+ mBuf[mOutputPos++] = (UINT8)LoopVar7;
+ LoopVar5 = 0;
+ while (LoopVar7 != 0) {
LoopVar7 >>= 1;
LoopVar5++;
}
+
mPFreq[LoopVar5]++;
}
}
@@ -1248,43 +1253,47 @@ Encode ( HufEncodeStart ();
- mRemainder = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH);
+ mRemainder = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH);
- mMatchLen = 0;
- mPos = WNDSIZ;
+ mMatchLen = 0;
+ mPos = WNDSIZ;
InsertNode ();
if (mMatchLen > mRemainder) {
mMatchLen = mRemainder;
}
while (mRemainder > 0) {
- LastMatchLen = mMatchLen;
- LastMatchPos = mMatchPos;
+ LastMatchLen = mMatchLen;
+ LastMatchPos = mMatchPos;
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--;
}
@@ -1324,28 +1333,28 @@ Compress ( //
// Initializations
//
- mBufSiz = 0;
- mBuf = NULL;
- mText = NULL;
- mLevel = NULL;
- mChildCount = NULL;
- mPosition = NULL;
- mParent = NULL;
- mPrev = NULL;
- mNext = NULL;
-
- mSrc = SrcBuffer;
- mSrcUpperLimit = mSrc + SrcSize;
- mDst = DstBuffer;
- mDstUpperLimit = mDst +*DstSize;
+ mBufSiz = 0;
+ mBuf = NULL;
+ mText = NULL;
+ mLevel = NULL;
+ mChildCount = NULL;
+ mPosition = NULL;
+ mParent = NULL;
+ mPrev = NULL;
+ mNext = NULL;
+
+ mSrc = SrcBuffer;
+ mSrcUpperLimit = mSrc + SrcSize;
+ mDst = DstBuffer;
+ mDstUpperLimit = mDst +*DstSize;
PutDword (0L);
PutDword (0L);
MakeCrcTable ();
- mOrigSize = mCompSize = 0;
- mCrc = INIT_CRC;
+ mOrigSize = mCompSize = 0;
+ mCrc = INIT_CRC;
//
// Compress it
@@ -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;
}
-
}
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h index d38b155cf4..dad3201c60 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.h @@ -30,4 +30,3 @@ Compress ( );
#endif
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c index 143ea7f154..97a4b57a93 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c @@ -20,49 +20,49 @@ @retval SHELL_SUCCESS The display was successful.
**/
SHELL_STATUS
-DisplayTheBlocks(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath,
- IN CONST UINT64 Lba,
- IN CONST UINT8 BlockCount
+DisplayTheBlocks (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath,
+ IN CONST UINT64 Lba,
+ IN CONST UINT8 BlockCount
)
{
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_HANDLE BlockIoHandle;
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- UINT8 *Buffer;
- UINT8 *OriginalBuffer;
- UINTN BufferSize;
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;
+ EFI_HANDLE BlockIoHandle;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ UINT8 *Buffer;
+ UINT8 *OriginalBuffer;
+ UINTN BufferSize;
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);
}
@@ -111,67 +111,69 @@ ShellCommandRunDblk ( UINT64 BlockCount;
EFI_DEVICE_PATH_PROTOCOL *DevPath;
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
//
// 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);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c index e6aec2e37c..c52c212a56 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -24,13 +24,14 @@ @return A printable character representing Char.
**/
CHAR16
-MakePrintable(
- IN CONST CHAR16 Char
+MakePrintable (
+ IN CONST CHAR16 Char
)
{
- if ((Char < 0x20 && Char > 0)||(Char > 126)) {
+ if (((Char < 0x20) && (Char > 0)) || (Char > 126)) {
return (L'?');
}
+
return (Char);
}
@@ -41,45 +42,46 @@ MakePrintable( @param[in] Size The length of memory to display.
**/
SHELL_STATUS
-DisplayMmioMemory(
+DisplayMmioMemory (
IN CONST VOID *Address,
IN CONST UINTN Size
)
{
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRbIo;
- EFI_STATUS Status;
- VOID *Buffer;
- SHELL_STATUS ShellStatus;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRbIo;
+ EFI_STATUS Status;
+ VOID *Buffer;
+ SHELL_STATUS ShellStatus;
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}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-mmio", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'dmem' command.
@@ -94,66 +96,67 @@ ShellCommandRunDmem ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- VOID *Address;
- UINT64 Size;
- CONST CHAR16 *Temp1;
- UINT64 AcpiTableAddress;
- UINT64 Acpi20TableAddress;
- UINT64 SalTableAddress;
- UINT64 SmbiosTableAddress;
- UINT64 MpsTableAddress;
- UINTN TableWalker;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- Address = NULL;
- Size = 0;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ VOID *Address;
+ UINT64 Size;
+ CONST CHAR16 *Temp1;
+ UINT64 AcpiTableAddress;
+ UINT64 Acpi20TableAddress;
+ UINT64 SalTableAddress;
+ UINT64 SmbiosTableAddress;
+ UINT64 MpsTableAddress;
+ UINTN TableWalker;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ Address = NULL;
+ Size = 0;
//
// 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) {
- Acpi20TableAddress = 0;
- AcpiTableAddress = 0;
- SalTableAddress = 0;
- SmbiosTableAddress = 0;
- MpsTableAddress = 0;
- for (TableWalker = 0 ; TableWalker < gST->NumberOfTableEntries ; TableWalker++) {
- if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi20TableGuid)) {
+ 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)) {
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);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c index 105ebfbeae..975db0a620 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c @@ -17,13 +17,13 @@ typedef enum { } DMP_STORE_TYPE;
typedef struct {
- UINT32 Signature;
- CHAR16 *Name;
- EFI_GUID Guid;
- UINT32 Attributes;
- UINT32 DataSize;
- UINT8 *Data;
- LIST_ENTRY Link;
+ UINT32 Signature;
+ CHAR16 *Name;
+ EFI_GUID Guid;
+ UINT32 Attributes;
+ UINT32 DataSize;
+ UINT8 *Data;
+ LIST_ENTRY Link;
} DMP_STORE_VARIABLE;
#define DMP_STORE_VARIABLE_SIGNATURE SIGNATURE_32 ('_', 'd', 's', 's')
@@ -37,39 +37,43 @@ typedef struct { **/
CHAR16 *
GetAttrType (
- IN CONST UINT32 Atts
+ IN CONST UINT32 Atts
)
{
- UINTN BufLen;
- CHAR16 *RetString;
+ UINTN BufLen;
+ CHAR16 *RetString;
- BufLen = 0;
- RetString = NULL;
+ BufLen = 0;
+ RetString = NULL;
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,
@@ -93,8 +97,8 @@ BinaryToHexString ( IN UINTN HexStringSize
)
{
- UINTN Index;
- UINTN StringIndex;
+ UINTN Index;
+ UINTN StringIndex;
ASSERT (Buffer != NULL);
ASSERT ((BufferSize * 2 + 1) * sizeof (CHAR16) <= HexStringSize);
@@ -105,9 +109,10 @@ BinaryToHexString ( &HexString[StringIndex],
HexStringSize - StringIndex * sizeof (CHAR16),
L"%02x",
- ((UINT8 *) Buffer)[Index]
+ ((UINT8 *)Buffer)[Index]
);
}
+
return HexString;
}
@@ -126,26 +131,26 @@ BinaryToHexString ( **/
SHELL_STATUS
LoadVariablesFromFile (
- IN SHELL_FILE_HANDLE FileHandle,
- IN CONST CHAR16 *Name,
- IN CONST EFI_GUID *Guid,
- OUT BOOLEAN *Found
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN CONST CHAR16 *Name,
+ IN CONST EFI_GUID *Guid,
+ OUT BOOLEAN *Found
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- UINT32 NameSize;
- UINT32 DataSize;
- UINTN BufferSize;
- UINTN RemainingSize;
- UINT64 Position;
- UINT64 FileSize;
- LIST_ENTRY List;
- DMP_STORE_VARIABLE *Variable;
- LIST_ENTRY *Link;
- CHAR16 *Attributes;
- UINT8 *Buffer;
- UINT32 Crc32;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ UINT32 NameSize;
+ UINT32 DataSize;
+ UINTN BufferSize;
+ UINTN RemainingSize;
+ UINT64 Position;
+ UINT64 FileSize;
+ LIST_ENTRY List;
+ DMP_STORE_VARIABLE *Variable;
+ LIST_ENTRY *Link;
+ CHAR16 *Attributes;
+ UINT8 *Buffer;
+ UINT32 Crc32;
Status = ShellGetFileSize (FileHandle, &FileSize);
if (EFI_ERROR (Status)) {
@@ -162,7 +167,7 @@ LoadVariablesFromFile ( // NameSize
//
BufferSize = sizeof (NameSize);
- Status = ShellReadFile (FileHandle, &BufferSize, &NameSize);
+ Status = ShellReadFile (FileHandle, &BufferSize, &NameSize);
if (EFI_ERROR (Status) || (BufferSize != sizeof (NameSize))) {
ShellStatus = SHELL_VOLUME_CORRUPTED;
break;
@@ -172,7 +177,7 @@ LoadVariablesFromFile ( // DataSize
//
BufferSize = sizeof (DataSize);
- Status = ShellReadFile (FileHandle, &BufferSize, &DataSize);
+ Status = ShellReadFile (FileHandle, &BufferSize, &DataSize);
if (EFI_ERROR (Status) || (BufferSize != sizeof (DataSize))) {
ShellStatus = SHELL_VOLUME_CORRUPTED;
break;
@@ -188,8 +193,9 @@ LoadVariablesFromFile ( ShellStatus = SHELL_OUT_OF_RESOURCES;
break;
}
- BufferSize = RemainingSize;
- Status = ShellReadFile (FileHandle, &BufferSize, (UINT32 *) Buffer + 2);
+
+ BufferSize = RemainingSize;
+ 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;
- BufferSize = RemainingSize + sizeof (NameSize) + sizeof (DataSize) - sizeof (Crc32);
+ *(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,41 +227,51 @@ 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;
- 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));
- CopyMem (Variable->Data, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID) + sizeof (UINT32), DataSize);
+ 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));
+ CopyMem (Variable->Data, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID) + sizeof (UINT32), DataSize);
InsertTailList (&List, &Variable->Link);
FreePool (Buffer);
}
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;
}
}
for ( Link = GetFirstNode (&List)
- ; !IsNull (&List, Link) && (ShellStatus == SHELL_SUCCESS)
- ; Link = GetNextNode (&List, Link)
- ) {
+ ; !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,14 +282,14 @@ 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);
}
}
}
for (Link = GetFirstNode (&List); !IsNull (&List, Link); ) {
Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE);
- Link = RemoveEntryList (&Variable->Link);
+ Link = RemoveEntryList (&Variable->Link);
FreePool (Variable);
}
@@ -296,26 +312,26 @@ LoadVariablesFromFile ( **/
EFI_STATUS
AppendSingleVariableToFile (
- IN SHELL_FILE_HANDLE FileHandle,
- IN CONST CHAR16 *Name,
- IN CONST EFI_GUID *Guid,
- IN UINT32 Attributes,
- IN UINT32 DataSize,
- IN CONST UINT8 *Data
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN CONST CHAR16 *Name,
+ IN CONST EFI_GUID *Guid,
+ IN UINT32 Attributes,
+ IN UINT32 DataSize,
+ IN CONST UINT8 *Data
)
{
- UINT32 NameSize;
- UINT8 *Buffer;
- UINT8 *Ptr;
- UINTN BufferSize;
- EFI_STATUS Status;
+ UINT32 NameSize;
+ UINT8 *Buffer;
+ UINT8 *Ptr;
+ UINTN BufferSize;
+ EFI_STATUS Status;
- NameSize = (UINT32) StrSize (Name);
+ NameSize = (UINT32)StrSize (Name);
BufferSize = sizeof (NameSize) + sizeof (DataSize)
- + sizeof (*Guid)
- + sizeof (Attributes)
- + NameSize + DataSize
- + sizeof (UINT32);
+ + sizeof (*Guid)
+ + sizeof (Attributes)
+ + NameSize + DataSize
+ + sizeof (UINT32);
Buffer = AllocatePool (BufferSize);
if (Buffer == NULL) {
@@ -326,10 +342,10 @@ AppendSingleVariableToFile ( //
// NameSize and DataSize
//
- * (UINT32 *) Ptr = NameSize;
- Ptr += sizeof (NameSize);
- *(UINT32 *) Ptr = DataSize;
- Ptr += sizeof (DataSize);
+ *(UINT32 *)Ptr = NameSize;
+ Ptr += sizeof (NameSize);
+ *(UINT32 *)Ptr = DataSize;
+ Ptr += sizeof (DataSize);
//
// Name
@@ -346,8 +362,8 @@ AppendSingleVariableToFile ( //
// Attributes
//
- * (UINT32 *) Ptr = Attributes;
- Ptr += sizeof (Attributes);
+ *(UINT32 *)Ptr = Attributes;
+ Ptr += sizeof (Attributes);
//
// Data
@@ -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;
}
@@ -398,49 +415,49 @@ AppendSingleVariableToFile ( **/
SHELL_STATUS
CascadeProcessVariables (
- IN CONST CHAR16 *Name OPTIONAL,
- IN CONST EFI_GUID *Guid OPTIONAL,
- IN DMP_STORE_TYPE Type,
- IN EFI_FILE_PROTOCOL *FileHandle OPTIONAL,
- IN CONST CHAR16 * CONST PrevName,
- IN EFI_GUID FoundVarGuid,
- IN BOOLEAN *FoundOne,
- IN BOOLEAN StandardFormatOutput
+ IN CONST CHAR16 *Name OPTIONAL,
+ IN CONST EFI_GUID *Guid OPTIONAL,
+ IN DMP_STORE_TYPE Type,
+ IN EFI_FILE_PROTOCOL *FileHandle OPTIONAL,
+ IN CONST CHAR16 *CONST PrevName,
+ IN EFI_GUID FoundVarGuid,
+ IN BOOLEAN *FoundOne,
+ IN BOOLEAN StandardFormatOutput
)
{
- EFI_STATUS Status;
- CHAR16 *FoundVarName;
- UINT8 *DataBuffer;
- UINTN DataSize;
- UINT32 Atts;
- SHELL_STATUS ShellStatus;
- UINTN NameSize;
- CHAR16 *AttrString;
- CHAR16 *HexString;
- EFI_STATUS SetStatus;
- CONST CHAR16 *GuidName;
-
- if (ShellGetExecutionBreakFlag()) {
+ EFI_STATUS Status;
+ CHAR16 *FoundVarName;
+ UINT8 *DataBuffer;
+ UINTN DataSize;
+ UINT32 Atts;
+ SHELL_STATUS ShellStatus;
+ UINTN NameSize;
+ CHAR16 *AttrString;
+ CHAR16 *HexString;
+ EFI_STATUS SetStatus;
+ CONST CHAR16 *GuidName;
+
+ if (ShellGetExecutionBreakFlag ()) {
return (SHELL_ABORTED);
}
- NameSize = 0;
- FoundVarName = NULL;
+ 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,18 +491,19 @@ 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) )
- ) {
- DataSize = 0;
- DataBuffer = NULL;
+ if ( ( (Name == NULL)
+ || gUnicodeCollation->MetaiMatch (gUnicodeCollation, FoundVarName, (CHAR16 *)Name))
+ && ( (Guid == NULL)
+ || CompareGuid (&FoundVarGuid, Guid))
+ )
+ {
+ DataSize = 0;
+ DataBuffer = NULL;
//
// do the print or delete
//
*FoundOne = TRUE;
- Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
+ Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
SHELL_FREE_NON_NULL (DataBuffer);
DataBuffer = AllocatePool (DataSize);
@@ -495,20 +513,31 @@ CascadeProcessVariables ( Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
}
}
- //
- // Last error check then print this variable out.
- //
+
+ //
+ // 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;
}
@@ -601,23 +665,23 @@ CascadeProcessVariables ( **/
SHELL_STATUS
ProcessVariables (
- IN CONST CHAR16 *Name OPTIONAL,
- IN CONST EFI_GUID *Guid OPTIONAL,
- IN DMP_STORE_TYPE Type,
- IN SHELL_FILE_HANDLE FileHandle OPTIONAL,
- IN BOOLEAN StandardFormatOutput
+ IN CONST CHAR16 *Name OPTIONAL,
+ IN CONST EFI_GUID *Guid OPTIONAL,
+ IN DMP_STORE_TYPE Type,
+ IN SHELL_FILE_HANDLE FileHandle OPTIONAL,
+ IN BOOLEAN StandardFormatOutput
)
{
- SHELL_STATUS ShellStatus;
- BOOLEAN Found;
- EFI_GUID FoundVarGuid;
+ SHELL_STATUS ShellStatus;
+ BOOLEAN Found;
+ EFI_GUID FoundVarGuid;
- Found = FALSE;
- ShellStatus = SHELL_SUCCESS;
- ZeroMem (&FoundVarGuid, sizeof(EFI_GUID));
+ Found = FALSE;
+ ShellStatus = SHELL_SUCCESS;
+ 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}
- };
+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 }
+};
/**
Function for 'dmpstore' command.
@@ -679,20 +745,20 @@ ShellCommandRunDmpStore ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- RETURN_STATUS RStatus;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *GuidStr;
- CONST CHAR16 *File;
- EFI_GUID *Guid;
- EFI_GUID GuidData;
- CONST CHAR16 *Name;
- DMP_STORE_TYPE Type;
- SHELL_FILE_HANDLE FileHandle;
- EFI_FILE_INFO *FileInfo;
- BOOLEAN StandardFormatOutput;
+ EFI_STATUS Status;
+ RETURN_STATUS RStatus;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *GuidStr;
+ CONST CHAR16 *File;
+ EFI_GUID *Guid;
+ EFI_GUID GuidData;
+ CONST CHAR16 *Name;
+ DMP_STORE_TYPE Type;
+ SHELL_FILE_HANDLE FileHandle;
+ EFI_FILE_INFO *FileInfo;
+ BOOLEAN StandardFormatOutput;
ShellStatus = SHELL_SUCCESS;
Package = NULL;
@@ -702,61 +768,62 @@ 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 {
+ } else {
Guid = &gEfiGlobalVariableGuid;
}
} else {
- Guid = NULL;
+ Guid = NULL;
}
//
// 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;
}
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c index 1160efaa7f..f5edc1bdbb 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Edit.c @@ -23,16 +23,17 @@ ShellCommandRunEdit ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- CHAR16 *Buffer;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- LIST_ENTRY *Package;
- CONST CHAR16 *Cwd;
- CHAR16 *Nfs;
- CHAR16 *Spot;
- CONST CHAR16 *TempParam;
-// SHELL_FILE_HANDLE TempHandle;
+ EFI_STATUS Status;
+ CHAR16 *Buffer;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ LIST_ENTRY *Package;
+ CONST CHAR16 *Cwd;
+ CHAR16 *Nfs;
+ CHAR16 *Spot;
+ CONST CHAR16 *TempParam;
+
+ // 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;
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c index 925d910ae2..088030d29f 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c @@ -47,16 +47,16 @@ EFI_EDITOR_FILE_BUFFER FileBufferConst = { //
// the whole edit area needs to be refreshed
//
-BOOLEAN FileBufferNeedRefresh;
+BOOLEAN FileBufferNeedRefresh;
//
// only the current line in edit area needs to be refresh
//
-BOOLEAN FileBufferOnlyLineNeedRefresh;
+BOOLEAN FileBufferOnlyLineNeedRefresh;
-BOOLEAN FileBufferMouseNeedRefresh;
+BOOLEAN FileBufferMouseNeedRefresh;
-extern BOOLEAN EditorMouseAction;
+extern BOOLEAN EditorMouseAction;
/**
Initialization function for FileBuffer.
@@ -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));
//
@@ -96,9 +96,9 @@ FileBufferInit ( FileBuffer.LowVisibleRange.Row = 2;
FileBuffer.LowVisibleRange.Column = 1;
- FileBufferNeedRefresh = FALSE;
- FileBufferMouseNeedRefresh = FALSE;
- FileBufferOnlyLineNeedRefresh = FALSE;
+ FileBufferNeedRefresh = FALSE;
+ FileBufferMouseNeedRefresh = FALSE;
+ FileBufferOnlyLineNeedRefresh = FALSE;
return EFI_SUCCESS;
}
@@ -121,17 +121,17 @@ FileBufferBackup ( FileBufferBackupVar.MousePosition = FileBuffer.MousePosition;
SHELL_FREE_NON_NULL (FileBufferBackupVar.FileName);
- FileBufferBackupVar.FileName = NULL;
- FileBufferBackupVar.FileName = StrnCatGrow (&FileBufferBackupVar.FileName, NULL, FileBuffer.FileName, 0);
+ FileBufferBackupVar.FileName = NULL;
+ FileBufferBackupVar.FileName = StrnCatGrow (&FileBufferBackupVar.FileName, NULL, FileBuffer.FileName, 0);
- FileBufferBackupVar.ModeInsert = FileBuffer.ModeInsert;
- FileBufferBackupVar.FileType = FileBuffer.FileType;
+ FileBufferBackupVar.ModeInsert = FileBuffer.ModeInsert;
+ FileBufferBackupVar.FileType = FileBuffer.FileType;
FileBufferBackupVar.FilePosition = FileBuffer.FilePosition;
FileBufferBackupVar.LowVisibleRange = FileBuffer.LowVisibleRange;
- FileBufferBackupVar.FileModified = FileBuffer.FileModified;
- FileBufferBackupVar.ReadOnly = FileBuffer.ReadOnly;
+ FileBufferBackupVar.FileModified = FileBuffer.FileModified;
+ FileBufferBackupVar.ReadOnly = FileBuffer.ReadOnly;
return EFI_SUCCESS;
}
@@ -154,10 +154,10 @@ InternalEditorMiscLineAdvance ( )
{
- UINTN Index;
- CONST EFI_EDITOR_LINE *Line;
+ UINTN Index;
+ CONST EFI_EDITOR_LINE *Line;
- if (CurrentLine == NULL || LineList == NULL) {
+ if ((CurrentLine == NULL) || (LineList == NULL)) {
return NULL;
}
@@ -193,10 +193,10 @@ InternalEditorMiscLineRetreat ( )
{
- UINTN Index;
- CONST EFI_EDITOR_LINE *Line;
+ UINTN Index;
+ CONST EFI_EDITOR_LINE *Line;
- if (CurrentLine == NULL || LineList == NULL) {
+ if ((CurrentLine == NULL) || (LineList == NULL)) {
return NULL;
}
@@ -226,21 +226,21 @@ InternalEditorMiscLineRetreat ( **/
EFI_EDITOR_LINE *
MoveLine (
- IN CONST INTN Count
+ IN CONST INTN Count
)
{
- EFI_EDITOR_LINE *Line;
- UINTN AbsCount;
+ EFI_EDITOR_LINE *Line;
+ UINTN AbsCount;
//
// if < 0, then retreat
// 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
//
@@ -296,18 +296,18 @@ FileBufferRestoreMousePosition ( //
// clear the old mouse position
//
- FRow = FileBuffer.LowVisibleRange.Row + FileBufferBackupVar.MousePosition.Row - 2;
+ FRow = FileBuffer.LowVisibleRange.Row + FileBufferBackupVar.MousePosition.Row - 2;
- FColumn = FileBuffer.LowVisibleRange.Column + FileBufferBackupVar.MousePosition.Column - 1;
+ FColumn = FileBuffer.LowVisibleRange.Column + FileBufferBackupVar.MousePosition.Column - 1;
- HasCharacter = TRUE;
+ HasCharacter = TRUE;
if (FRow > FileBuffer.NumLines) {
HasCharacter = FALSE;
} else {
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
//
@@ -337,17 +338,17 @@ FileBufferRestoreMousePosition ( //
// clear the old mouse position
//
- FRow = FileBuffer.LowVisibleRange.Row + FileBuffer.MousePosition.Row - 2;
- FColumn = FileBuffer.LowVisibleRange.Column + FileBuffer.MousePosition.Column - 1;
+ FRow = FileBuffer.LowVisibleRange.Row + FileBuffer.MousePosition.Row - 2;
+ FColumn = FileBuffer.LowVisibleRange.Column + FileBuffer.MousePosition.Column - 1;
- HasCharacter = TRUE;
+ HasCharacter = TRUE;
if (FRow > FileBuffer.NumLines) {
HasCharacter = FALSE;
} else {
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
//
@@ -399,19 +403,18 @@ FileBufferFreeLines ( VOID
)
{
- LIST_ENTRY *Link;
- EFI_EDITOR_LINE *Line;
+ LIST_ENTRY *Link;
+ EFI_EDITOR_LINE *Line;
//
// free all the lines
//
if (FileBuffer.Lines != NULL) {
-
- Line = FileBuffer.Lines;
- Link = &(Line->Link);
+ Line = FileBuffer.Lines;
+ Link = &(Line->Link);
do {
- Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
- Link = Link->ForwardLink;
+ Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
+ Link = Link->ForwardLink;
//
// free line's buffer and line itself
@@ -419,15 +422,16 @@ FileBufferFreeLines ( LineFree (Line);
} while (Link != FileBuffer.ListHead);
}
+
//
// clean the line list related structure
//
- FileBuffer.Lines = NULL;
- FileBuffer.CurrentLine = NULL;
- FileBuffer.NumLines = 0;
+ FileBuffer.Lines = NULL;
+ FileBuffer.CurrentLine = NULL;
+ FileBuffer.NumLines = 0;
- FileBuffer.ListHead->ForwardLink = FileBuffer.ListHead;
- FileBuffer.ListHead->BackLink = FileBuffer.ListHead;
+ FileBuffer.ListHead->ForwardLink = FileBuffer.ListHead;
+ FileBuffer.ListHead->BackLink = FileBuffer.ListHead;
return EFI_SUCCESS;
}
@@ -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;
@@ -483,17 +485,17 @@ FileBufferPrintLine ( //
// print start from correct character
//
- Buffer = Line->Buffer + FileBuffer.LowVisibleRange.Column - 1;
+ Buffer = Line->Buffer + FileBuffer.LowVisibleRange.Column - 1;
- Limit = Line->Size - FileBuffer.LowVisibleRange.Column + 1;
+ Limit = Line->Size - FileBuffer.LowVisibleRange.Column + 1;
if (Limit > Line->Size) {
Limit = 0;
}
- BufLen = (MainEditor.ScreenSize.Column + 1) * sizeof (CHAR16);
+ 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);
}
@@ -532,10 +535,10 @@ FileBufferRestorePosition ( // set cursor position
//
return (gST->ConOut->SetCursorPosition (
- gST->ConOut,
- FileBuffer.DisplayPosition.Column - 1,
- FileBuffer.DisplayPosition.Row - 1
- ));
+ gST->ConOut,
+ FileBuffer.DisplayPosition.Column - 1,
+ FileBuffer.DisplayPosition.Row - 1
+ ));
}
/**
@@ -549,9 +552,9 @@ FileBufferRefresh ( VOID
)
{
- LIST_ENTRY *Link;
- EFI_EDITOR_LINE *Line;
- UINTN Row;
+ LIST_ENTRY *Link;
+ EFI_EDITOR_LINE *Line;
+ UINTN Row;
//
// if it's the first time after editor launch, so should refresh
@@ -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
//
@@ -614,8 +618,8 @@ FileBufferRefresh ( return EFI_LOAD_ERROR;
}
- Link = &(Line->Link);
- Row = 2;
+ Link = &(Line->Link);
+ Row = 2;
do {
Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
@@ -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
//
@@ -660,7 +665,7 @@ FileBufferCreateLine ( VOID
)
{
- EFI_EDITOR_LINE *Line;
+ EFI_EDITOR_LINE *Line;
//
// allocate a line structure
@@ -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;
@@ -711,15 +717,16 @@ FileBufferCreateLine ( **/
EFI_STATUS
FileBufferSetFileName (
- IN CONST CHAR16 *Str
+ IN CONST CHAR16 *Str
)
{
//
// 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.
@@ -768,24 +775,24 @@ FileBufferFree ( **/
EFI_STATUS
FileBufferRead (
- IN CONST CHAR16 *FileName,
- IN CONST BOOLEAN Recover
+ IN CONST CHAR16 *FileName,
+ IN CONST BOOLEAN Recover
)
{
- EFI_EDITOR_LINE *Line;
- EE_NEWLINE_TYPE Type;
- UINTN LoopVar1;
- UINTN LoopVar2;
- UINTN LineSize;
- VOID *Buffer;
- CHAR16 *UnicodeBuffer;
- UINT8 *AsciiBuffer;
- UINTN FileSize;
- SHELL_FILE_HANDLE FileHandle;
- BOOLEAN CreateFile;
- EFI_STATUS Status;
- UINTN LineSizeBackup;
- EFI_FILE_INFO *Info;
+ EFI_EDITOR_LINE *Line;
+ EE_NEWLINE_TYPE Type;
+ UINTN LoopVar1;
+ UINTN LoopVar2;
+ UINTN LineSize;
+ VOID *Buffer;
+ CHAR16 *UnicodeBuffer;
+ UINT8 *AsciiBuffer;
+ UINTN FileSize;
+ SHELL_FILE_HANDLE FileHandle;
+ BOOLEAN CreateFile;
+ EFI_STATUS Status;
+ UINTN LineSizeBackup;
+ EFI_FILE_INFO *Info;
Line = NULL;
LoopVar1 = 0;
@@ -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,53 +1098,58 @@ 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;
//
- Line->Buffer[LineSize] = 0;
+ Line->Buffer[LineSize] = 0;
- Line->Size = LineSize;
- Line->TotalSize = LineSize;
- Line->Type = Type;
+ Line->Size = LineSize;
+ 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,83 +1173,84 @@ Done: StatusBarSetStatusString (UnicodeBuffer);
FreePool (UnicodeBuffer);
}
-/*
- //
- // check whether we have fs?: in filename
- //
- LoopVar1 = 0;
- FSMappingPtr = NULL;
- while (FileName[LoopVar1] != 0) {
- if (FileName[LoopVar1] == L':') {
- FSMappingPtr = &FileName[LoopVar1];
- break;
- }
-
- LoopVar1++;
- }
- if (FSMappingPtr == NULL) {
- CurDir = ShellGetCurrentDir (NULL);
- } else {
- LoopVar1 = 0;
- LoopVar2 = 0;
+ /*
+ //
+ // check whether we have fs?: in filename
+ //
+ LoopVar1 = 0;
+ FSMappingPtr = NULL;
while (FileName[LoopVar1] != 0) {
if (FileName[LoopVar1] == L':') {
+ FSMappingPtr = &FileName[LoopVar1];
break;
}
- FSMapping[LoopVar2++] = FileName[LoopVar1];
-
LoopVar1++;
}
- FSMapping[LoopVar2] = 0;
- CurDir = ShellGetCurrentDir (FSMapping);
- }
+ if (FSMappingPtr == NULL) {
+ CurDir = ShellGetCurrentDir (NULL);
+ } else {
+ LoopVar1 = 0;
+ LoopVar2 = 0;
+ while (FileName[LoopVar1] != 0) {
+ if (FileName[LoopVar1] == L':') {
+ break;
+ }
- if (CurDir != NULL) {
- for (LoopVar1 = 0; LoopVar1 < StrLen (CurDir) && CurDir[LoopVar1] != ':'; LoopVar1++);
+ FSMapping[LoopVar2++] = FileName[LoopVar1];
- CurDir[LoopVar1] = 0;
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) ShellGetMap (CurDir);
- FreePool (CurDir);
- } else {
- return EFI_LOAD_ERROR;
- }
+ LoopVar1++;
+ }
- Status = LibDevicePathToInterface (
- &gEfiSimpleFileSystemProtocolGuid,
- DevicePath,
- (VOID **) &Vol
- );
- if (EFI_ERROR (Status)) {
- return EFI_LOAD_ERROR;
- }
+ FSMapping[LoopVar2] = 0;
+ CurDir = ShellGetCurrentDir (FSMapping);
+ }
- Status = Vol->OpenVolume (Vol, &RootFs);
- if (EFI_ERROR (Status)) {
- return EFI_LOAD_ERROR;
- }
- //
- // Get volume information of file system
- //
- Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + 100;
- VolumeInfo = (EFI_FILE_SYSTEM_INFO *) AllocateZeroPool (Size);
- Status = RootFs->GetInfo (RootFs, &gEfiFileSystemInfoGuid, &Size, VolumeInfo);
- if (EFI_ERROR (Status)) {
- RootFs->Close (RootFs);
- return EFI_LOAD_ERROR;
- }
+ if (CurDir != NULL) {
+ for (LoopVar1 = 0; LoopVar1 < StrLen (CurDir) && CurDir[LoopVar1] != ':'; LoopVar1++);
- if (VolumeInfo->ReadOnly) {
- StatusBarSetStatusString (L"WARNING: Volume Read Only");
- }
+ CurDir[LoopVar1] = 0;
+ DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) ShellGetMap (CurDir);
+ FreePool (CurDir);
+ } else {
+ return EFI_LOAD_ERROR;
+ }
- FreePool (VolumeInfo);
- RootFs->Close (RootFs);
- }
-//
-*/
+ Status = LibDevicePathToInterface (
+ &gEfiSimpleFileSystemProtocolGuid,
+ DevicePath,
+ (VOID **) &Vol
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_LOAD_ERROR;
+ }
+
+ Status = Vol->OpenVolume (Vol, &RootFs);
+ if (EFI_ERROR (Status)) {
+ return EFI_LOAD_ERROR;
+ }
+ //
+ // Get volume information of file system
+ //
+ Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + 100;
+ VolumeInfo = (EFI_FILE_SYSTEM_INFO *) AllocateZeroPool (Size);
+ Status = RootFs->GetInfo (RootFs, &gEfiFileSystemInfoGuid, &Size, VolumeInfo);
+ if (EFI_ERROR (Status)) {
+ RootFs->Close (RootFs);
+ return EFI_LOAD_ERROR;
+ }
+
+ if (VolumeInfo->ReadOnly) {
+ StatusBarSetStatusString (L"WARNING: Volume Read Only");
+ }
+
+ FreePool (VolumeInfo);
+ RootFs->Close (RootFs);
+ }
+ //
+ */
//
// has line
//
@@ -1248,7 +1273,6 @@ Done: FileBufferOnlyLineNeedRefresh = FALSE;
FileBufferMouseNeedRefresh = TRUE;
-
return EFI_SUCCESS;
}
@@ -1262,12 +1286,12 @@ Done: **/
VOID
GetNewLine (
- IN CONST EE_NEWLINE_TYPE Type,
- OUT CHAR8 *Buffer,
- OUT UINT8 *Size
+ IN CONST EE_NEWLINE_TYPE Type,
+ OUT CHAR8 *Buffer,
+ OUT UINT8 *Size
)
{
- UINT8 NewLineSize;
+ UINT8 NewLineSize;
//
// give new line buffer,
@@ -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,17 +1338,18 @@ GetNewLine ( }
*Size = NewLineSize;
- return ;
+ return;
}
+
//
// use_crlf: give 0x0d 0x0a
//
if (Type == NewLineTypeCarriageReturnLineFeed) {
if (MainEditor.FileBuffer->FileType == FileTypeUnicode) {
- Buffer[0] = 0x0d;
- Buffer[1] = 0;
- Buffer[2] = 0x0a;
- Buffer[3] = 0;
+ Buffer[0] = 0x0d;
+ Buffer[1] = 0;
+ Buffer[2] = 0x0a;
+ Buffer[3] = 0;
NewLineSize = 4;
} else {
@@ -1332,17 +1359,18 @@ GetNewLine ( }
*Size = NewLineSize;
- return ;
+ return;
}
+
//
// use_lfcr: give 0x0a 0x0d
//
if (Type == NewLineTypeLineFeedCarriageReturn) {
if (MainEditor.FileBuffer->FileType == FileTypeUnicode) {
- Buffer[0] = 0x0a;
- Buffer[1] = 0;
- Buffer[2] = 0x0d;
- Buffer[3] = 0;
+ Buffer[0] = 0x0a;
+ Buffer[1] = 0;
+ Buffer[2] = 0x0d;
+ Buffer[3] = 0;
NewLineSize = 4;
} else {
@@ -1352,9 +1380,8 @@ GetNewLine ( }
*Size = NewLineSize;
- return ;
+ return;
}
-
}
/**
@@ -1368,18 +1395,18 @@ GetNewLine ( **/
UINTN
UnicodeToAscii (
- IN CONST CHAR16 *UStr,
- IN CONST UINTN Length,
- OUT CHAR8 *AStr
+ IN CONST CHAR16 *UStr,
+ IN CONST UINTN Length,
+ OUT CHAR8 *AStr
)
{
- UINTN Index;
+ UINTN Index;
//
// just buffer copy, not character copy
//
for (Index = 0; Index < Length; Index++) {
- *AStr++ = (CHAR8) *UStr++;
+ *AStr++ = (CHAR8)*UStr++;
}
return Index;
@@ -1396,36 +1423,36 @@ UnicodeToAscii ( **/
EFI_STATUS
FileBufferSave (
- IN CONST CHAR16 *FileName
+ IN CONST CHAR16 *FileName
)
{
- SHELL_FILE_HANDLE FileHandle;
- LIST_ENTRY *Link;
- EFI_EDITOR_LINE *Line;
- CHAR16 *Str;
+ SHELL_FILE_HANDLE FileHandle;
+ LIST_ENTRY *Link;
+ EFI_EDITOR_LINE *Line;
+ CHAR16 *Str;
- EFI_STATUS Status;
- UINTN Length;
- UINTN NumLines;
- CHAR8 NewLineBuffer[4];
- UINT8 NewLineSize;
+ EFI_STATUS Status;
+ UINTN Length;
+ UINTN NumLines;
+ CHAR8 NewLineBuffer[4];
+ UINT8 NewLineSize;
- EFI_FILE_INFO *Info;
+ EFI_FILE_INFO *Info;
- UINT64 Attribute;
+ UINT64 Attribute;
- EE_NEWLINE_TYPE Type;
+ EE_NEWLINE_TYPE Type;
- UINTN TotalSize;
+ UINTN TotalSize;
//
// 2M
//
- CHAR8 *Cache;
- UINTN LeftSize;
- UINTN Size;
- CHAR8 *Ptr;
+ CHAR8 *Cache;
+ UINTN LeftSize;
+ UINTN Size;
+ CHAR8 *Ptr;
- Length = 0;
+ Length = 0;
//
// 2M
//
@@ -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,29 +1483,29 @@ 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;
}
- }
+ }
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, Attribute);
@@ -1493,8 +1518,8 @@ FileBufferSave ( // if file is Unicode file, write Unicode header to it.
//
if (FileBuffer.FileType == FileTypeUnicode) {
- Length = 2;
- Status = ShellWriteFile (FileHandle, &Length, (VOID*)&gUnicodeFileTag);
+ Length = 2;
+ Status = ShellWriteFile (FileHandle, &Length, (VOID *)&gUnicodeFileTag);
if (EFI_ERROR (Status)) {
ShellDeleteFile (&FileHandle);
return EFI_LOAD_ERROR;
@@ -1510,11 +1535,11 @@ FileBufferSave ( //
// write all the lines back to disk
//
- NumLines = 0;
- Type = NewLineTypeCarriageReturnLineFeed;
+ NumLines = 0;
+ Type = NewLineTypeCarriageReturnLineFeed;
- Ptr = Cache;
- LeftSize = TotalSize;
+ Ptr = Cache;
+ LeftSize = TotalSize;
for (Link = FileBuffer.ListHead->ForwardLink; Link != FileBuffer.ListHead; Link = Link->ForwardLink) {
Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
@@ -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
//
@@ -1541,32 +1568,34 @@ FileBufferSave ( // no cache room left, so write cache to disk
//
if (LeftSize < Length) {
- Size = TotalSize - LeftSize;
- Status = ShellWriteFile (FileHandle, &Size, Cache);
+ Size = TotalSize - LeftSize;
+ Status = ShellWriteFile (FileHandle, &Size, Cache);
if (EFI_ERROR (Status)) {
ShellDeleteFile (&FileHandle);
FreePool (Cache);
return EFI_LOAD_ERROR;
}
- Ptr = Cache;
- LeftSize = TotalSize;
+
+ 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;
+ Ptr += Length;
LeftSize -= Length;
-
}
+
//
// end of if Line -> Buffer != NULL && Line -> Size != 0
//
@@ -1574,9 +1603,9 @@ FileBufferSave ( //
if (Link->ForwardLink != FileBuffer.ListHead) {
GetNewLine (Type, NewLineBuffer, &NewLineSize);
- CopyMem (Ptr, (CHAR8 *) NewLineBuffer, NewLineSize);
+ CopyMem (Ptr, (CHAR8 *)NewLineBuffer, NewLineSize);
- Ptr += NewLineSize;
+ Ptr += NewLineSize;
LeftSize -= NewLineSize;
}
@@ -1584,8 +1613,8 @@ FileBufferSave ( }
if (TotalSize != LeftSize) {
- Size = TotalSize - LeftSize;
- Status = ShellWriteFile (FileHandle, &Size, Cache);
+ Size = TotalSize - LeftSize;
+ Status = ShellWriteFile (FileHandle, &Size, Cache);
if (EFI_ERROR (Status)) {
ShellDeleteFile (&FileHandle);
FreePool (Cache);
@@ -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
//
@@ -1638,14 +1667,14 @@ FileBufferScrollLeft ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- UINTN FRow;
- UINTN FCol;
+ EFI_EDITOR_LINE *Line;
+ UINTN FRow;
+ UINTN FCol;
- Line = FileBuffer.CurrentLine;
+ Line = FileBuffer.CurrentLine;
- FRow = FileBuffer.FilePosition.Row;
- FCol = FileBuffer.FilePosition.Column;
+ FRow = FileBuffer.FilePosition.Row;
+ FCol = FileBuffer.FilePosition.Column;
//
// if already at start of this line, so move to the end of previous line
@@ -1656,8 +1685,8 @@ FileBufferScrollLeft ( //
if (Line->Link.BackLink != FileBuffer.ListHead) {
FRow--;
- Line = CR (Line->Link.BackLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
- FCol = Line->Size + 1;
+ Line = CR (Line->Link.BackLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
+ FCol = Line->Size + 1;
} else {
return EFI_SUCCESS;
}
@@ -1681,11 +1710,11 @@ FileBufferScrollLeft ( **/
VOID
LineDeleteAt (
- IN OUT EFI_EDITOR_LINE *Line,
- IN UINTN Pos
+ IN OUT EFI_EDITOR_LINE *Line,
+ IN UINTN Pos
)
{
- UINTN Index;
+ UINTN Index;
//
// move the latter characters front
@@ -1705,16 +1734,16 @@ LineDeleteAt ( **/
VOID
LineCat (
- IN OUT EFI_EDITOR_LINE *Dest,
- IN EFI_EDITOR_LINE *Src
+ IN OUT EFI_EDITOR_LINE *Dest,
+ IN EFI_EDITOR_LINE *Src
)
{
CHAR16 *Str;
UINTN Size;
- Size = Dest->Size;
+ Size = Dest->Size;
- Dest->Buffer[Size] = 0;
+ Dest->Buffer[Size] = 0;
//
// concatenate the two strings
@@ -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;
@@ -1748,14 +1777,14 @@ FileBufferDoBackspace ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- EFI_EDITOR_LINE *End;
- LIST_ENTRY *Link;
- UINTN FileColumn;
+ EFI_EDITOR_LINE *Line;
+ EFI_EDITOR_LINE *End;
+ LIST_ENTRY *Link;
+ UINTN FileColumn;
- FileColumn = FileBuffer.FilePosition.Column;
+ FileColumn = FileBuffer.FilePosition.Column;
- Line = FileBuffer.CurrentLine;
+ Line = FileBuffer.CurrentLine;
//
// the first column
@@ -1770,9 +1799,9 @@ FileBufferDoBackspace ( FileBufferScrollLeft ();
- Line = FileBuffer.CurrentLine;
- Link = Line->Link.ForwardLink;
- End = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
+ Line = FileBuffer.CurrentLine;
+ Link = Line->Link.ForwardLink;
+ End = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
//
// concatenate this line with previous line
@@ -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
@@ -1819,30 +1848,30 @@ FileBufferDoReturn ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- EFI_EDITOR_LINE *NewLine;
- UINTN FileColumn;
- UINTN Index;
- CHAR16 *Buffer;
- UINTN Row;
- UINTN Col;
+ EFI_EDITOR_LINE *Line;
+ EFI_EDITOR_LINE *NewLine;
+ UINTN FileColumn;
+ UINTN Index;
+ CHAR16 *Buffer;
+ UINTN Row;
+ UINTN Col;
FileBufferNeedRefresh = TRUE;
FileBufferOnlyLineNeedRefresh = FALSE;
- Line = FileBuffer.CurrentLine;
+ Line = FileBuffer.CurrentLine;
- FileColumn = FileBuffer.FilePosition.Column;
+ FileColumn = FileBuffer.FilePosition.Column;
- NewLine = AllocateZeroPool (sizeof (EFI_EDITOR_LINE));
+ NewLine = AllocateZeroPool (sizeof (EFI_EDITOR_LINE));
if (NewLine == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- NewLine->Signature = LINE_LIST_SIGNATURE;
- NewLine->Size = Line->Size - FileColumn + 1;
- NewLine->TotalSize = NewLine->Size;
- NewLine->Buffer = CatSPrint (NULL, L"\0");
+ NewLine->Signature = LINE_LIST_SIGNATURE;
+ NewLine->Size = Line->Size - FileColumn + 1;
+ NewLine->TotalSize = NewLine->Size;
+ NewLine->Buffer = CatSPrint (NULL, L"\0");
if (NewLine->Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -1868,11 +1897,12 @@ FileBufferDoReturn ( NewLine->Buffer[Index] = Line->Buffer[Index + FileColumn - 1];
}
- NewLine->Buffer[NewLine->Size] = CHAR_NULL;
+ NewLine->Buffer[NewLine->Size] = CHAR_NULL;
- Line->Buffer[FileColumn - 1] = CHAR_NULL;
- Line->Size = FileColumn - 1;
+ Line->Buffer[FileColumn - 1] = CHAR_NULL;
+ Line->Size = FileColumn - 1;
}
+
//
// increase NumLines
//
@@ -1881,10 +1911,10 @@ FileBufferDoReturn ( //
// insert it into the correct position of line list
//
- NewLine->Link.BackLink = &(Line->Link);
- NewLine->Link.ForwardLink = Line->Link.ForwardLink;
+ NewLine->Link.BackLink = &(Line->Link);
+ NewLine->Link.ForwardLink = Line->Link.ForwardLink;
Line->Link.ForwardLink->BackLink = &(NewLine->Link);
- Line->Link.ForwardLink = &(NewLine->Link);
+ Line->Link.ForwardLink = &(NewLine->Link);
//
// move cursor to the start of next line
@@ -1915,13 +1945,13 @@ FileBufferDoDelete ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- EFI_EDITOR_LINE *Next;
- LIST_ENTRY *Link;
- UINTN FileColumn;
+ EFI_EDITOR_LINE *Line;
+ EFI_EDITOR_LINE *Next;
+ LIST_ENTRY *Link;
+ UINTN FileColumn;
- Line = FileBuffer.CurrentLine;
- FileColumn = FileBuffer.FilePosition.Column;
+ Line = FileBuffer.CurrentLine;
+ FileColumn = FileBuffer.FilePosition.Column;
//
// the last column
@@ -1933,12 +1963,13 @@ FileBufferDoDelete ( if (Line->Link.ForwardLink == FileBuffer.ListHead) {
return EFI_SUCCESS;
}
+
//
// since last character,
// so will add the next line to this line
//
- Link = Line->Link.ForwardLink;
- Next = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
+ Link = Line->Link.ForwardLink;
+ Next = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
LineCat (Line, Next);
if (Line->Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -1951,7 +1982,6 @@ FileBufferDoDelete ( FileBufferNeedRefresh = TRUE;
FileBufferOnlyLineNeedRefresh = FALSE;
-
} else {
//
// just delete current character
@@ -1977,17 +2007,17 @@ FileBufferScrollRight ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- UINTN FRow;
- UINTN FCol;
+ EFI_EDITOR_LINE *Line;
+ UINTN FRow;
+ UINTN FCol;
Line = FileBuffer.CurrentLine;
if (Line->Buffer == NULL) {
return EFI_SUCCESS;
}
- FRow = FileBuffer.FilePosition.Row;
- FCol = FileBuffer.FilePosition.Column;
+ FRow = FileBuffer.FilePosition.Row;
+ FCol = FileBuffer.FilePosition.Column;
//
// if already at end of this line, scroll it to the start of next line
@@ -2039,7 +2069,7 @@ LineStrInsert ( Index = (StrSize) * 2;
- Str = Line->Buffer;
+ Str = Line->Buffer;
//
// do not have free space
@@ -2052,6 +2082,7 @@ LineStrInsert ( Line->TotalSize += 8;
}
+
//
// move the later part of the string one character right
//
@@ -2059,12 +2090,13 @@ LineStrInsert ( for (Index = StrSize; Index > Pos; Index--) {
TempStringPtr[Index] = TempStringPtr[Index - 1];
}
+
//
// insert char into it.
//
- TempStringPtr[Index] = Char;
+ TempStringPtr[Index] = Char;
- Line->Buffer = Str;
+ Line->Buffer = Str;
Line->Size++;
return StrSize + 1;
@@ -2082,8 +2114,8 @@ FileBufferAddChar ( IN CHAR16 Char
)
{
- EFI_EDITOR_LINE *Line;
- UINTN FilePos;
+ EFI_EDITOR_LINE *Line;
+ UINTN FilePos;
Line = FileBuffer.CurrentLine;
@@ -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
//
@@ -2126,7 +2159,7 @@ FileBufferAddChar ( **/
EFI_STATUS
FileBufferDoCharInput (
- IN CONST CHAR16 Char
+ IN CONST CHAR16 Char
)
{
EFI_STATUS Status;
@@ -2134,36 +2167,35 @@ FileBufferDoCharInput ( Status = EFI_SUCCESS;
switch (Char) {
- case CHAR_NULL:
- break;
+ case CHAR_NULL:
+ break;
- case CHAR_BACKSPACE:
- Status = FileBufferDoBackspace ();
- break;
+ case CHAR_BACKSPACE:
+ Status = FileBufferDoBackspace ();
+ break;
- case CHAR_TAB:
- //
- // Tabs are ignored
- //
- break;
-
- case CHAR_LINEFEED:
- case CHAR_CARRIAGE_RETURN:
- Status = FileBufferDoReturn ();
- break;
+ case CHAR_TAB:
+ //
+ // Tabs are ignored
+ //
+ break;
- default:
- //
- // DEAL WITH ASCII CHAR, filter out thing like ctrl+f
- //
- if (Char > 127 || Char < 32) {
- Status = StatusBarSetStatusString (L"Unknown Command");
- } else {
- Status = FileBufferAddChar (Char);
- }
+ case CHAR_LINEFEED:
+ case CHAR_CARRIAGE_RETURN:
+ Status = FileBufferDoReturn ();
+ break;
- break;
+ default:
+ //
+ // DEAL WITH ASCII CHAR, filter out thing like ctrl+f
+ //
+ if ((Char > 127) || (Char < 32)) {
+ Status = StatusBarSetStatusString (L"Unknown Command");
+ } else {
+ Status = FileBufferAddChar (Char);
+ }
+ break;
}
return Status;
@@ -2179,17 +2211,17 @@ FileBufferScrollDown ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- UINTN FRow;
- UINTN FCol;
+ EFI_EDITOR_LINE *Line;
+ UINTN FRow;
+ UINTN FCol;
Line = FileBuffer.CurrentLine;
if (Line->Buffer == NULL) {
return EFI_SUCCESS;
}
- FRow = FileBuffer.FilePosition.Row;
- FCol = FileBuffer.FilePosition.Column;
+ FRow = FileBuffer.FilePosition.Row;
+ FCol = FileBuffer.FilePosition.Column;
//
// has next line
@@ -2204,7 +2236,6 @@ FileBufferScrollDown ( if (FCol > Line->Size) {
FCol = Line->Size + 1;
}
-
} else {
return EFI_SUCCESS;
}
@@ -2224,14 +2255,14 @@ FileBufferScrollUp ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- UINTN FRow;
- UINTN FCol;
+ EFI_EDITOR_LINE *Line;
+ UINTN FRow;
+ UINTN FCol;
- Line = FileBuffer.CurrentLine;
+ Line = FileBuffer.CurrentLine;
- FRow = FileBuffer.FilePosition.Row;
- FCol = FileBuffer.FilePosition.Column;
+ FRow = FileBuffer.FilePosition.Row;
+ FCol = FileBuffer.FilePosition.Column;
//
// has previous line
@@ -2246,7 +2277,6 @@ FileBufferScrollUp ( if (FCol > Line->Size) {
FCol = Line->Size + 1;
}
-
} else {
return EFI_SUCCESS;
}
@@ -2266,15 +2296,15 @@ FileBufferPageDown ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- UINTN FRow;
- UINTN FCol;
- UINTN Gap;
+ EFI_EDITOR_LINE *Line;
+ UINTN FRow;
+ UINTN FCol;
+ UINTN Gap;
- Line = FileBuffer.CurrentLine;
+ Line = FileBuffer.CurrentLine;
- FRow = FileBuffer.FilePosition.Row;
- FCol = FileBuffer.FilePosition.Column;
+ FRow = FileBuffer.FilePosition.Row;
+ FCol = FileBuffer.FilePosition.Column;
//
// has next page
@@ -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;
}
@@ -2316,16 +2347,16 @@ FileBufferPageUp ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- UINTN FRow;
- UINTN FCol;
- UINTN Gap;
- INTN Retreat;
+ EFI_EDITOR_LINE *Line;
+ UINTN FRow;
+ UINTN FCol;
+ UINTN Gap;
+ INTN Retreat;
- Line = FileBuffer.CurrentLine;
+ Line = FileBuffer.CurrentLine;
- FRow = FileBuffer.FilePosition.Row;
- FCol = FileBuffer.FilePosition.Column;
+ FRow = FileBuffer.FilePosition.Row;
+ FCol = FileBuffer.FilePosition.Column;
//
// has previous page
@@ -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;
}
@@ -2371,13 +2402,13 @@ FileBufferEnd ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- UINTN FRow;
- UINTN FCol;
+ EFI_EDITOR_LINE *Line;
+ UINTN FRow;
+ UINTN FCol;
- Line = FileBuffer.CurrentLine;
+ Line = FileBuffer.CurrentLine;
- FRow = FileBuffer.FilePosition.Row;
+ FRow = FileBuffer.FilePosition.Row;
//
// goto the last column of the line
@@ -2405,7 +2436,7 @@ FileBufferEnd ( **/
EFI_STATUS
FileBufferHandleInput (
- IN CONST EFI_INPUT_KEY *Key
+ IN CONST EFI_INPUT_KEY *Key
)
{
EFI_STATUS Status;
@@ -2413,98 +2444,98 @@ FileBufferHandleInput ( Status = EFI_SUCCESS;
switch (Key->ScanCode) {
- //
- // ordinary key input
- //
- case SCAN_NULL:
- if (!FileBuffer.ReadOnly) {
- Status = FileBufferDoCharInput (Key->UnicodeChar);
- } else {
- Status = StatusBarSetStatusString (L"Read Only File Can Not Be Modified");
- }
+ //
+ // ordinary key input
+ //
+ case SCAN_NULL:
+ if (!FileBuffer.ReadOnly) {
+ Status = FileBufferDoCharInput (Key->UnicodeChar);
+ } else {
+ Status = StatusBarSetStatusString (L"Read Only File Can Not Be Modified");
+ }
- break;
+ break;
- //
- // up arrow
- //
- case SCAN_UP:
- Status = FileBufferScrollUp ();
- break;
+ //
+ // up arrow
+ //
+ case SCAN_UP:
+ Status = FileBufferScrollUp ();
+ break;
- //
- // down arrow
- //
- case SCAN_DOWN:
- Status = FileBufferScrollDown ();
- break;
+ //
+ // down arrow
+ //
+ case SCAN_DOWN:
+ Status = FileBufferScrollDown ();
+ break;
- //
- // right arrow
- //
- case SCAN_RIGHT:
- Status = FileBufferScrollRight ();
- break;
+ //
+ // right arrow
+ //
+ case SCAN_RIGHT:
+ Status = FileBufferScrollRight ();
+ break;
- //
- // left arrow
- //
- case SCAN_LEFT:
- Status = FileBufferScrollLeft ();
- break;
+ //
+ // left arrow
+ //
+ case SCAN_LEFT:
+ Status = FileBufferScrollLeft ();
+ break;
- //
- // page up
- //
- case SCAN_PAGE_UP:
- Status = FileBufferPageUp ();
- break;
+ //
+ // page up
+ //
+ case SCAN_PAGE_UP:
+ Status = FileBufferPageUp ();
+ break;
- //
- // page down
- //
- case SCAN_PAGE_DOWN:
- Status = FileBufferPageDown ();
- break;
+ //
+ // page down
+ //
+ case SCAN_PAGE_DOWN:
+ Status = FileBufferPageDown ();
+ break;
- //
- // delete
- //
- case SCAN_DELETE:
- if (!FileBuffer.ReadOnly) {
- Status = FileBufferDoDelete ();
- } else {
- Status = StatusBarSetStatusString (L"Read Only File Can Not Be Modified");
- }
+ //
+ // delete
+ //
+ case SCAN_DELETE:
+ if (!FileBuffer.ReadOnly) {
+ Status = FileBufferDoDelete ();
+ } else {
+ Status = StatusBarSetStatusString (L"Read Only File Can Not Be Modified");
+ }
- break;
+ break;
- //
- // home
- //
- case SCAN_HOME:
- FileBufferMovePosition (FileBuffer.FilePosition.Row, 1);
- Status = EFI_SUCCESS;
- break;
+ //
+ // home
+ //
+ case SCAN_HOME:
+ FileBufferMovePosition (FileBuffer.FilePosition.Row, 1);
+ Status = EFI_SUCCESS;
+ break;
- //
- // end
- //
- case SCAN_END:
- Status = FileBufferEnd ();
- break;
+ //
+ // end
+ //
+ case SCAN_END:
+ Status = FileBufferEnd ();
+ break;
- //
- // insert
- //
- case SCAN_INSERT:
- FileBuffer.ModeInsert = (BOOLEAN)!FileBuffer.ModeInsert;
- Status = EFI_SUCCESS;
- break;
+ //
+ // insert
+ //
+ case SCAN_INSERT:
+ FileBuffer.ModeInsert = (BOOLEAN) !FileBuffer.ModeInsert;
+ Status = EFI_SUCCESS;
+ break;
- default:
- Status = StatusBarSetStatusString (L"Unknown Command");
- break;
+ default:
+ Status = StatusBarSetStatusString (L"Unknown Command");
+ break;
}
return Status;
@@ -2520,7 +2551,7 @@ FileBufferHandleInput ( **/
BOOLEAN
AboveCurrentScreen (
- IN UINTN FileRow
+ IN UINTN FileRow
)
{
//
@@ -2543,7 +2574,7 @@ AboveCurrentScreen ( **/
BOOLEAN
UnderCurrentScreen (
- IN UINTN FileRow
+ IN UINTN FileRow
)
{
//
@@ -2566,7 +2597,7 @@ UnderCurrentScreen ( **/
BOOLEAN
LeftCurrentScreen (
- IN UINTN FileCol
+ IN UINTN FileCol
)
{
//
@@ -2589,7 +2620,7 @@ LeftCurrentScreen ( **/
BOOLEAN
RightCurrentScreen (
- IN UINTN FileCol
+ IN UINTN FileCol
)
{
//
@@ -2614,17 +2645,17 @@ RightCurrentScreen ( **/
EFI_EDITOR_LINE *
MoveCurrentLine (
- IN INTN Count
+ IN INTN Count
)
{
- EFI_EDITOR_LINE *Line;
- UINTN AbsCount;
+ EFI_EDITOR_LINE *Line;
+ 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) {
@@ -2644,26 +2675,26 @@ MoveCurrentLine ( **/
VOID
FileBufferMovePosition (
- IN CONST UINTN NewFilePosRow,
- IN CONST UINTN NewFilePosCol
+ IN CONST UINTN NewFilePosRow,
+ IN CONST UINTN NewFilePosCol
)
{
- INTN RowGap;
- INTN ColGap;
- UINTN Abs;
- BOOLEAN Above;
- BOOLEAN Under;
- BOOLEAN Right;
- BOOLEAN Left;
+ INTN RowGap;
+ INTN ColGap;
+ UINTN Abs;
+ BOOLEAN Above;
+ BOOLEAN Under;
+ BOOLEAN Right;
+ BOOLEAN Left;
//
// CALCULATE gap between current file position and new file position
//
- RowGap = NewFilePosRow - FileBuffer.FilePosition.Row;
- ColGap = NewFilePosCol - FileBuffer.FilePosition.Column;
+ RowGap = NewFilePosRow - FileBuffer.FilePosition.Row;
+ ColGap = NewFilePosCol - FileBuffer.FilePosition.Column;
- Under = UnderCurrentScreen (NewFilePosRow);
- Above = AboveCurrentScreen (NewFilePosRow);
+ Under = UnderCurrentScreen (NewFilePosRow);
+ Above = AboveCurrentScreen (NewFilePosRow);
//
// if is below current screen
//
@@ -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;
@@ -2698,10 +2729,10 @@ FileBufferMovePosition ( }
}
- FileBuffer.LowVisibleRange.Row = FileBuffer.FilePosition.Row - (FileBuffer.DisplayPosition.Row - 2);
+ FileBuffer.LowVisibleRange.Row = FileBuffer.FilePosition.Row - (FileBuffer.DisplayPosition.Row - 2);
Right = RightCurrentScreen (NewFilePosCol);
- Left = LeftCurrentScreen (NewFilePosCol);
+ Left = LeftCurrentScreen (NewFilePosCol);
//
// if right to current screen
@@ -2730,7 +2761,7 @@ FileBufferMovePosition ( //
FileBuffer.FilePosition.Column = NewFilePosCol;
if (ColGap < 0) {
- Abs = (UINTN)(-ColGap);
+ Abs = (UINTN)(-ColGap);
FileBuffer.DisplayPosition.Column -= Abs;
} else {
FileBuffer.DisplayPosition.Column += ColGap;
@@ -2744,7 +2775,6 @@ FileBufferMovePosition ( // let CurrentLine point to correct line;
//
FileBuffer.CurrentLine = MoveCurrentLine (RowGap);
-
}
/**
@@ -2759,15 +2789,15 @@ FileBufferMovePosition ( **/
EFI_STATUS
FileBufferCutLine (
- OUT EFI_EDITOR_LINE **CutLine
+ OUT EFI_EDITOR_LINE **CutLine
)
{
- EFI_EDITOR_LINE *Line;
- EFI_EDITOR_LINE *NewLine;
- UINTN Row;
- UINTN Col;
+ EFI_EDITOR_LINE *Line;
+ EFI_EDITOR_LINE *NewLine;
+ UINTN Row;
+ UINTN Col;
- *CutLine = NULL;
+ *CutLine = NULL;
if (FileBuffer.ReadOnly) {
StatusBarSetStatusString (L"Read Only File Can Not Be Modified");
@@ -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
- //
- // last line
- //
- ) {
+ 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
//
@@ -2811,11 +2843,11 @@ FileBufferCutLine ( // move home
//
FileBuffer.CurrentLine = CR (
- FileBuffer.CurrentLine->Link.ForwardLink,
- EFI_EDITOR_LINE,
- Link,
- LINE_LIST_SIGNATURE
- );
+ FileBuffer.CurrentLine->Link.ForwardLink,
+ EFI_EDITOR_LINE,
+ Link,
+ LINE_LIST_SIGNATURE
+ );
RemoveEntryList (&Line->Link);
@@ -2827,7 +2859,7 @@ FileBufferCutLine ( FileBufferNeedRefresh = TRUE;
FileBufferOnlyLineNeedRefresh = FALSE;
- *CutLine = Line;
+ *CutLine = Line;
return EFI_SUCCESS;
}
@@ -2843,10 +2875,10 @@ FileBufferPasteLine ( VOID
)
{
- EFI_EDITOR_LINE *Line;
- EFI_EDITOR_LINE *NewLine;
- UINTN Row;
- UINTN Col;
+ EFI_EDITOR_LINE *Line;
+ EFI_EDITOR_LINE *NewLine;
+ UINTN Row;
+ UINTN Col;
//
// if nothing is on clip board
@@ -2855,6 +2887,7 @@ FileBufferPasteLine ( if (MainEditor.CutLine == NULL) {
return EFI_SUCCESS;
}
+
//
// read only file can not be pasted on
//
@@ -2867,22 +2900,23 @@ FileBufferPasteLine ( if (NewLine == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// insert it above current line
//
- Line = FileBuffer.CurrentLine;
- NewLine->Link.BackLink = Line->Link.BackLink;
- NewLine->Link.ForwardLink = &Line->Link;
+ Line = FileBuffer.CurrentLine;
+ NewLine->Link.BackLink = Line->Link.BackLink;
+ NewLine->Link.ForwardLink = &Line->Link;
Line->Link.BackLink->ForwardLink = &NewLine->Link;
- Line->Link.BackLink = &NewLine->Link;
+ Line->Link.BackLink = &NewLine->Link;
FileBuffer.NumLines++;
- FileBuffer.CurrentLine = NewLine;
+ FileBuffer.CurrentLine = NewLine;
- FileBuffer.Lines = CR (FileBuffer.ListHead->ForwardLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
+ FileBuffer.Lines = CR (FileBuffer.ListHead->ForwardLink, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
- Col = 1;
+ Col = 1;
//
// move home
//
@@ -2912,19 +2946,19 @@ FileBufferPasteLine ( EFI_STATUS
FileBufferSearch (
IN CONST CHAR16 *Str,
- IN CONST UINTN Offset
+ IN CONST UINTN Offset
)
{
- CHAR16 *Current;
- UINTN Position;
- UINTN Row;
- UINTN Column;
- EFI_EDITOR_LINE *Line;
- CHAR16 *CharPos;
- LIST_ENTRY *Link;
- BOOLEAN Found;
-
- Column = 0;
+ CHAR16 *Current;
+ UINTN Position;
+ UINTN Row;
+ UINTN Column;
+ EFI_EDITOR_LINE *Line;
+ CHAR16 *CharPos;
+ LIST_ENTRY *Link;
+ BOOLEAN Found;
+
+ Column = 0;
Position = 0;
//
@@ -2941,32 +2975,32 @@ FileBufferSearch ( Found = FALSE;
- CharPos = StrStr (Current, Str);
+ CharPos = StrStr (Current, Str);
if (CharPos != NULL) {
Position = CharPos - Current + 1;
- Found = TRUE;
+ Found = TRUE;
}
//
// found
//
if (Found) {
- Column = (Position - 1) + FileBuffer.FilePosition.Column + Offset;
- Row = FileBuffer.FilePosition.Row;
+ Column = (Position - 1) + FileBuffer.FilePosition.Column + Offset;
+ Row = FileBuffer.FilePosition.Row;
} else {
//
// not found so find through next lines
//
- Link = FileBuffer.CurrentLine->Link.ForwardLink;
+ Link = FileBuffer.CurrentLine->Link.ForwardLink;
- Row = FileBuffer.FilePosition.Row + 1;
+ Row = FileBuffer.FilePosition.Row + 1;
while (Link != FileBuffer.ListHead) {
- Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
-// Position = StrStr (Line->Buffer, Str);
- CharPos = StrStr (Line->Buffer, Str);
+ Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
+ // Position = StrStr (Line->Buffer, Str);
+ CharPos = StrStr (Line->Buffer, Str);
if (CharPos != NULL) {
Position = CharPos - Line->Buffer + 1;
- Found = TRUE;
+ Found = TRUE;
}
if (Found) {
@@ -3016,8 +3050,8 @@ FileBufferSearch ( **/
EFI_STATUS
FileBufferReplace (
- IN CONST CHAR16 *Replace,
- IN CONST UINTN SearchLen
+ IN CONST CHAR16 *Replace,
+ IN CONST UINTN SearchLen
)
{
UINTN ReplaceLen;
@@ -3027,9 +3061,9 @@ FileBufferReplace ( UINTN OldSize;
UINTN Gap;
- ReplaceLen = StrLen (Replace);
+ ReplaceLen = StrLen (Replace);
- OldSize = FileBuffer.CurrentLine->Size + 1;
+ OldSize = FileBuffer.CurrentLine->Size + 1;
//
// include CHAR_NULL
//
@@ -3041,21 +3075,22 @@ FileBufferReplace ( //
if (FileBuffer.CurrentLine->TotalSize + 1 <= NewSize) {
FileBuffer.CurrentLine->Buffer = ReallocatePool (
- 2 * OldSize,
- 2 * NewSize,
- FileBuffer.CurrentLine->Buffer
- );
+ 2 * OldSize,
+ 2 * NewSize,
+ FileBuffer.CurrentLine->Buffer
+ );
FileBuffer.CurrentLine->TotalSize = NewSize - 1;
}
if (FileBuffer.CurrentLine->Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// the end CHAR_NULL character;
//
- Buffer = FileBuffer.CurrentLine->Buffer + (NewSize - 1);
- Gap = ReplaceLen - SearchLen;
+ Buffer = FileBuffer.CurrentLine->Buffer + (NewSize - 1);
+ Gap = ReplaceLen - SearchLen;
//
// keep the latter part
@@ -3064,6 +3099,7 @@ FileBufferReplace ( *Buffer = *(Buffer - Gap);
Buffer--;
}
+
//
// set replace into it
//
@@ -3081,7 +3117,7 @@ FileBufferReplace ( }
Buffer += ReplaceLen;
- Gap = SearchLen - ReplaceLen;
+ Gap = SearchLen - ReplaceLen;
//
// set replace into it
@@ -3103,7 +3139,7 @@ FileBufferReplace ( FileBufferOnlyLineNeedRefresh = TRUE;
- FileBuffer.FileModified = TRUE;
+ FileBuffer.FileModified = TRUE;
MainTitleBarRefresh (MainEditor.FileBuffer->FileName, MainEditor.FileBuffer->FileType, MainEditor.FileBuffer->ReadOnly, MainEditor.FileBuffer->FileModified, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row, 0, 0);
FileBufferRestorePosition ();
@@ -3120,14 +3156,14 @@ FileBufferReplace ( **/
VOID
FileBufferAdjustMousePosition (
- IN CONST INT32 TextX,
- IN CONST INT32 TextY
+ IN CONST INT32 TextX,
+ IN CONST INT32 TextY
)
{
- UINTN CoordinateX;
- UINTN CoordinateY;
- UINTN AbsX;
- UINTN AbsY;
+ UINTN CoordinateX;
+ UINTN CoordinateY;
+ UINTN AbsX;
+ UINTN AbsY;
//
// TextX and TextY is mouse movement data returned by mouse driver
@@ -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);
}
-
}
/**
@@ -3196,28 +3233,28 @@ FileBufferAdjustMousePosition ( **/
EFI_STATUS
FileBufferReplaceAll (
- IN CHAR16 *SearchStr,
- IN CHAR16 *ReplaceStr,
- IN UINTN Offset
+ IN CHAR16 *SearchStr,
+ IN CHAR16 *ReplaceStr,
+ IN UINTN Offset
)
{
- CHAR16 *Buffer;
- UINTN Position;
- UINTN Column;
- UINTN ReplaceLen;
- UINTN SearchLen;
- UINTN Index;
- UINTN NewSize;
- UINTN OldSize;
- UINTN Gap;
- EFI_EDITOR_LINE *Line;
- LIST_ENTRY *Link;
- CHAR16 *CharPos;
-
- SearchLen = StrLen (SearchStr);
- ReplaceLen = StrLen (ReplaceStr);
-
- Column = FileBuffer.FilePosition.Column + Offset - 1;
+ CHAR16 *Buffer;
+ UINTN Position;
+ UINTN Column;
+ UINTN ReplaceLen;
+ UINTN SearchLen;
+ UINTN Index;
+ UINTN NewSize;
+ UINTN OldSize;
+ UINTN Gap;
+ EFI_EDITOR_LINE *Line;
+ LIST_ENTRY *Link;
+ CHAR16 *CharPos;
+
+ SearchLen = StrLen (SearchStr);
+ ReplaceLen = StrLen (ReplaceStr);
+
+ Column = FileBuffer.FilePosition.Column + Offset - 1;
if (Column > FileBuffer.CurrentLine->Size) {
Column = FileBuffer.CurrentLine->Size;
@@ -3226,8 +3263,8 @@ FileBufferReplaceAll ( Link = &(FileBuffer.CurrentLine->Link);
while (Link != FileBuffer.ListHead) {
- Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
- CharPos = StrStr (Line->Buffer + Column, SearchStr);
+ Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
+ CharPos = StrStr (Line->Buffer + Column, SearchStr);
if (CharPos != NULL) {
Position = CharPos - Line->Buffer;// + Column;
//
@@ -3245,21 +3282,22 @@ FileBufferReplaceAll ( //
if (Line->TotalSize + 1 <= NewSize) {
Line->Buffer = ReallocatePool (
- 2 * OldSize,
- 2 * NewSize,
- Line->Buffer
- );
+ 2 * OldSize,
+ 2 * NewSize,
+ Line->Buffer
+ );
Line->TotalSize = NewSize - 1;
}
if (Line->Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// the end CHAR_NULL character;
//
- Buffer = Line->Buffer + (NewSize - 1);
- Gap = ReplaceLen - SearchLen;
+ Buffer = Line->Buffer + (NewSize - 1);
+ Gap = ReplaceLen - SearchLen;
//
// keep the latter part
@@ -3268,18 +3306,18 @@ FileBufferReplaceAll ( *Buffer = *(Buffer - Gap);
Buffer--;
}
-
- } else if (ReplaceLen < SearchLen){
- Buffer = Line->Buffer + Position + ReplaceLen;
- Gap = SearchLen - ReplaceLen;
+ } else if (ReplaceLen < SearchLen) {
+ Buffer = Line->Buffer + Position + ReplaceLen;
+ Gap = SearchLen - ReplaceLen;
for (Index = 0; Index < (Line->Size - Position - ReplaceLen + 1); Index++) {
*Buffer = *(Buffer + Gap);
Buffer++;
}
} else {
- ASSERT(ReplaceLen == SearchLen);
+ ASSERT (ReplaceLen == SearchLen);
}
+
//
// set replace into it
//
@@ -3289,15 +3327,16 @@ FileBufferReplaceAll ( }
Line->Size += (ReplaceLen - SearchLen);
- Column += ReplaceLen;
+ Column += ReplaceLen;
} else {
//
// not found
//
- Column = 0;
- Link = Link->ForwardLink;
+ Column = 0;
+ Link = Link->ForwardLink;
}
}
+
//
// call refresh to fresh edit area
//
@@ -3318,4 +3357,3 @@ FileBufferSetModified ( {
FileBuffer.FileModified = TRUE;
}
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h index 6800e4be3d..7a33269eee 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h @@ -60,7 +60,7 @@ FileBufferRefresh ( **/
EFI_STATUS
FileBufferHandleInput (
- IN CONST EFI_INPUT_KEY * Key
+ IN CONST EFI_INPUT_KEY *Key
);
/**
@@ -99,7 +99,7 @@ FileBufferRestorePosition ( **/
EFI_STATUS
FileBufferSetFileName (
- IN CONST CHAR16 *Str
+ IN CONST CHAR16 *Str
);
/**
@@ -115,8 +115,8 @@ FileBufferSetFileName ( **/
EFI_STATUS
FileBufferRead (
- IN CONST CHAR16 *FileName,
- IN CONST BOOLEAN Recover
+ IN CONST CHAR16 *FileName,
+ IN CONST BOOLEAN Recover
);
/**
@@ -130,7 +130,7 @@ FileBufferRead ( **/
EFI_STATUS
FileBufferSave (
- CONST CHAR16 *FileName
+ CONST CHAR16 *FileName
);
/**
@@ -141,8 +141,8 @@ FileBufferSave ( **/
VOID
FileBufferMovePosition (
- IN CONST UINTN NewFilePosRow,
- IN CONST UINTN NewFilePosCol
+ IN CONST UINTN NewFilePosRow,
+ IN CONST UINTN NewFilePosCol
);
/**
@@ -157,7 +157,7 @@ FileBufferMovePosition ( **/
EFI_STATUS
FileBufferCutLine (
- OUT EFI_EDITOR_LINE **CutLine
+ OUT EFI_EDITOR_LINE **CutLine
);
/**
@@ -183,7 +183,7 @@ FileBufferPasteLine ( EFI_STATUS
FileBufferSearch (
IN CONST CHAR16 *Str,
- IN CONST UINTN Offset
+ IN CONST UINTN Offset
);
/**
@@ -199,8 +199,8 @@ FileBufferSearch ( **/
EFI_STATUS
FileBufferReplace (
- IN CONST CHAR16 *Replace,
- IN CONST UINTN SearchLen
+ IN CONST CHAR16 *Replace,
+ IN CONST UINTN SearchLen
);
/**
@@ -212,9 +212,9 @@ FileBufferReplace ( **/
EFI_STATUS
FileBufferReplaceAll (
- IN CHAR16 *SearchStr,
- IN CHAR16 *ReplaceStr,
- IN UINTN Offset
+ IN CHAR16 *SearchStr,
+ IN CHAR16 *ReplaceStr,
+ IN UINTN Offset
);
/**
@@ -225,8 +225,8 @@ FileBufferReplaceAll ( **/
VOID
FileBufferAdjustMousePosition (
- IN CONST INT32 TextX,
- IN CONST INT32 TextY
+ IN CONST INT32 TextX,
+ IN CONST INT32 TextY
);
/**
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c index a9423e0d10..58beaaf9c5 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c @@ -14,27 +14,26 @@ //
// the first time editor launch
//
-BOOLEAN EditorFirst;
+BOOLEAN EditorFirst;
//
// it's time editor should exit
//
-BOOLEAN EditorExit;
+BOOLEAN EditorExit;
-BOOLEAN EditorMouseAction;
+BOOLEAN EditorMouseAction;
-extern EFI_EDITOR_FILE_BUFFER FileBuffer;
+extern EFI_EDITOR_FILE_BUFFER FileBuffer;
-extern BOOLEAN FileBufferNeedRefresh;
+extern BOOLEAN FileBufferNeedRefresh;
-extern BOOLEAN FileBufferOnlyLineNeedRefresh;
+extern BOOLEAN FileBufferOnlyLineNeedRefresh;
-extern BOOLEAN FileBufferMouseNeedRefresh;
+extern BOOLEAN FileBufferMouseNeedRefresh;
-extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar;
-
-EFI_EDITOR_GLOBAL_EDITOR MainEditor;
+extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar;
+EFI_EDITOR_GLOBAL_EDITOR MainEditor;
/**
Load a file from disk to editor
@@ -155,33 +154,33 @@ 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[] = {
+MENU_ITEM_FUNCTION MainControlBasedMenuFunctions[] = {
NULL,
NULL, /* Ctrl - A */
NULL, /* Ctrl - B */
@@ -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,36 +344,37 @@ MainCommandOpenFile ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- //
- // want to save this file first
- //
- Status = FileBufferSave (MainEditor.FileBuffer->FileName);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ //
+ // want to save this file first
+ //
+ Status = FileBufferSave (MainEditor.FileBuffer->FileName);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- MainTitleBarRefresh (MainEditor.FileBuffer->FileName, MainEditor.FileBuffer->FileType, MainEditor.FileBuffer->ReadOnly, MainEditor.FileBuffer->FileModified, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row, 0, 0);
- FileBufferRestorePosition ();
- Done = TRUE;
- break;
+ MainTitleBarRefresh (MainEditor.FileBuffer->FileName, MainEditor.FileBuffer->FileType, MainEditor.FileBuffer->ReadOnly, MainEditor.FileBuffer->FileModified, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row, 0, 0);
+ FileBufferRestorePosition ();
+ Done = TRUE;
+ break;
- case L'n':
- case L'N':
- //
- // the file won't be saved
- //
- Done = TRUE;
- break;
+ case L'n':
+ case L'N':
+ //
+ // the file won't be saved
+ //
+ Done = TRUE;
+ break;
- case L'c':
- case L'C':
- return EFI_SUCCESS;
+ case L'c':
+ case L'C':
+ return EFI_SUCCESS;
}
}
}
+
//
// 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);
@@ -472,8 +474,8 @@ MainCommandCutLine ( VOID
)
{
- EFI_STATUS Status;
- EFI_EDITOR_LINE *Line;
+ EFI_STATUS Status;
+ EFI_EDITOR_LINE *Line;
//
// This command will cut current line ( where cursor is on ) to clip board.
@@ -483,7 +485,7 @@ MainCommandCutLine ( // IF cursor is not on valid line, an Status String will be prompted :
// "Nothing to Cut".
//
- Line = NULL;
+ Line = NULL;
Status = FileBufferCutLine (&Line);
if (Status == EFI_NOT_FOUND) {
return EFI_SUCCESS;
@@ -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,29 +643,30 @@ MainCommandSearch ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- Done = TRUE;
- break;
-
- case L'n':
- case L'N':
- FreePool (Buffer);
- return EFI_SUCCESS;
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ Done = TRUE;
+ break;
+ case L'n':
+ 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,16 +787,16 @@ 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;
}
- ReplaceLen = StrLen (Replace);
+ ReplaceLen = StrLen (Replace);
- First = TRUE;
- ReplaceAll = FALSE;
+ First = TRUE;
+ ReplaceAll = FALSE;
do {
//
// since search may be continued to search multiple times
@@ -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,37 +854,38 @@ MainCommandSearchReplace ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- Done = TRUE;
- ReplaceOption = TRUE;
- break;
-
- case L'n':
- case L'N':
- Done = TRUE;
- ReplaceOption = FALSE;
- break;
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ Done = TRUE;
+ ReplaceOption = TRUE;
+ break;
- case L'a':
- case L'A':
- Done = TRUE;
- ReplaceOption = TRUE;
- ReplaceAll = TRUE;
- break;
+ case L'n':
+ case L'N':
+ Done = TRUE;
+ ReplaceOption = FALSE;
+ break;
- case L'c':
- case L'C':
- FreePool (Search);
- FreePool (Replace);
- return EFI_SUCCESS;
+ case L'a':
+ case L'A':
+ Done = TRUE;
+ ReplaceOption = TRUE;
+ ReplaceAll = TRUE;
+ break;
+ case L'c':
+ case L'C':
+ 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,29 +951,30 @@ MainCommandSearchReplace ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- Done = TRUE;
- break;
-
- case L'n':
- case L'N':
- FreePool (Search);
- FreePool (Replace);
- return EFI_SUCCESS;
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ Done = TRUE;
+ break;
+ case L'n':
+ case L'N':
+ 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,35 +1037,33 @@ MainCommandExit ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- //
- // write file back to disk
- //
- Status = FileBufferSave (MainEditor.FileBuffer->FileName);
- if (!EFI_ERROR (Status)) {
- EditorExit = TRUE;
- }
-
- return Status;
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ //
+ // write file back to disk
+ //
+ Status = FileBufferSave (MainEditor.FileBuffer->FileName);
+ if (!EFI_ERROR (Status)) {
+ EditorExit = TRUE;
+ }
- case L'n':
- case L'N':
- EditorExit = TRUE;
- return EFI_SUCCESS;
+ return Status;
- case L'c':
- case L'C':
- return EFI_SUCCESS;
+ case L'n':
+ case L'N':
+ EditorExit = TRUE;
+ return EFI_SUCCESS;
+ 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
//
@@ -1140,12 +1152,12 @@ MainCommandSaveFile ( VOID
)
{
- EFI_STATUS Status;
- CHAR16 *FileName;
- BOOLEAN OldFile;
- CHAR16 *Str;
- SHELL_FILE_HANDLE FileHandle;
- EFI_FILE_INFO *Info;
+ EFI_STATUS Status;
+ CHAR16 *FileName;
+ BOOLEAN OldFile;
+ CHAR16 *Str;
+ SHELL_FILE_HANDLE FileHandle;
+ EFI_FILE_INFO *Info;
//
// This command will save currently opened file to disk.
@@ -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,17 +1331,17 @@ MainCommandSaveFile ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- break;
-
- case L'n':
- case L'N':
- case L'c':
- case L'C':
- SHELL_FREE_NON_NULL (FileName);
- return EFI_SUCCESS;
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ break;
+
+ case L'n':
+ case L'N':
+ case L'c':
+ case L'C':
+ SHELL_FREE_NON_NULL (FileName);
+ return EFI_SUCCESS;
} // end switch
} // while (!done)
} // file does exist
@@ -1337,7 +1350,7 @@ MainCommandSaveFile ( //
// save file to disk with specified name
//
- FileBufferSetModified();
+ FileBufferSetModified ();
Status = FileBufferSave (FileName);
SHELL_FREE_NON_NULL (FileName);
@@ -1354,17 +1367,17 @@ MainCommandDisplayHelp ( VOID
)
{
- INT32 CurrentLine;
- CHAR16 *InfoString;
- EFI_KEY_DATA KeyData;
- EFI_STATUS Status;
- UINTN EventIndex;
+ INT32 CurrentLine;
+ CHAR16 *InfoString;
+ EFI_KEY_DATA KeyData;
+ EFI_STATUS Status;
+ UINTN EventIndex;
//
// 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,28 +1418,28 @@ MainCommandDisplayHelp ( }
}
}
+
//
// update screen with file buffer's info
//
FileBufferRestorePosition ();
- FileBufferNeedRefresh = TRUE;
+ FileBufferNeedRefresh = TRUE;
FileBufferOnlyLineNeedRefresh = FALSE;
FileBufferRefresh ();
return EFI_SUCCESS;
}
-EFI_EDITOR_COLOR_ATTRIBUTES OriginalColors;
-INTN OriginalMode;
-
+EFI_EDITOR_COLOR_ATTRIBUTES OriginalColors;
+INTN OriginalMode;
//
// basic initialization for MainEditor
//
-EFI_EDITOR_GLOBAL_EDITOR MainEditorConst = {
+EFI_EDITOR_GLOBAL_EDITOR MainEditorConst = {
&FileBuffer,
{
- {0, 0}
+ { 0, 0}
},
{
0,
@@ -1459,10 +1475,10 @@ MainEditorInit ( //
// set screen attributes
//
- MainEditor.ColorAttributes.Colors.Foreground = gST->ConOut->Mode->Attribute & 0x000000ff;
+ MainEditor.ColorAttributes.Colors.Foreground = gST->ConOut->Mode->Attribute & 0x000000ff;
- MainEditor.ColorAttributes.Colors.Background = (UINT8) (gST->ConOut->Mode->Attribute >> 4);
- OriginalColors = MainEditor.ColorAttributes.Colors;
+ MainEditor.ColorAttributes.Colors.Background = (UINT8)(gST->ConOut->Mode->Attribute >> 4);
+ OriginalColors = MainEditor.ColorAttributes.Colors;
OriginalMode = gST->ConOut->Mode->Mode;
@@ -1470,21 +1486,21 @@ MainEditorInit ( // query screen size
//
gST->ConOut->QueryMode (
- gST->ConOut,
- gST->ConOut->Mode->Mode,
- &(MainEditor.ScreenSize.Column),
- &(MainEditor.ScreenSize.Row)
- );
+ gST->ConOut,
+ gST->ConOut->Mode->Mode,
+ &(MainEditor.ScreenSize.Column),
+ &(MainEditor.ScreenSize.Row)
+ );
//
// Find TextInEx in System Table ConsoleInHandle
// Per UEFI Spec, TextInEx is required for a console capable platform.
//
Status = gBS->HandleProtocol (
- gST->ConsoleInHandle,
- &gEfiSimpleTextInputExProtocolGuid,
- (VOID**)&MainEditor.TextInputEx
- );
+ gST->ConsoleInHandle,
+ &gEfiSimpleTextInputExProtocolGuid,
+ (VOID **)&MainEditor.TextInputEx
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1493,47 +1509,48 @@ MainEditorInit ( // Find mouse in System Table ConsoleInHandle
//
Status = gBS->HandleProtocol (
- gST->ConsoleInHandle,
- &gEfiSimplePointerProtocolGuid,
- (VOID**)&MainEditor.MouseInterface
- );
+ gST->ConsoleInHandle,
+ &gEfiSimplePointerProtocolGuid,
+ (VOID **)&MainEditor.MouseInterface
+ );
if (EFI_ERROR (Status)) {
//
// If there is no Simple Pointer Protocol on System Table
//
- HandleBuffer = NULL;
+ HandleBuffer = NULL;
MainEditor.MouseInterface = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimplePointerProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (!EFI_ERROR (Status) && HandleCount > 0) {
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimplePointerProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ if (!EFI_ERROR (Status) && (HandleCount > 0)) {
//
// Try to find the first available mouse device
//
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiSimplePointerProtocolGuid,
- (VOID**)&MainEditor.MouseInterface
- );
+ HandleBuffer[Index],
+ &gEfiSimplePointerProtocolGuid,
+ (VOID **)&MainEditor.MouseInterface
+ );
if (!EFI_ERROR (Status)) {
break;
}
}
}
+
if (HandleBuffer != NULL) {
FreePool (HandleBuffer);
}
}
- if (!EFI_ERROR (Status) && MainEditor.MouseInterface != NULL) {
- MainEditor.MouseAccumulatorX = 0;
- MainEditor.MouseAccumulatorY = 0;
- MainEditor.MouseSupported = TRUE;
+ 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,28 +1617,30 @@ 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
//
gST->ConOut->SetAttribute (
- gST->ConOut,
- EFI_TEXT_ATTR (OriginalColors.Foreground, OriginalColors.Background)
- );
+ gST->ConOut,
+ EFI_TEXT_ATTR (OriginalColors.Foreground, OriginalColors.Background)
+ );
gST->ConOut->ClearScreen (gST->ConOut);
@@ -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 ();
}
@@ -1684,15 +1704,15 @@ MainEditorRefresh ( **/
INT32
GetTextX (
- IN INT32 GuidX
+ IN INT32 GuidX
)
{
- INT32 Gap;
+ 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;
}
@@ -1705,15 +1725,15 @@ GetTextX ( **/
INT32
GetTextY (
- IN INT32 GuidY
+ IN INT32 GuidY
)
{
- INT32 Gap;
+ 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;
}
@@ -1728,20 +1748,19 @@ GetTextY ( **/
EFI_STATUS
MainEditorHandleMouseInput (
- IN EFI_SIMPLE_POINTER_STATE MouseState
+ IN EFI_SIMPLE_POINTER_STATE MouseState
)
{
+ INT32 TextX;
+ INT32 TextY;
+ UINTN FRow;
+ UINTN FCol;
- INT32 TextX;
- INT32 TextY;
- UINTN FRow;
- UINTN FCol;
-
- LIST_ENTRY *Link;
- EFI_EDITOR_LINE *Line;
+ LIST_ENTRY *Link;
+ EFI_EDITOR_LINE *Line;
- UINTN Index;
- BOOLEAN Action;
+ UINTN Index;
+ BOOLEAN Action;
//
// mouse action means:
@@ -1763,19 +1782,17 @@ 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 +
- MainEditor.FileBuffer->MousePosition.Row -
- MainEditor.FileBuffer->DisplayPosition.Row;
+ MainEditor.FileBuffer->MousePosition.Row -
+ MainEditor.FileBuffer->DisplayPosition.Row;
//
// beyond the file line length
@@ -1800,12 +1817,13 @@ MainEditorHandleMouseInput ( FileBufferMovePosition (FRow, FCol);
- MainEditor.FileBuffer->MousePosition.Row = MainEditor.FileBuffer->DisplayPosition.Row;
+ MainEditor.FileBuffer->MousePosition.Row = MainEditor.FileBuffer->DisplayPosition.Row;
MainEditor.FileBuffer->MousePosition.Column = MainEditor.FileBuffer->DisplayPosition.Column;
Action = TRUE;
}
+
//
// mouse has action
//
@@ -1837,7 +1855,6 @@ MainEditorKeyInput ( BOOLEAN NoShiftState;
do {
-
Status = EFI_SUCCESS;
EditorMouseAction = FALSE;
@@ -1857,12 +1874,11 @@ MainEditorKeyInput ( &MouseState
);
if (!EFI_ERROR (Status)) {
-
Status = MainEditorHandleMouseInput (MouseState);
if (!EFI_ERROR (Status)) {
- EditorMouseAction = TRUE;
- FileBufferMouseNeedRefresh = TRUE;
+ EditorMouseAction = TRUE;
+ FileBufferMouseNeedRefresh = TRUE;
} else if (Status == EFI_LOAD_ERROR) {
StatusBarSetStatusString (L"Invalid Mouse Movement ");
}
@@ -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;
@@ -1934,7 +1949,7 @@ MainEditorKeyInput ( **/
EFI_STATUS
MainEditorSetCutLine (
- EFI_EDITOR_LINE *Line
+ EFI_EDITOR_LINE *Line
)
{
if (Line == NULL) {
@@ -1947,6 +1962,7 @@ MainEditorSetCutLine ( //
LineFree (MainEditor.CutLine);
}
+
//
// duplicate the line to clipboard
//
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c index db18010e45..fc77fe4068 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.c @@ -19,10 +19,10 @@ **/
EFI_EDITOR_LINE *
LineDup (
- IN EFI_EDITOR_LINE *Src
+ IN EFI_EDITOR_LINE *Src
)
{
- EFI_EDITOR_LINE *Dest;
+ EFI_EDITOR_LINE *Dest;
//
// allocate for the line structure
@@ -31,6 +31,7 @@ LineDup ( if (Dest == NULL) {
return NULL;
}
+
//
// allocate and set the line buffer
//
@@ -59,26 +60,16 @@ LineDup ( **/
VOID
LineFree (
- IN EFI_EDITOR_LINE *Src
+ IN EFI_EDITOR_LINE *Src
)
{
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);
-
}
-
-
-
-
-
-
-
-
-
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.h index 1a4cdd7b18..c3abb47576 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/Misc.h @@ -11,8 +11,6 @@ #include "TextEditorTypes.h"
-
-
/**
Free a EFI_EDITOR_LINE structure.
@@ -20,7 +18,7 @@ **/
VOID
LineFree (
- IN EFI_EDITOR_LINE *Src
+ IN EFI_EDITOR_LINE *Src
);
/**
@@ -33,12 +31,7 @@ LineFree ( **/
EFI_EDITOR_LINE *
LineDup (
- IN EFI_EDITOR_LINE *Src
+ IN EFI_EDITOR_LINE *Src
);
-
-
-
-
-
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h index 0807f80cc0..4ffc6faad3 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h @@ -19,8 +19,8 @@ #include "EditMenuBar.h"
#include "Misc.h"
-extern EFI_EDITOR_GLOBAL_EDITOR MainEditor;
-extern BOOLEAN EditorFirst;
-extern BOOLEAN EditorExit;
+extern EFI_EDITOR_GLOBAL_EDITOR MainEditor;
+extern BOOLEAN EditorFirst;
+extern BOOLEAN EditorExit;
#endif // _EFI_EDIT_H_
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h index 327ecd2257..a4dd09a7ce 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h @@ -13,12 +13,12 @@ #include "EditTitleBar.h"
#include "EditMenuBar.h"
-#define MIN_POOL_SIZE 125
-#define MAX_STRING_LENGTH 127
+#define MIN_POOL_SIZE 125
+#define MAX_STRING_LENGTH 127
typedef struct {
- UINTN Row;
- UINTN Column;
+ UINTN Row;
+ UINTN Column;
} EFI_EDITOR_POSITION;
typedef
@@ -38,60 +38,59 @@ typedef enum { #define LINE_LIST_SIGNATURE SIGNATURE_32 ('e', 'e', 'l', 'l')
typedef struct _EFI_EDITOR_LINE {
- UINTN Signature;
- CHAR16 *Buffer;
- UINTN Size; // unit is Unicode
- UINTN TotalSize; // unit is Unicode, exclude CHAR_NULL
- EE_NEWLINE_TYPE Type;
- LIST_ENTRY Link;
+ UINTN Signature;
+ CHAR16 *Buffer;
+ UINTN Size; // unit is Unicode
+ UINTN TotalSize; // unit is Unicode, exclude CHAR_NULL
+ EE_NEWLINE_TYPE Type;
+ LIST_ENTRY Link;
} EFI_EDITOR_LINE;
typedef struct {
- UINT32 Foreground : 4;
- UINT32 Background : 4;
+ UINT32 Foreground : 4;
+ UINT32 Background : 4;
} EFI_EDITOR_COLOR_ATTRIBUTES;
typedef union {
- EFI_EDITOR_COLOR_ATTRIBUTES Colors;
- UINTN Data;
+ EFI_EDITOR_COLOR_ATTRIBUTES Colors;
+ UINTN Data;
} EFI_EDITOR_COLOR_UNION;
typedef struct {
- UINTN Columns;
- UINTN Rows;
+ UINTN Columns;
+ UINTN Rows;
} EFI_EDITOR_TEXT_MODE;
typedef struct {
- CHAR16 *FileName; // file name current edited in editor
- EDIT_FILE_TYPE FileType; // Unicode file or ASCII file
- LIST_ENTRY *ListHead; // list head of lines
- EFI_EDITOR_LINE *Lines; // lines of current file
- UINTN NumLines; // total line numbers
- EFI_EDITOR_POSITION DisplayPosition; // cursor position in screen
- EFI_EDITOR_POSITION FilePosition; // cursor position in file
- EFI_EDITOR_POSITION MousePosition; // mouse position in screen
+ CHAR16 *FileName; // file name current edited in editor
+ EDIT_FILE_TYPE FileType; // Unicode file or ASCII file
+ LIST_ENTRY *ListHead; // list head of lines
+ EFI_EDITOR_LINE *Lines; // lines of current file
+ UINTN NumLines; // total line numbers
+ EFI_EDITOR_POSITION DisplayPosition; // cursor position in screen
+ EFI_EDITOR_POSITION FilePosition; // cursor position in file
+ EFI_EDITOR_POSITION MousePosition; // mouse position in screen
// file position of first byte displayed on screen
//
- EFI_EDITOR_POSITION LowVisibleRange;
+ EFI_EDITOR_POSITION LowVisibleRange;
- BOOLEAN FileModified; // file is modified or not
- BOOLEAN ModeInsert; // input mode INS or OVR
- BOOLEAN ReadOnly; // file is read-only or not
- EFI_EDITOR_LINE *CurrentLine; // current line cursor is at
+ BOOLEAN FileModified; // file is modified or not
+ BOOLEAN ModeInsert; // input mode INS or OVR
+ BOOLEAN ReadOnly; // file is read-only or not
+ EFI_EDITOR_LINE *CurrentLine; // current line cursor is at
} EFI_EDITOR_FILE_BUFFER;
typedef struct {
- EFI_EDITOR_FILE_BUFFER *FileBuffer;
-
- EFI_EDITOR_COLOR_UNION ColorAttributes;
- EFI_EDITOR_POSITION ScreenSize; // row number and column number
- EFI_EDITOR_LINE *CutLine; // clip board
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInputEx;
- BOOLEAN MouseSupported;
- EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;
- INT32 MouseAccumulatorX;
- INT32 MouseAccumulatorY;
-
+ EFI_EDITOR_FILE_BUFFER *FileBuffer;
+
+ EFI_EDITOR_COLOR_UNION ColorAttributes;
+ EFI_EDITOR_POSITION ScreenSize; // row number and column number
+ EFI_EDITOR_LINE *CutLine; // clip board
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInputEx;
+ BOOLEAN MouseSupported;
+ EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;
+ INT32 MouseAccumulatorX;
+ INT32 MouseAccumulatorY;
} EFI_EDITOR_GLOBAL_EDITOR;
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c index 35b0b701e8..0b25965427 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c @@ -9,10 +9,10 @@ #include "EditInputBar.h"
#include "UefiShellDebug1CommandsLib.h"
-CHAR16 *mPrompt; // Input bar mPrompt string.
-CHAR16 *mReturnString; // The returned string.
-UINTN StringSize; // Size of mReturnString space size.
-EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *mTextInEx;
+CHAR16 *mPrompt; // Input bar mPrompt string.
+CHAR16 *mReturnString; // The returned string.
+UINTN StringSize; // Size of mReturnString space size.
+EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *mTextInEx;
/**
Initialize the input bar.
@@ -21,7 +21,7 @@ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *mTextInEx; **/
VOID
InputBarInit (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx
)
{
mPrompt = NULL;
@@ -56,8 +56,8 @@ InputBarCleanup ( **/
VOID
InputBarPrintInput (
- IN UINTN LastColumn,
- IN UINTN LastRow
+ IN UINTN LastColumn,
+ IN UINTN LastRow
)
{
UINTN Limit;
@@ -67,8 +67,8 @@ InputBarPrintInput ( UINTN mPromptLen;
mPromptLen = StrLen (mPrompt);
- Limit = LastColumn - mPromptLen - 1;
- Size = StrLen (mReturnString);
+ Limit = LastColumn - mPromptLen - 1;
+ Size = StrLen (mReturnString);
//
// check whether the mPrompt length and input length will
@@ -97,16 +97,15 @@ InputBarPrintInput ( }
typedef struct {
- UINT32 Foreground : 4;
- UINT32 Background : 3;
+ UINT32 Foreground : 4;
+ UINT32 Background : 3;
} INPUT_BAR_COLOR_ATTRIBUTES;
typedef union {
- INPUT_BAR_COLOR_ATTRIBUTES Colors;
- UINTN Data;
+ INPUT_BAR_COLOR_ATTRIBUTES Colors;
+ UINTN Data;
} INPUT_BAR_COLOR_UNION;
-
/**
The refresh function for InputBar, it will wait for user input
@@ -117,25 +116,25 @@ typedef union { **/
EFI_STATUS
InputBarRefresh (
- UINTN LastRow,
- UINTN LastColumn
+ UINTN LastRow,
+ UINTN LastColumn
)
{
- INPUT_BAR_COLOR_UNION Orig;
- INPUT_BAR_COLOR_UNION New;
- EFI_KEY_DATA KeyData;
- UINTN Size;
- EFI_STATUS Status;
- BOOLEAN NoDisplay;
- UINTN EventIndex;
- UINTN CursorRow;
- UINTN CursorCol;
+ INPUT_BAR_COLOR_UNION Orig;
+ INPUT_BAR_COLOR_UNION New;
+ EFI_KEY_DATA KeyData;
+ UINTN Size;
+ EFI_STATUS Status;
+ BOOLEAN NoDisplay;
+ UINTN EventIndex;
+ UINTN CursorRow;
+ UINTN CursorCol;
//
// variable initialization
//
- Size = 0;
- Status = EFI_SUCCESS;
+ Size = 0;
+ Status = EFI_SUCCESS;
//
// back up the old screen attributes
@@ -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,37 +167,43 @@ 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
//
if (KeyData.Key.ScanCode == SCAN_ESC) {
- Size = 0;
- Status = EFI_NOT_READY;
+ Size = 0;
+ 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
//
@@ -266,7 +265,7 @@ InputBarRefresh ( **/
EFI_STATUS
InputBarSetPrompt (
- IN CONST CHAR16 *Str
+ IN CONST CHAR16 *Str
)
{
//
@@ -292,7 +291,7 @@ InputBarSetPrompt ( **/
EFI_STATUS
InputBarSetStringSize (
- UINTN Size
+ UINTN Size
)
{
//
@@ -300,8 +299,8 @@ InputBarSetStringSize ( //
SHELL_FREE_NON_NULL (mReturnString);
- StringSize = Size;
- mReturnString = AllocateZeroPool ((StringSize + 1) * sizeof(mReturnString[0]));
+ StringSize = Size;
+ 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
)
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.h index a6db2cdd70..b408f6ea28 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.h @@ -16,7 +16,7 @@ **/
VOID
InputBarInit (
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx
);
/**
@@ -37,8 +37,8 @@ InputBarCleanup ( **/
EFI_STATUS
InputBarRefresh (
- UINTN LastRow,
- UINTN LastColumn
+ UINTN LastRow,
+ UINTN LastColumn
);
/**
@@ -51,7 +51,7 @@ InputBarRefresh ( **/
EFI_STATUS
InputBarSetPrompt (
- IN CONST CHAR16 *Str
+ IN CONST CHAR16 *Str
);
/**
@@ -64,7 +64,7 @@ InputBarSetPrompt ( **/
EFI_STATUS
InputBarSetStringSize (
- UINTN Size
+ UINTN Size
);
/**
@@ -73,7 +73,7 @@ InputBarSetStringSize ( @retval NULL No input has been received.
@return The string that was input.
**/
-CONST CHAR16*
+CONST CHAR16 *
InputBarGetString (
VOID
);
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c index ca8bc506d9..3284f0c1e2 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c @@ -10,9 +10,9 @@ #include "UefiShellDebug1CommandsLib.h"
#include "EditStatusBar.h"
-EDITOR_MENU_ITEM *MenuItems;
-MENU_ITEM_FUNCTION *ControlBasedMenuFunctions;
-UINTN NumItems;
+EDITOR_MENU_ITEM *MenuItems;
+MENU_ITEM_FUNCTION *ControlBasedMenuFunctions;
+UINTN NumItems;
/**
Cleanup function for a menu bar. frees all allocated memory.
@@ -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.
@@ -75,16 +78,16 @@ ControlHotKeyInit ( **/
EFI_STATUS
MenuBarRefresh (
- IN CONST UINTN LastRow,
- IN CONST UINTN LastCol
+ IN CONST UINTN LastRow,
+ IN CONST UINTN LastCol
)
{
EDITOR_MENU_ITEM *Item;
- UINTN Col;
- UINTN Row;
- UINTN Width;
- CHAR16 *NameString;
- CHAR16 *FunctionKeyString;
+ UINTN Col;
+ UINTN Row;
+ UINTN Width;
+ CHAR16 *NameString;
+ CHAR16 *FunctionKeyString;
//
// variable initialization
@@ -97,25 +100,21 @@ 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);
+ Width = MAX ((StrLen (NameString) + 6), 20);
if (((Col + Width) > LastCol)) {
Row++;
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);
@@ -138,12 +137,12 @@ MenuBarRefresh ( **/
EFI_STATUS
MenuBarDispatchFunctionKey (
- IN CONST EFI_INPUT_KEY *Key
+ IN CONST EFI_INPUT_KEY *Key
)
{
- UINTN Index;
+ UINTN Index;
- Index = Key->ScanCode - SCAN_F1;
+ Index = Key->ScanCode - SCAN_F1;
//
// check whether in range
@@ -167,10 +166,10 @@ MenuBarDispatchFunctionKey ( **/
EFI_STATUS
MenuBarDispatchControlHotKey (
- IN CONST EFI_KEY_DATA *KeyData
+ IN CONST EFI_KEY_DATA *KeyData
)
{
- UINT16 ControlIndex;
+ UINT16 ControlIndex;
//
// Set to invalid value first.
@@ -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,14 +198,13 @@ 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;
+ return EFI_NOT_FOUND;
}
ControlBasedMenuFunctions[ControlIndex]();
return EFI_SUCCESS;
}
-
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h index b246c4920d..92c5610d66 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.h @@ -22,7 +22,6 @@ #define SCAN_CONTROL_W 23
#define SCAN_CONTROL_Z 26
-
typedef
EFI_STATUS
(*MENU_ITEM_FUNCTION) (
@@ -30,9 +29,9 @@ EFI_STATUS );
typedef struct _EDITOR_MENU_ITEM {
- EFI_STRING_ID NameToken;
- CHAR16 FunctionKeyToken;
- MENU_ITEM_FUNCTION Function;
+ EFI_STRING_ID NameToken;
+ CHAR16 FunctionKeyToken;
+ MENU_ITEM_FUNCTION Function;
} EDITOR_MENU_ITEM;
/**
@@ -78,8 +77,8 @@ MenuBarCleanup ( **/
EFI_STATUS
MenuBarRefresh (
- IN CONST UINTN LastRow,
- IN CONST UINTN LastCol
+ IN CONST UINTN LastRow,
+ IN CONST UINTN LastCol
);
/**
@@ -93,7 +92,7 @@ MenuBarRefresh ( **/
EFI_STATUS
MenuBarDispatchFunctionKey (
- IN CONST EFI_INPUT_KEY *Key
+ IN CONST EFI_INPUT_KEY *Key
);
/**
@@ -107,7 +106,7 @@ MenuBarDispatchFunctionKey ( **/
EFI_STATUS
MenuBarDispatchControlHotKey (
- IN CONST EFI_KEY_DATA *KeyData
+ IN CONST EFI_KEY_DATA *KeyData
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c index 400a0b05bd..06a60ebc5e 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c @@ -9,9 +9,9 @@ #include "EditStatusBar.h"
#include "UefiShellDebug1CommandsLib.h"
-CHAR16 *StatusString;
-BOOLEAN StatusBarNeedRefresh;
-BOOLEAN StatusStringChanged;
+CHAR16 *StatusString;
+BOOLEAN StatusBarNeedRefresh;
+BOOLEAN StatusStringChanged;
/**
Initialization function for Status Bar.
@@ -53,13 +53,13 @@ StatusBarCleanup ( }
typedef struct {
- UINT32 Foreground : 4;
- UINT32 Background : 3;
+ UINT32 Foreground : 4;
+ UINT32 Background : 3;
} STATUS_BAR_COLOR_ATTRIBUTES;
typedef union {
- STATUS_BAR_COLOR_ATTRIBUTES Colors;
- UINTN Data;
+ STATUS_BAR_COLOR_ATTRIBUTES Colors;
+ UINTN Data;
} STATUS_BAR_COLOR_UNION;
/**
@@ -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
//
@@ -153,8 +155,8 @@ StatusBarRefresh ( //
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
- StatusBarNeedRefresh = FALSE;
- StatusStringChanged = FALSE;
+ StatusBarNeedRefresh = FALSE;
+ StatusStringChanged = FALSE;
return EFI_SUCCESS;
}
@@ -169,7 +171,7 @@ StatusBarRefresh ( **/
EFI_STATUS
StatusBarSetStatusString (
- IN CHAR16 *Str
+ IN CHAR16 *Str
)
{
StatusStringChanged = TRUE;
@@ -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
)
{
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.h index eba3ee19c8..5008f2a0eb 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.h @@ -62,7 +62,7 @@ StatusBarRefresh ( **/
EFI_STATUS
StatusBarSetStatusString (
- IN CHAR16 *Str
+ IN CHAR16 *Str
);
/**
@@ -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
);
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c index f9ef7117b2..663a872dc2 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c @@ -22,7 +22,7 @@ CHAR16 *Title = NULL; **/
EFI_STATUS
MainTitleBarInit (
- CONST CHAR16 *Prompt
+ CONST CHAR16 *Prompt
)
{
SHELL_FREE_NON_NULL (Title);
@@ -34,6 +34,7 @@ MainTitleBarInit ( //
Title = CatSPrint (NULL, L"%s", Prompt);
}
+
if (Title == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -54,13 +55,13 @@ MainTitleBarCleanup ( }
typedef struct {
- UINT32 Foreground : 4;
- UINT32 Background : 4;
+ UINT32 Foreground : 4;
+ UINT32 Background : 4;
} TITLE_BAR_COLOR_ATTRIBUTES;
typedef union {
- TITLE_BAR_COLOR_ATTRIBUTES Colors;
- UINTN Data;
+ TITLE_BAR_COLOR_ATTRIBUTES Colors;
+ UINTN Data;
} TITLE_BAR_COLOR_UNION;
/**
@@ -79,21 +80,20 @@ typedef union { **/
EFI_STATUS
MainTitleBarRefresh (
- IN CONST CHAR16 *FileName OPTIONAL,
- IN CONST EDIT_FILE_TYPE FileType,
- IN CONST BOOLEAN ReadOnly,
- IN CONST BOOLEAN Modified,
- IN CONST UINTN LastCol,
- IN CONST UINTN LastRow,
- IN CONST UINTN Offset,
- IN CONST UINTN Size
+ IN CONST CHAR16 *FileName OPTIONAL,
+ IN CONST EDIT_FILE_TYPE FileType,
+ IN CONST BOOLEAN ReadOnly,
+ IN CONST BOOLEAN Modified,
+ IN CONST UINTN LastCol,
+ IN CONST UINTN LastRow,
+ IN CONST UINTN Offset,
+ IN CONST UINTN Size
)
{
- TITLE_BAR_COLOR_UNION Orig;
- TITLE_BAR_COLOR_UNION New;
- CONST CHAR16 *FileNameTmp;
- INTN TempInteger;
-
+ TITLE_BAR_COLOR_UNION Orig;
+ TITLE_BAR_COLOR_UNION New;
+ 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;
+
+ 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
//
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.h index 30b1ecca5f..bd43541973 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.h @@ -19,7 +19,7 @@ **/
EFI_STATUS
MainTitleBarInit (
- CONST CHAR16 *Prompt
+ CONST CHAR16 *Prompt
);
/**
@@ -55,14 +55,14 @@ typedef enum { **/
EFI_STATUS
MainTitleBarRefresh (
- IN CONST CHAR16 *FileName OPTIONAL,
- IN CONST EDIT_FILE_TYPE FileType,
- IN CONST BOOLEAN ReadOnly,
- IN CONST BOOLEAN Modified,
- IN CONST UINTN LastCol,
- IN CONST UINTN LastRow,
- IN CONST UINTN Offset,
- IN CONST UINTN Size
+ IN CONST CHAR16 *FileName OPTIONAL,
+ IN CONST EDIT_FILE_TYPE FileType,
+ IN CONST BOOLEAN ReadOnly,
+ IN CONST BOOLEAN Modified,
+ IN CONST UINTN LastCol,
+ IN CONST UINTN LastRow,
+ IN CONST UINTN Offset,
+ IN CONST UINTN Size
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c index 261129e88c..d581a334f4 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c @@ -23,103 +23,107 @@ ShellCommandRunEfiCompress ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- SHELL_FILE_HANDLE InShellFileHandle;
- SHELL_FILE_HANDLE OutShellFileHandle;
- UINT64 OutSize;
- UINTN OutSize2;
- VOID *OutBuffer;
- UINT64 InSize;
- UINTN InSize2;
- VOID *InBuffer;
- CHAR16 *InFileName;
- CONST CHAR16 *OutFileName;
- CONST CHAR16 *TempParam;
-
- InFileName = NULL;
- OutFileName = NULL;
- OutSize = 0;
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- OutBuffer = NULL;
- InShellFileHandle = NULL;
- OutShellFileHandle = NULL;
- InBuffer = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ SHELL_FILE_HANDLE InShellFileHandle;
+ SHELL_FILE_HANDLE OutShellFileHandle;
+ UINT64 OutSize;
+ UINTN OutSize2;
+ VOID *OutBuffer;
+ UINT64 InSize;
+ UINTN InSize2;
+ VOID *InBuffer;
+ CHAR16 *InFileName;
+ CONST CHAR16 *OutFileName;
+ CONST CHAR16 *TempParam;
+
+ InFileName = NULL;
+ OutFileName = NULL;
+ OutSize = 0;
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ OutBuffer = NULL;
+ InShellFileHandle = NULL;
+ OutShellFileHandle = NULL;
+ InBuffer = NULL;
//
// 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;
- Status = gEfiShellProtocol->ReadFile (InShellFileHandle, &InSize2, InBuffer);
- InSize = InSize2;
+ 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);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c index 4b293f5a7b..8bf23a2076 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c @@ -10,7 +10,6 @@ #include "UefiShellDebug1CommandsLib.h"
#include <Protocol/Decompress.h>
-
/**
Function for 'decompress' command.
@@ -24,124 +23,126 @@ ShellCommandRunEfiDecompress ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- SHELL_FILE_HANDLE InFileHandle;
- SHELL_FILE_HANDLE OutFileHandle;
- UINT32 OutSize;
- UINTN OutSizeTemp;
- VOID *OutBuffer;
- UINTN InSize;
- VOID *InBuffer;
- CHAR16 *InFileName;
- CONST CHAR16 *OutFileName;
- UINT64 Temp64Bit;
- UINT32 ScratchSize;
- VOID *ScratchBuffer;
- EFI_DECOMPRESS_PROTOCOL *Decompress;
- CONST CHAR16 *TempParam;
-
- InFileName = NULL;
- OutFileName = NULL;
- OutSize = 0;
- ScratchSize = 0;
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- OutBuffer = NULL;
- InBuffer = NULL;
- ScratchBuffer = NULL;
- InFileHandle = NULL;
- OutFileHandle = NULL;
- Decompress = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ SHELL_FILE_HANDLE InFileHandle;
+ SHELL_FILE_HANDLE OutFileHandle;
+ UINT32 OutSize;
+ UINTN OutSizeTemp;
+ VOID *OutBuffer;
+ UINTN InSize;
+ VOID *InBuffer;
+ CHAR16 *InFileName;
+ CONST CHAR16 *OutFileName;
+ UINT64 Temp64Bit;
+ UINT32 ScratchSize;
+ VOID *ScratchBuffer;
+ EFI_DECOMPRESS_PROTOCOL *Decompress;
+ CONST CHAR16 *TempParam;
+
+ InFileName = NULL;
+ OutFileName = NULL;
+ OutSize = 0;
+ ScratchSize = 0;
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ OutBuffer = NULL;
+ InBuffer = NULL;
+ ScratchBuffer = NULL;
+ InFileHandle = NULL;
+ OutFileHandle = NULL;
+ Decompress = NULL;
//
// 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"efidecompress", 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"efidecompress", 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"efidecompress");
+ if (ShellCommandLineGetCount (Package) > 3) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"efidecompress");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) < 3) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"efidecompress");
+ } else if (ShellCommandLineGetCount (Package) < 3) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"efidecompress");
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"efidecompress", TempParam);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"efidecompress", TempParam);
ShellStatus = SHELL_NOT_FOUND;
} else {
- if (ShellIsDirectory(InFileName) == EFI_SUCCESS){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", InFileName);
+ if (ShellIsDirectory (InFileName) == EFI_SUCCESS) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", InFileName);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- if (ShellIsDirectory(OutFileName) == EFI_SUCCESS){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", OutFileName);
+
+ if (ShellIsDirectory (OutFileName) == EFI_SUCCESS) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", OutFileName);
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
if (ShellStatus == SHELL_SUCCESS) {
- Status = ShellOpenFileByName(InFileName, &InFileHandle, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"efidecompress", ShellCommandLineGetRawValue(Package, 1));
+ Status = ShellOpenFileByName (InFileName, &InFileHandle, EFI_FILE_MODE_READ, 0);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"efidecompress", ShellCommandLineGetRawValue (Package, 1));
ShellStatus = SHELL_NOT_FOUND;
}
}
if (ShellStatus == SHELL_SUCCESS) {
- Status = FileHandleGetSize(InFileHandle, &Temp64Bit);
- ASSERT(Temp64Bit <= (UINT32)(-1));
+ Status = FileHandleGetSize (InFileHandle, &Temp64Bit);
+ ASSERT (Temp64Bit <= (UINT32)(-1));
InSize = (UINTN)Temp64Bit;
- ASSERT_EFI_ERROR(Status);
- InBuffer = AllocateZeroPool(InSize);
+ ASSERT_EFI_ERROR (Status);
+ InBuffer = AllocateZeroPool (InSize);
if (InBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
Status = gEfiShellProtocol->ReadFile (InFileHandle, &InSize, InBuffer);
ASSERT_EFI_ERROR (Status);
- Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID**) &Decompress);
+ Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress);
ASSERT_EFI_ERROR (Status);
- Status = Decompress->GetInfo (Decompress, InBuffer, (UINT32) InSize, &OutSize, &ScratchSize);
+ Status = Decompress->GetInfo (Decompress, InBuffer, (UINT32)InSize, &OutSize, &ScratchSize);
}
- if (EFI_ERROR(Status) || OutSize == 0) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_NOPE), gShellDebug1HiiHandle, InFileName);
+ if (EFI_ERROR (Status) || (OutSize == 0)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_NOPE), gShellDebug1HiiHandle, InFileName);
ShellStatus = SHELL_NOT_FOUND;
} else {
- Status = ShellOpenFileByName(OutFileName, &OutFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2), Status);
+ Status = ShellOpenFileByName (OutFileName, &OutFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue (Package, 2), Status);
ShellStatus = SHELL_NOT_FOUND;
} else {
- OutBuffer = AllocateZeroPool(OutSize);
- ScratchBuffer = AllocateZeroPool(ScratchSize);
- if (OutBuffer == NULL || ScratchBuffer == NULL) {
+ OutBuffer = AllocateZeroPool (OutSize);
+ ScratchBuffer = AllocateZeroPool (ScratchSize);
+ if ((OutBuffer == NULL) || (ScratchBuffer == NULL)) {
Status = EFI_OUT_OF_RESOURCES;
} else {
- Status = Decompress->Decompress (Decompress, InBuffer, (UINT32) InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize);
+ Status = Decompress->Decompress (Decompress, InBuffer, (UINT32)InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize);
}
}
}
@@ -151,8 +152,8 @@ ShellCommandRunEfiDecompress ( ShellStatus = ((Status == EFI_OUT_OF_RESOURCES) ? SHELL_OUT_OF_RESOURCES : SHELL_DEVICE_ERROR);
} else {
OutSizeTemp = OutSize;
- Status = gEfiShellProtocol->WriteFile (OutFileHandle, &OutSizeTemp, OutBuffer);
- OutSize = (UINT32) OutSizeTemp;
+ Status = gEfiShellProtocol->WriteFile (OutFileHandle, &OutSizeTemp, OutBuffer);
+ OutSize = (UINT32)OutSizeTemp;
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, L"efidecompress", OutFileName, Status);
ShellStatus = SHELL_DEVICE_ERROR;
@@ -164,17 +165,19 @@ ShellCommandRunEfiDecompress ( ShellCommandLineFreeVarList (Package);
}
+
if (InFileHandle != NULL) {
- gEfiShellProtocol->CloseFile(InFileHandle);
+ gEfiShellProtocol->CloseFile (InFileHandle);
}
+
if (OutFileHandle != NULL) {
- gEfiShellProtocol->CloseFile(OutFileHandle);
+ gEfiShellProtocol->CloseFile (OutFileHandle);
}
- SHELL_FREE_NON_NULL(InFileName);
- SHELL_FREE_NON_NULL(InBuffer);
- SHELL_FREE_NON_NULL(OutBuffer);
- SHELL_FREE_NON_NULL(ScratchBuffer);
+ SHELL_FREE_NON_NULL (InFileName);
+ SHELL_FREE_NON_NULL (InBuffer);
+ SHELL_FREE_NON_NULL (OutBuffer);
+ SHELL_FREE_NON_NULL (ScratchBuffer);
return (ShellStatus);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c index a730cc105c..be77e31a40 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c @@ -9,28 +9,28 @@ #include "HexEditor.h"
-extern EFI_HANDLE HImageHandleBackup;
+extern EFI_HANDLE HImageHandleBackup;
-extern HEFI_EDITOR_FILE_IMAGE HFileImage;
-extern HEFI_EDITOR_DISK_IMAGE HDiskImage;
-extern HEFI_EDITOR_MEM_IMAGE HMemImage;
+extern HEFI_EDITOR_FILE_IMAGE HFileImage;
+extern HEFI_EDITOR_DISK_IMAGE HDiskImage;
+extern HEFI_EDITOR_MEM_IMAGE HMemImage;
-extern HEFI_EDITOR_FILE_IMAGE HFileImageBackupVar;
-extern HEFI_EDITOR_DISK_IMAGE HDiskImageBackupVar;
-extern HEFI_EDITOR_MEM_IMAGE HMemImageBackupVar;
+extern HEFI_EDITOR_FILE_IMAGE HFileImageBackupVar;
+extern HEFI_EDITOR_DISK_IMAGE HDiskImageBackupVar;
+extern HEFI_EDITOR_MEM_IMAGE HMemImageBackupVar;
-extern BOOLEAN HEditorMouseAction;
+extern BOOLEAN HEditorMouseAction;
extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor;
extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar;
-HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
-HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar;
+HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
+HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar;
//
// for basic initialization of HBufferImage
//
-HEFI_EDITOR_BUFFER_IMAGE HBufferImageConst = {
+HEFI_EDITOR_BUFFER_IMAGE HBufferImageConst = {
NULL,
NULL,
0,
@@ -59,14 +59,14 @@ HEFI_EDITOR_BUFFER_IMAGE HBufferImageConst = { //
// the whole edit area needs to be refreshed
//
-BOOLEAN HBufferImageNeedRefresh;
+BOOLEAN HBufferImageNeedRefresh;
//
// only the current line in edit area needs to be refresh
//
-BOOLEAN HBufferImageOnlyLineNeedRefresh;
+BOOLEAN HBufferImageOnlyLineNeedRefresh;
-BOOLEAN HBufferImageMouseNeedRefresh;
+BOOLEAN HBufferImageMouseNeedRefresh;
/**
Initialization function for HBufferImage
@@ -101,17 +101,17 @@ HBufferImageInit ( HBufferImage.MousePosition.Row = 2;
HBufferImage.MousePosition.Column = 10;
- HBufferImage.FileImage = &HFileImage;
- HBufferImage.DiskImage = &HDiskImage;
- HBufferImage.MemImage = &HMemImage;
+ HBufferImage.FileImage = &HFileImage;
+ HBufferImage.DiskImage = &HDiskImage;
+ HBufferImage.MemImage = &HMemImage;
- HBufferImageNeedRefresh = FALSE;
- HBufferImageOnlyLineNeedRefresh = FALSE;
- HBufferImageMouseNeedRefresh = FALSE;
+ HBufferImageNeedRefresh = FALSE;
+ HBufferImageOnlyLineNeedRefresh = FALSE;
+ HBufferImageMouseNeedRefresh = FALSE;
- HBufferImageBackupVar.FileImage = &HFileImageBackupVar;
- HBufferImageBackupVar.DiskImage = &HDiskImageBackupVar;
- HBufferImageBackupVar.MemImage = &HMemImageBackupVar;
+ HBufferImageBackupVar.FileImage = &HFileImageBackupVar;
+ HBufferImageBackupVar.DiskImage = &HDiskImageBackupVar;
+ HBufferImageBackupVar.MemImage = &HMemImageBackupVar;
Status = HFileImageInit ();
if (EFI_ERROR (Status)) {
@@ -142,15 +142,15 @@ HBufferImageBackup ( VOID
)
{
- HBufferImageBackupVar.MousePosition = HBufferImage.MousePosition;
+ HBufferImageBackupVar.MousePosition = HBufferImage.MousePosition;
- HBufferImageBackupVar.BufferPosition = HBufferImage.BufferPosition;
+ HBufferImageBackupVar.BufferPosition = HBufferImage.BufferPosition;
- HBufferImageBackupVar.Modified = HBufferImage.Modified;
+ HBufferImageBackupVar.Modified = HBufferImage.Modified;
- HBufferImageBackupVar.BufferType = HBufferImage.BufferType;
- HBufferImageBackupVar.LowVisibleRow = HBufferImage.LowVisibleRow;
- HBufferImageBackupVar.HighBits = HBufferImage.HighBits;
+ HBufferImageBackupVar.BufferType = HBufferImage.BufferType;
+ HBufferImageBackupVar.LowVisibleRow = HBufferImage.LowVisibleRow;
+ HBufferImageBackupVar.HighBits = HBufferImage.HighBits;
//
// three kinds of buffer supported
@@ -159,20 +159,20 @@ HBufferImageBackup ( // memory buffer
//
switch (HBufferImage.BufferType) {
- case FileTypeFileBuffer:
- HFileImageBackup ();
- break;
+ case FileTypeFileBuffer:
+ HFileImageBackup ();
+ break;
- case FileTypeDiskBuffer:
- HDiskImageBackup ();
- break;
+ case FileTypeDiskBuffer:
+ HDiskImageBackup ();
+ break;
- case FileTypeMemBuffer:
- HMemImageBackup ();
- break;
+ case FileTypeMemBuffer:
+ HMemImageBackup ();
+ break;
- default:
- break;
+ default:
+ break;
}
return EFI_SUCCESS;
@@ -195,9 +195,9 @@ HBufferImageFreeLines ( {
HFreeLines (HBufferImage.ListHead, HBufferImage.Lines);
- HBufferImage.Lines = NULL;
- HBufferImage.CurrentLine = NULL;
- HBufferImage.NumLines = 0;
+ HBufferImage.Lines = NULL;
+ HBufferImage.CurrentLine = NULL;
+ HBufferImage.NumLines = 0;
return EFI_SUCCESS;
}
@@ -226,7 +226,6 @@ HBufferImageCleanup ( HDiskImageCleanup ();
return Status;
-
}
/**
@@ -242,42 +241,41 @@ HBufferImageCleanup ( **/
EFI_STATUS
HBufferImagePrintLine (
- IN HEFI_EDITOR_LINE *Line,
- IN UINTN Row,
- IN UINTN FRow,
- IN HEFI_EDITOR_COLOR_UNION Orig,
- IN HEFI_EDITOR_COLOR_UNION New
+ IN HEFI_EDITOR_LINE *Line,
+ IN UINTN Row,
+ IN UINTN FRow,
+ IN HEFI_EDITOR_COLOR_UNION Orig,
+ IN HEFI_EDITOR_COLOR_UNION New
)
{
-
- UINTN Index;
- UINTN Pos;
- BOOLEAN Selected;
- BOOLEAN BeNewColor;
- UINTN RowStart;
- UINTN RowEnd;
- UINTN ColStart;
- UINTN ColEnd;
+ UINTN Index;
+ UINTN Pos;
+ BOOLEAN Selected;
+ BOOLEAN BeNewColor;
+ UINTN RowStart;
+ UINTN RowEnd;
+ UINTN ColStart;
+ UINTN ColEnd;
//
// variable initialization
//
- ColStart = 0;
- ColEnd = 0;
- Selected = FALSE;
+ ColStart = 0;
+ ColEnd = 0;
+ Selected = FALSE;
//
// print the selected area in opposite color
//
- if (HMainEditor.SelectStart != 0 && HMainEditor.SelectEnd != 0) {
- RowStart = (HMainEditor.SelectStart - 1) / 0x10 + 1;
- RowEnd = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
+ if ((HMainEditor.SelectStart != 0) && (HMainEditor.SelectEnd != 0)) {
+ RowStart = (HMainEditor.SelectStart - 1) / 0x10 + 1;
+ RowEnd = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
- ColStart = (HMainEditor.SelectStart - 1) % 0x10 + 1;
- ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1;
+ ColStart = (HMainEditor.SelectStart - 1) % 0x10 + 1;
+ ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1;
- if (FRow >= RowStart && FRow <= RowEnd) {
+ if ((FRow >= RowStart) && (FRow <= RowEnd)) {
Selected = TRUE;
}
@@ -288,7 +286,6 @@ HBufferImagePrintLine ( if (FRow < RowEnd) {
ColEnd = 0x10;
}
-
}
if (!HEditorMouseAction) {
@@ -298,15 +295,13 @@ HBufferImagePrintLine ( L"%8X ",
((INT32)Row - 2 + HBufferImage.LowVisibleRow - 1) * 0x10
);
-
}
for (Index = 0; Index < 0x08 && Index < Line->Size; Index++) {
-
BeNewColor = FALSE;
if (Selected) {
- if (Index + 1 >= ColStart && Index + 1 <= ColEnd) {
+ if ((Index + 1 >= ColStart) && (Index + 1 <= ColEnd)) {
BeNewColor = TRUE;
}
}
@@ -328,7 +323,6 @@ HBufferImagePrintLine ( } else {
ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%x ", Line->Buffer[Index]);
}
-
}
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
@@ -339,11 +333,10 @@ HBufferImagePrintLine ( }
while (Index < 0x10 && Index < Line->Size) {
-
BeNewColor = FALSE;
if (Selected) {
- if (Index + 1 >= ColStart && Index + 1 <= ColEnd) {
+ if ((Index + 1 >= ColStart) && (Index + 1 <= ColEnd)) {
BeNewColor = TRUE;
}
}
@@ -370,6 +363,7 @@ HBufferImagePrintLine ( ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" ");
Index++;
}
+
//
// restore the original color
//
@@ -386,7 +380,7 @@ HBufferImagePrintLine ( // learned from shelle.h -- IsValidChar
//
if (Line->Buffer[Index] >= L' ') {
- ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%c", (CHAR16) Line->Buffer[Index]);
+ ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%c", (CHAR16)Line->Buffer[Index]);
} else {
ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%c", '.');
}
@@ -398,6 +392,7 @@ HBufferImagePrintLine ( Index++;
}
}
+
//
// restore the abundant blank in hex edit area to original color
//
@@ -428,8 +423,8 @@ HBufferImagePrintLine ( **/
BOOLEAN
HBufferImageIsAtHighBits (
- IN UINTN Column,
- OUT UINTN *FCol
+ IN UINTN Column,
+ OUT UINTN *FCol
)
{
Column -= 10;
@@ -471,17 +466,17 @@ HBufferImageIsAtHighBits ( **/
BOOLEAN
HBufferImageIsInSelectedArea (
- IN UINTN MouseRow,
- IN UINTN MouseCol
+ IN UINTN MouseRow,
+ IN UINTN MouseCol
)
{
- UINTN FRow;
- UINTN RowStart;
- UINTN RowEnd;
- UINTN ColStart;
- UINTN ColEnd;
- UINTN MouseColStart;
- UINTN MouseColEnd;
+ UINTN FRow;
+ UINTN RowStart;
+ UINTN RowEnd;
+ UINTN ColStart;
+ UINTN ColEnd;
+ UINTN MouseColStart;
+ UINTN MouseColEnd;
//
// judge mouse position whether is in selected area
@@ -489,20 +484,21 @@ HBufferImageIsInSelectedArea ( //
// not select
//
- if (HMainEditor.SelectStart == 0 || HMainEditor.SelectEnd == 0) {
+ if ((HMainEditor.SelectStart == 0) || (HMainEditor.SelectEnd == 0)) {
return FALSE;
}
+
//
// calculate the select area
//
- RowStart = (HMainEditor.SelectStart - 1) / 0x10 + 1;
- RowEnd = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
+ RowStart = (HMainEditor.SelectStart - 1) / 0x10 + 1;
+ RowEnd = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
- ColStart = (HMainEditor.SelectStart - 1) % 0x10 + 1;
- ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1;
+ ColStart = (HMainEditor.SelectStart - 1) % 0x10 + 1;
+ ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1;
- FRow = HBufferImage.LowVisibleRow + MouseRow - 2;
- if (FRow < RowStart || FRow > RowEnd) {
+ FRow = HBufferImage.LowVisibleRow + MouseRow - 2;
+ if ((FRow < RowStart) || (FRow > RowEnd)) {
return FALSE;
}
@@ -524,7 +520,7 @@ HBufferImageIsInSelectedArea ( MouseColEnd++;
}
- if (MouseCol < MouseColStart || MouseCol > MouseColEnd) {
+ if ((MouseCol < MouseColStart) || (MouseCol > MouseColEnd)) {
return FALSE;
}
@@ -541,21 +537,19 @@ HBufferImageRestoreMousePosition ( VOID
)
{
- HEFI_EDITOR_COLOR_UNION Orig;
- HEFI_EDITOR_COLOR_UNION New;
- UINTN FRow;
- UINTN FColumn;
- BOOLEAN HasCharacter;
- HEFI_EDITOR_LINE *CurrentLine;
- HEFI_EDITOR_LINE *Line;
- UINT8 Value;
- BOOLEAN HighBits;
+ HEFI_EDITOR_COLOR_UNION Orig;
+ HEFI_EDITOR_COLOR_UNION New;
+ UINTN FRow;
+ UINTN FColumn;
+ BOOLEAN HasCharacter;
+ HEFI_EDITOR_LINE *CurrentLine;
+ HEFI_EDITOR_LINE *Line;
+ UINT8 Value;
+ BOOLEAN HighBits;
Line = NULL;
if (HMainEditor.MouseSupported) {
-
if (HBufferImageMouseNeedRefresh) {
-
HBufferImageMouseNeedRefresh = FALSE;
//
@@ -563,13 +557,15 @@ HBufferImageRestoreMousePosition ( // so do not need to refresh mouse position
//
if ((
- HBufferImage.MousePosition.Row == HBufferImageBackupVar.MousePosition.Row &&
- HBufferImage.MousePosition.Column == HBufferImageBackupVar.MousePosition.Column
- ) &&
+ (HBufferImage.MousePosition.Row == HBufferImageBackupVar.MousePosition.Row) &&
+ (HBufferImage.MousePosition.Column == HBufferImageBackupVar.MousePosition.Column)
+ ) &&
HEditorMouseAction
- ) {
+ )
+ {
return EFI_SUCCESS;
}
+
//
// backup the old screen attributes
//
@@ -583,31 +579,33 @@ HBufferImageRestoreMousePosition ( // so do not need to refresh mouse
//
if (!HBufferImageIsInSelectedArea (
- HBufferImageBackupVar.MousePosition.Row,
- HBufferImageBackupVar.MousePosition.Column
- )) {
+ HBufferImageBackupVar.MousePosition.Row,
+ HBufferImageBackupVar.MousePosition.Column
+ ))
+ {
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
} else {
gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
}
+
//
// clear the old mouse position
//
FRow = HBufferImage.LowVisibleRow + HBufferImageBackupVar.MousePosition.Row - 2;
HighBits = HBufferImageIsAtHighBits (
- HBufferImageBackupVar.MousePosition.Column,
- &FColumn
- );
+ HBufferImageBackupVar.MousePosition.Column,
+ &FColumn
+ );
HasCharacter = TRUE;
- if (FRow > HBufferImage.NumLines || FColumn == 0) {
+ if ((FRow > HBufferImage.NumLines) || (FColumn == 0)) {
HasCharacter = FALSE;
} else {
CurrentLine = HBufferImage.CurrentLine;
Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row);
- if (Line == NULL || FColumn > Line->Size) {
+ if ((Line == NULL) || (FColumn > Line->Size)) {
HasCharacter = FALSE;
}
@@ -622,10 +620,10 @@ HBufferImageRestoreMousePosition ( if (HasCharacter) {
if (HighBits) {
- Value = (UINT8) (Line->Buffer[FColumn - 1] & 0xf0);
- Value = (UINT8) (Value >> 4);
+ Value = (UINT8)(Line->Buffer[FColumn - 1] & 0xf0);
+ Value = (UINT8)(Value >> 4);
} else {
- Value = (UINT8) (Line->Buffer[FColumn - 1] & 0xf);
+ Value = (UINT8)(Line->Buffer[FColumn - 1] & 0xf);
}
ShellPrintEx (
@@ -637,31 +635,33 @@ HBufferImageRestoreMousePosition ( }
if (!HBufferImageIsInSelectedArea (
- HBufferImage.MousePosition.Row,
- HBufferImage.MousePosition.Column
- )) {
+ HBufferImage.MousePosition.Row,
+ HBufferImage.MousePosition.Column
+ ))
+ {
gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
} else {
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
}
+
//
// clear the old mouse position
//
FRow = HBufferImage.LowVisibleRow + HBufferImage.MousePosition.Row - 2;
HighBits = HBufferImageIsAtHighBits (
- HBufferImage.MousePosition.Column,
- &FColumn
- );
+ HBufferImage.MousePosition.Column,
+ &FColumn
+ );
HasCharacter = TRUE;
- if (FRow > HBufferImage.NumLines || FColumn == 0) {
+ if ((FRow > HBufferImage.NumLines) || (FColumn == 0)) {
HasCharacter = FALSE;
} else {
CurrentLine = HBufferImage.CurrentLine;
Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row);
- if (Line == NULL || FColumn > Line->Size) {
+ if ((Line == NULL) || (FColumn > Line->Size)) {
HasCharacter = FALSE;
}
@@ -676,10 +676,10 @@ HBufferImageRestoreMousePosition ( if (HasCharacter) {
if (HighBits) {
- Value = (UINT8) (Line->Buffer[FColumn - 1] & 0xf0);
- Value = (UINT8) (Value >> 4);
+ Value = (UINT8)(Line->Buffer[FColumn - 1] & 0xf0);
+ Value = (UINT8)(Value >> 4);
} else {
- Value = (UINT8) (Line->Buffer[FColumn - 1] & 0xf);
+ Value = (UINT8)(Line->Buffer[FColumn - 1] & 0xf);
}
ShellPrintEx (
@@ -689,15 +689,18 @@ HBufferImageRestoreMousePosition ( Value
);
}
+
//
// end of HasCharacter
//
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
}
+
//
// end of MouseNeedRefresh
//
}
+
//
// end of MouseSupported
//
@@ -718,10 +721,10 @@ HBufferImageRestorePosition ( // set cursor position
//
gST->ConOut->SetCursorPosition (
- gST->ConOut,
- HBufferImage.DisplayPosition.Column - 1,
- HBufferImage.DisplayPosition.Row - 1
- );
+ gST->ConOut,
+ HBufferImage.DisplayPosition.Column - 1,
+ HBufferImage.DisplayPosition.Row - 1
+ );
return EFI_SUCCESS;
}
@@ -738,16 +741,16 @@ HBufferImageRefresh ( VOID
)
{
- LIST_ENTRY *Link;
- HEFI_EDITOR_LINE *Line;
- UINTN Row;
- HEFI_EDITOR_COLOR_UNION Orig;
- HEFI_EDITOR_COLOR_UNION New;
+ LIST_ENTRY *Link;
+ HEFI_EDITOR_LINE *Line;
+ UINTN Row;
+ HEFI_EDITOR_COLOR_UNION Orig;
+ HEFI_EDITOR_COLOR_UNION New;
- UINTN StartRow;
- UINTN EndRow;
- UINTN FStartRow;
- UINTN Tmp;
+ UINTN StartRow;
+ UINTN EndRow;
+ UINTN FStartRow;
+ UINTN Tmp;
Orig = HMainEditor.ColorAttributes;
New.Data = 0;
@@ -764,8 +767,9 @@ HBufferImageRefresh ( //
if (!HBufferImageNeedRefresh &&
!HBufferImageOnlyLineNeedRefresh &&
- HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow
- ) {
+ (HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow)
+ )
+ {
HBufferImageRestoreMousePosition ();
HBufferImageRestorePosition ();
return EFI_SUCCESS;
@@ -777,8 +781,7 @@ HBufferImageRefresh ( //
// only need to refresh current line
//
- if (HBufferImageOnlyLineNeedRefresh && HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow) {
-
+ if (HBufferImageOnlyLineNeedRefresh && (HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow)) {
HBufferImagePrintLine (
HBufferImage.CurrentLine,
HBufferImage.DisplayPosition.Row,
@@ -790,9 +793,9 @@ HBufferImageRefresh ( //
// the whole edit area need refresh
//
- if (HEditorMouseAction && HMainEditor.SelectStart != 0 && HMainEditor.SelectEnd != 0) {
+ if (HEditorMouseAction && (HMainEditor.SelectStart != 0) && (HMainEditor.SelectEnd != 0)) {
if (HMainEditor.SelectStart != HMainEditorBackupVar.SelectStart) {
- if (HMainEditor.SelectStart >= HMainEditorBackupVar.SelectStart && HMainEditorBackupVar.SelectStart != 0) {
+ if ((HMainEditor.SelectStart >= HMainEditorBackupVar.SelectStart) && (HMainEditorBackupVar.SelectStart != 0)) {
StartRow = (HMainEditorBackupVar.SelectStart - 1) / 0x10 + 1;
} else {
StartRow = (HMainEditor.SelectStart - 1) / 0x10 + 1;
@@ -806,20 +809,20 @@ HBufferImageRefresh ( } else {
EndRow = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
}
+
//
// swap
//
if (StartRow > EndRow) {
- Tmp = StartRow;
- StartRow = EndRow;
- EndRow = Tmp;
+ Tmp = StartRow;
+ StartRow = EndRow;
+ EndRow = Tmp;
}
FStartRow = StartRow;
- StartRow = 2 + StartRow - HBufferImage.LowVisibleRow;
- EndRow = 2 + EndRow - HBufferImage.LowVisibleRow;
-
+ StartRow = 2 + StartRow - HBufferImage.LowVisibleRow;
+ EndRow = 2 + EndRow - HBufferImage.LowVisibleRow;
} else {
//
// not mouse selection actions
@@ -828,6 +831,7 @@ HBufferImageRefresh ( StartRow = 2;
EndRow = (HMainEditor.ScreenSize.Row - 1);
}
+
//
// no line
//
@@ -837,6 +841,7 @@ HBufferImageRefresh ( gST->ConOut->EnableCursor (gST->ConOut, TRUE);
return EFI_SUCCESS;
}
+
//
// get the first line that will be displayed
//
@@ -846,8 +851,8 @@ HBufferImageRefresh ( return EFI_LOAD_ERROR;
}
- Link = &(Line->Link);
- Row = StartRow;
+ Link = &(Line->Link);
+ Row = StartRow;
do {
Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
@@ -870,6 +875,7 @@ HBufferImageRefresh ( EditorClearLine (Row, HMainEditor.ScreenSize.Column, HMainEditor.ScreenSize.Row);
Row++;
}
+
//
// while not file end and not screen full
//
@@ -901,23 +907,23 @@ HBufferImageRefresh ( **/
EFI_STATUS
HBufferImageRead (
- IN CONST CHAR16 *FileName,
- IN CONST CHAR16 *DiskName,
- IN UINTN DiskOffset,
- IN UINTN DiskSize,
- IN UINTN MemOffset,
- IN UINTN MemSize,
- IN EDIT_FILE_TYPE BufferType,
- IN BOOLEAN Recover
+ IN CONST CHAR16 *FileName,
+ IN CONST CHAR16 *DiskName,
+ IN UINTN DiskOffset,
+ IN UINTN DiskSize,
+ IN UINTN MemOffset,
+ IN UINTN MemSize,
+ IN EDIT_FILE_TYPE BufferType,
+ IN BOOLEAN Recover
)
{
- EFI_STATUS Status;
- EDIT_FILE_TYPE BufferTypeBackup;
+ EFI_STATUS Status;
+ EDIT_FILE_TYPE BufferTypeBackup;
//
// variable initialization
//
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
HBufferImage.BufferType = BufferType;
//
@@ -929,21 +935,21 @@ HBufferImageRead ( BufferTypeBackup = HBufferImage.BufferType;
switch (BufferType) {
- case FileTypeFileBuffer:
- Status = HFileImageRead (FileName, Recover);
- break;
+ case FileTypeFileBuffer:
+ Status = HFileImageRead (FileName, Recover);
+ break;
- case FileTypeDiskBuffer:
- Status = HDiskImageRead (DiskName, DiskOffset, DiskSize, Recover);
- break;
+ case FileTypeDiskBuffer:
+ Status = HDiskImageRead (DiskName, DiskOffset, DiskSize, Recover);
+ break;
- case FileTypeMemBuffer:
- Status = HMemImageRead (MemOffset, MemSize, Recover);
- break;
+ case FileTypeMemBuffer:
+ Status = HMemImageRead (MemOffset, MemSize, Recover);
+ break;
- default:
- Status = EFI_NOT_FOUND;
- break;
+ default:
+ Status = EFI_NOT_FOUND;
+ break;
}
if (EFI_ERROR (Status)) {
@@ -968,49 +974,49 @@ HBufferImageRead ( **/
EFI_STATUS
HBufferImageSave (
- IN CHAR16 *FileName,
- IN CHAR16 *DiskName,
- IN UINTN DiskOffset,
- IN UINTN DiskSize,
- IN UINTN MemOffset,
- IN UINTN MemSize,
- IN EDIT_FILE_TYPE BufferType
+ IN CHAR16 *FileName,
+ IN CHAR16 *DiskName,
+ IN UINTN DiskOffset,
+ IN UINTN DiskSize,
+ IN UINTN MemOffset,
+ IN UINTN MemSize,
+ IN EDIT_FILE_TYPE BufferType
)
{
- EFI_STATUS Status;
- EDIT_FILE_TYPE BufferTypeBackup;
+ EFI_STATUS Status;
+ EDIT_FILE_TYPE BufferTypeBackup;
//
// variable initialization
//
- Status = EFI_SUCCESS;
- BufferTypeBackup = HBufferImage.BufferType;
+ Status = EFI_SUCCESS;
+ BufferTypeBackup = HBufferImage.BufferType;
switch (HBufferImage.BufferType) {
- //
- // file buffer
- //
- case FileTypeFileBuffer:
- Status = HFileImageSave (FileName);
- break;
+ //
+ // file buffer
+ //
+ case FileTypeFileBuffer:
+ Status = HFileImageSave (FileName);
+ break;
- //
- // disk buffer
- //
- case FileTypeDiskBuffer:
- Status = HDiskImageSave (DiskName, DiskOffset, DiskSize);
- break;
+ //
+ // disk buffer
+ //
+ case FileTypeDiskBuffer:
+ Status = HDiskImageSave (DiskName, DiskOffset, DiskSize);
+ break;
- //
- // memory buffer
- //
- case FileTypeMemBuffer:
- Status = HMemImageSave (MemOffset, MemSize);
- break;
+ //
+ // memory buffer
+ //
+ case FileTypeMemBuffer:
+ Status = HMemImageSave (MemOffset, MemSize);
+ break;
- default:
- Status = EFI_NOT_FOUND;
- break;
+ default:
+ Status = EFI_NOT_FOUND;
+ break;
}
if (EFI_ERROR (Status)) {
@@ -1057,11 +1063,11 @@ HBufferImageCreateLine ( if (HBufferImage.Lines == NULL) {
HBufferImage.Lines = CR (
- HBufferImage.ListHead->ForwardLink,
- HEFI_EDITOR_LINE,
- Link,
- EFI_EDITOR_LINE_LIST
- );
+ HBufferImage.ListHead->ForwardLink,
+ HEFI_EDITOR_LINE,
+ Link,
+ EFI_EDITOR_LINE_LIST
+ );
}
return Line;
@@ -1095,21 +1101,21 @@ HBufferImageFree ( **/
INTN
HBufferImageCharToHex (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
//
// change the character to hex
//
- if (Char >= L'0' && Char <= L'9') {
+ if ((Char >= L'0') && (Char <= L'9')) {
return (Char - L'0');
}
- if (Char >= L'a' && Char <= L'f') {
+ if ((Char >= L'a') && (Char <= L'f')) {
return (Char - L'a' + 10);
}
- if (Char >= L'A' && Char <= L'F') {
+ if ((Char >= L'A') && (Char <= L'F')) {
return (Char - L'A' + 10);
}
@@ -1146,10 +1152,10 @@ HBufferImageAddChar ( return EFI_SUCCESS;
}
- Line = HBufferImage.CurrentLine;
- FRow = HBufferImage.BufferPosition.Row;
- FCol = HBufferImage.BufferPosition.Column;
- High = HBufferImage.HighBits;
+ Line = HBufferImage.CurrentLine;
+ FRow = HBufferImage.BufferPosition.Row;
+ FCol = HBufferImage.BufferPosition.Column;
+ High = HBufferImage.HighBits;
//
// only needs to refresh current line
@@ -1164,27 +1170,25 @@ HBufferImageAddChar ( // cursor always at high 4 bits
// and always put input to the low 4 bits
//
- Line->Buffer[Line->Size] = (UINT8) Value;
+ Line->Buffer[Line->Size] = (UINT8)Value;
Line->Size++;
High = FALSE;
} else {
-
Old = Line->Buffer[FCol - 1];
//
// always put the input to the low 4 bits
//
- Old = (UINT8) (Old & 0x0f);
- Old = (UINT8) (Old << 4);
- Old = (UINT8) (Value + Old);
- Line->Buffer[FCol - 1] = Old;
+ Old = (UINT8)(Old & 0x0f);
+ Old = (UINT8)(Old << 4);
+ Old = (UINT8)(Value + Old);
+ Line->Buffer[FCol - 1] = Old;
//
// at the low 4 bits of the last character of a full line
// so if no next line, need to create a new line
//
- if (!High && FCol == 0x10) {
-
+ if (!High && (FCol == 0x10)) {
HBufferImageOnlyLineNeedRefresh = FALSE;
HBufferImageNeedRefresh = TRUE;
@@ -1198,26 +1202,29 @@ HBufferImageAddChar ( if (NewLine == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// end of NULL
//
}
+
//
// end of == ListHead
//
}
+
//
// end of == 0x10
//
// if already at end of this line, scroll it to the start of next line
//
- if (FCol == 0x10 && !High) {
+ if ((FCol == 0x10) && !High) {
//
// definitely has next line
//
FRow++;
- FCol = 1;
- High = TRUE;
+ FCol = 1;
+ High = TRUE;
} else {
//
// if not at end of this line, just move to next column
@@ -1231,12 +1238,13 @@ HBufferImageAddChar ( } else {
High = TRUE;
}
-
}
+
//
// end of ==FALSE
//
}
+
//
// move cursor to right
//
@@ -1261,9 +1269,9 @@ HBufferImageDoBackspace ( {
HEFI_EDITOR_LINE *Line;
- UINTN FileColumn;
- UINTN FPos;
- BOOLEAN LastLine;
+ UINTN FileColumn;
+ UINTN FPos;
+ BOOLEAN LastLine;
//
// variable initialization
@@ -1273,17 +1281,17 @@ HBufferImageDoBackspace ( //
// already the first character
//
- if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) {
+ if ((HBufferImage.BufferPosition.Row == 1) && (HBufferImage.BufferPosition.Column == 1)) {
return EFI_SUCCESS;
}
- FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;
+ FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;
- FileColumn = HBufferImage.BufferPosition.Column;
+ FileColumn = HBufferImage.BufferPosition.Column;
- Line = HBufferImage.CurrentLine;
- LastLine = FALSE;
- if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) {
+ Line = HBufferImage.CurrentLine;
+ LastLine = FALSE;
+ if ((Line->Link.ForwardLink == HBufferImage.ListHead) && (FileColumn > 1)) {
LastLine = TRUE;
}
@@ -1327,32 +1335,32 @@ HBufferImageDoCharInput ( Status = EFI_SUCCESS;
switch (Char) {
- case 0:
- break;
+ case 0:
+ break;
- case 0x08:
- Status = HBufferImageDoBackspace ();
- break;
+ case 0x08:
+ Status = HBufferImageDoBackspace ();
+ break;
- case 0x09:
- case 0x0a:
- case 0x0d:
- //
- // Tabs, Returns are thought as nothing
- //
- break;
+ case 0x09:
+ case 0x0a:
+ case 0x0d:
+ //
+ // Tabs, Returns are thought as nothing
+ //
+ break;
- default:
- //
- // DEAL WITH ASCII CHAR, filter out thing like ctrl+f
- //
- if (Char > 127 || Char < 32) {
- Status = StatusBarSetStatusString (L"Unknown Command");
- } else {
- Status = HBufferImageAddChar (Char);
- }
+ default:
+ //
+ // DEAL WITH ASCII CHAR, filter out thing like ctrl+f
+ //
+ if ((Char > 127) || (Char < 32)) {
+ Status = StatusBarSetStatusString (L"Unknown Command");
+ } else {
+ Status = HBufferImageAddChar (Char);
+ }
- break;
+ break;
}
return Status;
@@ -1369,7 +1377,7 @@ HBufferImageDoCharInput ( **/
BOOLEAN
HAboveCurrentScreen (
- IN UINTN FileRow
+ IN UINTN FileRow
)
{
if (FileRow < HBufferImage.LowVisibleRow) {
@@ -1390,7 +1398,7 @@ HAboveCurrentScreen ( **/
BOOLEAN
HUnderCurrentScreen (
- IN UINTN FileRow
+ IN UINTN FileRow
)
{
if (FileRow > HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 2) - 1) {
@@ -1414,19 +1422,19 @@ HBufferImageMovePosition ( IN BOOLEAN HighBits
)
{
- INTN RowGap;
- UINTN Abs;
- BOOLEAN Above;
- BOOLEAN Under;
- UINTN NewDisplayCol;
+ INTN RowGap;
+ UINTN Abs;
+ BOOLEAN Above;
+ BOOLEAN Under;
+ UINTN NewDisplayCol;
//
// CALCULATE gap between current file position and new file position
//
- RowGap = NewFilePosRow - HBufferImage.BufferPosition.Row;
+ RowGap = NewFilePosRow - HBufferImage.BufferPosition.Row;
- Under = HUnderCurrentScreen (NewFilePosRow);
- Above = HAboveCurrentScreen (NewFilePosRow);
+ Under = HUnderCurrentScreen (NewFilePosRow);
+ Above = HAboveCurrentScreen (NewFilePosRow);
HBufferImage.HighBits = HighBits;
@@ -1456,12 +1464,11 @@ HBufferImageMovePosition ( //
HBufferImage.BufferPosition.Row = NewFilePosRow;
if (RowGap <= 0) {
- Abs = (UINTN)ABS(RowGap);
+ Abs = (UINTN)ABS (RowGap);
HBufferImage.DisplayPosition.Row -= Abs;
} else {
HBufferImage.DisplayPosition.Row += RowGap;
}
-
}
}
@@ -1470,9 +1477,9 @@ HBufferImageMovePosition ( //
// always in current screen
//
- HBufferImage.BufferPosition.Column = NewFilePosCol;
+ HBufferImage.BufferPosition.Column = NewFilePosCol;
- NewDisplayCol = 10 + (NewFilePosCol - 1) * 3;
+ NewDisplayCol = 10 + (NewFilePosCol - 1) * 3;
if (NewFilePosCol > 0x8) {
NewDisplayCol++;
}
@@ -1487,7 +1494,6 @@ HBufferImageMovePosition ( // let CurrentLine point to correct line;
//
HBufferImage.CurrentLine = HMoveCurrentLine (RowGap);
-
}
/**
@@ -1521,6 +1527,7 @@ HBufferImageScrollRight ( if (FCol > Line->Size) {
return EFI_SUCCESS;
}
+
//
// if already at end of this line, scroll it to the start of next line
//
@@ -1531,7 +1538,6 @@ HBufferImageScrollRight ( if (Line->Link.ForwardLink != HBufferImage.ListHead) {
FRow++;
FCol = 1;
-
} else {
return EFI_SUCCESS;
}
@@ -1540,7 +1546,6 @@ HBufferImageScrollRight ( // if not at end of this line, just move to next column
//
FCol++;
-
}
HBufferImageMovePosition (FRow, FCol, TRUE);
@@ -1558,7 +1563,6 @@ HBufferImageScrollLeft ( VOID
)
{
-
HEFI_EDITOR_LINE *Line;
UINTN FRow;
UINTN FCol;
@@ -1580,8 +1584,8 @@ HBufferImageScrollLeft ( //
if (Line->Link.BackLink != HBufferImage.ListHead) {
FRow--;
- Line = CR (Line->Link.BackLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
- FCol = Line->Size;
+ Line = CR (Line->Link.BackLink, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
+ FCol = Line->Size;
} else {
return EFI_SUCCESS;
}
@@ -1612,11 +1616,11 @@ HBufferImageScrollDown ( UINTN FCol;
BOOLEAN HighBits;
- Line = HBufferImage.CurrentLine;
+ Line = HBufferImage.CurrentLine;
- FRow = HBufferImage.BufferPosition.Row;
- FCol = HBufferImage.BufferPosition.Column;
- HighBits = HBufferImage.HighBits;
+ FRow = HBufferImage.BufferPosition.Row;
+ FCol = HBufferImage.BufferPosition.Column;
+ HighBits = HBufferImage.HighBits;
//
// has next line
@@ -1629,10 +1633,9 @@ HBufferImageScrollDown ( // if the next line is not that long, so move to end of next line
//
if (FCol > Line->Size) {
- FCol = Line->Size + 1;
- HighBits = TRUE;
+ FCol = Line->Size + 1;
+ HighBits = TRUE;
}
-
} else {
return EFI_SUCCESS;
}
@@ -1656,17 +1659,16 @@ HBufferImageScrollUp ( UINTN FRow;
UINTN FCol;
- Line = HBufferImage.CurrentLine;
+ Line = HBufferImage.CurrentLine;
- FRow = HBufferImage.BufferPosition.Row;
- FCol = HBufferImage.BufferPosition.Column;
+ FRow = HBufferImage.BufferPosition.Row;
+ FCol = HBufferImage.BufferPosition.Column;
//
// has previous line
//
if (Line->Link.BackLink != HBufferImage.ListHead) {
FRow--;
-
} else {
return EFI_SUCCESS;
}
@@ -1692,11 +1694,11 @@ HBufferImagePageDown ( UINTN Gap;
BOOLEAN HighBits;
- Line = HBufferImage.CurrentLine;
+ Line = HBufferImage.CurrentLine;
- FRow = HBufferImage.BufferPosition.Row;
- FCol = HBufferImage.BufferPosition.Column;
- HighBits = HBufferImage.HighBits;
+ FRow = HBufferImage.BufferPosition.Row;
+ FCol = HBufferImage.BufferPosition.Column;
+ HighBits = HBufferImage.HighBits;
//
// has next page
@@ -1709,6 +1711,7 @@ HBufferImagePageDown ( //
Gap = HBufferImage.NumLines - FRow;
}
+
//
// get correct line
//
@@ -1717,9 +1720,9 @@ HBufferImagePageDown ( //
// if that line, is not that long, so move to the end of that line
//
- if (Line != NULL && FCol > Line->Size) {
- FCol = Line->Size + 1;
- HighBits = TRUE;
+ if ((Line != NULL) && (FCol > Line->Size)) {
+ FCol = Line->Size + 1;
+ HighBits = TRUE;
}
FRow += Gap;
@@ -1739,13 +1742,13 @@ HBufferImagePageUp ( VOID
)
{
- UINTN FRow;
- UINTN FCol;
- UINTN Gap;
- INTN Retreat;
+ UINTN FRow;
+ UINTN FCol;
+ UINTN Gap;
+ INTN Retreat;
- FRow = HBufferImage.BufferPosition.Row;
- FCol = HBufferImage.BufferPosition.Column;
+ FRow = HBufferImage.BufferPosition.Row;
+ FCol = HBufferImage.BufferPosition.Column;
//
// has previous page
@@ -1779,16 +1782,16 @@ HBufferImageHome ( VOID
)
{
- UINTN FRow;
- UINTN FCol;
- BOOLEAN HighBits;
+ UINTN FRow;
+ UINTN FCol;
+ BOOLEAN HighBits;
//
// curosr will at the high bit
//
- FRow = HBufferImage.BufferPosition.Row;
- FCol = 1;
- HighBits = TRUE;
+ FRow = HBufferImage.BufferPosition.Row;
+ FCol = 1;
+ HighBits = TRUE;
//
// move cursor position
@@ -1816,19 +1819,20 @@ HBufferImageEnd ( //
// need refresh mouse
//
- HBufferImageMouseNeedRefresh = TRUE;
+ HBufferImageMouseNeedRefresh = TRUE;
- Line = HBufferImage.CurrentLine;
+ Line = HBufferImage.CurrentLine;
- FRow = HBufferImage.BufferPosition.Row;
+ FRow = HBufferImage.BufferPosition.Row;
if (Line->Size == 0x10) {
- FCol = Line->Size;
- HighBits = FALSE;
+ FCol = Line->Size;
+ HighBits = FALSE;
} else {
- FCol = Line->Size + 1;
- HighBits = TRUE;
+ FCol = Line->Size + 1;
+ HighBits = TRUE;
}
+
//
// move cursor position
//
@@ -1847,7 +1851,7 @@ HBufferImageGetTotalSize ( VOID
)
{
- UINTN Size;
+ UINTN Size;
HEFI_EDITOR_LINE *Line;
@@ -1859,11 +1863,11 @@ HBufferImageGetTotalSize ( }
Line = CR (
- HBufferImage.ListHead->BackLink,
- HEFI_EDITOR_LINE,
- Link,
- EFI_EDITOR_LINE_LIST
- );
+ HBufferImage.ListHead->BackLink,
+ HEFI_EDITOR_LINE,
+ Link,
+ EFI_EDITOR_LINE_LIST
+ );
//
// one line at most 0x10
//
@@ -1883,29 +1887,29 @@ HBufferImageGetTotalSize ( **/
EFI_STATUS
HBufferImageDeleteCharacterFromBuffer (
- IN UINTN Pos,
- IN UINTN Count,
- OUT UINT8 *DeleteBuffer
+ IN UINTN Pos,
+ IN UINTN Count,
+ OUT UINT8 *DeleteBuffer
)
{
- UINTN Index;
+ UINTN Index;
- VOID *Buffer;
- UINT8 *BufferPtr;
- UINTN Size;
+ VOID *Buffer;
+ UINT8 *BufferPtr;
+ UINTN Size;
HEFI_EDITOR_LINE *Line;
- LIST_ENTRY *Link;
+ LIST_ENTRY *Link;
- UINTN OldFCol;
- UINTN OldFRow;
- UINTN OldPos;
+ UINTN OldFCol;
+ UINTN OldFRow;
+ UINTN OldPos;
- UINTN NewPos;
+ UINTN NewPos;
- EFI_STATUS Status;
+ EFI_STATUS Status;
- Size = HBufferImageGetTotalSize ();
+ Size = HBufferImageGetTotalSize ();
if (Size < Count) {
return EFI_LOAD_ERROR;
@@ -1928,7 +1932,6 @@ HBufferImageDeleteCharacterFromBuffer ( // so locate according to block's previous character
//
NewPos = Pos - 1;
-
} else {
//
// has no character before it,
@@ -1946,7 +1949,7 @@ HBufferImageDeleteCharacterFromBuffer ( HBufferImageListToBuffer (Buffer, Size);
- BufferPtr = (UINT8 *) Buffer;
+ BufferPtr = (UINT8 *)Buffer;
//
// pass deleted buffer out
@@ -1956,6 +1959,7 @@ HBufferImageDeleteCharacterFromBuffer ( DeleteBuffer[Index] = BufferPtr[Pos + Index];
}
}
+
//
// delete the part from Pos
//
@@ -1979,14 +1983,14 @@ HBufferImageDeleteCharacterFromBuffer ( Link = Link->ForwardLink;
}
- Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
- HBufferImage.CurrentLine = Line;
+ Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
+ HBufferImage.CurrentLine = Line;
//
// if current cursor position if inside select area
// then move it to the block's NEXT character
//
- if (OldPos >= Pos && OldPos < (Pos + Count)) {
+ if ((OldPos >= Pos) && (OldPos < (Pos + Count))) {
NewPos = Pos;
} else {
if (OldPos < Pos) {
@@ -2012,28 +2016,28 @@ HBufferImageDeleteCharacterFromBuffer ( **/
EFI_STATUS
HBufferImageAddCharacterToBuffer (
- IN UINTN Pos,
- IN UINTN Count,
- IN UINT8 *AddBuffer
+ IN UINTN Pos,
+ IN UINTN Count,
+ IN UINT8 *AddBuffer
)
{
- INTN Index;
+ INTN Index;
- VOID *Buffer;
- UINT8 *BufferPtr;
- UINTN Size;
+ VOID *Buffer;
+ UINT8 *BufferPtr;
+ UINTN Size;
HEFI_EDITOR_LINE *Line;
- LIST_ENTRY *Link;
+ LIST_ENTRY *Link;
- UINTN OldFCol;
- UINTN OldFRow;
- UINTN OldPos;
+ UINTN OldFCol;
+ UINTN OldFRow;
+ UINTN OldPos;
- UINTN NewPos;
+ UINTN NewPos;
- Size = HBufferImageGetTotalSize ();
+ Size = HBufferImageGetTotalSize ();
//
// relocate all the HBufferImage fields
@@ -2060,18 +2064,19 @@ HBufferImageAddCharacterToBuffer ( HBufferImageListToBuffer (Buffer, Size);
- BufferPtr = (UINT8 *) Buffer;
+ BufferPtr = (UINT8 *)Buffer;
//
// get a place to add
//
- for (Index = (INTN) (Size + Count - 1); Index >= (INTN) Pos; Index--) {
+ for (Index = (INTN)(Size + Count - 1); Index >= (INTN)Pos; Index--) {
BufferPtr[Index] = BufferPtr[Index - Count];
}
+
//
// add the buffer
//
- for (Index = (INTN) 0; Index < (INTN) Count; Index++) {
+ for (Index = (INTN)0; Index < (INTN)Count; Index++) {
BufferPtr[Index + Pos] = AddBuffer[Index];
}
@@ -2084,12 +2089,12 @@ HBufferImageAddCharacterToBuffer ( FreePool (Buffer);
Link = HMainEditor.BufferImage->ListHead->ForwardLink;
- for (Index = 0; Index < (INTN) NewPos / 0x10; Index++) {
+ for (Index = 0; Index < (INTN)NewPos / 0x10; Index++) {
Link = Link->ForwardLink;
}
- Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
- HBufferImage.CurrentLine = Line;
+ Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
+ HBufferImage.CurrentLine = Line;
if (OldPos >= Pos) {
NewPos = OldPos + Count;
@@ -2112,18 +2117,17 @@ HBufferImageDoDelete ( VOID
)
{
-
HEFI_EDITOR_LINE *Line;
- BOOLEAN LastLine;
- UINTN FileColumn;
- UINTN FPos;
+ BOOLEAN LastLine;
+ UINTN FileColumn;
+ UINTN FPos;
- FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;
+ FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;
- FileColumn = HBufferImage.BufferPosition.Column;
+ FileColumn = HBufferImage.BufferPosition.Column;
- Line = HBufferImage.CurrentLine;
+ Line = HBufferImage.CurrentLine;
//
// if beyond the last character
@@ -2179,9 +2183,9 @@ HBufferImageBufferToList ( HEFI_EDITOR_LINE *Line;
UINT8 *BufferPtr;
- TempI = 0;
+ TempI = 0;
Left = 0;
- BufferPtr = (UINT8 *) Buffer;
+ BufferPtr = (UINT8 *)Buffer;
//
// parse file content line by line
@@ -2207,13 +2211,12 @@ HBufferImageBufferToList ( Line->Buffer[TempJ] = BufferPtr[TempI];
TempI++;
}
-
}
//
// last line is a full line, SO create a new line
//
- if (Left == 0x10 || Bytes == 0) {
+ if ((Left == 0x10) || (Bytes == 0)) {
Line = HBufferImageCreateLine ();
if (Line == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -2240,7 +2243,7 @@ HBufferImageListToBuffer ( UINTN Count;
UINTN Index;
HEFI_EDITOR_LINE *Line;
- LIST_ENTRY *Link;
+ LIST_ENTRY *Link;
UINT8 *BufferPtr;
//
@@ -2252,16 +2255,15 @@ HBufferImageListToBuffer ( Link = &HBufferImage.Lines->Link;
Count = 0;
- BufferPtr = (UINT8 *) Buffer;
+ BufferPtr = (UINT8 *)Buffer;
//
// deal line by line
//
while (Link != HBufferImage.ListHead) {
-
Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
- //@todo shouldn't this be an error???
+ // @todo shouldn't this be an error???
if (Count + Line->Size > Bytes) {
return EFI_SUCCESS;
}
@@ -2270,7 +2272,7 @@ HBufferImageListToBuffer ( BufferPtr[Index] = Line->Buffer[Index];
}
- Count += Line->Size;
+ Count += Line->Size;
BufferPtr += Line->Size;
Link = Link->ForwardLink;
@@ -2287,14 +2289,14 @@ HBufferImageListToBuffer ( **/
VOID
HBufferImageAdjustMousePosition (
- IN INT32 TextX,
- IN INT32 TextY
+ IN INT32 TextX,
+ IN INT32 TextY
)
{
- UINTN TempX;
- UINTN TempY;
- UINTN AbsX;
- UINTN AbsY;
+ UINTN TempX;
+ UINTN TempY;
+ UINTN AbsX;
+ UINTN AbsY;
//
// TextX and TextY is mouse movement data returned by mouse driver
@@ -2308,6 +2310,7 @@ HBufferImageAdjustMousePosition ( } else {
AbsX = -TextX;
}
+
//
// get absolute TempY value
//
@@ -2339,29 +2342,30 @@ HBufferImageAdjustMousePosition ( TempY = 0;
}
}
+
//
// check whether new mouse column position is beyond screen
// if not, adjust it
//
- if (TempX >= 10 && TempX <= (10 + 0x10 * 3 - 1)) {
+ if ((TempX >= 10) && (TempX <= (10 + 0x10 * 3 - 1))) {
HBufferImage.MousePosition.Column = TempX;
} else if (TempX < 10) {
HBufferImage.MousePosition.Column = 10;
} else if (TempX > (10 + 0x10 * 3 - 1)) {
HBufferImage.MousePosition.Column = 10 + 0x10 * 3 - 1;
}
+
//
// check whether new mouse row position is beyond screen
// if not, adjust it
//
- if (TempY >= 2 && TempY <= (HMainEditor.ScreenSize.Row - 1)) {
+ if ((TempY >= 2) && (TempY <= (HMainEditor.ScreenSize.Row - 1))) {
HBufferImage.MousePosition.Row = TempY;
} else if (TempY < 2) {
HBufferImage.MousePosition.Row = 2;
} else if (TempY > (HMainEditor.ScreenSize.Row - 1)) {
HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 1);
}
-
}
/**
@@ -2381,7 +2385,7 @@ HBufferImageAdjustMousePosition ( **/
EFI_STATUS
HBufferImageHandleInput (
- IN EFI_INPUT_KEY *Key
+ IN EFI_INPUT_KEY *Key
)
{
EFI_STATUS Status;
@@ -2389,81 +2393,80 @@ HBufferImageHandleInput ( Status = EFI_SUCCESS;
switch (Key->ScanCode) {
- //
- // ordinary key
- //
- case SCAN_NULL:
- Status = HBufferImageDoCharInput (Key->UnicodeChar);
- break;
+ //
+ // ordinary key
+ //
+ case SCAN_NULL:
+ Status = HBufferImageDoCharInput (Key->UnicodeChar);
+ break;
- //
- // up arrow
- //
- case SCAN_UP:
- Status = HBufferImageScrollUp ();
- break;
+ //
+ // up arrow
+ //
+ case SCAN_UP:
+ Status = HBufferImageScrollUp ();
+ break;
- //
- // down arrow
- //
- case SCAN_DOWN:
- Status = HBufferImageScrollDown ();
- break;
+ //
+ // down arrow
+ //
+ case SCAN_DOWN:
+ Status = HBufferImageScrollDown ();
+ break;
- //
- // right arrow
- //
- case SCAN_RIGHT:
- Status = HBufferImageScrollRight ();
- break;
+ //
+ // right arrow
+ //
+ case SCAN_RIGHT:
+ Status = HBufferImageScrollRight ();
+ break;
- //
- // left arrow
- //
- case SCAN_LEFT:
- Status = HBufferImageScrollLeft ();
- break;
+ //
+ // left arrow
+ //
+ case SCAN_LEFT:
+ Status = HBufferImageScrollLeft ();
+ break;
- //
- // page up
- //
- case SCAN_PAGE_UP:
- Status = HBufferImagePageUp ();
- break;
+ //
+ // page up
+ //
+ case SCAN_PAGE_UP:
+ Status = HBufferImagePageUp ();
+ break;
- //
- // page down
- //
- case SCAN_PAGE_DOWN:
- Status = HBufferImagePageDown ();
- break;
+ //
+ // page down
+ //
+ case SCAN_PAGE_DOWN:
+ Status = HBufferImagePageDown ();
+ break;
- //
- // delete
- //
- case SCAN_DELETE:
- Status = HBufferImageDoDelete ();
- break;
+ //
+ // delete
+ //
+ case SCAN_DELETE:
+ Status = HBufferImageDoDelete ();
+ break;
- //
- // home
- //
- case SCAN_HOME:
- Status = HBufferImageHome ();
- break;
+ //
+ // home
+ //
+ case SCAN_HOME:
+ Status = HBufferImageHome ();
+ break;
- //
- // end
- //
- case SCAN_END:
- Status = HBufferImageEnd ();
- break;
+ //
+ // end
+ //
+ case SCAN_END:
+ Status = HBufferImageEnd ();
+ break;
- default:
- Status = StatusBarSetStatusString (L"Unknown Command");
- break;
+ default:
+ Status = StatusBarSetStatusString (L"Unknown Command");
+ break;
}
return Status;
}
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h index 0599f293ec..777a7ce93b 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h @@ -62,7 +62,7 @@ HBufferImageRefresh ( **/
EFI_STATUS
HBufferImageHandleInput (
- IN EFI_INPUT_KEY *Key
+ IN EFI_INPUT_KEY *Key
);
/**
@@ -92,14 +92,14 @@ HBufferImageBackup ( **/
EFI_STATUS
HBufferImageRead (
- IN CONST CHAR16 *FileName,
- IN CONST CHAR16 *DiskName,
- IN UINTN DiskOffset,
- IN UINTN DiskSize,
- IN UINTN MemOffset,
- IN UINTN MemSize,
- IN EDIT_FILE_TYPE BufferType,
- IN BOOLEAN Recover
+ IN CONST CHAR16 *FileName,
+ IN CONST CHAR16 *DiskName,
+ IN UINTN DiskOffset,
+ IN UINTN DiskSize,
+ IN UINTN MemOffset,
+ IN UINTN MemSize,
+ IN EDIT_FILE_TYPE BufferType,
+ IN BOOLEAN Recover
);
/**
@@ -117,13 +117,13 @@ HBufferImageRead ( **/
EFI_STATUS
HBufferImageSave (
- IN CHAR16 *FileName,
- IN CHAR16 *DiskName,
- IN UINTN DiskOffset,
- IN UINTN DiskSize,
- IN UINTN MemOffset,
- IN UINTN MemSize,
- IN EDIT_FILE_TYPE BufferType
+ IN CHAR16 *FileName,
+ IN CHAR16 *DiskName,
+ IN UINTN DiskOffset,
+ IN UINTN DiskSize,
+ IN UINTN MemOffset,
+ IN UINTN MemSize,
+ IN EDIT_FILE_TYPE BufferType
);
/**
@@ -140,7 +140,6 @@ HBufferImageMovePosition ( IN BOOLEAN HighBits
);
-
/**
Create a new line and append it to the line list.
Fields affected:
@@ -177,9 +176,9 @@ HBufferImageFree ( **/
EFI_STATUS
HBufferImageDeleteCharacterFromBuffer (
- IN UINTN Pos,
- IN UINTN Count,
- OUT UINT8 *DeleteBuffer
+ IN UINTN Pos,
+ IN UINTN Count,
+ OUT UINT8 *DeleteBuffer
);
/**
@@ -193,9 +192,9 @@ HBufferImageDeleteCharacterFromBuffer ( **/
EFI_STATUS
HBufferImageAddCharacterToBuffer (
- IN UINTN Pos,
- IN UINTN Count,
- IN UINT8 *AddBuffer
+ IN UINTN Pos,
+ IN UINTN Count,
+ IN UINT8 *AddBuffer
);
/**
@@ -235,8 +234,8 @@ HBufferImageListToBuffer ( **/
VOID
HBufferImageAdjustMousePosition (
- IN INT32 TextX,
- IN INT32 TextY
+ IN INT32 TextX,
+ IN INT32 TextY
);
/**
@@ -250,8 +249,8 @@ HBufferImageAdjustMousePosition ( **/
BOOLEAN
HBufferImageIsAtHighBits (
- IN UINTN Column,
- OUT UINTN *FCol
+ IN UINTN Column,
+ OUT UINTN *FCol
);
/**
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c index c2d6c5fa9a..f18a7dd098 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c @@ -9,16 +9,16 @@ #include "HexEditor.h"
typedef struct {
- UINT8 *Buffer;
- UINTN Size;
+ UINT8 *Buffer;
+ UINTN Size;
} HEFI_EDITOR_CLIPBOARD;
-HEFI_EDITOR_CLIPBOARD HClipBoard;
+HEFI_EDITOR_CLIPBOARD HClipBoard;
//
// for basic initialization of HClipBoard
//
-HEFI_EDITOR_CLIPBOARD HClipBoardConst = {
+HEFI_EDITOR_CLIPBOARD HClipBoardConst = {
NULL,
0
};
@@ -53,7 +53,6 @@ HClipBoardCleanup ( VOID
)
{
-
SHELL_FREE_NON_NULL (HClipBoard.Buffer);
return EFI_SUCCESS;
@@ -69,8 +68,8 @@ HClipBoardCleanup ( **/
EFI_STATUS
HClipBoardSet (
- IN UINT8 *Buffer,
- IN UINTN Size
+ IN UINT8 *Buffer,
+ IN UINTN Size
)
{
//
@@ -80,7 +79,7 @@ HClipBoardSet ( SHELL_FREE_NON_NULL (HClipBoard.Buffer);
HClipBoard.Buffer = Buffer;
- HClipBoard.Size = Size;
+ HClipBoard.Size = Size;
return EFI_SUCCESS;
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h index 6e1e2d42cc..eaeaa00d3a 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.h @@ -44,8 +44,8 @@ HClipBoardCleanup ( **/
EFI_STATUS
HClipBoardSet (
- IN UINT8 *Buffer,
- IN UINTN Size
+ IN UINT8 *Buffer,
+ IN UINTN Size
);
/**
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c index 771a5c6840..f884428240 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c @@ -9,22 +9,22 @@ #include "HexEditor.h"
#include <Protocol/BlockIo.h>
-extern EFI_HANDLE HImageHandleBackup;
-extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
+extern EFI_HANDLE HImageHandleBackup;
+extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
-extern BOOLEAN HBufferImageNeedRefresh;
-extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
-extern BOOLEAN HBufferImageMouseNeedRefresh;
+extern BOOLEAN HBufferImageNeedRefresh;
+extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
+extern BOOLEAN HBufferImageMouseNeedRefresh;
extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor;
-HEFI_EDITOR_DISK_IMAGE HDiskImage;
-HEFI_EDITOR_DISK_IMAGE HDiskImageBackupVar;
+HEFI_EDITOR_DISK_IMAGE HDiskImage;
+HEFI_EDITOR_DISK_IMAGE HDiskImageBackupVar;
//
// for basic initialization of HDiskImage
//
-HEFI_EDITOR_DISK_IMAGE HDiskImageConst = {
+HEFI_EDITOR_DISK_IMAGE HDiskImageConst = {
NULL,
0,
0,
@@ -70,13 +70,13 @@ HDiskImageBackup ( //
SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name);
- HDiskImageBackupVar.Name = CatSPrint(NULL, L"%s", HDiskImage.Name);
+ HDiskImageBackupVar.Name = CatSPrint (NULL, L"%s", HDiskImage.Name);
if (HDiskImageBackupVar.Name == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- HDiskImageBackupVar.Offset = HDiskImage.Offset;
- HDiskImageBackupVar.Size = HDiskImage.Size;
+ HDiskImageBackupVar.Offset = HDiskImage.Offset;
+ HDiskImageBackupVar.Size = HDiskImage.Size;
return EFI_SUCCESS;
}
@@ -109,9 +109,9 @@ HDiskImageCleanup ( **/
EFI_STATUS
HDiskImageSetDiskNameOffsetSize (
- IN CONST CHAR16 *Str,
- IN UINTN Offset,
- IN UINTN Size
+ IN CONST CHAR16 *Str,
+ IN UINTN Offset,
+ IN UINTN Size
)
{
if (Str == HDiskImage.Name) {
@@ -131,8 +131,8 @@ HDiskImageSetDiskNameOffsetSize ( return EFI_OUT_OF_RESOURCES;
}
- HDiskImage.Offset = Offset;
- HDiskImage.Size = Size;
+ HDiskImage.Offset = Offset;
+ HDiskImage.Size = Size;
return EFI_SUCCESS;
}
@@ -152,10 +152,10 @@ HDiskImageSetDiskNameOffsetSize ( **/
EFI_STATUS
HDiskImageRead (
- IN CONST CHAR16 *DeviceName,
- IN UINTN Offset,
- IN UINTN Size,
- IN BOOLEAN Recover
+ IN CONST CHAR16 *DeviceName,
+ IN UINTN Offset,
+ IN UINTN Size,
+ IN BOOLEAN Recover
)
{
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;
@@ -165,46 +165,49 @@ HDiskImageRead ( EFI_BLOCK_IO_PROTOCOL *BlkIo;
EFI_STATUS Status;
- VOID *Buffer;
- CHAR16 *Str;
- UINTN Bytes;
+ VOID *Buffer;
+ CHAR16 *Str;
+ UINTN Bytes;
- HEFI_EDITOR_LINE *Line;
+ HEFI_EDITOR_LINE *Line;
HBufferImage.BufferType = FileTypeDiskBuffer;
- DevicePath = gEfiShellProtocol->GetDevicePathFromMap(DeviceName);
+ DevicePath = gEfiShellProtocol->GetDevicePathFromMap (DeviceName);
if (DevicePath == NULL) {
StatusBarSetStatusString (L"Cannot Find Device");
return EFI_INVALID_PARAMETER;
}
- DupDevicePath = DuplicateDevicePath(DevicePath);
+
+ DupDevicePath = DuplicateDevicePath (DevicePath);
DupDevicePathForFree = DupDevicePath;
//
// get blkio interface
//
- Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid,&DupDevicePath,&Handle);
- FreePool(DupDevicePathForFree);
+ Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DupDevicePath, &Handle);
+ FreePool (DupDevicePathForFree);
if (EFI_ERROR (Status)) {
StatusBarSetStatusString (L"Read Disk Failed");
return Status;
}
- Status = gBS->OpenProtocol(Handle, &gEfiBlockIoProtocolGuid, (VOID**)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+
+ Status = gBS->OpenProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR (Status)) {
StatusBarSetStatusString (L"Read Disk Failed");
return Status;
}
+
//
// if Offset exceeds LastBlock,
// return error
//
- if (Offset > BlkIo->Media->LastBlock || Offset + Size > BlkIo->Media->LastBlock) {
+ if ((Offset > BlkIo->Media->LastBlock) || (Offset + Size > BlkIo->Media->LastBlock)) {
StatusBarSetStatusString (L"Invalid Offset + Size");
return EFI_LOAD_ERROR;
}
- Bytes = BlkIo->Media->BlockSize * Size;
- Buffer = AllocateZeroPool (Bytes);
+ Bytes = BlkIo->Media->BlockSize * Size;
+ Buffer = AllocateZeroPool (Bytes);
if (Buffer == NULL) {
StatusBarSetStatusString (L"Read Disk Failed");
@@ -246,25 +249,26 @@ HDiskImageRead ( StatusBarSetStatusString (L"Read Disk Failed");
return EFI_OUT_OF_RESOURCES;
}
+
//
// initialize some variables
//
- HDiskImage.BlockSize = BlkIo->Media->BlockSize;
+ HDiskImage.BlockSize = BlkIo->Media->BlockSize;
HBufferImage.DisplayPosition.Row = 2;
HBufferImage.DisplayPosition.Column = 10;
- HBufferImage.MousePosition.Row = 2;
- HBufferImage.MousePosition.Column = 10;
+ HBufferImage.MousePosition.Row = 2;
+ HBufferImage.MousePosition.Column = 10;
- HBufferImage.LowVisibleRow = 1;
- HBufferImage.HighBits = TRUE;
+ HBufferImage.LowVisibleRow = 1;
+ HBufferImage.HighBits = TRUE;
- HBufferImage.BufferPosition.Row = 1;
- HBufferImage.BufferPosition.Column = 1;
+ HBufferImage.BufferPosition.Row = 1;
+ HBufferImage.BufferPosition.Column = 1;
if (!Recover) {
- Str = CatSPrint(NULL, L"%d Lines Read", HBufferImage.NumLines);
+ Str = CatSPrint (NULL, L"%d Lines Read", HBufferImage.NumLines);
if (Str == NULL) {
StatusBarSetStatusString (L"Read Disk Failed");
return EFI_OUT_OF_RESOURCES;
@@ -275,7 +279,6 @@ HDiskImageRead ( HMainEditor.SelectStart = 0;
HMainEditor.SelectEnd = 0;
-
}
//
@@ -283,11 +286,11 @@ HDiskImageRead ( //
if (HBufferImage.Lines != NULL) {
HBufferImage.CurrentLine = CR (
- HBufferImage.ListHead->ForwardLink,
- HEFI_EDITOR_LINE,
- Link,
- EFI_EDITOR_LINE_LIST
- );
+ HBufferImage.ListHead->ForwardLink,
+ HEFI_EDITOR_LINE,
+ Link,
+ EFI_EDITOR_LINE_LIST
+ );
} else {
//
// create a dummy line
@@ -324,12 +327,11 @@ HDiskImageRead ( **/
EFI_STATUS
HDiskImageSave (
- IN CHAR16 *DeviceName,
- IN UINTN Offset,
- IN UINTN Size
+ IN CHAR16 *DeviceName,
+ IN UINTN Offset,
+ IN UINTN Size
)
{
-
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *DupDevicePath;
EFI_DEVICE_PATH_PROTOCOL *DupDevicePathForFree;
@@ -348,35 +350,38 @@ HDiskImageSave ( HBufferImage.BufferType = FileTypeDiskBuffer;
- DevicePath = gEfiShellProtocol->GetDevicePathFromMap(DeviceName);
+ DevicePath = gEfiShellProtocol->GetDevicePathFromMap (DeviceName);
if (DevicePath == NULL) {
-// StatusBarSetStatusString (L"Cannot Find Device");
+ // StatusBarSetStatusString (L"Cannot Find Device");
return EFI_INVALID_PARAMETER;
}
- DupDevicePath = DuplicateDevicePath(DevicePath);
+
+ DupDevicePath = DuplicateDevicePath (DevicePath);
DupDevicePathForFree = DupDevicePath;
//
// get blkio interface
//
- Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid,&DupDevicePath,&Handle);
- FreePool(DupDevicePathForFree);
+ Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DupDevicePath, &Handle);
+ FreePool (DupDevicePathForFree);
if (EFI_ERROR (Status)) {
-// StatusBarSetStatusString (L"Read Disk Failed");
+ // StatusBarSetStatusString (L"Read Disk Failed");
return Status;
}
- Status = gBS->OpenProtocol(Handle, &gEfiBlockIoProtocolGuid, (VOID**)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+
+ Status = gBS->OpenProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR (Status)) {
-// StatusBarSetStatusString (L"Read Disk Failed");
+ // StatusBarSetStatusString (L"Read Disk Failed");
return Status;
}
- Bytes = BlkIo->Media->BlockSize * Size;
- Buffer = AllocateZeroPool (Bytes);
+ Bytes = BlkIo->Media->BlockSize * Size;
+ Buffer = AllocateZeroPool (Bytes);
if (Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// concatenate the line list to a buffer
//
@@ -402,6 +407,7 @@ HDiskImageSave ( if (EFI_ERROR (Status)) {
return EFI_LOAD_ERROR;
}
+
//
// now not modified
//
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h index d0a78e0a12..69d822e7e4 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.h @@ -60,10 +60,10 @@ HDiskImageBackup ( **/
EFI_STATUS
HDiskImageRead (
- IN CONST CHAR16 *DeviceName,
- IN UINTN Offset,
- IN UINTN Size,
- IN BOOLEAN Recover
+ IN CONST CHAR16 *DeviceName,
+ IN UINTN Offset,
+ IN UINTN Size,
+ IN BOOLEAN Recover
);
/**
@@ -81,9 +81,9 @@ HDiskImageRead ( **/
EFI_STATUS
HDiskImageSave (
- IN CHAR16 *DeviceName,
- IN UINTN Offset,
- IN UINTN Size
+ IN CHAR16 *DeviceName,
+ IN UINTN Offset,
+ IN UINTN Size
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c index 4f96cb6cb5..d8818dd958 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c @@ -8,22 +8,22 @@ #include "HexEditor.h"
-extern EFI_HANDLE HImageHandleBackup;
-extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
+extern EFI_HANDLE HImageHandleBackup;
+extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
-extern BOOLEAN HBufferImageNeedRefresh;
-extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
-extern BOOLEAN HBufferImageMouseNeedRefresh;
+extern BOOLEAN HBufferImageNeedRefresh;
+extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
+extern BOOLEAN HBufferImageMouseNeedRefresh;
extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor;
-HEFI_EDITOR_FILE_IMAGE HFileImage;
-HEFI_EDITOR_FILE_IMAGE HFileImageBackupVar;
+HEFI_EDITOR_FILE_IMAGE HFileImage;
+HEFI_EDITOR_FILE_IMAGE HFileImageBackupVar;
//
// for basic initialization of HFileImage
//
-HEFI_EDITOR_BUFFER_IMAGE HFileImageConst = {
+HEFI_EDITOR_BUFFER_IMAGE HFileImageConst = {
NULL,
0,
FALSE
@@ -66,7 +66,7 @@ HFileImageBackup ( )
{
SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName);
- HFileImageBackupVar.FileName = CatSPrint(NULL, L"%s", HFileImage.FileName);
+ HFileImageBackupVar.FileName = CatSPrint (NULL, L"%s", HFileImage.FileName);
if (HFileImageBackupVar.FileName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -84,7 +84,6 @@ HFileImageCleanup ( VOID
)
{
-
SHELL_FREE_NON_NULL (HFileImage.FileName);
SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName);
@@ -101,7 +100,7 @@ HFileImageCleanup ( **/
EFI_STATUS
HFileImageSetFileName (
- IN CONST CHAR16 *Str
+ IN CONST CHAR16 *Str
)
{
if (Str == HFileImage.FileName) {
@@ -111,6 +110,7 @@ HFileImageSetFileName ( //
return EFI_SUCCESS;
}
+
//
// free the old file name
//
@@ -136,18 +136,18 @@ HFileImageSetFileName ( EFI_STATUS
HFileImageRead (
IN CONST CHAR16 *FileName,
- IN BOOLEAN Recover
+ IN BOOLEAN Recover
)
{
- HEFI_EDITOR_LINE *Line;
- UINT8 *Buffer;
- CHAR16 *UnicodeBuffer;
- EFI_STATUS Status;
+ HEFI_EDITOR_LINE *Line;
+ UINT8 *Buffer;
+ CHAR16 *UnicodeBuffer;
+ EFI_STATUS Status;
//
// variable initialization
//
- Line = NULL;
+ Line = NULL;
//
// in this function, when you return error ( except EFI_OUT_OF_RESOURCES )
@@ -157,14 +157,14 @@ HFileImageRead ( // so if you want to print the error status
// you should set the status string
//
- Status = ReadFileIntoBuffer (FileName, (VOID**)&Buffer, &HFileImage.Size, &HFileImage.ReadOnly);
+ Status = ReadFileIntoBuffer (FileName, (VOID **)&Buffer, &HFileImage.Size, &HFileImage.ReadOnly);
//
// NULL pointer is only also a failure for a non-zero file size.
//
- if ((EFI_ERROR(Status)) || (Buffer == NULL && HFileImage.Size != 0)) {
- UnicodeBuffer = CatSPrint(NULL, L"Read error on file %s: %r", FileName, Status);
+ if ((EFI_ERROR (Status)) || ((Buffer == NULL) && (HFileImage.Size != 0))) {
+ UnicodeBuffer = CatSPrint (NULL, L"Read error on file %s: %r", FileName, Status);
if (UnicodeBuffer == NULL) {
- SHELL_FREE_NON_NULL(Buffer);
+ SHELL_FREE_NON_NULL (Buffer);
return EFI_OUT_OF_RESOURCES;
}
@@ -195,12 +195,12 @@ HFileImageRead ( HBufferImage.HighBits = TRUE;
HBufferImage.BufferPosition.Row = 1;
HBufferImage.BufferPosition.Column = 1;
- HBufferImage.BufferType = FileTypeFileBuffer;
+ HBufferImage.BufferType = FileTypeFileBuffer;
if (!Recover) {
- UnicodeBuffer = CatSPrint(NULL, L"%d Lines Read", HBufferImage.NumLines);
+ UnicodeBuffer = CatSPrint (NULL, L"%d Lines Read", HBufferImage.NumLines);
if (UnicodeBuffer == NULL) {
- SHELL_FREE_NON_NULL(Buffer);
+ SHELL_FREE_NON_NULL (Buffer);
return EFI_OUT_OF_RESOURCES;
}
@@ -222,7 +222,7 @@ HFileImageRead ( //
Line = HBufferImageCreateLine ();
if (Line == NULL) {
- SHELL_FREE_NON_NULL(Buffer);
+ SHELL_FREE_NON_NULL (Buffer);
return EFI_OUT_OF_RESOURCES;
}
@@ -248,20 +248,19 @@ HFileImageRead ( **/
EFI_STATUS
HFileImageSave (
- IN CHAR16 *FileName
+ IN CHAR16 *FileName
)
{
-
- LIST_ENTRY *Link;
- HEFI_EDITOR_LINE *Line;
- CHAR16 *Str;
- EFI_STATUS Status;
- UINTN NumLines;
- SHELL_FILE_HANDLE FileHandle;
- UINTN TotalSize;
- UINT8 *Buffer;
- UINT8 *Ptr;
- EDIT_FILE_TYPE BufferTypeBackup;
+ LIST_ENTRY *Link;
+ HEFI_EDITOR_LINE *Line;
+ CHAR16 *Str;
+ EFI_STATUS Status;
+ UINTN NumLines;
+ SHELL_FILE_HANDLE FileHandle;
+ UINTN TotalSize;
+ UINT8 *Buffer;
+ UINT8 *Ptr;
+ EDIT_FILE_TYPE BufferTypeBackup;
BufferTypeBackup = HBufferImage.BufferType;
HBufferImage.BufferType = FileTypeFileBuffer;
@@ -269,11 +268,11 @@ HFileImageSave ( //
// if is the old file
//
- if (HFileImage.FileName != NULL && FileName != NULL && StrCmp (FileName, HFileImage.FileName) == 0) {
+ if ((HFileImage.FileName != NULL) && (FileName != NULL) && (StrCmp (FileName, HFileImage.FileName) == 0)) {
//
// check whether file exists on disk
//
- if (ShellIsFile(FileName) == EFI_SUCCESS) {
+ if (ShellIsFile (FileName) == EFI_SUCCESS) {
//
// current file exists on disk
// so if not modified, then not save
@@ -281,6 +280,7 @@ HFileImageSave ( if (HBufferImage.Modified == FALSE) {
return EFI_SUCCESS;
}
+
//
// if file is read-only, set error
//
@@ -291,7 +291,7 @@ HFileImageSave ( }
}
- if (ShellIsDirectory(FileName) == EFI_SUCCESS) {
+ if (ShellIsDirectory (FileName) == EFI_SUCCESS) {
StatusBarSetStatusString (L"Directory Can Not Be Saved");
return EFI_LOAD_ERROR;
}
@@ -303,11 +303,11 @@ HFileImageSave ( // the file exits, 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;
}
- }
+ }
//
// write all the lines back to disk
@@ -320,11 +320,13 @@ HFileImageSave ( if (Line->Size != 0) {
TotalSize += Line->Size;
}
+
//
// end of if Line -> Size != 0
//
NumLines++;
}
+
//
// end of for Link
//
@@ -341,12 +343,12 @@ HFileImageSave ( CopyMem (Ptr, Line->Buffer, Line->Size);
Ptr += Line->Size;
}
+
//
// end of if Line -> Size != 0
//
}
-
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
if (EFI_ERROR (Status)) {
@@ -361,22 +363,23 @@ HFileImageSave ( return EFI_LOAD_ERROR;
}
- ShellCloseFile(&FileHandle);
+ ShellCloseFile (&FileHandle);
HBufferImage.Modified = FALSE;
//
// set status string
//
- Str = CatSPrint(NULL, L"%d Lines Written", NumLines);
+ Str = CatSPrint (NULL, L"%d Lines Written", NumLines);
StatusBarSetStatusString (Str);
FreePool (Str);
//
// now everything is ready , you can set the new file name to filebuffer
//
- if ((BufferTypeBackup != FileTypeFileBuffer && FileName != NULL) ||
- (FileName != NULL && HFileImage.FileName != NULL && StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0)){
+ if (((BufferTypeBackup != FileTypeFileBuffer) && (FileName != NULL)) ||
+ ((FileName != NULL) && (HFileImage.FileName != NULL) && (StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0)))
+ {
//
// not the same
//
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h index 9fb25ac5e9..36ee989b2e 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.h @@ -57,7 +57,7 @@ HFileImageBackup ( EFI_STATUS
HFileImageRead (
IN CONST CHAR16 *FileName,
- IN BOOLEAN Recover
+ IN BOOLEAN Recover
);
/**
@@ -71,7 +71,7 @@ HFileImageRead ( **/
EFI_STATUS
HFileImageSave (
- IN CHAR16 *FileName
+ IN CHAR16 *FileName
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c index 5e5d6fc290..9ca675648d 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c @@ -13,12 +13,12 @@ //
// Global Variables
//
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-f", TypeFlag},
- {L"-d", TypeFlag},
- {L"-m", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-f", TypeFlag },
+ { L"-d", TypeFlag },
+ { L"-m", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'hexedit' command.
@@ -33,20 +33,20 @@ ShellCommandRunHexEdit ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- CHAR16 *Buffer;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- LIST_ENTRY *Package;
- CHAR16 *NewName;
- CONST CHAR16 *Name;
- UINTN Offset;
- UINTN Size;
- EDIT_FILE_TYPE WhatToDo;
+ EFI_STATUS Status;
+ CHAR16 *Buffer;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ LIST_ENTRY *Package;
+ CHAR16 *NewName;
+ CONST CHAR16 *Name;
+ UINTN Offset;
+ UINTN Size;
+ EDIT_FILE_TYPE WhatToDo;
Buffer = NULL;
ShellStatus = SHELL_SUCCESS;
- NewName = NULL;
+ NewName = NULL;
Buffer = NULL;
Name = NULL;
Offset = 0;
@@ -56,43 +56,44 @@ ShellCommandRunHexEdit ( //
// 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"hexedit", 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"hexedit", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// Check for -d
//
- if (ShellCommandLineGetFlag(Package, L"-d")){
- if (ShellCommandLineGetCount(Package) < 4) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
+ if (ShellCommandLineGetFlag (Package, L"-d")) {
+ if (ShellCommandLineGetCount (Package) < 4) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) > 4) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
+ } else if (ShellCommandLineGetCount (Package) > 4) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
WhatToDo = FileTypeDiskBuffer;
- Name = ShellCommandLineGetRawValue(Package, 1);
- Offset = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 2));
- Size = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 3));
+ Name = ShellCommandLineGetRawValue (Package, 1);
+ Offset = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 2));
+ Size = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 3));
}
- if (Offset == (UINTN)-1 || Size == (UINTN)-1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"hexedit", L"-d");
+
+ if ((Offset == (UINTN)-1) || (Size == (UINTN)-1)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"hexedit", L"-d");
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
@@ -100,20 +101,20 @@ ShellCommandRunHexEdit ( //
// check for -f
//
- if (ShellCommandLineGetFlag(Package, L"-f") && (WhatToDo == FileTypeNone)){
- if (ShellCommandLineGetCount(Package) < 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
+ if (ShellCommandLineGetFlag (Package, L"-f") && (WhatToDo == FileTypeNone)) {
+ if (ShellCommandLineGetCount (Package) < 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) > 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
+ } else if (ShellCommandLineGetCount (Package) > 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Name = ShellCommandLineGetRawValue(Package, 1);
- if (Name == NULL || !IsValidFileName(Name)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name);
+ Name = ShellCommandLineGetRawValue (Package, 1);
+ if ((Name == NULL) || !IsValidFileName (Name)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- WhatToDo = FileTypeFileBuffer;
+ WhatToDo = FileTypeFileBuffer;
}
}
}
@@ -121,46 +122,47 @@ ShellCommandRunHexEdit ( //
// check for -m
//
- if (ShellCommandLineGetFlag(Package, L"-m") && (WhatToDo == FileTypeNone)){
- if (ShellCommandLineGetCount(Package) < 3) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
+ if (ShellCommandLineGetFlag (Package, L"-m") && (WhatToDo == FileTypeNone)) {
+ if (ShellCommandLineGetCount (Package) < 3) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) > 3) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
+ } else if (ShellCommandLineGetCount (Package) > 3) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
WhatToDo = FileTypeMemBuffer;
- Offset = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 1));
- Size = ShellStrToUintn(ShellCommandLineGetRawValue(Package, 2));
+ Offset = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 1));
+ Size = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 2));
}
}
- Name = ShellCommandLineGetRawValue(Package, 1);
- if (WhatToDo == FileTypeNone && Name != NULL) {
- if (ShellCommandLineGetCount(Package) > 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
+
+ Name = ShellCommandLineGetRawValue (Package, 1);
+ if ((WhatToDo == FileTypeNone) && (Name != NULL)) {
+ if (ShellCommandLineGetCount (Package) > 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (!IsValidFileName(Name)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name);
+ } else if (!IsValidFileName (Name)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- WhatToDo = FileTypeFileBuffer;
+ WhatToDo = FileTypeFileBuffer;
}
} else if (WhatToDo == FileTypeNone) {
- if (gEfiShellProtocol->GetCurDir(NULL) == NULL) {
+ if (gEfiShellProtocol->GetCurDir (NULL) == NULL) {
ShellStatus = SHELL_NOT_FOUND;
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellDebug1HiiHandle, L"hexedit");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellDebug1HiiHandle, L"hexedit");
} else {
- NewName = EditGetDefaultFileName(L"bin");
- Name = NewName;
- WhatToDo = FileTypeFileBuffer;
+ NewName = EditGetDefaultFileName (L"bin");
+ Name = NewName;
+ WhatToDo = FileTypeFileBuffer;
}
}
- if (ShellStatus == SHELL_SUCCESS && WhatToDo == FileTypeNone) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
+ if ((ShellStatus == SHELL_SUCCESS) && (WhatToDo == FileTypeNone)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (WhatToDo == FileTypeFileBuffer && ShellGetCurrentDir(NULL) == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellDebug1HiiHandle, L"hexedit");
+ } else if ((WhatToDo == FileTypeFileBuffer) && (ShellGetCurrentDir (NULL) == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellDebug1HiiHandle, L"hexedit");
ShellStatus = SHELL_INVALID_PARAMETER;
}
@@ -172,62 +174,64 @@ ShellCommandRunHexEdit ( if (EFI_ERROR (Status)) {
gST->ConOut->ClearScreen (gST->ConOut);
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_INIT_FAILED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_INIT_FAILED), gShellDebug1HiiHandle);
} else {
HMainEditorBackup ();
switch (WhatToDo) {
- case FileTypeFileBuffer:
- Status = HBufferImageRead (
- Name==NULL?L"":Name,
- NULL,
- 0,
- 0,
- 0,
- 0,
- FileTypeFileBuffer,
- FALSE
- );
- break;
+ case FileTypeFileBuffer:
+ Status = HBufferImageRead (
+ Name == NULL ? L"" : Name,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
+ FileTypeFileBuffer,
+ FALSE
+ );
+ break;
- case FileTypeDiskBuffer:
- Status = HBufferImageRead (
- NULL,
- Name==NULL?L"":Name,
- Offset,
- Size,
- 0,
- 0,
- FileTypeDiskBuffer,
- FALSE
- );
- break;
+ case FileTypeDiskBuffer:
+ Status = HBufferImageRead (
+ NULL,
+ Name == NULL ? L"" : Name,
+ Offset,
+ Size,
+ 0,
+ 0,
+ FileTypeDiskBuffer,
+ FALSE
+ );
+ break;
- case FileTypeMemBuffer:
- Status = HBufferImageRead (
- NULL,
- NULL,
- 0,
- 0,
- (UINT32) Offset,
- Size,
- FileTypeMemBuffer,
- FALSE
- );
- break;
+ case FileTypeMemBuffer:
+ Status = HBufferImageRead (
+ NULL,
+ NULL,
+ 0,
+ 0,
+ (UINT32)Offset,
+ Size,
+ FileTypeMemBuffer,
+ FALSE
+ );
+ break;
- default:
- Status = EFI_NOT_FOUND;
- break;
+ default:
+ Status = EFI_NOT_FOUND;
+ break;
}
+
if (!EFI_ERROR (Status)) {
HMainEditorRefresh ();
Status = HMainEditorKeyInput ();
}
+
if (Status != EFI_OUT_OF_RESOURCES) {
//
// back up the status string
//
- Buffer = CatSPrint (NULL, L"%s\r\n", StatusBarGetString());
+ Buffer = CatSPrint (NULL, L"%s\r\n", StatusBarGetString ());
}
}
@@ -246,22 +250,23 @@ ShellCommandRunHexEdit ( // print editor exit code on screen
//
if (Status == EFI_OUT_OF_RESOURCES) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"hexedit");
- } else if (EFI_ERROR(Status)){
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"hexedit");
+ } else if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
if (StrCmp (Buffer, L"") != 0) {
//
// print out the status string
//
- ShellPrintEx(-1, -1, L"%s", Buffer);
+ ShellPrintEx (-1, -1, L"%s", Buffer);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_UNKNOWN_EDITOR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_UNKNOWN_EDITOR), gShellDebug1HiiHandle);
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_UNKNOWN_EDITOR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_UNKNOWN_EDITOR), gShellDebug1HiiHandle);
}
}
}
+
ShellCommandLineFreeVarList (Package);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h index 404914eb4b..63a1d54965 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h @@ -14,12 +14,11 @@ #define EFI_EDITOR_LINE_LIST SIGNATURE_32 ('e', 'e', 'l', 'l')
-#define ASCII_POSITION ((0x10 * 3) + 12)
-
+#define ASCII_POSITION ((0x10 * 3) + 12)
typedef struct {
- UINTN Row;
- UINTN Column;
+ UINTN Row;
+ UINTN Column;
} HEFI_EDITOR_POSITION;
typedef
@@ -29,92 +28,90 @@ EFI_STATUS );
typedef struct {
- CHAR16 Name[50];
- CHAR16 Key[3];
- HEFI_MENU_ITEM_FUNCTION Function;
+ CHAR16 Name[50];
+ CHAR16 Key[3];
+ HEFI_MENU_ITEM_FUNCTION Function;
} HMENU_ITEMS;
typedef struct _HEFI_EDITOR_LINE {
- UINTN Signature;
- UINT8 Buffer[0x10];
- UINTN Size; // unit is Unicode
- LIST_ENTRY Link;
+ UINTN Signature;
+ UINT8 Buffer[0x10];
+ UINTN Size; // unit is Unicode
+ LIST_ENTRY Link;
} HEFI_EDITOR_LINE;
typedef struct _HEFI_EDITOR_MENU_ITEM {
- CHAR16 NameToken;
- CHAR16 FunctionKeyToken;
- HEFI_MENU_ITEM_FUNCTION Function;
+ CHAR16 NameToken;
+ CHAR16 FunctionKeyToken;
+ HEFI_MENU_ITEM_FUNCTION Function;
} HEFI_EDITOR_MENU_ITEM;
typedef struct {
- UINT32 Foreground : 4;
- UINT32 Background : 4;
+ UINT32 Foreground : 4;
+ UINT32 Background : 4;
} HEFI_EDITOR_COLOR_ATTRIBUTES;
typedef union {
- HEFI_EDITOR_COLOR_ATTRIBUTES Colors;
- UINTN Data;
+ HEFI_EDITOR_COLOR_ATTRIBUTES Colors;
+ UINTN Data;
} HEFI_EDITOR_COLOR_UNION;
typedef struct {
- UINTN Columns;
- UINTN Rows;
+ UINTN Columns;
+ UINTN Rows;
} HEFI_EDITOR_TEXT_MODE;
-
typedef struct {
- CHAR16 *Name;
+ CHAR16 *Name;
- UINTN BlockSize;
- UINTN Size;
- UINTN Offset;
+ UINTN BlockSize;
+ UINTN Size;
+ UINTN Offset;
} HEFI_EDITOR_DISK_IMAGE;
typedef struct {
- EFI_CPU_IO2_PROTOCOL *IoFncs;
- UINTN Offset;
- UINTN Size;
+ EFI_CPU_IO2_PROTOCOL *IoFncs;
+ UINTN Offset;
+ UINTN Size;
} HEFI_EDITOR_MEM_IMAGE;
typedef struct {
- CHAR16 *FileName;
- UINTN Size; // file size
- BOOLEAN ReadOnly; // file is read-only or not
+ CHAR16 *FileName;
+ UINTN Size; // file size
+ BOOLEAN ReadOnly; // file is read-only or not
} HEFI_EDITOR_FILE_IMAGE;
typedef struct {
- LIST_ENTRY *ListHead; // list head of lines
- HEFI_EDITOR_LINE *Lines; // lines of current file
- UINTN NumLines; // number of lines
- HEFI_EDITOR_LINE *CurrentLine; // current line cursor is at
- HEFI_EDITOR_POSITION DisplayPosition; // cursor position in screen
- HEFI_EDITOR_POSITION MousePosition; // mouse position in screen
- HEFI_EDITOR_POSITION BufferPosition; // cursor position in buffer
- UINTN LowVisibleRow; // the lowest visible row of file position
- BOOLEAN HighBits; // cursor is at the high4 bits or low4 bits
- BOOLEAN Modified; // BUFFER is modified or not
- EDIT_FILE_TYPE BufferType;
-
- HEFI_EDITOR_FILE_IMAGE *FileImage;
- HEFI_EDITOR_DISK_IMAGE *DiskImage;
- HEFI_EDITOR_MEM_IMAGE *MemImage;
-
+ LIST_ENTRY *ListHead; // list head of lines
+ HEFI_EDITOR_LINE *Lines; // lines of current file
+ UINTN NumLines; // number of lines
+ HEFI_EDITOR_LINE *CurrentLine; // current line cursor is at
+ HEFI_EDITOR_POSITION DisplayPosition; // cursor position in screen
+ HEFI_EDITOR_POSITION MousePosition; // mouse position in screen
+ HEFI_EDITOR_POSITION BufferPosition; // cursor position in buffer
+ UINTN LowVisibleRow; // the lowest visible row of file position
+ BOOLEAN HighBits; // cursor is at the high4 bits or low4 bits
+ BOOLEAN Modified; // BUFFER is modified or not
+ EDIT_FILE_TYPE BufferType;
+
+ HEFI_EDITOR_FILE_IMAGE *FileImage;
+ HEFI_EDITOR_DISK_IMAGE *DiskImage;
+ HEFI_EDITOR_MEM_IMAGE *MemImage;
} HEFI_EDITOR_BUFFER_IMAGE;
typedef struct {
- HEFI_EDITOR_BUFFER_IMAGE *BufferImage;
-
- HEFI_EDITOR_COLOR_UNION ColorAttributes;
- HEFI_EDITOR_POSITION ScreenSize; // row number and column number
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInputEx;
- BOOLEAN MouseSupported;
- EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;
- INT32 MouseAccumulatorX;
- INT32 MouseAccumulatorY;
-
- UINTN SelectStart; // starting from 1
- UINTN SelectEnd; // starting from 1
+ HEFI_EDITOR_BUFFER_IMAGE *BufferImage;
+
+ HEFI_EDITOR_COLOR_UNION ColorAttributes;
+ HEFI_EDITOR_POSITION ScreenSize; // row number and column number
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInputEx;
+ BOOLEAN MouseSupported;
+ EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;
+ INT32 MouseAccumulatorX;
+ INT32 MouseAccumulatorY;
+
+ UINTN SelectStart; // starting from 1
+ UINTN SelectEnd; // starting from 1
} HEFI_EDITOR_GLOBAL_EDITOR;
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c index 9f72da1193..0eb917acf7 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c @@ -13,38 +13,38 @@ #include "EditStatusBar.h"
#include "EditInputBar.h"
-HEFI_EDITOR_COLOR_ATTRIBUTES HOriginalColors;
-INTN HOriginalMode;
+HEFI_EDITOR_COLOR_ATTRIBUTES HOriginalColors;
+INTN HOriginalMode;
//
// the first time editor launch
//
-BOOLEAN HEditorFirst;
+BOOLEAN HEditorFirst;
//
// it's time editor should exit
//
-BOOLEAN HEditorExit;
+BOOLEAN HEditorExit;
-BOOLEAN HEditorMouseAction;
+BOOLEAN HEditorMouseAction;
-extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
-extern HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar;
+extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
+extern HEFI_EDITOR_BUFFER_IMAGE HBufferImageBackupVar;
-extern BOOLEAN HBufferImageMouseNeedRefresh;
-extern BOOLEAN HBufferImageNeedRefresh;
-extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
+extern BOOLEAN HBufferImageMouseNeedRefresh;
+extern BOOLEAN HBufferImageNeedRefresh;
+extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
-HEFI_EDITOR_GLOBAL_EDITOR HMainEditor;
-HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar;
+HEFI_EDITOR_GLOBAL_EDITOR HMainEditor;
+HEFI_EDITOR_GLOBAL_EDITOR HMainEditorBackupVar;
//
// basic initialization for MainEditor
//
-HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = {
+HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = {
&HBufferImage,
{
- {0, 0}
+ { 0, 0}
},
{
0,
@@ -63,33 +63,32 @@ HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = { Help info that will be displayed.
**/
EFI_STRING_ID HexMainMenuHelpInfo[] = {
- STRING_TOKEN(STR_HEXEDIT_HELP_TITLE),
- STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
- STRING_TOKEN(STR_HEXEDIT_HELP_LIST_TITLE),
- STRING_TOKEN(STR_HEXEDIT_HELP_DIV),
- STRING_TOKEN(STR_HEXEDIT_HELP_GO_TO_OFFSET),
- STRING_TOKEN(STR_HEXEDIT_HELP_SAVE_BUFFER),
- STRING_TOKEN(STR_HEXEDIT_HELP_EXIT),
- STRING_TOKEN(STR_HEXEDIT_HELP_SELECT_START),
- STRING_TOKEN(STR_HEXEDIT_HELP_SELECT_END),
- STRING_TOKEN(STR_HEXEDIT_HELP_CUT),
- STRING_TOKEN(STR_HEXEDIT_HELP_PASTE),
- STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_FILE),
- STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_DISK),
- STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_MEMORY),
- STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
- STRING_TOKEN(STR_HEXEDIT_HELP_EXIT_HELP),
- STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
- STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
- STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
- STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
- STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
- STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
- STRING_TOKEN(STR_HEXEDIT_HELP_DIV),
+ STRING_TOKEN (STR_HEXEDIT_HELP_TITLE),
+ STRING_TOKEN (STR_HEXEDIT_HELP_BLANK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_LIST_TITLE),
+ STRING_TOKEN (STR_HEXEDIT_HELP_DIV),
+ STRING_TOKEN (STR_HEXEDIT_HELP_GO_TO_OFFSET),
+ STRING_TOKEN (STR_HEXEDIT_HELP_SAVE_BUFFER),
+ STRING_TOKEN (STR_HEXEDIT_HELP_EXIT),
+ STRING_TOKEN (STR_HEXEDIT_HELP_SELECT_START),
+ STRING_TOKEN (STR_HEXEDIT_HELP_SELECT_END),
+ STRING_TOKEN (STR_HEXEDIT_HELP_CUT),
+ STRING_TOKEN (STR_HEXEDIT_HELP_PASTE),
+ STRING_TOKEN (STR_HEXEDIT_HELP_OPEN_FILE),
+ STRING_TOKEN (STR_HEXEDIT_HELP_OPEN_DISK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_OPEN_MEMORY),
+ STRING_TOKEN (STR_HEXEDIT_HELP_BLANK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_EXIT_HELP),
+ STRING_TOKEN (STR_HEXEDIT_HELP_BLANK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_BLANK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_BLANK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_BLANK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_BLANK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_BLANK),
+ STRING_TOKEN (STR_HEXEDIT_HELP_DIV),
0
};
-
/**
show help menu.
@@ -100,19 +99,23 @@ HMainCommandDisplayHelp ( VOID
)
{
- INT32 CurrentLine;
- CHAR16 *InfoString;
- EFI_KEY_DATA KeyData;
- EFI_STATUS Status;
- UINTN EventIndex;
+ INT32 CurrentLine;
+ CHAR16 *InfoString;
+ EFI_KEY_DATA KeyData;
+ EFI_STATUS Status;
+ UINTN EventIndex;
//
// print helpInfo
//
for (CurrentLine = 0; 0 != HexMainMenuHelpInfo[CurrentLine]; CurrentLine++) {
- InfoString = HiiGetString(gShellDebug1HiiHandle, HexMainMenuHelpInfo[CurrentLine]
-, NULL);
- ShellPrintEx (0,CurrentLine+1,L"%E%s%N",InfoString);
+ InfoString = HiiGetString (
+ gShellDebug1HiiHandle,
+ HexMainMenuHelpInfo[CurrentLine]
+ ,
+ NULL
+ );
+ ShellPrintEx (0, CurrentLine+1, L"%E%s%N", InfoString);
}
//
@@ -123,13 +126,15 @@ HMainCommandDisplayHelp ( if (EFI_ERROR (Status) || (EventIndex != 0)) {
continue;
}
+
Status = HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.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.
@@ -139,7 +144,8 @@ HMainCommandDisplayHelp ( }
} 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.
@@ -151,7 +157,7 @@ HMainCommandDisplayHelp ( }
// update screen with buffer's info
- HBufferImageNeedRefresh = TRUE;
+ HBufferImageNeedRefresh = TRUE;
HBufferImageOnlyLineNeedRefresh = FALSE;
HBufferImageRefresh ();
@@ -177,10 +183,10 @@ HMainCommandGoToOffset ( //
// variable initialization
//
- Size = 0;
- Offset = 0;
- FRow = 0;
- FCol = 0;
+ Size = 0;
+ Offset = 0;
+ FRow = 0;
+ FCol = 0;
//
// get offset
@@ -202,14 +208,14 @@ HMainCommandGoToOffset ( // ESC pressed
//
if (Status == EFI_NOT_READY) {
-
return EFI_SUCCESS;
}
+
//
// THE input string length should > 0
//
- if (StrLen (InputBarGetString()) > 0) {
- Status = ShellConvertStringToUint64 (InputBarGetString(), &Offset, TRUE, FALSE);
+ if (StrLen (InputBarGetString ()) > 0) {
+ Status = ShellConvertStringToUint64 (InputBarGetString (), &Offset, TRUE, FALSE);
if (EFI_ERROR (Status)) {
StatusBarSetStatusString (L"Invalid Offset");
return EFI_SUCCESS;
@@ -225,8 +231,8 @@ HMainCommandGoToOffset ( return EFI_SUCCESS;
}
- FRow = (UINTN)DivU64x32(Offset , 0x10) + 1;
- FCol = (UINTN)ModU64x32(Offset , 0x10) + 1;
+ FRow = (UINTN)DivU64x32 (Offset, 0x10) + 1;
+ FCol = (UINTN)ModU64x32 (Offset, 0x10) + 1;
HBufferImageMovePosition (FRow, FCol, TRUE);
@@ -251,13 +257,13 @@ HMainCommandSaveBuffer ( VOID
)
{
- EFI_STATUS Status;
- BOOLEAN Done;
- CHAR16 *FileName;
- BOOLEAN OldFile;
- CHAR16 *Str;
- EFI_FILE_INFO *Info;
- SHELL_FILE_HANDLE ShellFileHandle;
+ EFI_STATUS Status;
+ BOOLEAN Done;
+ CHAR16 *FileName;
+ BOOLEAN OldFile;
+ CHAR16 *Str;
+ EFI_FILE_INFO *Info;
+ SHELL_FILE_HANDLE ShellFileHandle;
if (HMainEditor.BufferImage->BufferType != FileTypeFileBuffer) {
if (!HMainEditor.BufferImage->Modified) {
@@ -268,6 +274,7 @@ HMainCommandSaveBuffer ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// the answer is just one character
//
@@ -275,6 +282,7 @@ HMainCommandSaveBuffer ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// loop for user's answer
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
@@ -289,48 +297,51 @@ HMainCommandSaveBuffer ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- //
- // want to save this buffer first
- //
- Status = HBufferImageSave (
- NULL,
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- HMainEditor.BufferImage->BufferType
- );
-
- if (EFI_ERROR (Status)) {
- StatusBarSetStatusString (L"BufferSave: Problems Writing");
- return Status;
- }
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ //
+ // want to save this buffer first
+ //
+ Status = HBufferImageSave (
+ NULL,
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ HMainEditor.BufferImage->BufferType
+ );
+
+ if (EFI_ERROR (Status)) {
+ StatusBarSetStatusString (L"BufferSave: Problems Writing");
+ return Status;
+ }
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
- case L'n':
- case L'N':
- //
- // the file won't be saved
- //
- return EFI_SUCCESS;
+ case L'n':
+ case L'N':
+ //
+ // the file won't be saved
+ //
+ return EFI_SUCCESS;
- case L'c':
- case L'C':
- return EFI_SUCCESS;
+ case L'c':
+ case L'C':
+ return EFI_SUCCESS;
}
+
//
// end of switch
//
}
+
//
// ENDOF WHILE
//
}
+
//
// ENDOF != FILEBUFFER
//
@@ -369,7 +380,8 @@ HMainCommandSaveBuffer ( // 7. Update File Name field in Title Bar to B
// and remove the Modified flag in Title Bar.
//
- Str = CatSPrint(NULL,
+ Str = CatSPrint (
+ NULL,
L"File to Save: [%s]",
HMainEditor.BufferImage->FileImage->FileName
);
@@ -397,6 +409,7 @@ HMainCommandSaveBuffer ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// get new file name
//
@@ -415,13 +428,14 @@ HMainCommandSaveBuffer ( //
// if just enter pressed, so think save to current file name
//
- if (StrLen (InputBarGetString()) == 0) {
- FileName = CatSPrint(NULL,
- L"%s",
- HMainEditor.BufferImage->FileImage->FileName
- );
+ if (StrLen (InputBarGetString ()) == 0) {
+ FileName = CatSPrint (
+ NULL,
+ L"%s",
+ HMainEditor.BufferImage->FileImage->FileName
+ );
} else {
- FileName = CatSPrint(NULL, L"%s", InputBarGetString());
+ FileName = CatSPrint (NULL, L"%s", InputBarGetString ());
}
if (FileName == NULL) {
@@ -442,7 +456,8 @@ HMainCommandSaveBuffer ( if (StringNoCaseCompare (
&FileName,
&HMainEditor.BufferImage->FileImage->FileName
- ) == 0) {
+ ) == 0)
+ {
OldFile = TRUE;
}
@@ -459,10 +474,9 @@ HMainCommandSaveBuffer ( Status = ShellOpenFileByName (FileName, &ShellFileHandle, EFI_FILE_MODE_READ, 0);
if (!EFI_ERROR (Status)) {
+ Info = ShellGetFileInfo (ShellFileHandle);
- Info = ShellGetFileInfo(ShellFileHandle);
-
- ShellCloseFile(&ShellFileHandle);
+ ShellCloseFile (&ShellFileHandle);
//
// check if read only
//
@@ -472,7 +486,7 @@ HMainCommandSaveBuffer ( return EFI_SUCCESS;
}
- SHELL_FREE_NON_NULL(Info);
+ SHELL_FREE_NON_NULL (Info);
//
// ask user whether to overwrite this file
//
@@ -497,19 +511,19 @@ HMainCommandSaveBuffer ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- Done = TRUE;
- break;
- case L'n':
- case L'N':
- SHELL_FREE_NON_NULL (FileName);
- return EFI_SUCCESS;
- case L'c':
- case L'C':
- SHELL_FREE_NON_NULL (FileName);
- return EFI_SUCCESS;
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ Done = TRUE;
+ break;
+ case L'n':
+ case L'N':
+ SHELL_FREE_NON_NULL (FileName);
+ return EFI_SUCCESS;
+ case L'c':
+ case L'C':
+ SHELL_FREE_NON_NULL (FileName);
+ return EFI_SUCCESS;
} // switch
} // while
} // if opened existing file
@@ -519,14 +533,14 @@ HMainCommandSaveBuffer ( // save file back to disk
//
Status = HBufferImageSave (
- FileName,
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- FileTypeFileBuffer
- );
+ FileName,
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ FileTypeFileBuffer
+ );
SHELL_FREE_NON_NULL (FileName);
if (EFI_ERROR (Status)) {
@@ -548,7 +562,7 @@ HMainCommandSelectStart ( VOID
)
{
- UINTN Start;
+ UINTN Start;
Start = (HMainEditor.BufferImage->BufferPosition.Row - 1) * 0x10 + HMainEditor.BufferImage->BufferPosition.Column;
@@ -562,7 +576,7 @@ HMainCommandSelectStart ( }
}
- if (HMainEditor.SelectEnd != 0 && Start > HMainEditor.SelectEnd) {
+ if ((HMainEditor.SelectEnd != 0) && (Start > HMainEditor.SelectEnd)) {
StatusBarSetStatusString (L"Invalid Block Start");
return EFI_LOAD_ERROR;
}
@@ -586,7 +600,7 @@ HMainCommandSelectEnd ( VOID
)
{
- UINTN End;
+ UINTN End;
End = (HMainEditor.BufferImage->BufferPosition.Row - 1) * 0x10 + HMainEditor.BufferImage->BufferPosition.Column;
@@ -600,12 +614,12 @@ HMainCommandSelectEnd ( }
}
- if (HMainEditor.SelectStart != 0 && End < HMainEditor.SelectStart) {
+ if ((HMainEditor.SelectStart != 0) && (End < HMainEditor.SelectStart)) {
StatusBarSetStatusString (L"Invalid Block End");
return EFI_SUCCESS;
}
- HMainEditor.SelectEnd = End;
+ HMainEditor.SelectEnd = End;
HBufferImageNeedRefresh = TRUE;
@@ -624,10 +638,10 @@ HMainCommandCut ( VOID
)
{
- UINTN Index;
- LIST_ENTRY *Link;
- UINT8 *Buffer;
- UINTN Count;
+ UINTN Index;
+ LIST_ENTRY *Link;
+ UINT8 *Buffer;
+ UINTN Count;
//
// not select, so not allowed to cut
@@ -636,6 +650,7 @@ HMainCommandCut ( StatusBarSetStatusString (L"No Block is Selected");
return EFI_SUCCESS;
}
+
//
// not select, so not allowed to cut
//
@@ -649,11 +664,12 @@ HMainCommandCut ( Link = Link->ForwardLink;
}
- Count = HMainEditor.SelectEnd - HMainEditor.SelectStart + 1;
- Buffer = AllocateZeroPool (Count);
+ Count = HMainEditor.SelectEnd - HMainEditor.SelectStart + 1;
+ Buffer = AllocateZeroPool (Count);
if (Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// cut the selected area
//
@@ -696,7 +712,6 @@ HMainCommandPaste ( VOID
)
{
-
BOOLEAN OnlyLineRefresh;
HEFI_EDITOR_LINE *Line;
UINT8 *Buffer;
@@ -704,15 +719,15 @@ HMainCommandPaste ( UINTN FPos;
Count = HClipBoardGet (&Buffer);
- if (Count == 0 || Buffer == NULL) {
+ if ((Count == 0) || (Buffer == NULL)) {
StatusBarSetStatusString (L"Nothing to Paste");
return EFI_SUCCESS;
}
- Line = HMainEditor.BufferImage->CurrentLine;
+ Line = HMainEditor.BufferImage->CurrentLine;
OnlyLineRefresh = FALSE;
- if (Line->Link.ForwardLink == HMainEditor.BufferImage->ListHead && Line->Size + Count < 0x10) {
+ if ((Line->Link.ForwardLink == HMainEditor.BufferImage->ListHead) && (Line->Size + Count < 0x10)) {
//
// is at last line, and after paste will not exceed
// so only this line need to be refreshed
@@ -721,7 +736,6 @@ HMainCommandPaste ( // so the whole page will need be refreshed
//
OnlyLineRefresh = TRUE;
-
}
FPos = 0x10 * (HMainEditor.BufferImage->BufferPosition.Row - 1) + HMainEditor.BufferImage->BufferPosition.Column - 1;
@@ -741,7 +755,6 @@ HMainCommandPaste ( }
return EFI_SUCCESS;
-
}
/**
@@ -777,7 +790,6 @@ HMainCommandExit ( // whether to save the changes
//
if (HMainEditor.BufferImage->Modified) {
-
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
if (EFI_ERROR (Status)) {
return Status;
@@ -798,43 +810,41 @@ HMainCommandExit ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- //
- // write file back to disk
- //
- Status = HBufferImageSave (
- HMainEditor.BufferImage->FileImage->FileName,
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- HMainEditor.BufferImage->BufferType
- );
- if (!EFI_ERROR (Status)) {
- HEditorExit = TRUE;
- }
-
- return Status;
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ //
+ // write file back to disk
+ //
+ Status = HBufferImageSave (
+ HMainEditor.BufferImage->FileImage->FileName,
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ HMainEditor.BufferImage->BufferType
+ );
+ if (!EFI_ERROR (Status)) {
+ HEditorExit = TRUE;
+ }
- case L'n':
- case L'N':
- HEditorExit = TRUE;
- return EFI_SUCCESS;
+ return Status;
- case L'c':
- case L'C':
- return EFI_SUCCESS;
+ case L'n':
+ case L'N':
+ HEditorExit = TRUE;
+ return EFI_SUCCESS;
+ case L'c':
+ case L'C':
+ return EFI_SUCCESS;
}
}
}
HEditorExit = TRUE;
return EFI_SUCCESS;
-
}
/**
@@ -849,9 +859,9 @@ HMainCommandOpenFile ( VOID
)
{
- BOOLEAN Done;
- EFI_STATUS Status;
- EDIT_FILE_TYPE BufferType;
+ BOOLEAN Done;
+ EFI_STATUS Status;
+ EDIT_FILE_TYPE BufferType;
BufferType = HMainEditor.BufferImage->BufferType;
@@ -886,11 +896,11 @@ HMainCommandOpenFile ( // save it first.
//
if (HMainEditor.BufferImage->Modified) {
-
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// the answer is just one character
//
@@ -898,6 +908,7 @@ HMainCommandOpenFile ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// loop for user's answer
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
@@ -913,52 +924,53 @@ HMainCommandOpenFile ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- //
- // want to save this buffer first
- //
- Status = HBufferImageSave (
- HMainEditor.BufferImage->FileImage->FileName,
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- HMainEditor.BufferImage->BufferType
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ //
+ // want to save this buffer first
+ //
+ Status = HBufferImageSave (
+ HMainEditor.BufferImage->FileImage->FileName,
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ HMainEditor.BufferImage->BufferType
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- MainTitleBarRefresh (
- HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL,
- HMainEditor.BufferImage->BufferType,
- HMainEditor.BufferImage->FileImage->ReadOnly,
- FALSE,
- HMainEditor.ScreenSize.Column,
- HMainEditor.ScreenSize.Row,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Offset:0,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Size :0
- );
- Done = TRUE;
- break;
+ MainTitleBarRefresh (
+ HMainEditor.BufferImage->BufferType == FileTypeFileBuffer ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Name : NULL,
+ HMainEditor.BufferImage->BufferType,
+ HMainEditor.BufferImage->FileImage->ReadOnly,
+ FALSE,
+ HMainEditor.ScreenSize.Column,
+ HMainEditor.ScreenSize.Row,
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Offset : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Offset : 0,
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Size : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Size : 0
+ );
+ Done = TRUE;
+ break;
- case L'n':
- case L'N':
- //
- // the file won't be saved
- //
- Done = TRUE;
- break;
+ case L'n':
+ case L'N':
+ //
+ // the file won't be saved
+ //
+ Done = TRUE;
+ break;
- case L'c':
- case L'C':
- return EFI_SUCCESS;
+ case L'c':
+ case L'C':
+ return EFI_SUCCESS;
}
}
}
+
//
// TO get the open file name
//
@@ -980,15 +992,15 @@ HMainCommandOpenFile ( Status = InputBarSetStringSize (100);
if (EFI_ERROR (Status)) {
Status = HBufferImageRead (
- HMainEditor.BufferImage->FileImage->FileName,
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- BufferType,
- TRUE
- );
+ HMainEditor.BufferImage->FileImage->FileName,
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ BufferType,
+ TRUE
+ );
return Status;
}
@@ -1000,26 +1012,27 @@ HMainCommandOpenFile ( //
if (Status == EFI_NOT_READY) {
Status = HBufferImageRead (
- HMainEditor.BufferImage->FileImage->FileName,
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- BufferType,
- TRUE
- );
+ HMainEditor.BufferImage->FileImage->FileName,
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ BufferType,
+ TRUE
+ );
return Status;
}
+
//
// THE input string length should > 0
//
- if (StrLen (InputBarGetString()) > 0) {
+ if (StrLen (InputBarGetString ()) > 0) {
//
// CHECK if filename's valid
//
- if (!IsValidFileName (InputBarGetString())) {
+ if (!IsValidFileName (InputBarGetString ())) {
HBufferImageRead (
HMainEditor.BufferImage->FileImage->FileName,
HMainEditor.BufferImage->DiskImage->Name,
@@ -1038,19 +1051,20 @@ HMainCommandOpenFile ( break;
}
}
+
//
// read from disk
//
Status = HBufferImageRead (
- InputBarGetString(),
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- FileTypeFileBuffer,
- FALSE
- );
+ InputBarGetString (),
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ FileTypeFileBuffer,
+ FALSE
+ );
if (EFI_ERROR (Status)) {
HBufferImageRead (
@@ -1083,31 +1097,31 @@ HMainCommandOpenDisk ( VOID
)
{
- UINT64 Size;
- UINT64 Offset;
- CHAR16 *DeviceName;
- EFI_STATUS Status;
- BOOLEAN Done;
+ UINT64 Size;
+ UINT64 Offset;
+ CHAR16 *DeviceName;
+ EFI_STATUS Status;
+ BOOLEAN Done;
- EDIT_FILE_TYPE BufferType;
+ EDIT_FILE_TYPE BufferType;
//
// variable initialization
//
- Size = 0;
- Offset = 0;
- BufferType = HMainEditor.BufferImage->BufferType;
+ Size = 0;
+ Offset = 0;
+ BufferType = HMainEditor.BufferImage->BufferType;
//
// if current file is modified, so you need to choose
// whether to save it first.
//
if (HMainEditor.BufferImage->Modified) {
-
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// the answer is just one character
//
@@ -1115,6 +1129,7 @@ HMainCommandOpenDisk ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// loop for user's answer
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
@@ -1130,52 +1145,53 @@ HMainCommandOpenDisk ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- //
- // want to save this buffer first
- //
- Status = HBufferImageSave (
- HMainEditor.BufferImage->FileImage->FileName,
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- BufferType
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ //
+ // want to save this buffer first
+ //
+ Status = HBufferImageSave (
+ HMainEditor.BufferImage->FileImage->FileName,
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ BufferType
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- MainTitleBarRefresh (
- HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL,
- HMainEditor.BufferImage->BufferType,
- HMainEditor.BufferImage->FileImage->ReadOnly,
- FALSE,
- HMainEditor.ScreenSize.Column,
- HMainEditor.ScreenSize.Row,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Offset:0,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Size :0
- );
- Done = TRUE;
- break;
+ MainTitleBarRefresh (
+ HMainEditor.BufferImage->BufferType == FileTypeFileBuffer ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Name : NULL,
+ HMainEditor.BufferImage->BufferType,
+ HMainEditor.BufferImage->FileImage->ReadOnly,
+ FALSE,
+ HMainEditor.ScreenSize.Column,
+ HMainEditor.ScreenSize.Row,
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Offset : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Offset : 0,
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Size : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Size : 0
+ );
+ Done = TRUE;
+ break;
- case L'n':
- case L'N':
- //
- // the file won't be saved
- //
- Done = TRUE;
- break;
+ case L'n':
+ case L'N':
+ //
+ // the file won't be saved
+ //
+ Done = TRUE;
+ break;
- case L'c':
- case L'C':
- return EFI_SUCCESS;
+ case L'c':
+ case L'C':
+ return EFI_SUCCESS;
}
}
}
+
//
// get disk block device name
//
@@ -1196,21 +1212,22 @@ HMainCommandOpenDisk ( // ESC pressed
//
if (Status == EFI_NOT_READY) {
-
return EFI_SUCCESS;
}
+
//
// THE input string length should > 0
//
- if (StrLen (InputBarGetString()) > 0) {
+ if (StrLen (InputBarGetString ()) > 0) {
break;
}
}
- DeviceName = CatSPrint(NULL, L"%s", InputBarGetString());
+ DeviceName = CatSPrint (NULL, L"%s", InputBarGetString ());
if (DeviceName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// get starting offset
//
@@ -1231,14 +1248,14 @@ HMainCommandOpenDisk ( // ESC pressed
//
if (Status == EFI_NOT_READY) {
-
return EFI_SUCCESS;
}
+
//
// THE input string length should > 0
//
- if (StrLen (InputBarGetString()) > 0) {
- Status = ShellConvertStringToUint64 (InputBarGetString(), &Offset, TRUE, FALSE);
+ if (StrLen (InputBarGetString ()) > 0) {
+ Status = ShellConvertStringToUint64 (InputBarGetString (), &Offset, TRUE, FALSE);
if (EFI_ERROR (Status)) {
continue;
}
@@ -1246,6 +1263,7 @@ HMainCommandOpenDisk ( break;
}
}
+
//
// get Number of Blocks:
//
@@ -1266,14 +1284,14 @@ HMainCommandOpenDisk ( // ESC pressed
//
if (Status == EFI_NOT_READY) {
-
return EFI_SUCCESS;
}
+
//
// THE input string length should > 0
//
- if (StrLen (InputBarGetString()) > 0) {
- Status = ShellConvertStringToUint64 (InputBarGetString(), &Size, TRUE, FALSE);
+ if (StrLen (InputBarGetString ()) > 0) {
+ Status = ShellConvertStringToUint64 (InputBarGetString (), &Size, TRUE, FALSE);
if (EFI_ERROR (Status)) {
continue;
}
@@ -1287,18 +1305,17 @@ HMainCommandOpenDisk ( }
Status = HBufferImageRead (
- NULL,
- DeviceName,
- (UINTN)Offset,
- (UINTN)Size,
- 0,
- 0,
- FileTypeDiskBuffer,
- FALSE
- );
+ NULL,
+ DeviceName,
+ (UINTN)Offset,
+ (UINTN)Size,
+ 0,
+ 0,
+ FileTypeDiskBuffer,
+ FALSE
+ );
if (EFI_ERROR (Status)) {
-
HBufferImageRead (
HMainEditor.BufferImage->FileImage->FileName,
HMainEditor.BufferImage->DiskImage->Name,
@@ -1328,29 +1345,29 @@ HMainCommandOpenMemory ( VOID
)
{
- UINT64 Size;
- UINT64 Offset;
- EFI_STATUS Status;
- BOOLEAN Done;
- EDIT_FILE_TYPE BufferType;
+ UINT64 Size;
+ UINT64 Offset;
+ EFI_STATUS Status;
+ BOOLEAN Done;
+ EDIT_FILE_TYPE BufferType;
//
// variable initialization
//
- Size = 0;
- Offset = 0;
- BufferType = HMainEditor.BufferImage->BufferType;
+ Size = 0;
+ Offset = 0;
+ BufferType = HMainEditor.BufferImage->BufferType;
//
// if current buffer is modified, so you need to choose
// whether to save it first.
//
if (HMainEditor.BufferImage->Modified) {
-
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// the answer is just one character
//
@@ -1358,6 +1375,7 @@ HMainCommandOpenMemory ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// loop for user's answer
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
@@ -1373,52 +1391,53 @@ HMainCommandOpenMemory ( return EFI_SUCCESS;
}
- switch (InputBarGetString()[0]) {
- case L'y':
- case L'Y':
- //
- // want to save this buffer first
- //
- Status = HBufferImageSave (
- HMainEditor.BufferImage->FileImage->FileName,
- HMainEditor.BufferImage->DiskImage->Name,
- HMainEditor.BufferImage->DiskImage->Offset,
- HMainEditor.BufferImage->DiskImage->Size,
- HMainEditor.BufferImage->MemImage->Offset,
- HMainEditor.BufferImage->MemImage->Size,
- BufferType
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ switch (InputBarGetString ()[0]) {
+ case L'y':
+ case L'Y':
+ //
+ // want to save this buffer first
+ //
+ Status = HBufferImageSave (
+ HMainEditor.BufferImage->FileImage->FileName,
+ HMainEditor.BufferImage->DiskImage->Name,
+ HMainEditor.BufferImage->DiskImage->Offset,
+ HMainEditor.BufferImage->DiskImage->Size,
+ HMainEditor.BufferImage->MemImage->Offset,
+ HMainEditor.BufferImage->MemImage->Size,
+ BufferType
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- MainTitleBarRefresh (
- HMainEditor.BufferImage->BufferType == FileTypeFileBuffer?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Name:NULL,
- HMainEditor.BufferImage->BufferType,
- HMainEditor.BufferImage->FileImage->ReadOnly,
- FALSE,
- HMainEditor.ScreenSize.Column,
- HMainEditor.ScreenSize.Row,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Offset:0,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer?HMainEditor.BufferImage->MemImage->Size :0
- );
- Done = TRUE;
- break;
+ MainTitleBarRefresh (
+ HMainEditor.BufferImage->BufferType == FileTypeFileBuffer ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Name : NULL,
+ HMainEditor.BufferImage->BufferType,
+ HMainEditor.BufferImage->FileImage->ReadOnly,
+ FALSE,
+ HMainEditor.ScreenSize.Column,
+ HMainEditor.ScreenSize.Row,
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Offset : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Offset : 0,
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer ? HMainEditor.BufferImage->DiskImage->Size : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer ? HMainEditor.BufferImage->MemImage->Size : 0
+ );
+ Done = TRUE;
+ break;
- case L'n':
- case L'N':
- //
- // the file won't be saved
- //
- Done = TRUE;
- break;
+ case L'n':
+ case L'N':
+ //
+ // the file won't be saved
+ //
+ Done = TRUE;
+ break;
- case L'c':
- case L'C':
- return EFI_SUCCESS;
+ case L'c':
+ case L'C':
+ return EFI_SUCCESS;
}
}
}
+
//
// get starting offset
//
@@ -1439,14 +1458,14 @@ HMainCommandOpenMemory ( // ESC pressed
//
if (Status == EFI_NOT_READY) {
-
return EFI_SUCCESS;
}
+
//
// THE input string length should > 0
//
- if (StrLen (InputBarGetString()) > 0) {
- Status = ShellConvertStringToUint64 (InputBarGetString(), &Offset, TRUE, FALSE);
+ if (StrLen (InputBarGetString ()) > 0) {
+ Status = ShellConvertStringToUint64 (InputBarGetString (), &Offset, TRUE, FALSE);
if (EFI_ERROR (Status)) {
continue;
}
@@ -1454,6 +1473,7 @@ HMainCommandOpenMemory ( break;
}
}
+
//
// get Number of Blocks:
//
@@ -1474,14 +1494,14 @@ HMainCommandOpenMemory ( // ESC pressed
//
if (Status == EFI_NOT_READY) {
-
return EFI_SUCCESS;
}
+
//
// THE input string length should > 0
//
- if (StrLen (InputBarGetString()) > 0) {
- Status = ShellConvertStringToUint64 (InputBarGetString(), &Size, TRUE, FALSE);
+ if (StrLen (InputBarGetString ()) > 0) {
+ Status = ShellConvertStringToUint64 (InputBarGetString (), &Size, TRUE, FALSE);
if (EFI_ERROR (Status)) {
continue;
}
@@ -1494,21 +1514,21 @@ HMainCommandOpenMemory ( }
}
- if ((Offset + Size - 1)> 0xffffffff) {
+ if ((Offset + Size - 1) > 0xffffffff) {
StatusBarSetStatusString (L"Invalid parameter");
return EFI_LOAD_ERROR;
}
Status = HBufferImageRead (
- NULL,
- NULL,
- 0,
- 0,
- (UINTN)Offset,
- (UINTN)Size,
- FileTypeMemBuffer,
- FALSE
- );
+ NULL,
+ NULL,
+ 0,
+ 0,
+ (UINTN)Offset,
+ (UINTN)Size,
+ FileTypeMemBuffer,
+ FALSE
+ );
if (EFI_ERROR (Status)) {
StatusBarSetStatusString (L"Read Device Error!");
@@ -1524,11 +1544,11 @@ HMainCommandOpenMemory ( );
return EFI_NOT_FOUND;
}
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
}
-MENU_ITEM_FUNCTION HexMainControlBasedMenuFunctions[] = {
+MENU_ITEM_FUNCTION HexMainControlBasedMenuFunctions[] = {
NULL,
NULL, /* Ctrl - A */
NULL, /* Ctrl - B */
@@ -1558,57 +1578,57 @@ MENU_ITEM_FUNCTION HexMainControlBasedMenuFunctions[] = { NULL, /* Ctrl - Z */
};
-CONST EDITOR_MENU_ITEM HexEditorMenuItems[] = {
+CONST EDITOR_MENU_ITEM HexEditorMenuItems[] = {
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_GO_TO_OFFSET),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F1),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_GO_TO_OFFSET),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F1),
HMainCommandGoToOffset
},
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_SAVE_BUFFER),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F2),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_SAVE_BUFFER),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F2),
HMainCommandSaveBuffer
},
{
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_EXIT),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F3),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_EXIT),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F3),
HMainCommandExit
},
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_SELECT_START),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F4),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_SELECT_START),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F4),
HMainCommandSelectStart
},
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_SELECT_END),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F5),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_SELECT_END),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F5),
HMainCommandSelectEnd
},
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_CUT),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F6),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_CUT),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F6),
HMainCommandCut
},
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_PASTE),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F7),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_PASTE),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F7),
HMainCommandPaste
},
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_OPEN_FILE),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F8),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_OPEN_FILE),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F8),
HMainCommandOpenFile
},
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_OPEN_DISK),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F9),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_OPEN_DISK),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F9),
HMainCommandOpenDisk
},
{
- STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_OPEN_MEMORY),
- STRING_TOKEN(STR_EDIT_LIBMENUBAR_F10),
+ STRING_TOKEN (STR_HEXEDIT_LIBMENUBAR_OPEN_MEMORY),
+ STRING_TOKEN (STR_EDIT_LIBMENUBAR_F10),
HMainCommandOpenMemory
},
@@ -1645,7 +1665,7 @@ HMainEditorInit ( //
HMainEditor.ColorAttributes.Colors.Foreground = gST->ConOut->Mode->Attribute & 0x000000ff;
- HMainEditor.ColorAttributes.Colors.Background = (UINT8) (gST->ConOut->Mode->Attribute >> 4);
+ HMainEditor.ColorAttributes.Colors.Background = (UINT8)(gST->ConOut->Mode->Attribute >> 4);
HOriginalColors = HMainEditor.ColorAttributes.Colors;
@@ -1655,21 +1675,21 @@ HMainEditorInit ( // query screen size
//
gST->ConOut->QueryMode (
- gST->ConOut,
- gST->ConOut->Mode->Mode,
- &(HMainEditor.ScreenSize.Column),
- &(HMainEditor.ScreenSize.Row)
- );
+ gST->ConOut,
+ gST->ConOut->Mode->Mode,
+ &(HMainEditor.ScreenSize.Column),
+ &(HMainEditor.ScreenSize.Row)
+ );
//
// Find TextInEx in System Table ConsoleInHandle
// Per UEFI Spec, TextInEx is required for a console capable platform.
//
Status = gBS->HandleProtocol (
- gST->ConsoleInHandle,
- &gEfiSimpleTextInputExProtocolGuid,
- (VOID**)&HMainEditor.TextInputEx
- );
+ gST->ConsoleInHandle,
+ &gEfiSimpleTextInputExProtocolGuid,
+ (VOID **)&HMainEditor.TextInputEx
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1678,47 +1698,48 @@ HMainEditorInit ( // Find mouse in System Table ConsoleInHandle
//
Status = gBS->HandleProtocol (
- gST->ConsoleInHandle,
- &gEfiSimplePointerProtocolGuid,
- (VOID**)&HMainEditor.MouseInterface
- );
+ gST->ConsoleInHandle,
+ &gEfiSimplePointerProtocolGuid,
+ (VOID **)&HMainEditor.MouseInterface
+ );
if (EFI_ERROR (Status)) {
//
// If there is no Simple Pointer Protocol on System Table
//
- HandleBuffer = NULL;
+ HandleBuffer = NULL;
HMainEditor.MouseInterface = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimplePointerProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (!EFI_ERROR (Status) && HandleCount > 0) {
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimplePointerProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ if (!EFI_ERROR (Status) && (HandleCount > 0)) {
//
// Try to find the first available mouse device
//
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiSimplePointerProtocolGuid,
- (VOID**)&HMainEditor.MouseInterface
- );
+ HandleBuffer[Index],
+ &gEfiSimplePointerProtocolGuid,
+ (VOID **)&HMainEditor.MouseInterface
+ );
if (!EFI_ERROR (Status)) {
break;
}
}
}
+
if (HandleBuffer != NULL) {
FreePool (HandleBuffer);
}
}
- if (!EFI_ERROR (Status) && HMainEditor.MouseInterface != NULL) {
- HMainEditor.MouseAccumulatorX = 0;
- HMainEditor.MouseAccumulatorY = 0;
- HMainEditor.MouseSupported = TRUE;
+ if (!EFI_ERROR (Status) && (HMainEditor.MouseInterface != NULL)) {
+ HMainEditor.MouseAccumulatorX = 0;
+ HMainEditor.MouseAccumulatorY = 0;
+ HMainEditor.MouseSupported = TRUE;
}
//
@@ -1726,24 +1747,25 @@ HMainEditorInit ( //
Status = MainTitleBarInit (L"UEFI HEXEDIT");
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_TITLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_TITLE), gShellDebug1HiiHandle);
return EFI_LOAD_ERROR;
}
Status = ControlHotKeyInit (HexMainControlBasedMenuFunctions);
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
return EFI_LOAD_ERROR;
}
+
Status = MenuBarInit (HexEditorMenuItems);
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
return EFI_LOAD_ERROR;
}
Status = StatusBarInit ();
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_STATUS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_STATUS), gShellDebug1HiiHandle);
return EFI_LOAD_ERROR;
}
@@ -1751,15 +1773,16 @@ HMainEditorInit ( Status = HBufferImageInit ();
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_BUFFERIMAGE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_BUFFERIMAGE), gShellDebug1HiiHandle);
return EFI_LOAD_ERROR;
}
Status = HClipBoardInit ();
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_CLIPBOARD), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_CLIPBOARD), gShellDebug1HiiHandle);
return EFI_LOAD_ERROR;
}
+
//
// clear whole screen and enable cursor
//
@@ -1769,9 +1792,9 @@ HMainEditorInit ( //
// initialize EditorFirst and EditorExit
//
- HEditorFirst = TRUE;
- HEditorExit = FALSE;
- HEditorMouseAction = FALSE;
+ HEditorFirst = TRUE;
+ HEditorExit = FALSE;
+ HEditorMouseAction = FALSE;
return EFI_SUCCESS;
}
@@ -1802,13 +1825,14 @@ HMainEditorCleanup ( Status = HBufferImageCleanup ();
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_BUFFERIMAGE_CLEAN), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_BUFFERIMAGE_CLEAN), gShellDebug1HiiHandle);
}
Status = HClipBoardCleanup ();
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_CLIPBOARD_CLEAN), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_CLIPBOARD_CLEAN), gShellDebug1HiiHandle);
}
+
//
// restore old mode
//
@@ -1817,9 +1841,9 @@ HMainEditorCleanup ( }
gST->ConOut->SetAttribute (
- gST->ConOut,
- EFI_TEXT_ATTR (HOriginalColors.Foreground, HOriginalColors.Background)
- );
+ gST->ConOut,
+ EFI_TEXT_ATTR (HOriginalColors.Foreground, HOriginalColors.Background)
+ );
gST->ConOut->ClearScreen (gST->ConOut);
return EFI_SUCCESS;
@@ -1835,38 +1859,43 @@ HMainEditorRefresh ( VOID
)
{
- BOOLEAN NameChange;
- BOOLEAN ReadChange;
+ BOOLEAN NameChange;
+ BOOLEAN ReadChange;
NameChange = FALSE;
ReadChange = FALSE;
if (HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer) {
- if (HMainEditor.BufferImage->DiskImage != NULL &&
- HBufferImageBackupVar.DiskImage != NULL &&
- (HMainEditor.BufferImage->DiskImage->Offset != HBufferImageBackupVar.DiskImage->Offset ||
- HMainEditor.BufferImage->DiskImage->Size != HBufferImageBackupVar.DiskImage->Size) ){
+ if ((HMainEditor.BufferImage->DiskImage != NULL) &&
+ (HBufferImageBackupVar.DiskImage != NULL) &&
+ ((HMainEditor.BufferImage->DiskImage->Offset != HBufferImageBackupVar.DiskImage->Offset) ||
+ (HMainEditor.BufferImage->DiskImage->Size != HBufferImageBackupVar.DiskImage->Size)))
+ {
NameChange = TRUE;
}
} else if (HMainEditor.BufferImage->BufferType == FileTypeMemBuffer) {
- if (HMainEditor.BufferImage->MemImage != NULL &&
- HBufferImageBackupVar.MemImage != NULL &&
- (HMainEditor.BufferImage->MemImage->Offset != HBufferImageBackupVar.MemImage->Offset ||
- HMainEditor.BufferImage->MemImage->Size != HBufferImageBackupVar.MemImage->Size) ){
+ if ((HMainEditor.BufferImage->MemImage != NULL) &&
+ (HBufferImageBackupVar.MemImage != NULL) &&
+ ((HMainEditor.BufferImage->MemImage->Offset != HBufferImageBackupVar.MemImage->Offset) ||
+ (HMainEditor.BufferImage->MemImage->Size != HBufferImageBackupVar.MemImage->Size)))
+ {
NameChange = TRUE;
}
} else if (HMainEditor.BufferImage->BufferType == FileTypeFileBuffer) {
- if ( HMainEditor.BufferImage->FileImage != NULL &&
- HMainEditor.BufferImage->FileImage->FileName != NULL &&
- HBufferImageBackupVar.FileImage != NULL &&
- HBufferImageBackupVar.FileImage->FileName != NULL &&
- StrCmp (HMainEditor.BufferImage->FileImage->FileName, HBufferImageBackupVar.FileImage->FileName) != 0 ) {
+ if ((HMainEditor.BufferImage->FileImage != NULL) &&
+ (HMainEditor.BufferImage->FileImage->FileName != NULL) &&
+ (HBufferImageBackupVar.FileImage != NULL) &&
+ (HBufferImageBackupVar.FileImage->FileName != NULL) &&
+ (StrCmp (HMainEditor.BufferImage->FileImage->FileName, HBufferImageBackupVar.FileImage->FileName) != 0))
+ {
NameChange = TRUE;
}
}
- if ( HMainEditor.BufferImage->FileImage != NULL &&
- HBufferImageBackupVar.FileImage != NULL &&
- HMainEditor.BufferImage->FileImage->ReadOnly != HBufferImageBackupVar.FileImage->ReadOnly ) {
+
+ if ((HMainEditor.BufferImage->FileImage != NULL) &&
+ (HBufferImageBackupVar.FileImage != NULL) &&
+ (HMainEditor.BufferImage->FileImage->ReadOnly != HBufferImageBackupVar.FileImage->ReadOnly))
+ {
ReadChange = TRUE;
}
@@ -1879,29 +1908,30 @@ HMainEditorRefresh ( //
// call the components refresh function
//
- if (HEditorFirst
- || NameChange
- || HMainEditor.BufferImage->BufferType != HBufferImageBackupVar.BufferType
- || HBufferImageBackupVar.Modified != HMainEditor.BufferImage->Modified
- || ReadChange ) {
-
+ if ( HEditorFirst
+ || NameChange
+ || (HMainEditor.BufferImage->BufferType != HBufferImageBackupVar.BufferType)
+ || (HBufferImageBackupVar.Modified != HMainEditor.BufferImage->Modified)
+ || ReadChange )
+ {
MainTitleBarRefresh (
- HMainEditor.BufferImage->BufferType == FileTypeFileBuffer&&HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->FileName:HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Name:NULL,
+ HMainEditor.BufferImage->BufferType == FileTypeFileBuffer && HMainEditor.BufferImage->FileImage != NULL ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer && HMainEditor.BufferImage->DiskImage != NULL ? HMainEditor.BufferImage->DiskImage->Name : NULL,
HMainEditor.BufferImage->BufferType,
- (BOOLEAN)(HMainEditor.BufferImage->FileImage!=NULL?HMainEditor.BufferImage->FileImage->ReadOnly:FALSE),
+ (BOOLEAN)(HMainEditor.BufferImage->FileImage != NULL ? HMainEditor.BufferImage->FileImage->ReadOnly : FALSE),
HMainEditor.BufferImage->Modified,
HMainEditor.ScreenSize.Column,
HMainEditor.ScreenSize.Row,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Offset:HMainEditor.BufferImage->BufferType == FileTypeMemBuffer&&HMainEditor.BufferImage->MemImage!=NULL?HMainEditor.BufferImage->MemImage->Offset:0,
- HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer&&HMainEditor.BufferImage->DiskImage!=NULL?HMainEditor.BufferImage->DiskImage->Size :HMainEditor.BufferImage->BufferType == FileTypeMemBuffer&&HMainEditor.BufferImage->MemImage!=NULL?HMainEditor.BufferImage->MemImage->Size :0
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer && HMainEditor.BufferImage->DiskImage != NULL ? HMainEditor.BufferImage->DiskImage->Offset : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer && HMainEditor.BufferImage->MemImage != NULL ? HMainEditor.BufferImage->MemImage->Offset : 0,
+ HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer && HMainEditor.BufferImage->DiskImage != NULL ? HMainEditor.BufferImage->DiskImage->Size : HMainEditor.BufferImage->BufferType == FileTypeMemBuffer && HMainEditor.BufferImage->MemImage != NULL ? HMainEditor.BufferImage->MemImage->Size : 0
);
HBufferImageRefresh ();
}
- if (HEditorFirst
- || HBufferImageBackupVar.DisplayPosition.Row != HMainEditor.BufferImage->DisplayPosition.Row
- || HBufferImageBackupVar.DisplayPosition.Column != HMainEditor.BufferImage->DisplayPosition.Column
- || StatusBarGetRefresh()) {
+ if ( HEditorFirst
+ || (HBufferImageBackupVar.DisplayPosition.Row != HMainEditor.BufferImage->DisplayPosition.Row)
+ || (HBufferImageBackupVar.DisplayPosition.Column != HMainEditor.BufferImage->DisplayPosition.Column)
+ || StatusBarGetRefresh ())
+ {
StatusBarRefresh (
HEditorFirst,
HMainEditor.ScreenSize.Row,
@@ -1938,17 +1968,16 @@ HMainEditorRefresh ( **/
EFI_STATUS
HMainEditorHandleMouseInput (
- IN EFI_SIMPLE_POINTER_STATE MouseState,
- OUT BOOLEAN *BeforeLeftButtonDown
+ IN EFI_SIMPLE_POINTER_STATE MouseState,
+ OUT BOOLEAN *BeforeLeftButtonDown
)
{
-
INT32 TextX;
INT32 TextY;
UINTN FRow;
UINTN FCol;
BOOLEAN HighBits;
- LIST_ENTRY *Link;
+ LIST_ENTRY *Link;
HEFI_EDITOR_LINE *Line;
UINTN Index;
BOOLEAN Action;
@@ -1968,14 +1997,13 @@ HMainEditorHandleMouseInput ( HBufferImageAdjustMousePosition (TextX, TextY);
Action = TRUE;
-
}
if (MouseState.LeftButton) {
HighBits = HBufferImageIsAtHighBits (
- HMainEditor.BufferImage->MousePosition.Column,
- &FCol
- );
+ HMainEditor.BufferImage->MousePosition.Column,
+ &FCol
+ );
//
// not at an movable place
@@ -2003,12 +2031,11 @@ HMainEditorHandleMouseInput ( }
HighBits = TRUE;
-
}
FRow = HMainEditor.BufferImage->BufferPosition.Row +
- HMainEditor.BufferImage->MousePosition.Row -
- HMainEditor.BufferImage->DisplayPosition.Row;
+ HMainEditor.BufferImage->MousePosition.Row -
+ HMainEditor.BufferImage->DisplayPosition.Row;
if (HMainEditor.BufferImage->NumLines < FRow) {
//
@@ -2017,8 +2044,8 @@ HMainEditorHandleMouseInput ( //
// now just move mouse pointer to legal position
//
- FRow = HMainEditor.BufferImage->NumLines;
- HighBits = TRUE;
+ FRow = HMainEditor.BufferImage->NumLines;
+ HighBits = TRUE;
}
Link = HMainEditor.BufferImage->ListHead->ForwardLink;
@@ -2043,26 +2070,25 @@ HMainEditorHandleMouseInput ( FRow--;
FCol = 16;
} else {
- FRow = 1;
- FCol = 1;
+ FRow = 1;
+ FCol = 1;
}
-
} else {
FCol = Line->Size;
}
} else {
- FCol = Line->Size + 1;
- HighBits = TRUE;
+ FCol = Line->Size + 1;
+ HighBits = TRUE;
}
}
HBufferImageMovePosition (FRow, FCol, HighBits);
- HMainEditor.BufferImage->MousePosition.Row = HMainEditor.BufferImage->DisplayPosition.Row;
+ HMainEditor.BufferImage->MousePosition.Row = HMainEditor.BufferImage->DisplayPosition.Row;
HMainEditor.BufferImage->MousePosition.Column = HMainEditor.BufferImage->DisplayPosition.Column;
- *BeforeLeftButtonDown = TRUE;
+ *BeforeLeftButtonDown = TRUE;
Action = TRUE;
} else {
@@ -2074,6 +2100,7 @@ HMainEditorHandleMouseInput ( if (*BeforeLeftButtonDown) {
Action = TRUE;
}
+
//
// mouse up
//
@@ -2118,20 +2145,19 @@ HMainEditorKeyInput ( //
// variable initialization
//
- OldSize = 0;
- FRow = 0;
- FCol = 0;
- LengthChange = FALSE;
+ OldSize = 0;
+ FRow = 0;
+ FCol = 0;
+ LengthChange = FALSE;
- MouseIsDown = FALSE;
- FirstDown = FALSE;
- MouseDrag = FALSE;
+ MouseIsDown = FALSE;
+ FirstDown = FALSE;
+ MouseDrag = FALSE;
do {
+ Status = EFI_SUCCESS;
- Status = EFI_SUCCESS;
-
- HEditorMouseAction = FALSE;
+ HEditorMouseAction = FALSE;
//
// backup some key elements, so that can aVOID some refresh work
@@ -2148,14 +2174,13 @@ HMainEditorKeyInput ( //
if (HMainEditor.MouseSupported) {
Status = HMainEditor.MouseInterface->GetState (
- HMainEditor.MouseInterface,
- &MouseState
- );
+ HMainEditor.MouseInterface,
+ &MouseState
+ );
if (!EFI_ERROR (Status)) {
-
BeforeMouseIsDown = MouseIsDown;
- Status = HMainEditorHandleMouseInput (MouseState, &MouseIsDown);
+ Status = HMainEditorHandleMouseInput (MouseState, &MouseIsDown);
if (!EFI_ERROR (Status)) {
if (!BeforeMouseIsDown) {
@@ -2168,10 +2193,9 @@ HMainEditorKeyInput ( SelectStartBackup = HMainEditor.SelectStart;
SelectEndBackup = HMainEditor.SelectEnd;
- FirstDown = TRUE;
+ FirstDown = TRUE;
}
} else {
-
SelectStartBackup = HMainEditor.SelectStart;
SelectEndBackup = HMainEditor.SelectEnd;
@@ -2185,23 +2209,25 @@ HMainEditorKeyInput ( HMainEditor.SelectEnd = 0;
HMainEditor.SelectStart = (FRow - 1) * 0x10 + FCol;
- MouseDrag = TRUE;
- FirstDown = FALSE;
+ MouseDrag = TRUE;
+ FirstDown = FALSE;
}
} else {
if ((
- (HBufferImage.BufferPosition.Row - 1) *
- 0x10 +
- HBufferImage.BufferPosition.Column
- ) >= HMainEditor.SelectStart
- ) {
+ (HBufferImage.BufferPosition.Row - 1) *
+ 0x10 +
+ HBufferImage.BufferPosition.Column
+ ) >= HMainEditor.SelectStart
+ )
+ {
HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) *
- 0x10 +
- HBufferImage.BufferPosition.Column;
+ 0x10 +
+ HBufferImage.BufferPosition.Column;
} else {
HMainEditor.SelectEnd = 0;
}
}
+
//
// end of if RelativeX/Y
//
@@ -2218,14 +2244,15 @@ HMainEditorKeyInput ( }
if ((
- (HBufferImage.BufferPosition.Row - 1) *
- 0x10 +
- HBufferImage.BufferPosition.Column
- ) >= HMainEditor.SelectStart
- ) {
+ (HBufferImage.BufferPosition.Row - 1) *
+ 0x10 +
+ HBufferImage.BufferPosition.Column
+ ) >= HMainEditor.SelectStart
+ )
+ {
HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) *
- 0x10 +
- HBufferImage.BufferPosition.Column;
+ 0x10 +
+ HBufferImage.BufferPosition.Column;
} else {
HMainEditor.SelectEnd = 0;
}
@@ -2239,7 +2266,7 @@ HMainEditorKeyInput ( MouseDrag = FALSE;
}
- if (SelectStartBackup != HMainEditor.SelectStart || SelectEndBackup != HMainEditor.SelectEnd) {
+ if ((SelectStartBackup != HMainEditor.SelectStart) || (SelectEndBackup != HMainEditor.SelectEnd)) {
if ((SelectStartBackup - 1) / 0x10 != (HMainEditor.SelectStart - 1) / 0x10) {
HBufferImageNeedRefresh = TRUE;
} else {
@@ -2252,9 +2279,8 @@ HMainEditorKeyInput ( }
}
- HEditorMouseAction = TRUE;
- HBufferImageMouseNeedRefresh = TRUE;
-
+ HEditorMouseAction = TRUE;
+ HBufferImageMouseNeedRefresh = TRUE;
} else if (Status == EFI_LOAD_ERROR) {
StatusBarSetStatusString (L"Invalid Mouse Movement ");
}
@@ -2277,7 +2303,7 @@ HMainEditorKeyInput ( //
// clear previous status string
//
- StatusBarSetRefresh();
+ StatusBarSetRefresh ();
//
// NoShiftState: TRUE when no shift key is pressed.
//
@@ -2285,13 +2311,13 @@ HMainEditorKeyInput ( //
// dispatch to different components' key handling function
//
- if (EFI_SUCCESS == MenuBarDispatchControlHotKey(&KeyData)) {
+ if (EFI_SUCCESS == MenuBarDispatchControlHotKey (&KeyData)) {
Status = EFI_SUCCESS;
- } else if (NoShiftState && KeyData.Key.ScanCode == SCAN_NULL) {
+ } else if (NoShiftState && (KeyData.Key.ScanCode == SCAN_NULL)) {
Status = HBufferImageHandleInput (&KeyData.Key);
} else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_UP) && (KeyData.Key.ScanCode <= SCAN_PAGE_DOWN))) {
Status = HBufferImageHandleInput (&KeyData.Key);
- } else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_F1) && KeyData.Key.ScanCode <= SCAN_F12)) {
+ } else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_F1) && (KeyData.Key.ScanCode <= SCAN_F12))) {
Status = MenuBarDispatchFunctionKey (&KeyData.Key);
} else {
StatusBarSetStatusString (L"Unknown Command");
@@ -2299,15 +2325,16 @@ HMainEditorKeyInput ( HBufferImageMouseNeedRefresh = FALSE;
}
- if (Status != EFI_SUCCESS && Status != EFI_OUT_OF_RESOURCES) {
+ if ((Status != EFI_SUCCESS) && (Status != EFI_OUT_OF_RESOURCES)) {
//
// not already has some error status
//
- if (StrCmp (L"", StatusBarGetString()) == 0) {
+ if (StrCmp (L"", StatusBarGetString ()) == 0) {
StatusBarSetStatusString (L"Disk Error. Try Again");
}
}
}
+
//
// decide if has to set length warning
//
@@ -2321,17 +2348,17 @@ HMainEditorKeyInput ( Size = HBufferImageGetTotalSize ();
switch (HBufferImage.BufferType) {
- case FileTypeDiskBuffer:
- OldSize = HBufferImage.DiskImage->Size * HBufferImage.DiskImage->BlockSize;
- break;
+ case FileTypeDiskBuffer:
+ OldSize = HBufferImage.DiskImage->Size * HBufferImage.DiskImage->BlockSize;
+ break;
- case FileTypeMemBuffer:
- OldSize = HBufferImage.MemImage->Size;
- break;
+ case FileTypeMemBuffer:
+ OldSize = HBufferImage.MemImage->Size;
+ break;
- default:
- OldSize = 0;
- break;
+ default:
+ OldSize = 0;
+ break;
}
if (!LengthChange) {
@@ -2348,11 +2375,11 @@ HMainEditorKeyInput ( }
}
}
+
//
// after handling, refresh editor
//
HMainEditorRefresh ();
-
} while (Status != EFI_OUT_OF_RESOURCES && !HEditorExit);
return Status;
@@ -2366,7 +2393,7 @@ HMainEditorBackup ( VOID
)
{
- HMainEditorBackupVar.SelectStart = HMainEditor.SelectStart;
- HMainEditorBackupVar.SelectEnd = HMainEditor.SelectEnd;
+ HMainEditorBackupVar.SelectStart = HMainEditor.SelectStart;
+ HMainEditorBackupVar.SelectEnd = HMainEditor.SelectEnd;
HBufferImageBackup ();
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c index 5e734f668a..a7c80a4e96 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c @@ -8,23 +8,23 @@ #include "HexEditor.h"
-extern EFI_HANDLE HImageHandleBackup;
+extern EFI_HANDLE HImageHandleBackup;
-extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
+extern HEFI_EDITOR_BUFFER_IMAGE HBufferImage;
-extern BOOLEAN HBufferImageNeedRefresh;
-extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
-extern BOOLEAN HBufferImageMouseNeedRefresh;
+extern BOOLEAN HBufferImageNeedRefresh;
+extern BOOLEAN HBufferImageOnlyLineNeedRefresh;
+extern BOOLEAN HBufferImageMouseNeedRefresh;
extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor;
-HEFI_EDITOR_MEM_IMAGE HMemImage;
-HEFI_EDITOR_MEM_IMAGE HMemImageBackupVar;
+HEFI_EDITOR_MEM_IMAGE HMemImage;
+HEFI_EDITOR_MEM_IMAGE HMemImageBackupVar;
//
// for basic initialization of HDiskImage
//
-HEFI_EDITOR_MEM_IMAGE HMemImageConst = {
+HEFI_EDITOR_MEM_IMAGE HMemImageConst = {
NULL,
0,
0
@@ -49,10 +49,10 @@ HMemImageInit ( CopyMem (&HMemImage, &HMemImageConst, sizeof (HMemImage));
Status = gBS->LocateProtocol (
- &gEfiCpuIo2ProtocolGuid,
- NULL,
- (VOID**)&HMemImage.IoFncs
- );
+ &gEfiCpuIo2ProtocolGuid,
+ NULL,
+ (VOID **)&HMemImage.IoFncs
+ );
if (!EFI_ERROR (Status)) {
return EFI_SUCCESS;
} else {
@@ -88,13 +88,12 @@ HMemImageBackup ( **/
EFI_STATUS
HMemImageSetMemOffsetSize (
- IN UINTN Offset,
- IN UINTN Size
+ IN UINTN Offset,
+ IN UINTN Size
)
{
-
- HMemImage.Offset = Offset;
- HMemImage.Size = Size;
+ HMemImage.Offset = Offset;
+ HMemImage.Size = Size;
return EFI_SUCCESS;
}
@@ -112,32 +111,31 @@ HMemImageSetMemOffsetSize ( **/
EFI_STATUS
HMemImageRead (
- IN UINTN Offset,
- IN UINTN Size,
- IN BOOLEAN Recover
+ IN UINTN Offset,
+ IN UINTN Size,
+ IN BOOLEAN Recover
)
{
-
- EFI_STATUS Status;
- void *Buffer;
- CHAR16 *Str;
- HEFI_EDITOR_LINE *Line;
+ EFI_STATUS Status;
+ void *Buffer;
+ CHAR16 *Str;
+ HEFI_EDITOR_LINE *Line;
HBufferImage.BufferType = FileTypeMemBuffer;
- Buffer = AllocateZeroPool (Size);
+ Buffer = AllocateZeroPool (Size);
if (Buffer == NULL) {
StatusBarSetStatusString (L"Read Memory Failed");
return EFI_OUT_OF_RESOURCES;
}
Status = HMemImage.IoFncs->Mem.Read (
- HMemImage.IoFncs,
- EfiCpuIoWidthUint8,
- Offset,
- Size,
- Buffer
- );
+ HMemImage.IoFncs,
+ EfiCpuIoWidthUint8,
+ Offset,
+ Size,
+ Buffer
+ );
if (EFI_ERROR (Status)) {
FreePool (Buffer);
@@ -155,22 +153,22 @@ HMemImageRead ( return Status;
}
- Status = HMemImageSetMemOffsetSize (Offset, Size);
+ Status = HMemImageSetMemOffsetSize (Offset, Size);
HBufferImage.DisplayPosition.Row = 2;
HBufferImage.DisplayPosition.Column = 10;
- HBufferImage.MousePosition.Row = 2;
- HBufferImage.MousePosition.Column = 10;
+ HBufferImage.MousePosition.Row = 2;
+ HBufferImage.MousePosition.Column = 10;
- HBufferImage.LowVisibleRow = 1;
- HBufferImage.HighBits = TRUE;
+ HBufferImage.LowVisibleRow = 1;
+ HBufferImage.HighBits = TRUE;
- HBufferImage.BufferPosition.Row = 1;
- HBufferImage.BufferPosition.Column = 1;
+ HBufferImage.BufferPosition.Row = 1;
+ HBufferImage.BufferPosition.Column = 1;
if (!Recover) {
- Str = CatSPrint(NULL, L"%d Lines Read", HBufferImage.NumLines);
+ Str = CatSPrint (NULL, L"%d Lines Read", HBufferImage.NumLines);
if (Str == NULL) {
StatusBarSetStatusString (L"Read Memory Failed");
return EFI_OUT_OF_RESOURCES;
@@ -181,7 +179,6 @@ HMemImageRead ( HMainEditor.SelectStart = 0;
HMainEditor.SelectEnd = 0;
-
}
//
@@ -208,7 +205,6 @@ HMemImageRead ( HBufferImageMouseNeedRefresh = TRUE;
return EFI_SUCCESS;
-
}
/**
@@ -223,13 +219,12 @@ HMemImageRead ( **/
EFI_STATUS
HMemImageSave (
- IN UINTN Offset,
- IN UINTN Size
+ IN UINTN Offset,
+ IN UINTN Size
)
{
-
- EFI_STATUS Status;
- VOID *Buffer;
+ EFI_STATUS Status;
+ VOID *Buffer;
//
// not modified, so directly return
@@ -240,7 +235,7 @@ HMemImageSave ( HBufferImage.BufferType = FileTypeMemBuffer;
- Buffer = AllocateZeroPool (Size);
+ Buffer = AllocateZeroPool (Size);
if (Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -251,22 +246,24 @@ HMemImageSave ( FreePool (Buffer);
return Status;
}
+
//
// write back to memory
//
Status = HMemImage.IoFncs->Mem.Write (
- HMemImage.IoFncs,
- EfiCpuIoWidthUint8,
- Offset,
- Size,
- Buffer
- );
+ HMemImage.IoFncs,
+ EfiCpuIoWidthUint8,
+ Offset,
+ Size,
+ Buffer
+ );
FreePool (Buffer);
if (EFI_ERROR (Status)) {
return EFI_LOAD_ERROR;
}
+
//
// now not modified
//
@@ -274,5 +271,3 @@ HMemImageSave ( return EFI_SUCCESS;
}
-
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h index 090a3fc775..5e7fdc0b17 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.h @@ -45,8 +45,8 @@ HMemImageBackup ( **/
EFI_STATUS
HMemImageSetMemOffsetSize (
- IN UINTN Offset,
- IN UINTN Size
+ IN UINTN Offset,
+ IN UINTN Size
);
/**
@@ -62,9 +62,9 @@ HMemImageSetMemOffsetSize ( **/
EFI_STATUS
HMemImageRead (
- IN UINTN Offset,
- IN UINTN Size,
- IN BOOLEAN Recover
+ IN UINTN Offset,
+ IN UINTN Size,
+ IN BOOLEAN Recover
);
/**
@@ -79,8 +79,8 @@ HMemImageRead ( **/
EFI_STATUS
HMemImageSave (
- IN UINTN Offset,
- IN UINTN Size
+ IN UINTN Offset,
+ IN UINTN Size
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c index 10bf15cbfb..9f96780372 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.c @@ -17,15 +17,14 @@ extern BOOLEAN HEditorMouseAction; **/
VOID
HLineFree (
- IN HEFI_EDITOR_LINE *Src
+ IN HEFI_EDITOR_LINE *Src
)
{
if (Src == NULL) {
- return ;
+ return;
}
SHELL_FREE_NON_NULL (Src);
-
}
/**
@@ -38,7 +37,7 @@ HLineFree ( **/
HEFI_EDITOR_LINE *
HLineAdvance (
- IN UINTN Count
+ IN UINTN Count
)
{
UINTN Index;
@@ -73,7 +72,7 @@ HLineAdvance ( **/
HEFI_EDITOR_LINE *
HLineRetreat (
- IN UINTN Count
+ IN UINTN Count
)
{
UINTN Index;
@@ -110,7 +109,7 @@ HLineRetreat ( **/
HEFI_EDITOR_LINE *
HMoveLine (
- IN INTN Count
+ IN INTN Count
)
{
HEFI_EDITOR_LINE *Line;
@@ -122,8 +121,8 @@ HMoveLine ( // do not set currentline to Line
//
if (Count <= 0) {
- AbsCount = (UINTN)ABS(Count);
- Line = HLineRetreat (AbsCount);
+ AbsCount = (UINTN)ABS (Count);
+ Line = HLineRetreat (AbsCount);
} else {
Line = HLineAdvance ((UINTN)Count);
}
@@ -143,7 +142,7 @@ HMoveLine ( **/
HEFI_EDITOR_LINE *
HMoveCurrentLine (
- IN INTN Count
+ IN INTN Count
)
{
HEFI_EDITOR_LINE *Line;
@@ -154,8 +153,8 @@ HMoveCurrentLine ( // >0: advance
//
if (Count <= 0) {
- AbsCount = (UINTN)ABS(Count);
- Line = HLineRetreat (AbsCount);
+ AbsCount = (UINTN)ABS (Count);
+ Line = HLineRetreat (AbsCount);
} else {
Line = HLineAdvance ((UINTN)Count);
}
@@ -169,7 +168,6 @@ HMoveCurrentLine ( return Line;
}
-
/**
Free all the lines in HBufferImage.
Fields affected:
@@ -185,8 +183,8 @@ HMoveCurrentLine ( **/
EFI_STATUS
HFreeLines (
- IN LIST_ENTRY *ListHead,
- IN HEFI_EDITOR_LINE *Lines
+ IN LIST_ENTRY *ListHead,
+ IN HEFI_EDITOR_LINE *Lines
)
{
LIST_ENTRY *Link;
@@ -196,18 +194,17 @@ HFreeLines ( // release all the lines
//
if (Lines != NULL) {
-
- Line = Lines;
- Link = &(Line->Link);
+ Line = Lines;
+ Link = &(Line->Link);
do {
- Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
- Link = Link->ForwardLink;
+ Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
+ Link = Link->ForwardLink;
HLineFree (Line);
} while (Link != ListHead);
}
ListHead->ForwardLink = ListHead;
- ListHead->BackLink = ListHead;
+ ListHead->BackLink = ListHead;
return EFI_SUCCESS;
}
@@ -221,15 +218,15 @@ HFreeLines ( **/
INT32
HGetTextX (
- IN INT32 GuidX
+ IN INT32 GuidX
)
{
- INT32 Gap;
+ INT32 Gap;
HMainEditor.MouseAccumulatorX += GuidX;
- Gap = (HMainEditor.MouseAccumulatorX * (INT32) HMainEditor.ScreenSize.Column) / (INT32) (50 * (INT32) HMainEditor.MouseInterface->Mode->ResolutionX);
- HMainEditor.MouseAccumulatorX = (HMainEditor.MouseAccumulatorX * (INT32) HMainEditor.ScreenSize.Column) % (INT32) (50 * (INT32) HMainEditor.MouseInterface->Mode->ResolutionX);
- HMainEditor.MouseAccumulatorX = HMainEditor.MouseAccumulatorX / (INT32) HMainEditor.ScreenSize.Column;
+ Gap = (HMainEditor.MouseAccumulatorX * (INT32)HMainEditor.ScreenSize.Column) / (INT32)(50 * (INT32)HMainEditor.MouseInterface->Mode->ResolutionX);
+ HMainEditor.MouseAccumulatorX = (HMainEditor.MouseAccumulatorX * (INT32)HMainEditor.ScreenSize.Column) % (INT32)(50 * (INT32)HMainEditor.MouseInterface->Mode->ResolutionX);
+ HMainEditor.MouseAccumulatorX = HMainEditor.MouseAccumulatorX / (INT32)HMainEditor.ScreenSize.Column;
return Gap;
}
@@ -242,15 +239,15 @@ HGetTextX ( **/
INT32
HGetTextY (
- IN INT32 GuidY
+ IN INT32 GuidY
)
{
- INT32 Gap;
+ INT32 Gap;
HMainEditor.MouseAccumulatorY += GuidY;
- Gap = (HMainEditor.MouseAccumulatorY * (INT32) HMainEditor.ScreenSize.Row) / (INT32) (50 * (INT32) HMainEditor.MouseInterface->Mode->ResolutionY);
- HMainEditor.MouseAccumulatorY = (HMainEditor.MouseAccumulatorY * (INT32) HMainEditor.ScreenSize.Row) % (INT32) (50 * (INT32) HMainEditor.MouseInterface->Mode->ResolutionY);
- HMainEditor.MouseAccumulatorY = HMainEditor.MouseAccumulatorY / (INT32) HMainEditor.ScreenSize.Row;
+ Gap = (HMainEditor.MouseAccumulatorY * (INT32)HMainEditor.ScreenSize.Row) / (INT32)(50 * (INT32)HMainEditor.MouseInterface->Mode->ResolutionY);
+ HMainEditor.MouseAccumulatorY = (HMainEditor.MouseAccumulatorY * (INT32)HMainEditor.ScreenSize.Row) % (INT32)(50 * (INT32)HMainEditor.MouseInterface->Mode->ResolutionY);
+ HMainEditor.MouseAccumulatorY = HMainEditor.MouseAccumulatorY / (INT32)HMainEditor.ScreenSize.Row;
return Gap;
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h index 02df65959c..f02324176a 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Misc.h @@ -23,7 +23,7 @@ **/
HEFI_EDITOR_LINE *
HMoveLine (
- IN INTN Count
+ IN INTN Count
);
/**
@@ -38,7 +38,7 @@ HMoveLine ( **/
HEFI_EDITOR_LINE *
HMoveCurrentLine (
- IN INTN Count
+ IN INTN Count
);
/**
@@ -56,8 +56,8 @@ HMoveCurrentLine ( **/
EFI_STATUS
HFreeLines (
- IN LIST_ENTRY *ListHead,
- IN HEFI_EDITOR_LINE *Lines
+ IN LIST_ENTRY *ListHead,
+ IN HEFI_EDITOR_LINE *Lines
);
/**
@@ -69,7 +69,7 @@ HFreeLines ( **/
INT32
HGetTextX (
- IN INT32 GuidX
+ IN INT32 GuidX
);
/**
@@ -81,7 +81,7 @@ HGetTextX ( **/
INT32
HGetTextY (
- IN INT32 GuidY
+ IN INT32 GuidY
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c index 5b6cba17f3..852d6dcf80 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c @@ -39,15 +39,15 @@ LoadPciRomConnectAllDriversToAllControllers ( **/
EFI_STATUS
LoadEfiDriversFromRomImage (
- VOID *RomBar,
- UINTN RomSize,
- CONST CHAR16 *FileName
+ VOID *RomBar,
+ UINTN RomSize,
+ CONST CHAR16 *FileName
);
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-nc", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-nc", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'loadpcirom' command.
@@ -62,17 +62,18 @@ ShellCommandRunLoadPciRom ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_SHELL_FILE_INFO *FileList;
- UINTN SourceSize;
- UINT8 *File1Buffer;
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- BOOLEAN Connect;
- CONST CHAR16 *Param;
- UINTN ParamCount;
- EFI_SHELL_FILE_INFO *Node;
+ EFI_SHELL_FILE_INFO *FileList;
+ UINTN SourceSize;
+ UINT8 *File1Buffer;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ BOOLEAN Connect;
+ CONST CHAR16 *Param;
+ UINTN ParamCount;
+ EFI_SHELL_FILE_INFO *Node;
+
//
// Local variable initializations
//
@@ -80,25 +81,24 @@ ShellCommandRunLoadPciRom ( ShellStatus = SHELL_SUCCESS;
FileList = NULL;
-
//
// verify number of arguments
//
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"loadpcirom", 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"loadpcirom", 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_FEW), gShellDebug1HiiHandle, L"loadpcirom");
+ if (ShellCommandLineGetCount (Package) < 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"loadpcirom");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- if (ShellCommandLineGetFlag(Package, L"-nc")) {
+ if (ShellCommandLineGetFlag (Package, L"-nc")) {
Connect = FALSE;
} else {
Connect = TRUE;
@@ -108,64 +108,73 @@ ShellCommandRunLoadPciRom ( // get a list with each file specified by parameters
// if parameter is a directory then add all the files below it to the list
//
- for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ; Param != NULL
- ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ){
- Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Param);
+ for ( ParamCount = 1, Param = ShellCommandLineGetRawValue (Package, ParamCount)
+ ; Param != NULL
+ ; ParamCount++, Param = ShellCommandLineGetRawValue (Package, ParamCount)
+ )
+ {
+ Status = ShellOpenFileMetaArg ((CHAR16 *)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Param);
ShellStatus = SHELL_ACCESS_DENIED;
break;
}
}
- if (ShellStatus == SHELL_SUCCESS && FileList != NULL) {
+
+ if ((ShellStatus == SHELL_SUCCESS) && (FileList != NULL)) {
//
// loop through the list and make sure we are not aborting...
//
- for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag()
- ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link)
- ){
- if (EFI_ERROR(Node->Status)){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
+ for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; !IsNull (&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag ()
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
+ )
+ {
+ if (EFI_ERROR (Node->Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
ShellStatus = SHELL_INVALID_PARAMETER;
continue;
}
- if (FileHandleIsDirectory(Node->Handle) == EFI_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
+
+ if (FileHandleIsDirectory (Node->Handle) == EFI_SUCCESS) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
ShellStatus = SHELL_INVALID_PARAMETER;
continue;
}
- SourceSize = (UINTN) Node->Info->FileSize;
+
+ SourceSize = (UINTN)Node->Info->FileSize;
File1Buffer = AllocateZeroPool (SourceSize);
if (File1Buffer == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"loadpcirom");
ShellStatus = SHELL_OUT_OF_RESOURCES;
continue;
}
- Status = gEfiShellProtocol->ReadFile(Node->Handle, &SourceSize, File1Buffer);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
+
+ Status = gEfiShellProtocol->ReadFile (Node->Handle, &SourceSize, File1Buffer);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Status = LoadEfiDriversFromRomImage (
- File1Buffer,
- SourceSize,
- Node->FullName
- );
+ File1Buffer,
+ SourceSize,
+ Node->FullName
+ );
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_PCI_ROM_RES), gShellDebug1HiiHandle, Node->FullName, Status);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOAD_PCI_ROM_RES), gShellDebug1HiiHandle, Node->FullName, Status);
}
- FreePool(File1Buffer);
+
+ FreePool (File1Buffer);
}
} else if (ShellStatus == SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle, "loadpcirom");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle, "loadpcirom");
ShellStatus = SHELL_NOT_FOUND;
}
- if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
- Status = ShellCloseFileMetaArg(&FileList);
+
+ if ((FileList != NULL) && !IsListEmpty (&FileList->Link)) {
+ Status = ShellCloseFileMetaArg (&FileList);
}
+
FileList = NULL;
if (Connect) {
@@ -192,9 +201,9 @@ ShellCommandRunLoadPciRom ( **/
EFI_STATUS
LoadEfiDriversFromRomImage (
- VOID *RomBar,
- UINTN RomSize,
- CONST CHAR16 *FileName
+ VOID *RomBar,
+ UINTN RomSize,
+ CONST CHAR16 *FileName
)
{
@@ -219,17 +228,16 @@ LoadEfiDriversFromRomImage ( EFI_DECOMPRESS_PROTOCOL *Decompress;
UINT32 InitializationSize;
- ImageIndex = 0;
- ReturnStatus = EFI_NOT_FOUND;
- RomBarOffset = (UINTN) RomBar;
+ ImageIndex = 0;
+ ReturnStatus = EFI_NOT_FOUND;
+ RomBarOffset = (UINTN)RomBar;
do {
-
- EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) (UINTN) RomBarOffset;
+ EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *)(UINTN)RomBarOffset;
if (EfiRomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_CORRUPT), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
-// PrintToken (STRING_TOKEN (STR_LOADPCIROM_IMAGE_CORRUPT), HiiHandle, ImageIndex);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_CORRUPT), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
+ // PrintToken (STRING_TOKEN (STR_LOADPCIROM_IMAGE_CORRUPT), HiiHandle, ImageIndex);
return ReturnStatus;
}
@@ -237,19 +245,21 @@ LoadEfiDriversFromRomImage ( // If the pointer to the PCI Data Structure is invalid, no further images can be located.
// The PCI Data Structure must be DWORD aligned.
//
- if (EfiRomHeader->PcirOffset == 0 ||
- (EfiRomHeader->PcirOffset & 3) != 0 ||
- RomBarOffset - (UINTN)RomBar + EfiRomHeader->PcirOffset + sizeof (PCI_DATA_STRUCTURE) > RomSize) {
+ if ((EfiRomHeader->PcirOffset == 0) ||
+ ((EfiRomHeader->PcirOffset & 3) != 0) ||
+ (RomBarOffset - (UINTN)RomBar + EfiRomHeader->PcirOffset + sizeof (PCI_DATA_STRUCTURE) > RomSize))
+ {
break;
}
- Pcir = (PCI_DATA_STRUCTURE *) (UINTN) (RomBarOffset + EfiRomHeader->PcirOffset);
+ Pcir = (PCI_DATA_STRUCTURE *)(UINTN)(RomBarOffset + EfiRomHeader->PcirOffset);
//
// If a valid signature is not present in the PCI Data Structure, no further images can be located.
//
if (Pcir->Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
break;
}
+
ImageSize = Pcir->ImageLength * 512;
if (RomBarOffset - (UINTN)RomBar + ImageSize > RomSize) {
break;
@@ -258,14 +268,13 @@ LoadEfiDriversFromRomImage ( if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) &&
((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
- (EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER))) {
-
- ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
- InitializationSize = EfiRomHeader->InitializationSize * 512;
-
- if (InitializationSize <= ImageSize && ImageOffset < InitializationSize) {
+ (EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)))
+ {
+ ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
+ InitializationSize = EfiRomHeader->InitializationSize * 512;
- ImageBuffer = (VOID *) (UINTN) (RomBarOffset + ImageOffset);
+ if ((InitializationSize <= ImageSize) && (ImageOffset < InitializationSize)) {
+ ImageBuffer = (VOID *)(UINTN)(RomBarOffset + ImageOffset);
ImageLength = InitializationSize - ImageOffset;
DecompressedImageBuffer = NULL;
@@ -278,33 +287,33 @@ LoadEfiDriversFromRomImage ( }
if (EfiRomHeader->CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
- Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID**)&Decompress);
- ASSERT_EFI_ERROR(Status);
+ Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress);
+ ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
SkipImage = TRUE;
} else {
SkipImage = TRUE;
- Status = Decompress->GetInfo (
- Decompress,
- ImageBuffer,
- ImageLength,
- &DestinationSize,
- &ScratchSize
- );
+ Status = Decompress->GetInfo (
+ Decompress,
+ ImageBuffer,
+ ImageLength,
+ &DestinationSize,
+ &ScratchSize
+ );
if (!EFI_ERROR (Status)) {
DecompressedImageBuffer = AllocateZeroPool (DestinationSize);
if (ImageBuffer != NULL) {
Scratch = AllocateZeroPool (ScratchSize);
if (Scratch != NULL) {
Status = Decompress->Decompress (
- Decompress,
- ImageBuffer,
- ImageLength,
- DecompressedImageBuffer,
- DestinationSize,
- Scratch,
- ScratchSize
- );
+ Decompress,
+ ImageBuffer,
+ ImageLength,
+ DecompressedImageBuffer,
+ DestinationSize,
+ Scratch,
+ ScratchSize
+ );
if (!EFI_ERROR (Status)) {
ImageBuffer = DecompressedImageBuffer;
ImageLength = DestinationSize;
@@ -326,13 +335,13 @@ LoadEfiDriversFromRomImage ( FilePath = FileDevicePath (NULL, RomFileName);
Status = gBS->LoadImage (
- TRUE,
- gImageHandle,
- FilePath,
- ImageBuffer,
- ImageLength,
- &ImageHandle
- );
+ TRUE,
+ gImageHandle,
+ FilePath,
+ ImageBuffer,
+ ImageLength,
+ &ImageHandle
+ );
if (EFI_ERROR (Status)) {
//
// With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created
@@ -343,13 +352,14 @@ LoadEfiDriversFromRomImage ( if (Status == EFI_SECURITY_VIOLATION) {
gBS->UnloadImage (ImageHandle);
}
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_LOAD_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
-// PrintToken (STRING_TOKEN (STR_LOADPCIROM_LOAD_IMAGE_ERROR), HiiHandle, ImageIndex, Status);
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_LOAD_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
+ // PrintToken (STRING_TOKEN (STR_LOADPCIROM_LOAD_IMAGE_ERROR), HiiHandle, ImageIndex, Status);
} else {
Status = gBS->StartImage (ImageHandle, NULL, NULL);
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_START_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
-// PrintToken (STRING_TOKEN (STR_LOADPCIROM_START_IMAGE), HiiHandle, ImageIndex, Status);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_START_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
+ // PrintToken (STRING_TOKEN (STR_LOADPCIROM_START_IMAGE), HiiHandle, ImageIndex, Status);
} else {
ReturnStatus = Status;
}
@@ -359,13 +369,12 @@ LoadEfiDriversFromRomImage ( if (DecompressedImageBuffer != NULL) {
FreePool (DecompressedImageBuffer);
}
-
}
}
RomBarOffset = RomBarOffset + ImageSize;
ImageIndex++;
- } while (((Pcir->Indicator & 0x80) == 0x00) && ((RomBarOffset - (UINTN) RomBar) < RomSize));
+ } while (((Pcir->Indicator & 0x80) == 0x00) && ((RomBarOffset - (UINTN)RomBar) < RomSize));
return ReturnStatus;
}
@@ -402,11 +411,13 @@ LoadPciRomConnectAllDriversToAllControllers ( Status = EFI_ABORTED;
break;
}
+
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
}
if (HandleBuffer != NULL) {
FreePool (HandleBuffer);
}
+
return Status;
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c index ea651802cb..72f3c58b09 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c @@ -11,41 +11,41 @@ //
// Need full names for Standard-Format Output
//
-STATIC CONST CHAR16 NameEfiReservedMemoryType[] = L"Reserved";
-STATIC CONST CHAR16 NameEfiLoaderCode[] = L"LoaderCode";
-STATIC CONST CHAR16 NameEfiLoaderData[] = L"LoaderData";
-STATIC CONST CHAR16 NameEfiBootServicesCode[] = L"BootServiceCode";
-STATIC CONST CHAR16 NameEfiBootServicesData[] = L"BootServiceData";
-STATIC CONST CHAR16 NameEfiRuntimeServicesCode[] = L"RuntimeCode";
-STATIC CONST CHAR16 NameEfiRuntimeServicesData[] = L"RuntimeData";
-STATIC CONST CHAR16 NameEfiConventionalMemory[] = L"Available";
-STATIC CONST CHAR16 NameEfiPersistentMemory[] = L"Persistent";
-STATIC CONST CHAR16 NameEfiUnusableMemory[] = L"UnusableMemory";
-STATIC CONST CHAR16 NameEfiACPIReclaimMemory[] = L"ACPIReclaimMemory";
-STATIC CONST CHAR16 NameEfiACPIMemoryNVS[] = L"ACPIMemoryNVS";
-STATIC CONST CHAR16 NameEfiMemoryMappedIO[] = L"MemoryMappedIO";
-STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpace[] = L"MemoryMappedIOPortSpace";
-STATIC CONST CHAR16 NameEfiPalCode[] = L"PalCode";
+STATIC CONST CHAR16 NameEfiReservedMemoryType[] = L"Reserved";
+STATIC CONST CHAR16 NameEfiLoaderCode[] = L"LoaderCode";
+STATIC CONST CHAR16 NameEfiLoaderData[] = L"LoaderData";
+STATIC CONST CHAR16 NameEfiBootServicesCode[] = L"BootServiceCode";
+STATIC CONST CHAR16 NameEfiBootServicesData[] = L"BootServiceData";
+STATIC CONST CHAR16 NameEfiRuntimeServicesCode[] = L"RuntimeCode";
+STATIC CONST CHAR16 NameEfiRuntimeServicesData[] = L"RuntimeData";
+STATIC CONST CHAR16 NameEfiConventionalMemory[] = L"Available";
+STATIC CONST CHAR16 NameEfiPersistentMemory[] = L"Persistent";
+STATIC CONST CHAR16 NameEfiUnusableMemory[] = L"UnusableMemory";
+STATIC CONST CHAR16 NameEfiACPIReclaimMemory[] = L"ACPIReclaimMemory";
+STATIC CONST CHAR16 NameEfiACPIMemoryNVS[] = L"ACPIMemoryNVS";
+STATIC CONST CHAR16 NameEfiMemoryMappedIO[] = L"MemoryMappedIO";
+STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpace[] = L"MemoryMappedIOPortSpace";
+STATIC CONST CHAR16 NameEfiPalCode[] = L"PalCode";
//
// Need short names for some memory types
//
-STATIC CONST CHAR16 NameEfiBootServicesCodeShort[] = L"BS_Code";
-STATIC CONST CHAR16 NameEfiBootServicesDataShort[] = L"BS_Data";
-STATIC CONST CHAR16 NameEfiRuntimeServicesCodeShort[] = L"RT_Code";
-STATIC CONST CHAR16 NameEfiRuntimeServicesDataShort[] = L"RT_Data";
-STATIC CONST CHAR16 NameEfiUnusableMemoryShort[] = L"Unusable";
-STATIC CONST CHAR16 NameEfiACPIReclaimMemoryShort[] = L"ACPI_Recl";
-STATIC CONST CHAR16 NameEfiACPIMemoryNVSShort[] = L"ACPI_NVS";
-STATIC CONST CHAR16 NameEfiMemoryMappedIOShort[] = L"MMIO";
-STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpaceShort[] = L"MMIO_Port";
+STATIC CONST CHAR16 NameEfiBootServicesCodeShort[] = L"BS_Code";
+STATIC CONST CHAR16 NameEfiBootServicesDataShort[] = L"BS_Data";
+STATIC CONST CHAR16 NameEfiRuntimeServicesCodeShort[] = L"RT_Code";
+STATIC CONST CHAR16 NameEfiRuntimeServicesDataShort[] = L"RT_Data";
+STATIC CONST CHAR16 NameEfiUnusableMemoryShort[] = L"Unusable";
+STATIC CONST CHAR16 NameEfiACPIReclaimMemoryShort[] = L"ACPI_Recl";
+STATIC CONST CHAR16 NameEfiACPIMemoryNVSShort[] = L"ACPI_NVS";
+STATIC CONST CHAR16 NameEfiMemoryMappedIOShort[] = L"MMIO";
+STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpaceShort[] = L"MMIO_Port";
#include "UefiShellDebug1CommandsLib.h"
typedef struct {
- UINT32 Type;
- UINT64 NumberOfPages;
- LIST_ENTRY Link;
+ UINT32 Type;
+ UINT64 NumberOfPages;
+ LIST_ENTRY Link;
} MEMORY_LENGTH_ENTRY;
/**
@@ -57,14 +57,14 @@ typedef struct { **/
VOID
AddMemoryLength (
- LIST_ENTRY *List,
- UINT32 Type,
- UINT64 NumberOfPages
+ LIST_ENTRY *List,
+ UINT32 Type,
+ UINT64 NumberOfPages
)
{
- MEMORY_LENGTH_ENTRY *Entry;
- MEMORY_LENGTH_ENTRY *NewEntry;
- LIST_ENTRY *Link;
+ MEMORY_LENGTH_ENTRY *Entry;
+ MEMORY_LENGTH_ENTRY *NewEntry;
+ LIST_ENTRY *Link;
Entry = NULL;
for (Link = GetFirstNode (List); !IsNull (List, Link); Link = GetNextNode (List, Link)) {
@@ -89,7 +89,8 @@ AddMemoryLength ( if (NewEntry == NULL) {
return;
}
- NewEntry->Type = Type;
+
+ NewEntry->Type = Type;
NewEntry->NumberOfPages = 0;
InsertTailList (Link, &NewEntry->Link);
}
@@ -110,52 +111,52 @@ ShellCommandRunMemMap ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINTN Size;
- EFI_MEMORY_DESCRIPTOR *Descriptors;
- UINTN MapKey;
- UINTN ItemSize;
- UINT32 Version;
- EFI_MEMORY_DESCRIPTOR *Walker;
- UINT64 ReservedPages;
- UINT64 LoadCodePages;
- UINT64 LoadDataPages;
- UINT64 BSCodePages;
- UINT64 BSDataPages;
- UINT64 RTDataPages;
- UINT64 RTCodePages;
- UINT64 AvailPages;
- UINT64 TotalPages;
- UINT64 ReservedPagesSize;
- UINT64 LoadCodePagesSize;
- UINT64 LoadDataPagesSize;
- UINT64 BSCodePagesSize;
- UINT64 BSDataPagesSize;
- UINT64 RTDataPagesSize;
- UINT64 RTCodePagesSize;
- UINT64 AvailPagesSize;
- UINT64 TotalPagesSize;
- UINT64 AcpiReclaimPages;
- UINT64 AcpiNvsPages;
- UINT64 MmioSpacePages;
- UINT64 AcpiReclaimPagesSize;
- UINT64 AcpiNvsPagesSize;
- UINT64 MmioSpacePagesSize;
- UINT64 MmioPortPages;
- UINT64 MmioPortPagesSize;
- UINT64 UnusableMemoryPages;
- UINT64 UnusableMemoryPagesSize;
- UINT64 PalCodePages;
- UINT64 PalCodePagesSize;
- UINT64 PersistentPages;
- UINT64 PersistentPagesSize;
- BOOLEAN Sfo;
- LIST_ENTRY MemoryList;
- MEMORY_LENGTH_ENTRY *Entry;
- LIST_ENTRY *Link;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINTN Size;
+ EFI_MEMORY_DESCRIPTOR *Descriptors;
+ UINTN MapKey;
+ UINTN ItemSize;
+ UINT32 Version;
+ EFI_MEMORY_DESCRIPTOR *Walker;
+ UINT64 ReservedPages;
+ UINT64 LoadCodePages;
+ UINT64 LoadDataPages;
+ UINT64 BSCodePages;
+ UINT64 BSDataPages;
+ UINT64 RTDataPages;
+ UINT64 RTCodePages;
+ UINT64 AvailPages;
+ UINT64 TotalPages;
+ UINT64 ReservedPagesSize;
+ UINT64 LoadCodePagesSize;
+ UINT64 LoadDataPagesSize;
+ UINT64 BSCodePagesSize;
+ UINT64 BSDataPagesSize;
+ UINT64 RTDataPagesSize;
+ UINT64 RTCodePagesSize;
+ UINT64 AvailPagesSize;
+ UINT64 TotalPagesSize;
+ UINT64 AcpiReclaimPages;
+ UINT64 AcpiNvsPages;
+ UINT64 MmioSpacePages;
+ UINT64 AcpiReclaimPagesSize;
+ UINT64 AcpiNvsPagesSize;
+ UINT64 MmioSpacePagesSize;
+ UINT64 MmioPortPages;
+ UINT64 MmioPortPagesSize;
+ UINT64 UnusableMemoryPages;
+ UINT64 UnusableMemoryPagesSize;
+ UINT64 PalCodePages;
+ UINT64 PalCodePagesSize;
+ UINT64 PersistentPages;
+ UINT64 PersistentPagesSize;
+ BOOLEAN Sfo;
+ LIST_ENTRY MemoryList;
+ MEMORY_LENGTH_ENTRY *Entry;
+ LIST_ENTRY *Link;
AcpiReclaimPages = 0;
AcpiNvsPages = 0;
@@ -182,42 +183,43 @@ ShellCommandRunMemMap ( //
// 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 (SfoParamList, &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"memmap", 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"memmap", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetCount(Package) > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"memmap");
+ if (ShellCommandLineGetCount (Package) > 1) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"memmap");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = gBS->GetMemoryMap(&Size, Descriptors, &MapKey, &ItemSize, &Version);
- if (Status == EFI_BUFFER_TOO_SMALL){
- Size += SIZE_1KB;
- Descriptors = AllocateZeroPool(Size);
- Status = gBS->GetMemoryMap(&Size, Descriptors, &MapKey, &ItemSize, &Version);
+ Status = gBS->GetMemoryMap (&Size, Descriptors, &MapKey, &ItemSize, &Version);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ Size += SIZE_1KB;
+ Descriptors = AllocateZeroPool (Size);
+ Status = gBS->GetMemoryMap (&Size, Descriptors, &MapKey, &ItemSize, &Version);
}
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap");
+
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap");
ShellStatus = SHELL_ACCESS_DENIED;
} else {
- ASSERT(Version == EFI_MEMORY_DESCRIPTOR_VERSION);
+ ASSERT (Version == EFI_MEMORY_DESCRIPTOR_VERSION);
- Sfo = ShellCommandLineGetFlag(Package, L"-sfo");
+ Sfo = ShellCommandLineGetFlag (Package, L"-sfo");
if (!Sfo) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_HEAD), gShellDebug1HiiHandle);
} else {
@@ -225,79 +227,80 @@ ShellCommandRunMemMap ( }
for ( Walker = Descriptors
- ; (Walker < (EFI_MEMORY_DESCRIPTOR *) ((UINT8*)Descriptors + Size)) && (Walker != NULL)
- ; Walker = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *)Walker + ItemSize)
- ){
+ ; (Walker < (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Descriptors + Size)) && (Walker != NULL)
+ ; Walker = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Walker + ItemSize)
+ )
+ {
switch (Walker->Type) {
- case EfiReservedMemoryType:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiReservedMemoryType, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ case EfiReservedMemoryType:
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiReservedMemoryType, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
ReservedPages += Walker->NumberOfPages;
break;
case EfiLoaderCode:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
LoadCodePages += Walker->NumberOfPages;
- TotalPages += Walker->NumberOfPages;
+ TotalPages += Walker->NumberOfPages;
break;
case EfiLoaderData:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
LoadDataPages += Walker->NumberOfPages;
- TotalPages += Walker->NumberOfPages;
+ TotalPages += Walker->NumberOfPages;
break;
case EfiBootServicesCode:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiBootServicesCodeShort:NameEfiBootServicesCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiBootServicesCodeShort : NameEfiBootServicesCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
BSCodePages += Walker->NumberOfPages;
- TotalPages += Walker->NumberOfPages;
+ TotalPages += Walker->NumberOfPages;
break;
case EfiBootServicesData:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiBootServicesDataShort:NameEfiBootServicesData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiBootServicesDataShort : NameEfiBootServicesData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
BSDataPages += Walker->NumberOfPages;
- TotalPages += Walker->NumberOfPages;
+ TotalPages += Walker->NumberOfPages;
break;
case EfiRuntimeServicesCode:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiRuntimeServicesCodeShort:NameEfiRuntimeServicesCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiRuntimeServicesCodeShort : NameEfiRuntimeServicesCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
RTCodePages += Walker->NumberOfPages;
- TotalPages += Walker->NumberOfPages;
+ TotalPages += Walker->NumberOfPages;
break;
case EfiRuntimeServicesData:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiRuntimeServicesDataShort:NameEfiRuntimeServicesData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiRuntimeServicesDataShort : NameEfiRuntimeServicesData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
RTDataPages += Walker->NumberOfPages;
- TotalPages += Walker->NumberOfPages;
+ TotalPages += Walker->NumberOfPages;
break;
case EfiConventionalMemory:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiConventionalMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiConventionalMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
AvailPages += Walker->NumberOfPages;
TotalPages += Walker->NumberOfPages;
break;
case EfiPersistentMemory:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPersistentMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPersistentMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
PersistentPages += Walker->NumberOfPages;
TotalPages += Walker->NumberOfPages;
break;
case EfiUnusableMemory:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiUnusableMemoryShort:NameEfiUnusableMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiUnusableMemoryShort : NameEfiUnusableMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
UnusableMemoryPages += Walker->NumberOfPages;
break;
case EfiACPIReclaimMemory:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiACPIReclaimMemoryShort:NameEfiACPIReclaimMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
- TotalPages += Walker->NumberOfPages;
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiACPIReclaimMemoryShort : NameEfiACPIReclaimMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ TotalPages += Walker->NumberOfPages;
AcpiReclaimPages += Walker->NumberOfPages;
break;
case EfiACPIMemoryNVS:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiACPIMemoryNVSShort:NameEfiACPIMemoryNVS, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
- TotalPages += Walker->NumberOfPages;
- AcpiNvsPages += Walker->NumberOfPages;
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiACPIMemoryNVSShort : NameEfiACPIMemoryNVS, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ TotalPages += Walker->NumberOfPages;
+ AcpiNvsPages += Walker->NumberOfPages;
break;
case EfiMemoryMappedIO:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiMemoryMappedIOShort:NameEfiMemoryMappedIO, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
- MmioSpacePages += Walker->NumberOfPages;
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiMemoryMappedIOShort : NameEfiMemoryMappedIO, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ MmioSpacePages += Walker->NumberOfPages;
break;
case EfiMemoryMappedIOPortSpace:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiMemoryMappedIOPortSpaceShort:NameEfiMemoryMappedIOPortSpace, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo ? NameEfiMemoryMappedIOPortSpaceShort : NameEfiMemoryMappedIOPortSpace, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
MmioPortPages += Walker->NumberOfPages;
break;
case EfiPalCode:
- ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPalCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
- TotalPages += Walker->NumberOfPages;
+ ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPalCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
+ TotalPages += Walker->NumberOfPages;
PalCodePages += Walker->NumberOfPages;
break;
default:
@@ -308,46 +311,67 @@ ShellCommandRunMemMap ( if (!Sfo) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_ITEM_OTHER), gShellDebug1HiiHandle, Walker->Type, Walker->PhysicalStart, Walker->PhysicalStart + MultU64x64 (SIZE_4KB, Walker->NumberOfPages) - 1, Walker->NumberOfPages, Walker->Attribute);
}
+
TotalPages += Walker->NumberOfPages;
AddMemoryLength (&MemoryList, Walker->Type, Walker->NumberOfPages);
break;
}
}
+
//
// print the summary
//
- ReservedPagesSize = MultU64x64(SIZE_4KB,ReservedPages);
- LoadCodePagesSize = MultU64x64(SIZE_4KB,LoadCodePages);
- LoadDataPagesSize = MultU64x64(SIZE_4KB,LoadDataPages);
- BSCodePagesSize = MultU64x64(SIZE_4KB,BSCodePages);
- BSDataPagesSize = MultU64x64(SIZE_4KB,BSDataPages);
- RTDataPagesSize = MultU64x64(SIZE_4KB,RTDataPages);
- RTCodePagesSize = MultU64x64(SIZE_4KB,RTCodePages);
- AvailPagesSize = MultU64x64(SIZE_4KB,AvailPages);
- TotalPagesSize = MultU64x64(SIZE_4KB,TotalPages);
- AcpiReclaimPagesSize = MultU64x64(SIZE_4KB,AcpiReclaimPages);
- AcpiNvsPagesSize = MultU64x64(SIZE_4KB,AcpiNvsPages);
- MmioSpacePagesSize = MultU64x64(SIZE_4KB,MmioSpacePages);
- MmioPortPagesSize = MultU64x64(SIZE_4KB,MmioPortPages);
- PalCodePagesSize = MultU64x64(SIZE_4KB,PalCodePages);
- PersistentPagesSize = MultU64x64(SIZE_4KB,PersistentPages);
- UnusableMemoryPagesSize = MultU64x64(SIZE_4KB,UnusableMemoryPages);
+ ReservedPagesSize = MultU64x64 (SIZE_4KB, ReservedPages);
+ LoadCodePagesSize = MultU64x64 (SIZE_4KB, LoadCodePages);
+ LoadDataPagesSize = MultU64x64 (SIZE_4KB, LoadDataPages);
+ BSCodePagesSize = MultU64x64 (SIZE_4KB, BSCodePages);
+ BSDataPagesSize = MultU64x64 (SIZE_4KB, BSDataPages);
+ RTDataPagesSize = MultU64x64 (SIZE_4KB, RTDataPages);
+ RTCodePagesSize = MultU64x64 (SIZE_4KB, RTCodePages);
+ AvailPagesSize = MultU64x64 (SIZE_4KB, AvailPages);
+ TotalPagesSize = MultU64x64 (SIZE_4KB, TotalPages);
+ AcpiReclaimPagesSize = MultU64x64 (SIZE_4KB, AcpiReclaimPages);
+ AcpiNvsPagesSize = MultU64x64 (SIZE_4KB, AcpiNvsPages);
+ MmioSpacePagesSize = MultU64x64 (SIZE_4KB, MmioSpacePages);
+ MmioPortPagesSize = MultU64x64 (SIZE_4KB, MmioPortPages);
+ PalCodePagesSize = MultU64x64 (SIZE_4KB, PalCodePages);
+ PersistentPagesSize = MultU64x64 (SIZE_4KB, PersistentPages);
+ UnusableMemoryPagesSize = MultU64x64 (SIZE_4KB, UnusableMemoryPages);
if (!Sfo) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM), gShellDebug1HiiHandle,
- ReservedPages, ReservedPagesSize,
- LoadCodePages, LoadCodePagesSize,
- LoadDataPages, LoadDataPagesSize,
- BSCodePages, BSCodePagesSize,
- BSDataPages, BSDataPagesSize,
- RTCodePages, RTCodePagesSize,
- RTDataPages, RTDataPagesSize,
- AcpiReclaimPages, AcpiReclaimPagesSize,
- AcpiNvsPages, AcpiNvsPagesSize,
- MmioSpacePages, MmioSpacePagesSize,
- MmioPortPages, MmioPortPagesSize,
- PalCodePages, PalCodePagesSize,
- AvailPages, AvailPagesSize,
- PersistentPages, PersistentPagesSize
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_MEMMAP_LIST_SUMM),
+ gShellDebug1HiiHandle,
+ ReservedPages,
+ ReservedPagesSize,
+ LoadCodePages,
+ LoadCodePagesSize,
+ LoadDataPages,
+ LoadDataPagesSize,
+ BSCodePages,
+ BSCodePagesSize,
+ BSDataPages,
+ BSDataPagesSize,
+ RTCodePages,
+ RTCodePagesSize,
+ RTDataPages,
+ RTDataPagesSize,
+ AcpiReclaimPages,
+ AcpiReclaimPagesSize,
+ AcpiNvsPages,
+ AcpiNvsPagesSize,
+ MmioSpacePages,
+ MmioSpacePagesSize,
+ MmioPortPages,
+ MmioPortPagesSize,
+ PalCodePages,
+ PalCodePagesSize,
+ AvailPages,
+ AvailPagesSize,
+ PersistentPages,
+ PersistentPagesSize
);
//
@@ -355,16 +379,34 @@ ShellCommandRunMemMap ( //
for (Link = GetFirstNode (&MemoryList); !IsNull (&MemoryList, Link); Link = GetNextNode (&MemoryList, Link)) {
Entry = BASE_CR (Link, MEMORY_LENGTH_ENTRY, Link);
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_OTHER), gShellDebug1HiiHandle,
- Entry->Type, Entry->NumberOfPages, MultU64x64 (SIZE_4KB, Entry->NumberOfPages)
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_MEMMAP_LIST_SUMM_OTHER),
+ gShellDebug1HiiHandle,
+ Entry->Type,
+ Entry->NumberOfPages,
+ MultU64x64 (SIZE_4KB, Entry->NumberOfPages)
);
}
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM2), gShellDebug1HiiHandle,
- DivU64x32(MultU64x64(SIZE_4KB,TotalPages), SIZE_1MB), TotalPagesSize
- );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_MEMMAP_LIST_SUMM2),
+ gShellDebug1HiiHandle,
+ DivU64x32 (MultU64x64 (SIZE_4KB, TotalPages), SIZE_1MB),
+ TotalPagesSize
+ );
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO), gShellDebug1HiiHandle,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO),
+ gShellDebug1HiiHandle,
TotalPagesSize,
ReservedPagesSize,
BSCodePagesSize,
@@ -381,15 +423,16 @@ ShellCommandRunMemMap ( AcpiNvsPagesSize,
PalCodePagesSize,
PersistentPagesSize
- );
+ );
}
}
}
+
ShellCommandLineFreeVarList (Package);
}
if (Descriptors != NULL) {
- FreePool(Descriptors);
+ FreePool (Descriptors);
}
//
@@ -401,4 +444,3 @@ ShellCommandRunMemMap ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c index 4e60baa325..b75e2f4770 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c @@ -21,7 +21,7 @@ typedef enum { ShellMmPciExpress
} SHELL_MM_ACCESS_TYPE;
-CONST UINT16 mShellMmAccessTypeStr[] = {
+CONST UINT16 mShellMmAccessTypeStr[] = {
STRING_TOKEN (STR_MM_MEM),
STRING_TOKEN (STR_MM_MMIO),
STRING_TOKEN (STR_MM_IO),
@@ -29,24 +29,24 @@ CONST UINT16 mShellMmAccessTypeStr[] = { STRING_TOKEN (STR_MM_PCIE)
};
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-mmio", TypeFlag},
- {L"-mem", TypeFlag},
- {L"-io", TypeFlag},
- {L"-pci", TypeFlag},
- {L"-pcie", TypeFlag},
- {L"-n", TypeFlag},
- {L"-w", TypeValue},
- {NULL, TypeMax}
- };
-
-CONST UINT64 mShellMmMaxNumber[] = {
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-mmio", TypeFlag },
+ { L"-mem", TypeFlag },
+ { L"-io", TypeFlag },
+ { L"-pci", TypeFlag },
+ { L"-pcie", TypeFlag },
+ { L"-n", TypeFlag },
+ { L"-w", TypeValue },
+ { NULL, TypeMax }
+};
+
+CONST UINT64 mShellMmMaxNumber[] = {
0, MAX_UINT8, MAX_UINT16, 0, MAX_UINT32, 0, 0, 0, MAX_UINT64
};
-CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH mShellMmRootBridgeIoWidth[] = {
+CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH mShellMmRootBridgeIoWidth[] = {
0, EfiPciWidthUint8, EfiPciWidthUint16, 0, EfiPciWidthUint32, 0, 0, 0, EfiPciWidthUint64
};
-CONST EFI_CPU_IO_PROTOCOL_WIDTH mShellMmCpuIoWidth[] = {
+CONST EFI_CPU_IO_PROTOCOL_WIDTH mShellMmCpuIoWidth[] = {
0, EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, 0, EfiCpuIoWidthUint32, 0, 0, 0, EfiCpuIoWidthUint64
};
@@ -64,13 +64,13 @@ CONST EFI_CPU_IO_PROTOCOL_WIDTH mShellMmCpuIoWidth[] = { **/
VOID
ShellMmDecodePciAddress (
- IN BOOLEAN PciFormat,
- IN UINT64 Address,
- OUT UINT32 *Segment,
- OUT UINT8 *Bus,
- OUT UINT8 *Device OPTIONAL,
- OUT UINT8 *Function OPTIONAL,
- OUT UINT32 *Register OPTIONAL
+ IN BOOLEAN PciFormat,
+ IN UINT64 Address,
+ OUT UINT32 *Segment,
+ OUT UINT8 *Bus,
+ OUT UINT8 *Device OPTIONAL,
+ OUT UINT8 *Function OPTIONAL,
+ OUT UINT32 *Register OPTIONAL
)
{
if (PciFormat) {
@@ -78,33 +78,37 @@ ShellMmDecodePciAddress ( // PCI Configuration Space.The address will have the format ssssbbddffrr,
// where ssss = Segment, bb = Bus, dd = Device, ff = Function and rr = Register.
//
- *Segment = (UINT32) (RShiftU64 (Address, 32) & 0xFFFF);
- *Bus = (UINT8) (((UINT32) Address) >> 24);
+ *Segment = (UINT32)(RShiftU64 (Address, 32) & 0xFFFF);
+ *Bus = (UINT8)(((UINT32)Address) >> 24);
if (Device != NULL) {
- *Device = (UINT8) (((UINT32) Address) >> 16);
+ *Device = (UINT8)(((UINT32)Address) >> 16);
}
+
if (Function != NULL) {
- *Function = (UINT8) (((UINT32) Address) >> 8);
+ *Function = (UINT8)(((UINT32)Address) >> 8);
}
+
if (Register != NULL) {
- *Register = (UINT8) Address;
+ *Register = (UINT8)Address;
}
} else {
//
// PCI Express Configuration Space.The address will have the format ssssssbbddffrrr,
// where ssss = Segment, bb = Bus, dd = Device, ff = Function and rrr = Register.
//
- *Segment = (UINT32) (RShiftU64 (Address, 36) & 0xFFFF);
- *Bus = (UINT8) RShiftU64 (Address, 28);
+ *Segment = (UINT32)(RShiftU64 (Address, 36) & 0xFFFF);
+ *Bus = (UINT8)RShiftU64 (Address, 28);
if (Device != NULL) {
- *Device = (UINT8) (((UINT32) Address) >> 20);
+ *Device = (UINT8)(((UINT32)Address) >> 20);
}
+
if (Function != NULL) {
- *Function = (UINT8) (((UINT32) Address) >> 12);
+ *Function = (UINT8)(((UINT32)Address) >> 12);
}
+
if (Register != NULL) {
- *Register = (UINT32) (Address & 0xFFF);
+ *Register = (UINT32)(Address & 0xFFF);
}
}
}
@@ -122,80 +126,90 @@ ShellMmDecodePciAddress ( **/
VOID
ShellMmAccess (
- IN SHELL_MM_ACCESS_TYPE AccessType,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN EFI_CPU_IO2_PROTOCOL *CpuIo,
- IN BOOLEAN Read,
- IN UINT64 Address,
- IN UINTN Size,
- IN OUT VOID *Buffer
+ IN SHELL_MM_ACCESS_TYPE AccessType,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
+ IN EFI_CPU_IO2_PROTOCOL *CpuIo,
+ IN BOOLEAN Read,
+ IN UINT64 Address,
+ IN UINTN Size,
+ IN OUT VOID *Buffer
)
{
- EFI_STATUS Status;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM RootBridgeIoMem;
- EFI_CPU_IO_PROTOCOL_IO_MEM CpuIoMem;
- UINT32 Segment;
- UINT8 Bus;
- UINT8 Device;
- UINT8 Function;
- UINT32 Register;
+ EFI_STATUS Status;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM RootBridgeIoMem;
+ EFI_CPU_IO_PROTOCOL_IO_MEM CpuIoMem;
+ UINT32 Segment;
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT32 Register;
if (AccessType == ShellMmMemory) {
if (Read) {
- CopyMem (Buffer, (VOID *) (UINTN) Address, Size);
+ CopyMem (Buffer, (VOID *)(UINTN)Address, Size);
} else {
- CopyMem ((VOID *) (UINTN) Address, Buffer, Size);
+ CopyMem ((VOID *)(UINTN)Address, Buffer, Size);
}
} else {
RootBridgeIoMem = NULL;
- CpuIoMem = NULL;
+ CpuIoMem = NULL;
switch (AccessType) {
- case ShellMmPci:
- case ShellMmPciExpress:
- ASSERT (PciRootBridgeIo != NULL);
- ShellMmDecodePciAddress ((BOOLEAN) (AccessType == ShellMmPci), Address, &Segment, &Bus, &Device, &Function, &Register);
- if (Read) {
- Status = PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size],
- EFI_PCI_ADDRESS (Bus, Device, Function, Register),
- 1, Buffer
- );
- } else {
- Status = PciRootBridgeIo->Pci.Write (
- PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size],
- EFI_PCI_ADDRESS (Bus, Device, Function, Register),
- 1, Buffer
- );
- }
- ASSERT_EFI_ERROR (Status);
- return;
+ case ShellMmPci:
+ case ShellMmPciExpress:
+ ASSERT (PciRootBridgeIo != NULL);
+ ShellMmDecodePciAddress ((BOOLEAN)(AccessType == ShellMmPci), Address, &Segment, &Bus, &Device, &Function, &Register);
+ if (Read) {
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ mShellMmRootBridgeIoWidth[Size],
+ EFI_PCI_ADDRESS (Bus, Device, Function, Register),
+ 1,
+ Buffer
+ );
+ } else {
+ Status = PciRootBridgeIo->Pci.Write (
+ PciRootBridgeIo,
+ mShellMmRootBridgeIoWidth[Size],
+ EFI_PCI_ADDRESS (Bus, Device, Function, Register),
+ 1,
+ Buffer
+ );
+ }
- case ShellMmMemoryMappedIo:
- if (PciRootBridgeIo != NULL) {
- RootBridgeIoMem = Read ? PciRootBridgeIo->Mem.Read : PciRootBridgeIo->Mem.Write;
- }
- if (CpuIo != NULL) {
- CpuIoMem = Read ? CpuIo->Mem.Read : CpuIo->Mem.Write;
- }
- break;
+ ASSERT_EFI_ERROR (Status);
+ return;
- case ShellMmIo:
- if (PciRootBridgeIo != NULL) {
- RootBridgeIoMem = Read ? PciRootBridgeIo->Io.Read : PciRootBridgeIo->Io.Write;
- }
- if (CpuIo != NULL) {
- CpuIoMem = Read ? CpuIo->Io.Read : CpuIo->Io.Write;
- }
- break;
- default:
- ASSERT (FALSE);
- break;
+ case ShellMmMemoryMappedIo:
+ if (PciRootBridgeIo != NULL) {
+ RootBridgeIoMem = Read ? PciRootBridgeIo->Mem.Read : PciRootBridgeIo->Mem.Write;
+ }
+
+ if (CpuIo != NULL) {
+ CpuIoMem = Read ? CpuIo->Mem.Read : CpuIo->Mem.Write;
+ }
+
+ break;
+
+ case ShellMmIo:
+ if (PciRootBridgeIo != NULL) {
+ RootBridgeIoMem = Read ? PciRootBridgeIo->Io.Read : PciRootBridgeIo->Io.Write;
+ }
+
+ if (CpuIo != NULL) {
+ CpuIoMem = Read ? CpuIo->Io.Read : CpuIo->Io.Write;
+ }
+
+ break;
+ default:
+ ASSERT (FALSE);
+ break;
}
Status = EFI_UNSUPPORTED;
if (RootBridgeIoMem != NULL) {
Status = RootBridgeIoMem (PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size], Address, 1, Buffer);
}
+
if (EFI_ERROR (Status) && (CpuIoMem != NULL)) {
Status = CpuIoMem (CpuIo, mShellMmCpuIoWidth[Size], Address, 1, Buffer);
}
@@ -203,71 +217,79 @@ ShellMmAccess ( if (EFI_ERROR (Status)) {
if (AccessType == ShellMmIo) {
switch (Size) {
- case 1:
- if (Read) {
- *(UINT8 *) Buffer = IoRead8 ((UINTN) Address);
- } else {
- IoWrite8 ((UINTN) Address, *(UINT8 *) Buffer);
- }
- break;
- case 2:
- if (Read) {
- *(UINT16 *) Buffer = IoRead16 ((UINTN) Address);
- } else {
- IoWrite16 ((UINTN) Address, *(UINT16 *) Buffer);
- }
- break;
- case 4:
- if (Read) {
- *(UINT32 *) Buffer = IoRead32 ((UINTN) Address);
- } else {
- IoWrite32 ((UINTN) Address, *(UINT32 *) Buffer);
- }
- break;
- case 8:
- if (Read) {
- *(UINT64 *) Buffer = IoRead64 ((UINTN) Address);
- } else {
- IoWrite64 ((UINTN) Address, *(UINT64 *) Buffer);
- }
- break;
- default:
- ASSERT (FALSE);
- break;
+ case 1:
+ if (Read) {
+ *(UINT8 *)Buffer = IoRead8 ((UINTN)Address);
+ } else {
+ IoWrite8 ((UINTN)Address, *(UINT8 *)Buffer);
+ }
+
+ break;
+ case 2:
+ if (Read) {
+ *(UINT16 *)Buffer = IoRead16 ((UINTN)Address);
+ } else {
+ IoWrite16 ((UINTN)Address, *(UINT16 *)Buffer);
+ }
+
+ break;
+ case 4:
+ if (Read) {
+ *(UINT32 *)Buffer = IoRead32 ((UINTN)Address);
+ } else {
+ IoWrite32 ((UINTN)Address, *(UINT32 *)Buffer);
+ }
+
+ break;
+ case 8:
+ if (Read) {
+ *(UINT64 *)Buffer = IoRead64 ((UINTN)Address);
+ } else {
+ IoWrite64 ((UINTN)Address, *(UINT64 *)Buffer);
+ }
+
+ break;
+ default:
+ ASSERT (FALSE);
+ break;
}
} else {
switch (Size) {
- case 1:
- if (Read) {
- *(UINT8 *) Buffer = MmioRead8 ((UINTN) Address);
- } else {
- MmioWrite8 ((UINTN) Address, *(UINT8 *) Buffer);
- }
- break;
- case 2:
- if (Read) {
- *(UINT16 *) Buffer = MmioRead16 ((UINTN) Address);
- } else {
- MmioWrite16 ((UINTN) Address, *(UINT16 *) Buffer);
- }
- break;
- case 4:
- if (Read) {
- *(UINT32 *) Buffer = MmioRead32 ((UINTN) Address);
- } else {
- MmioWrite32 ((UINTN) Address, *(UINT32 *) Buffer);
- }
- break;
- case 8:
- if (Read) {
- *(UINT64 *) Buffer = MmioRead64 ((UINTN) Address);
- } else {
- MmioWrite64 ((UINTN) Address, *(UINT64 *) Buffer);
- }
- break;
- default:
- ASSERT (FALSE);
- break;
+ case 1:
+ if (Read) {
+ *(UINT8 *)Buffer = MmioRead8 ((UINTN)Address);
+ } else {
+ MmioWrite8 ((UINTN)Address, *(UINT8 *)Buffer);
+ }
+
+ break;
+ case 2:
+ if (Read) {
+ *(UINT16 *)Buffer = MmioRead16 ((UINTN)Address);
+ } else {
+ MmioWrite16 ((UINTN)Address, *(UINT16 *)Buffer);
+ }
+
+ break;
+ case 4:
+ if (Read) {
+ *(UINT32 *)Buffer = MmioRead32 ((UINTN)Address);
+ } else {
+ MmioWrite32 ((UINTN)Address, *(UINT32 *)Buffer);
+ }
+
+ break;
+ case 8:
+ if (Read) {
+ *(UINT64 *)Buffer = MmioRead64 ((UINTN)Address);
+ } else {
+ MmioWrite64 ((UINTN)Address, *(UINT64 *)Buffer);
+ }
+
+ break;
+ default:
+ ASSERT (FALSE);
+ break;
}
}
}
@@ -289,35 +311,35 @@ ShellMmAccess ( **/
BOOLEAN
ShellMmLocateIoProtocol (
- IN SHELL_MM_ACCESS_TYPE AccessType,
- IN UINT64 Address,
- OUT EFI_CPU_IO2_PROTOCOL **CpuIo,
- OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **PciRootBridgeIo
+ IN SHELL_MM_ACCESS_TYPE AccessType,
+ IN UINT64 Address,
+ OUT EFI_CPU_IO2_PROTOCOL **CpuIo,
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **PciRootBridgeIo
)
{
- EFI_STATUS Status;
- UINTN Index;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Io;
- UINT32 Segment;
- UINT8 Bus;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
-
- Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **) CpuIo);
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Io;
+ UINT32 Segment;
+ UINT8 Bus;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
+
+ Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **)CpuIo);
if (EFI_ERROR (Status)) {
*CpuIo = NULL;
}
*PciRootBridgeIo = NULL;
HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiPciRootBridgeIoProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (EFI_ERROR (Status) || (HandleCount == 0) || (HandleBuffer == NULL)) {
return FALSE;
}
@@ -325,7 +347,7 @@ ShellMmLocateIoProtocol ( Segment = 0;
Bus = 0;
if ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) {
- ShellMmDecodePciAddress ((BOOLEAN) (AccessType == ShellMmPci), Address, &Segment, &Bus, NULL, NULL, NULL);
+ ShellMmDecodePciAddress ((BOOLEAN)(AccessType == ShellMmPci), Address, &Segment, &Bus, NULL, NULL, NULL);
}
//
@@ -335,7 +357,7 @@ ShellMmLocateIoProtocol ( Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiPciRootBridgeIoProtocolGuid,
- (VOID *) &Io
+ (VOID *)&Io
);
if (EFI_ERROR (Status)) {
continue;
@@ -343,8 +365,9 @@ ShellMmLocateIoProtocol ( if ((((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) && (Io->SegmentNumber == Segment)) ||
((AccessType == ShellMmIo) || (AccessType == ShellMmMemoryMappedIo))
- ) {
- Status = Io->Configuration (Io, (VOID **) &Descriptors);
+ )
+ {
+ Status = Io->Configuration (Io, (VOID **)&Descriptors);
if (!EFI_ERROR (Status)) {
while (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR) {
//
@@ -353,25 +376,29 @@ ShellMmLocateIoProtocol ( if ((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) &&
((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) &&
((Bus >= Descriptors->AddrRangeMin) && (Bus <= Descriptors->AddrRangeMax))
- ) {
+ )
+ {
*PciRootBridgeIo = Io;
break;
- //
- // Compare the address range for MMIO/IO access
- //
+ //
+ // Compare the address range for MMIO/IO access
+ //
} else if ((((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_IO) && (AccessType == ShellMmIo)) ||
((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) && (AccessType == ShellMmMemoryMappedIo))
) && ((Address >= Descriptors->AddrRangeMin) && (Address <= Descriptors->AddrRangeMax))
- ) {
+ )
+ {
*PciRootBridgeIo = Io;
break;
}
+
Descriptors++;
}
}
}
}
+
if (HandleBuffer != NULL) {
FreePool (HandleBuffer);
}
@@ -392,37 +419,37 @@ ShellCommandRunMm ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- EFI_CPU_IO2_PROTOCOL *CpuIo;
- UINT64 Address;
- UINT64 Value;
- SHELL_MM_ACCESS_TYPE AccessType;
- UINT64 Buffer;
- UINTN Index;
- UINTN Size;
- BOOLEAN Complete;
- CHAR16 *InputStr;
- BOOLEAN Interactive;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Temp;
- BOOLEAN HasPciRootBridgeIo;
-
- Value = 0;
- Address = 0;
+ EFI_STATUS Status;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ EFI_CPU_IO2_PROTOCOL *CpuIo;
+ UINT64 Address;
+ UINT64 Value;
+ SHELL_MM_ACCESS_TYPE AccessType;
+ UINT64 Buffer;
+ UINTN Index;
+ UINTN Size;
+ BOOLEAN Complete;
+ CHAR16 *InputStr;
+ BOOLEAN Interactive;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Temp;
+ BOOLEAN HasPciRootBridgeIo;
+
+ Value = 0;
+ Address = 0;
ShellStatus = SHELL_SUCCESS;
- InputStr = NULL;
- Size = 1;
- AccessType = ShellMmMemory;
+ InputStr = NULL;
+ Size = 1;
+ AccessType = ShellMmMemory;
//
// Parse arguments
//
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, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mm", ProblemParam);
FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -439,37 +466,40 @@ ShellCommandRunMm ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
- } else if (ShellCommandLineGetFlag (Package, L"-w") && ShellCommandLineGetValue (Package, L"-w") == NULL) {
+ } else if (ShellCommandLineGetFlag (Package, L"-w") && (ShellCommandLineGetValue (Package, L"-w") == NULL)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"mm", L"-w");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
} else {
if (ShellCommandLineGetFlag (Package, L"-mmio")) {
AccessType = ShellMmMemoryMappedIo;
- if (ShellCommandLineGetFlag (Package, L"-mem")
- || ShellCommandLineGetFlag (Package, L"-io")
- || ShellCommandLineGetFlag (Package, L"-pci")
- || ShellCommandLineGetFlag (Package, L"-pcie")
- ) {
+ if ( ShellCommandLineGetFlag (Package, L"-mem")
+ || ShellCommandLineGetFlag (Package, L"-io")
+ || ShellCommandLineGetFlag (Package, L"-pci")
+ || ShellCommandLineGetFlag (Package, L"-pcie")
+ )
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
} else if (ShellCommandLineGetFlag (Package, L"-mem")) {
AccessType = ShellMmMemory;
- if (ShellCommandLineGetFlag (Package, L"-io")
- || ShellCommandLineGetFlag (Package, L"-pci")
- || ShellCommandLineGetFlag (Package, L"-pcie")
- ) {
+ if ( ShellCommandLineGetFlag (Package, L"-io")
+ || ShellCommandLineGetFlag (Package, L"-pci")
+ || ShellCommandLineGetFlag (Package, L"-pcie")
+ )
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
} else if (ShellCommandLineGetFlag (Package, L"-io")) {
AccessType = ShellMmIo;
- if (ShellCommandLineGetFlag (Package, L"-pci")
- || ShellCommandLineGetFlag (Package, L"-pcie")
- ) {
+ if ( ShellCommandLineGetFlag (Package, L"-pci")
+ || ShellCommandLineGetFlag (Package, L"-pcie")
+ )
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
@@ -477,7 +507,8 @@ ShellCommandRunMm ( } else if (ShellCommandLineGetFlag (Package, L"-pci")) {
AccessType = ShellMmPci;
if (ShellCommandLineGetFlag (Package, L"-pcie")
- ) {
+ )
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
@@ -499,13 +530,14 @@ ShellCommandRunMm ( if (Temp != NULL) {
Size = ShellStrToUintn (Temp);
}
+
if ((Size != 1) && (Size != 2) && (Size != 4) && (Size != 8)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"mm", Temp, L"-w");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- Temp = ShellCommandLineGetRawValue (Package, 1);
+ Temp = ShellCommandLineGetRawValue (Package, 1);
Status = ShellConvertStringToUint64 (Temp, &Address, TRUE, FALSE);
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mm", Temp);
@@ -529,6 +561,7 @@ ShellCommandRunMm ( ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
+
if (PciRootBridgeIo == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE_ADDRESS_RANGE), gShellDebug1HiiHandle, L"mm", Address);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -565,11 +598,13 @@ ShellCommandRunMm ( if (!gEfiShellProtocol->BatchIsActive ()) {
ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType], gShellDebug1HiiHandle);
}
+
ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address, Size, &Buffer);
if (!gEfiShellProtocol->BatchIsActive ()) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);
}
+
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_BUF), gShellDebug1HiiHandle, Size * 2, Buffer & mShellMmMaxNumber[Size]);
ShellPrintEx (-1, -1, L"\r\n");
goto Done;
@@ -592,20 +627,23 @@ ShellCommandRunMm ( FreePool (InputStr);
InputStr = NULL;
}
- ShellPromptForResponse (ShellPromptResponseTypeFreeform, NULL, (VOID**) &InputStr);
+
+ ShellPromptForResponse (ShellPromptResponseTypeFreeform, NULL, (VOID **)&InputStr);
if (InputStr != NULL) {
//
// skip space characters
//
- for (Index = 0; InputStr[Index] == ' '; Index++);
+ for (Index = 0; InputStr[Index] == ' '; Index++) {
+ }
if (InputStr[Index] != CHAR_NULL) {
if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || (InputStr[Index] == 'Q')) {
Complete = TRUE;
} else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, &Buffer, TRUE, TRUE)) &&
(Buffer <= mShellMmMaxNumber[Size])
- ) {
+ )
+ {
ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Buffer);
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), gShellDebug1HiiHandle, L"mm");
@@ -618,14 +656,17 @@ ShellCommandRunMm ( ShellPrintEx (-1, -1, L"\r\n");
} while (!Complete);
}
+
ASSERT (ShellStatus == SHELL_SUCCESS);
Done:
if (InputStr != NULL) {
FreePool (InputStr);
}
+
if (Package != NULL) {
ShellCommandLineFreeVarList (Package);
}
+
return ShellStatus;
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c index 68e775d78d..d907ddd415 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c @@ -22,99 +22,104 @@ ShellCommandRunMode ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINTN NewCol;
- UINTN NewRow;
- UINTN Col;
- UINTN Row;
- CONST CHAR16 *Temp;
- BOOLEAN Done;
- INT32 LoopVar;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINTN NewCol;
+ UINTN NewRow;
+ UINTN Col;
+ UINTN Row;
+ CONST CHAR16 *Temp;
+ BOOLEAN Done;
+ INT32 LoopVar;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
//
// 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"mode", 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"mode", 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"mode");
+ if (ShellCommandLineGetCount (Package) > 3) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mode");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) == 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"mode");
+ } else if (ShellCommandLineGetCount (Package) == 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"mode");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) == 3) {
- Temp = ShellCommandLineGetRawValue(Package, 1);
- if (!ShellIsHexOrDecimalNumber(Temp, FALSE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
+ } else if (ShellCommandLineGetCount (Package) == 3) {
+ Temp = ShellCommandLineGetRawValue (Package, 1);
+ if (!ShellIsHexOrDecimalNumber (Temp, FALSE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- NewCol = ShellStrToUintn(Temp);
- Temp = ShellCommandLineGetRawValue(Package, 2);
- if (!ShellIsHexOrDecimalNumber(Temp, FALSE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
+
+ NewCol = ShellStrToUintn (Temp);
+ Temp = ShellCommandLineGetRawValue (Package, 2);
+ if (!ShellIsHexOrDecimalNumber (Temp, FALSE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- NewRow = ShellStrToUintn(Temp);
- for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS ; LoopVar++) {
- Status = gST->ConOut->QueryMode(gST->ConOut, LoopVar, &Col, &Row);
- if (EFI_ERROR(Status)) {
+ NewRow = ShellStrToUintn (Temp);
+
+ for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS; LoopVar++) {
+ Status = gST->ConOut->QueryMode (gST->ConOut, LoopVar, &Col, &Row);
+ if (EFI_ERROR (Status)) {
continue;
}
- if (Col == NewCol && Row == NewRow) {
- Status = gST->ConOut->SetMode(gST->ConOut, LoopVar);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_SET_FAIL), gShellDebug1HiiHandle, L"mode");
+
+ if ((Col == NewCol) && (Row == NewRow)) {
+ Status = gST->ConOut->SetMode (gST->ConOut, LoopVar);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_SET_FAIL), gShellDebug1HiiHandle, L"mode");
ShellStatus = SHELL_DEVICE_ERROR;
} else {
// worked fine...
Done = TRUE;
}
+
break;
}
}
if (!Done) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_NO_MATCH), gShellDebug1HiiHandle, L"mode");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_NO_MATCH), gShellDebug1HiiHandle, L"mode");
ShellStatus = SHELL_INVALID_PARAMETER;
}
-
- } else if (ShellCommandLineGetCount(Package) == 1) {
+ } else if (ShellCommandLineGetCount (Package) == 1) {
//
// print out valid
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_HEAD), gShellDebug1HiiHandle);
- for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS ; LoopVar++) {
- Status = gST->ConOut->QueryMode(gST->ConOut, LoopVar, &Col, &Row);
- if (EFI_ERROR(Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_HEAD), gShellDebug1HiiHandle);
+ for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS; LoopVar++) {
+ Status = gST->ConOut->QueryMode (gST->ConOut, LoopVar, &Col, &Row);
+ if (EFI_ERROR (Status)) {
continue;
}
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_ITEM), gShellDebug1HiiHandle, Col, Row, LoopVar == gST->ConOut->Mode->Mode?L'*':L' ');
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_ITEM), gShellDebug1HiiHandle, Col, Row, LoopVar == gST->ConOut->Mode->Mode ? L'*' : L' ');
}
}
+
ShellCommandLineFreeVarList (Package);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c index 1e5dc75e27..7b11f49d0d 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c @@ -19,9 +19,9 @@ // Printable strings for Pci class code
//
typedef struct {
- CHAR16 *BaseClass; // Pointer to the PCI base class string
- CHAR16 *SubClass; // Pointer to the PCI sub class string
- CHAR16 *PIFClass; // Pointer to the PCI programming interface string
+ CHAR16 *BaseClass; // Pointer to the PCI base class string
+ CHAR16 *SubClass; // Pointer to the PCI sub class string
+ CHAR16 *PIFClass; // Pointer to the PCI programming interface string
} PCI_CLASS_STRINGS;
//
@@ -29,65 +29,65 @@ typedef struct { // class
//
typedef struct PCI_CLASS_ENTRY_TAG {
- UINT8 Code; // Class, subclass or I/F code
- CHAR16 *DescText; // Description string
- struct PCI_CLASS_ENTRY_TAG *LowerLevelClass; // Subclass or I/F if any
+ UINT8 Code; // Class, subclass or I/F code
+ CHAR16 *DescText; // Description string
+ struct PCI_CLASS_ENTRY_TAG *LowerLevelClass; // Subclass or I/F if any
} PCI_CLASS_ENTRY;
//
// Declarations of entries which contain printable strings for class codes
// in PCI configuration space
//
-PCI_CLASS_ENTRY PCIBlankEntry[];
-PCI_CLASS_ENTRY PCISubClass_00[];
-PCI_CLASS_ENTRY PCISubClass_01[];
-PCI_CLASS_ENTRY PCISubClass_02[];
-PCI_CLASS_ENTRY PCISubClass_03[];
-PCI_CLASS_ENTRY PCISubClass_04[];
-PCI_CLASS_ENTRY PCISubClass_05[];
-PCI_CLASS_ENTRY PCISubClass_06[];
-PCI_CLASS_ENTRY PCISubClass_07[];
-PCI_CLASS_ENTRY PCISubClass_08[];
-PCI_CLASS_ENTRY PCISubClass_09[];
-PCI_CLASS_ENTRY PCISubClass_0a[];
-PCI_CLASS_ENTRY PCISubClass_0b[];
-PCI_CLASS_ENTRY PCISubClass_0c[];
-PCI_CLASS_ENTRY PCISubClass_0d[];
-PCI_CLASS_ENTRY PCISubClass_0e[];
-PCI_CLASS_ENTRY PCISubClass_0f[];
-PCI_CLASS_ENTRY PCISubClass_10[];
-PCI_CLASS_ENTRY PCISubClass_11[];
-PCI_CLASS_ENTRY PCISubClass_12[];
-PCI_CLASS_ENTRY PCISubClass_13[];
-PCI_CLASS_ENTRY PCIPIFClass_0100[];
-PCI_CLASS_ENTRY PCIPIFClass_0101[];
-PCI_CLASS_ENTRY PCIPIFClass_0105[];
-PCI_CLASS_ENTRY PCIPIFClass_0106[];
-PCI_CLASS_ENTRY PCIPIFClass_0107[];
-PCI_CLASS_ENTRY PCIPIFClass_0108[];
-PCI_CLASS_ENTRY PCIPIFClass_0109[];
-PCI_CLASS_ENTRY PCIPIFClass_0300[];
-PCI_CLASS_ENTRY PCIPIFClass_0604[];
-PCI_CLASS_ENTRY PCIPIFClass_0609[];
-PCI_CLASS_ENTRY PCIPIFClass_060b[];
-PCI_CLASS_ENTRY PCIPIFClass_0700[];
-PCI_CLASS_ENTRY PCIPIFClass_0701[];
-PCI_CLASS_ENTRY PCIPIFClass_0703[];
-PCI_CLASS_ENTRY PCIPIFClass_0800[];
-PCI_CLASS_ENTRY PCIPIFClass_0801[];
-PCI_CLASS_ENTRY PCIPIFClass_0802[];
-PCI_CLASS_ENTRY PCIPIFClass_0803[];
-PCI_CLASS_ENTRY PCIPIFClass_0904[];
-PCI_CLASS_ENTRY PCIPIFClass_0c00[];
-PCI_CLASS_ENTRY PCIPIFClass_0c03[];
-PCI_CLASS_ENTRY PCIPIFClass_0c07[];
-PCI_CLASS_ENTRY PCIPIFClass_0d01[];
-PCI_CLASS_ENTRY PCIPIFClass_0e00[];
+PCI_CLASS_ENTRY PCIBlankEntry[];
+PCI_CLASS_ENTRY PCISubClass_00[];
+PCI_CLASS_ENTRY PCISubClass_01[];
+PCI_CLASS_ENTRY PCISubClass_02[];
+PCI_CLASS_ENTRY PCISubClass_03[];
+PCI_CLASS_ENTRY PCISubClass_04[];
+PCI_CLASS_ENTRY PCISubClass_05[];
+PCI_CLASS_ENTRY PCISubClass_06[];
+PCI_CLASS_ENTRY PCISubClass_07[];
+PCI_CLASS_ENTRY PCISubClass_08[];
+PCI_CLASS_ENTRY PCISubClass_09[];
+PCI_CLASS_ENTRY PCISubClass_0a[];
+PCI_CLASS_ENTRY PCISubClass_0b[];
+PCI_CLASS_ENTRY PCISubClass_0c[];
+PCI_CLASS_ENTRY PCISubClass_0d[];
+PCI_CLASS_ENTRY PCISubClass_0e[];
+PCI_CLASS_ENTRY PCISubClass_0f[];
+PCI_CLASS_ENTRY PCISubClass_10[];
+PCI_CLASS_ENTRY PCISubClass_11[];
+PCI_CLASS_ENTRY PCISubClass_12[];
+PCI_CLASS_ENTRY PCISubClass_13[];
+PCI_CLASS_ENTRY PCIPIFClass_0100[];
+PCI_CLASS_ENTRY PCIPIFClass_0101[];
+PCI_CLASS_ENTRY PCIPIFClass_0105[];
+PCI_CLASS_ENTRY PCIPIFClass_0106[];
+PCI_CLASS_ENTRY PCIPIFClass_0107[];
+PCI_CLASS_ENTRY PCIPIFClass_0108[];
+PCI_CLASS_ENTRY PCIPIFClass_0109[];
+PCI_CLASS_ENTRY PCIPIFClass_0300[];
+PCI_CLASS_ENTRY PCIPIFClass_0604[];
+PCI_CLASS_ENTRY PCIPIFClass_0609[];
+PCI_CLASS_ENTRY PCIPIFClass_060b[];
+PCI_CLASS_ENTRY PCIPIFClass_0700[];
+PCI_CLASS_ENTRY PCIPIFClass_0701[];
+PCI_CLASS_ENTRY PCIPIFClass_0703[];
+PCI_CLASS_ENTRY PCIPIFClass_0800[];
+PCI_CLASS_ENTRY PCIPIFClass_0801[];
+PCI_CLASS_ENTRY PCIPIFClass_0802[];
+PCI_CLASS_ENTRY PCIPIFClass_0803[];
+PCI_CLASS_ENTRY PCIPIFClass_0904[];
+PCI_CLASS_ENTRY PCIPIFClass_0c00[];
+PCI_CLASS_ENTRY PCIPIFClass_0c03[];
+PCI_CLASS_ENTRY PCIPIFClass_0c07[];
+PCI_CLASS_ENTRY PCIPIFClass_0d01[];
+PCI_CLASS_ENTRY PCIPIFClass_0e00[];
//
// Base class strings entries
//
-PCI_CLASS_ENTRY gClassStringList[] = {
+PCI_CLASS_ENTRY gClassStringList[] = {
{
0x00,
L"Pre 2.0 device",
@@ -196,14 +196,14 @@ PCI_CLASS_ENTRY gClassStringList[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
//
// Subclass strings entries
//
-PCI_CLASS_ENTRY PCIBlankEntry[] = {
+PCI_CLASS_ENTRY PCIBlankEntry[] = {
{
0x00,
L"",
@@ -212,11 +212,11 @@ PCI_CLASS_ENTRY PCIBlankEntry[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_00[] = {
+PCI_CLASS_ENTRY PCISubClass_00[] = {
{
0x00,
L"All devices other than VGA",
@@ -230,11 +230,11 @@ PCI_CLASS_ENTRY PCISubClass_00[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_01[] = {
+PCI_CLASS_ENTRY PCISubClass_01[] = {
{
0x00,
L"SCSI",
@@ -293,11 +293,11 @@ PCI_CLASS_ENTRY PCISubClass_01[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_02[] = {
+PCI_CLASS_ENTRY PCISubClass_02[] = {
{
0x00,
L"Ethernet controller",
@@ -346,11 +346,11 @@ PCI_CLASS_ENTRY PCISubClass_02[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_03[] = {
+PCI_CLASS_ENTRY PCISubClass_03[] = {
{
0x00,
L"VGA/8514 controller",
@@ -374,11 +374,11 @@ PCI_CLASS_ENTRY PCISubClass_03[] = { {
0x00,
NULL,
- /* null string ends the list */PCIBlankEntry
+ /* null string ends the list */ PCIBlankEntry
}
};
-PCI_CLASS_ENTRY PCISubClass_04[] = {
+PCI_CLASS_ENTRY PCISubClass_04[] = {
{
0x00,
L"Video device",
@@ -407,11 +407,11 @@ PCI_CLASS_ENTRY PCISubClass_04[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_05[] = {
+PCI_CLASS_ENTRY PCISubClass_05[] = {
{
0x00,
L"RAM memory controller",
@@ -430,11 +430,11 @@ PCI_CLASS_ENTRY PCISubClass_05[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_06[] = {
+PCI_CLASS_ENTRY PCISubClass_06[] = {
{
0x00,
L"Host/PCI bridge",
@@ -503,11 +503,11 @@ PCI_CLASS_ENTRY PCISubClass_06[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_07[] = {
+PCI_CLASS_ENTRY PCISubClass_07[] = {
{
0x00,
L"Serial controller",
@@ -546,11 +546,11 @@ PCI_CLASS_ENTRY PCISubClass_07[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_08[] = {
+PCI_CLASS_ENTRY PCISubClass_08[] = {
{
0x00,
L"PIC",
@@ -599,11 +599,11 @@ PCI_CLASS_ENTRY PCISubClass_08[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_09[] = {
+PCI_CLASS_ENTRY PCISubClass_09[] = {
{
0x00,
L"Keyboard controller",
@@ -637,11 +637,11 @@ PCI_CLASS_ENTRY PCISubClass_09[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_0a[] = {
+PCI_CLASS_ENTRY PCISubClass_0a[] = {
{
0x00,
L"Generic docking station",
@@ -655,11 +655,11 @@ PCI_CLASS_ENTRY PCISubClass_0a[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_0b[] = {
+PCI_CLASS_ENTRY PCISubClass_0b[] = {
{
0x00,
L"386",
@@ -703,11 +703,11 @@ PCI_CLASS_ENTRY PCISubClass_0b[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_0c[] = {
+PCI_CLASS_ENTRY PCISubClass_0c[] = {
{
0x00,
L"IEEE 1394",
@@ -766,11 +766,11 @@ PCI_CLASS_ENTRY PCISubClass_0c[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_0d[] = {
+PCI_CLASS_ENTRY PCISubClass_0d[] = {
{
0x00,
L"iRDA compatible controller",
@@ -814,11 +814,11 @@ PCI_CLASS_ENTRY PCISubClass_0d[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_0e[] = {
+PCI_CLASS_ENTRY PCISubClass_0e[] = {
{
0x00,
L"I2O Architecture",
@@ -827,11 +827,11 @@ PCI_CLASS_ENTRY PCISubClass_0e[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_0f[] = {
+PCI_CLASS_ENTRY PCISubClass_0f[] = {
{
0x01,
L"TV",
@@ -860,11 +860,11 @@ PCI_CLASS_ENTRY PCISubClass_0f[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_10[] = {
+PCI_CLASS_ENTRY PCISubClass_10[] = {
{
0x00,
L"Network & computing Encrypt/Decrypt",
@@ -883,11 +883,11 @@ PCI_CLASS_ENTRY PCISubClass_10[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_11[] = {
+PCI_CLASS_ENTRY PCISubClass_11[] = {
{
0x00,
L"DPIO modules",
@@ -916,11 +916,11 @@ PCI_CLASS_ENTRY PCISubClass_11[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_12[] = {
+PCI_CLASS_ENTRY PCISubClass_12[] = {
{
0x00,
L"Processing Accelerator",
@@ -929,11 +929,11 @@ PCI_CLASS_ENTRY PCISubClass_12[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCISubClass_13[] = {
+PCI_CLASS_ENTRY PCISubClass_13[] = {
{
0x00,
L"Non-Essential Instrumentation Function",
@@ -942,14 +942,14 @@ PCI_CLASS_ENTRY PCISubClass_13[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
//
// Programming Interface entries
//
-PCI_CLASS_ENTRY PCIPIFClass_0100[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0100[] = {
{
0x00,
L"SCSI controller",
@@ -978,11 +978,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0100[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0101[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0101[] = {
{
0x00,
L"",
@@ -1146,11 +1146,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0101[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0105[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0105[] = {
{
0x20,
L"Single stepping",
@@ -1164,11 +1164,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0105[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0106[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0106[] = {
{
0x00,
L"",
@@ -1187,11 +1187,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0106[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0107[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0107[] = {
{
0x00,
L"",
@@ -1205,11 +1205,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0107[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0108[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0108[] = {
{
0x00,
L"",
@@ -1228,11 +1228,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0108[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0109[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0109[] = {
{
0x00,
L"",
@@ -1246,11 +1246,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0109[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0300[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0300[] = {
{
0x00,
L"VGA compatible",
@@ -1264,11 +1264,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0300[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0604[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0604[] = {
{
0x00,
L"",
@@ -1282,11 +1282,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0604[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0609[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0609[] = {
{
0x40,
L"Primary PCI bus side facing the system host processor",
@@ -1300,11 +1300,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0609[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_060b[] = {
+PCI_CLASS_ENTRY PCIPIFClass_060b[] = {
{
0x00,
L"Custom",
@@ -1318,11 +1318,11 @@ PCI_CLASS_ENTRY PCIPIFClass_060b[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0700[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0700[] = {
{
0x00,
L"Generic XT-compatible",
@@ -1361,11 +1361,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0700[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0701[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0701[] = {
{
0x00,
L"",
@@ -1394,11 +1394,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0701[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0703[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0703[] = {
{
0x00,
L"Generic",
@@ -1427,11 +1427,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0703[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0800[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0800[] = {
{
0x00,
L"Generic 8259",
@@ -1460,11 +1460,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0800[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0801[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0801[] = {
{
0x00,
L"Generic 8237",
@@ -1483,11 +1483,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0801[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0802[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0802[] = {
{
0x00,
L"Generic 8254",
@@ -1506,11 +1506,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0802[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0803[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0803[] = {
{
0x00,
L"Generic",
@@ -1529,11 +1529,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0803[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0904[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0904[] = {
{
0x00,
L"Generic",
@@ -1547,11 +1547,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0904[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0c00[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0c00[] = {
{
0x00,
L"",
@@ -1565,11 +1565,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0c00[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0c03[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0c03[] = {
{
0x00,
L"UHCI",
@@ -1603,11 +1603,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0c03[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0c07[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0c07[] = {
{
0x00,
L"SMIC",
@@ -1626,11 +1626,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0c07[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0d01[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0d01[] = {
{
0x00,
L"Consumer IR controller",
@@ -1644,11 +1644,11 @@ PCI_CLASS_ENTRY PCIPIFClass_0d01[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-PCI_CLASS_ENTRY PCIPIFClass_0e00[] = {
+PCI_CLASS_ENTRY PCIPIFClass_0e00[] = {
{
0x00,
L"Message FIFO at offset 40h",
@@ -1662,11 +1662,10 @@ PCI_CLASS_ENTRY PCIPIFClass_0e00[] = { {
0x00,
NULL,
- /* null string ends the list */NULL
+ /* null string ends the list */ NULL
}
};
-
/**
Generates printable Unicode strings that represent PCI device class,
subclass and programmed I/F based on a value passed to the function.
@@ -1683,13 +1682,13 @@ PCI_CLASS_ENTRY PCIPIFClass_0e00[] = { **/
VOID
PciGetClassStrings (
- IN UINT32 ClassCode,
- IN OUT PCI_CLASS_STRINGS *ClassStrings
+ IN UINT32 ClassCode,
+ IN OUT PCI_CLASS_STRINGS *ClassStrings
)
{
- INTN Index;
- UINT8 Code;
- PCI_CLASS_ENTRY *CurrentClass;
+ INTN Index;
+ UINT8 Code;
+ PCI_CLASS_ENTRY *CurrentClass;
//
// Assume no strings found
@@ -1699,8 +1698,8 @@ PciGetClassStrings ( ClassStrings->PIFClass = L"UNDEFINED";
CurrentClass = gClassStringList;
- Code = (UINT8) (ClassCode >> 16);
- Index = 0;
+ Code = (UINT8)(ClassCode >> 16);
+ Index = 0;
//
// Go through all entries of the base class, until the entry with a matching
@@ -1710,11 +1709,12 @@ PciGetClassStrings ( //
while (Code != CurrentClass[Index].Code) {
if (NULL == CurrentClass[Index].DescText) {
- return ;
+ return;
}
Index++;
}
+
//
// A base class was found. Assign description, and check if this class has
// sub-class defined. If sub-class defined, no more action is needed,
@@ -1722,14 +1722,15 @@ PciGetClassStrings ( //
ClassStrings->BaseClass = CurrentClass[Index].DescText;
if (NULL == CurrentClass[Index].LowerLevelClass) {
- return ;
+ return;
}
+
//
// find Subclass entry
//
- CurrentClass = CurrentClass[Index].LowerLevelClass;
- Code = (UINT8) (ClassCode >> 8);
- Index = 0;
+ CurrentClass = CurrentClass[Index].LowerLevelClass;
+ Code = (UINT8)(ClassCode >> 8);
+ Index = 0;
//
// Go through all entries of the sub-class, until the entry with a matching
@@ -1739,11 +1740,12 @@ PciGetClassStrings ( //
while (Code != CurrentClass[Index].Code) {
if (NULL == CurrentClass[Index].DescText) {
- return ;
+ return;
}
Index++;
}
+
//
// A class was found for the sub-class code. Assign description, and check if
// this sub-class has programming interface defined. If no, no more action is
@@ -1752,14 +1754,15 @@ PciGetClassStrings ( //
ClassStrings->SubClass = CurrentClass[Index].DescText;
if (NULL == CurrentClass[Index].LowerLevelClass) {
- return ;
+ return;
}
+
//
// Find programming interface entry
//
- CurrentClass = CurrentClass[Index].LowerLevelClass;
- Code = (UINT8) ClassCode;
- Index = 0;
+ CurrentClass = CurrentClass[Index].LowerLevelClass;
+ Code = (UINT8)ClassCode;
+ Index = 0;
//
// Go through all entries of the I/F entries, until the entry with a
@@ -1769,16 +1772,17 @@ PciGetClassStrings ( //
while (Code != CurrentClass[Index].Code) {
if (NULL == CurrentClass[Index].DescText) {
- return ;
+ return;
}
Index++;
}
+
//
// A class was found for the I/F code. Assign description, done!
//
ClassStrings->PIFClass = CurrentClass[Index].DescText;
- return ;
+ return;
}
/**
@@ -1790,14 +1794,14 @@ PciGetClassStrings ( **/
VOID
PciPrintClassCode (
- IN UINT8 *ClassCodePtr,
- IN BOOLEAN IncludePIF
+ IN UINT8 *ClassCodePtr,
+ IN BOOLEAN IncludePIF
)
{
- UINT32 ClassCode;
- PCI_CLASS_STRINGS ClassStrings;
+ UINT32 ClassCode;
+ PCI_CLASS_STRINGS ClassStrings;
- ClassCode = 0;
+ ClassCode = 0;
ClassCode |= (UINT32)ClassCodePtr[0];
ClassCode |= (UINT32)(ClassCodePtr[1] << 8);
ClassCode |= (UINT32)(ClassCodePtr[2] << 16);
@@ -1811,20 +1815,25 @@ PciPrintClassCode ( //
// Print base class, sub class, and programming inferface name
//
- ShellPrintEx (-1, -1, L"%s - %s - %s",
+ ShellPrintEx (
+ -1,
+ -1,
+ L"%s - %s - %s",
ClassStrings.BaseClass,
ClassStrings.SubClass,
ClassStrings.PIFClass
- );
-
+ );
} else {
//
// Only print base class and sub class name
//
- ShellPrintEx (-1, -1, L"%s - %s",
+ ShellPrintEx (
+ -1,
+ -1,
+ L"%s - %s",
ClassStrings.BaseClass,
ClassStrings.SubClass
- );
+ );
}
}
@@ -1846,11 +1855,11 @@ PciPrintClassCode ( **/
EFI_STATUS
PciFindProtocolInterface (
- IN EFI_HANDLE *HandleBuf,
- IN UINTN HandleCount,
- IN UINT16 Segment,
- IN UINT16 Bus,
- OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev
+ IN EFI_HANDLE *HandleBuf,
+ IN UINTN HandleCount,
+ IN UINT16 Segment,
+ IN UINT16 Bus,
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev
);
/**
@@ -1865,9 +1874,9 @@ PciFindProtocolInterface ( **/
EFI_STATUS
PciGetProtocolAndResource (
- IN EFI_HANDLE Handle,
- OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,
- OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors
+ IN EFI_HANDLE Handle,
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,
+ OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors
);
/**
@@ -1902,9 +1911,9 @@ PciGetNextBusRange ( **/
VOID
PciExplainPci (
- IN PCI_CONFIG_SPACE *ConfigSpace,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
+ IN PCI_CONFIG_SPACE *ConfigSpace,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
);
/**
@@ -1918,9 +1927,9 @@ PciExplainPci ( **/
EFI_STATUS
PciExplainDeviceData (
- IN PCI_DEVICE_HEADER_TYPE_REGION *Device,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
+ IN PCI_DEVICE_HEADER_TYPE_REGION *Device,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
);
/**
@@ -1934,9 +1943,9 @@ PciExplainDeviceData ( **/
EFI_STATUS
PciExplainBridgeData (
- IN PCI_BRIDGE_CONTROL_REGISTER *Bridge,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
+ IN PCI_BRIDGE_CONTROL_REGISTER *Bridge,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
);
/**
@@ -1952,11 +1961,11 @@ PciExplainBridgeData ( **/
EFI_STATUS
PciExplainBar (
- IN UINT32 *Bar,
- IN UINT16 *Command,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,
- IN OUT UINTN *Index
+ IN UINT32 *Bar,
+ IN UINT16 *Command,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,
+ IN OUT UINTN *Index
);
/**
@@ -1970,9 +1979,9 @@ PciExplainBar ( **/
EFI_STATUS
PciExplainCardBusData (
- IN PCI_CARDBUS_CONTROL_REGISTER *CardBus,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
+ IN PCI_CARDBUS_CONTROL_REGISTER *CardBus,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
);
/**
@@ -1988,9 +1997,9 @@ PciExplainCardBusData ( **/
EFI_STATUS
PciExplainStatus (
- IN UINT16 *Status,
- IN BOOLEAN MainStatus,
- IN PCI_HEADER_TYPE HeaderType
+ IN UINT16 *Status,
+ IN BOOLEAN MainStatus,
+ IN PCI_HEADER_TYPE HeaderType
);
/**
@@ -2002,7 +2011,7 @@ PciExplainStatus ( **/
EFI_STATUS
PciExplainCommand (
- IN UINT16 *Command
+ IN UINT16 *Command
);
/**
@@ -2015,8 +2024,8 @@ PciExplainCommand ( **/
EFI_STATUS
PciExplainBridgeControl (
- IN UINT16 *BridgeControl,
- IN PCI_HEADER_TYPE HeaderType
+ IN UINT16 *BridgeControl,
+ IN PCI_HEADER_TYPE HeaderType
);
/**
@@ -2029,8 +2038,8 @@ PciExplainBridgeControl ( **/
UINT8
LocatePciCapability (
- IN PCI_CONFIG_SPACE *ConfigSpace,
- IN UINT8 CapabilityId
+ IN PCI_CONFIG_SPACE *ConfigSpace,
+ IN UINT8 CapabilityId
);
/**
@@ -2043,10 +2052,10 @@ LocatePciCapability ( **/
VOID
PciExplainPciExpress (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap,
- IN UINT8 *ExtendedConfigSpace,
- IN UINTN ExtendedConfigSize,
- IN CONST UINT16 ExtendedCapability
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap,
+ IN UINT8 *ExtendedConfigSpace,
+ IN UINTN ExtendedConfigSize,
+ IN CONST UINT16 ExtendedCapability
);
/**
@@ -2058,7 +2067,7 @@ PciExplainPciExpress ( **/
EFI_STATUS
ExplainPcieCapReg (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2070,7 +2079,7 @@ ExplainPcieCapReg ( **/
EFI_STATUS
ExplainPcieDeviceCap (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2082,7 +2091,7 @@ ExplainPcieDeviceCap ( **/
EFI_STATUS
ExplainPcieDeviceControl (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2094,7 +2103,7 @@ ExplainPcieDeviceControl ( **/
EFI_STATUS
ExplainPcieDeviceStatus (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2106,7 +2115,7 @@ ExplainPcieDeviceStatus ( **/
EFI_STATUS
ExplainPcieLinkCap (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2118,7 +2127,7 @@ ExplainPcieLinkCap ( **/
EFI_STATUS
ExplainPcieLinkControl (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2130,7 +2139,7 @@ ExplainPcieLinkControl ( **/
EFI_STATUS
ExplainPcieLinkStatus (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2142,7 +2151,7 @@ ExplainPcieLinkStatus ( **/
EFI_STATUS
ExplainPcieSlotCap (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2154,7 +2163,7 @@ ExplainPcieSlotCap ( **/
EFI_STATUS
ExplainPcieSlotControl (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2166,7 +2175,7 @@ ExplainPcieSlotControl ( **/
EFI_STATUS
ExplainPcieSlotStatus (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2178,7 +2187,7 @@ ExplainPcieSlotStatus ( **/
EFI_STATUS
ExplainPcieRootControl (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2190,7 +2199,7 @@ ExplainPcieRootControl ( **/
EFI_STATUS
ExplainPcieRootCap (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
/**
@@ -2202,10 +2211,12 @@ ExplainPcieRootCap ( **/
EFI_STATUS
ExplainPcieRootStatus (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
);
-typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION) (IN PCI_CAPABILITY_PCIEXP *PciExpressCap);
+typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION) (
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ );
typedef enum {
FieldWidthUINT8,
@@ -2222,16 +2233,15 @@ typedef enum { PcieExplainTypeMax
} PCIE_EXPLAIN_TYPE;
-typedef struct
-{
- UINT16 Token;
- UINTN Offset;
- PCIE_CAPREG_FIELD_WIDTH Width;
- PCIE_EXPLAIN_FUNCTION Func;
- PCIE_EXPLAIN_TYPE Type;
+typedef struct {
+ UINT16 Token;
+ UINTN Offset;
+ PCIE_CAPREG_FIELD_WIDTH Width;
+ PCIE_EXPLAIN_FUNCTION Func;
+ PCIE_EXPLAIN_TYPE Type;
} PCIE_EXPLAIN_STRUCT;
-PCIE_EXPLAIN_STRUCT PcieExplainList[] = {
+PCIE_EXPLAIN_STRUCT PcieExplainList[] = {
{
STRING_TOKEN (STR_PCIEX_CAPABILITY_CAPID),
0x00,
@@ -2349,15 +2359,15 @@ PCIE_EXPLAIN_STRUCT PcieExplainList[] = { //
// Global Variables
//
-PCI_CONFIG_SPACE *mConfigSpace = NULL;
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-s", TypeValue},
- {L"-i", TypeFlag},
- {L"-ec", TypeValue},
- {NULL, TypeMax}
- };
-
-CHAR16 *DevicePortTypeTable[] = {
+PCI_CONFIG_SPACE *mConfigSpace = NULL;
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-s", TypeValue },
+ { L"-i", TypeFlag },
+ { L"-ec", TypeValue },
+ { NULL, TypeMax }
+};
+
+CHAR16 *DevicePortTypeTable[] = {
L"PCI Express Endpoint",
L"Legacy PCI Express Endpoint",
L"Unknown Type",
@@ -2371,7 +2381,7 @@ CHAR16 *DevicePortTypeTable[] = { L"Root Complex Event Collector"
};
-CHAR16 *L0sLatencyStrTable[] = {
+CHAR16 *L0sLatencyStrTable[] = {
L"Less than 64ns",
L"64ns to less than 128ns",
L"128ns to less than 256ns",
@@ -2382,7 +2392,7 @@ CHAR16 *L0sLatencyStrTable[] = { L"More than 4us"
};
-CHAR16 *L1LatencyStrTable[] = {
+CHAR16 *L1LatencyStrTable[] = {
L"Less than 1us",
L"1us to less than 2us",
L"2us to less than 4us",
@@ -2393,28 +2403,27 @@ CHAR16 *L1LatencyStrTable[] = { L"More than 64us"
};
-CHAR16 *ASPMCtrlStrTable[] = {
+CHAR16 *ASPMCtrlStrTable[] = {
L"Disabled",
L"L0s Entry Enabled",
L"L1 Entry Enabled",
L"L0s and L1 Entry Enabled"
};
-CHAR16 *SlotPwrLmtScaleTable[] = {
+CHAR16 *SlotPwrLmtScaleTable[] = {
L"1.0x",
L"0.1x",
L"0.01x",
L"0.001x"
};
-CHAR16 *IndicatorTable[] = {
+CHAR16 *IndicatorTable[] = {
L"Reserved",
L"On",
L"Blink",
L"Off"
};
-
/**
Function for 'pci' command.
@@ -2428,130 +2437,132 @@ ShellCommandRunPci ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- UINT16 Segment;
- UINT16 Bus;
- UINT16 Device;
- UINT16 Func;
- UINT64 Address;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev;
- EFI_STATUS Status;
- PCI_DEVICE_INDEPENDENT_REGION PciHeader;
- PCI_CONFIG_SPACE ConfigSpace;
- UINTN ScreenCount;
- UINTN TempColumn;
- UINTN ScreenSize;
- BOOLEAN ExplainData;
- UINTN Index;
- UINTN SizeOfHeader;
- BOOLEAN PrintTitle;
- UINTN HandleBufSize;
- EFI_HANDLE *HandleBuf;
- UINTN HandleCount;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
- UINT16 MinBus;
- UINT16 MaxBus;
- BOOLEAN IsEnd;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Temp;
- UINT64 RetVal;
- UINT16 ExtendedCapability;
- UINT8 PcieCapabilityPtr;
- UINT8 *ExtendedConfigSpace;
- UINTN ExtendedConfigSize;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- Address = 0;
- IoDev = NULL;
- HandleBuf = NULL;
- Package = NULL;
+ UINT16 Segment;
+ UINT16 Bus;
+ UINT16 Device;
+ UINT16 Func;
+ UINT64 Address;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev;
+ EFI_STATUS Status;
+ PCI_DEVICE_INDEPENDENT_REGION PciHeader;
+ PCI_CONFIG_SPACE ConfigSpace;
+ UINTN ScreenCount;
+ UINTN TempColumn;
+ UINTN ScreenSize;
+ BOOLEAN ExplainData;
+ UINTN Index;
+ UINTN SizeOfHeader;
+ BOOLEAN PrintTitle;
+ UINTN HandleBufSize;
+ EFI_HANDLE *HandleBuf;
+ UINTN HandleCount;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
+ UINT16 MinBus;
+ UINT16 MaxBus;
+ BOOLEAN IsEnd;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Temp;
+ UINT64 RetVal;
+ UINT16 ExtendedCapability;
+ UINT8 PcieCapabilityPtr;
+ UINT8 *ExtendedConfigSpace;
+ UINTN ExtendedConfigSize;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ Address = 0;
+ IoDev = NULL;
+ HandleBuf = NULL;
+ Package = NULL;
//
// 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"pci", 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"pci", 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_FEW), gShellDebug1HiiHandle, L"pci");
+ if (ShellCommandLineGetCount (Package) == 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"pci");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- if (ShellCommandLineGetCount(Package) > 4) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"pci");
+ if (ShellCommandLineGetCount (Package) > 4) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"pci");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- if (ShellCommandLineGetFlag(Package, L"-ec") && ShellCommandLineGetValue(Package, L"-ec") == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-ec");
+
+ if (ShellCommandLineGetFlag (Package, L"-ec") && (ShellCommandLineGetValue (Package, L"-ec") == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-ec");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetValue(Package, L"-s") == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-s");
+
+ if (ShellCommandLineGetFlag (Package, L"-s") && (ShellCommandLineGetValue (Package, L"-s") == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-s");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+
//
// Get all instances of PciRootBridgeIo. Allocate space for 1 EFI_HANDLE and
// call LibLocateHandle(), if EFI_BUFFER_TOO_SMALL is returned, allocate enough
// space for handles and call it again.
//
HandleBufSize = sizeof (EFI_HANDLE);
- HandleBuf = (EFI_HANDLE *) AllocateZeroPool (HandleBufSize);
+ HandleBuf = (EFI_HANDLE *)AllocateZeroPool (HandleBufSize);
if (HandleBuf == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"pci");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"pci");
ShellStatus = SHELL_OUT_OF_RESOURCES;
goto Done;
}
Status = gBS->LocateHandle (
- ByProtocol,
- &gEfiPciRootBridgeIoProtocolGuid,
- NULL,
- &HandleBufSize,
- HandleBuf
- );
+ ByProtocol,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ &HandleBufSize,
+ HandleBuf
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
HandleBuf = ReallocatePool (sizeof (EFI_HANDLE), HandleBufSize, HandleBuf);
if (HandleBuf == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"pci");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"pci");
ShellStatus = SHELL_OUT_OF_RESOURCES;
goto Done;
}
Status = gBS->LocateHandle (
- ByProtocol,
- &gEfiPciRootBridgeIoProtocolGuid,
- NULL,
- &HandleBufSize,
- HandleBuf
- );
+ ByProtocol,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ &HandleBufSize,
+ HandleBuf
+ );
}
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"pci");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"pci");
ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
@@ -2560,13 +2571,13 @@ ShellCommandRunPci ( //
// Argument Count == 1(no other argument): enumerate all pci functions
//
- if (ShellCommandLineGetCount(Package) == 1) {
+ if (ShellCommandLineGetCount (Package) == 1) {
gST->ConOut->QueryMode (
- gST->ConOut,
- gST->ConOut->Mode->Mode,
- &TempColumn,
- &ScreenSize
- );
+ gST->ConOut,
+ gST->ConOut->Mode->Mode,
+ &TempColumn,
+ &ScreenSize
+ );
ScreenCount = 0;
ScreenSize -= 4;
@@ -2582,15 +2593,16 @@ ShellCommandRunPci ( //
for (Index = 0; Index < HandleCount; Index++) {
Status = PciGetProtocolAndResource (
- HandleBuf[Index],
- &IoDev,
- &Descriptors
- );
+ HandleBuf[Index],
+ &IoDev,
+ &Descriptors
+ );
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_HANDLE_CFG_ERR), gShellDebug1HiiHandle, L"pci");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI_HANDLE_CFG_ERR), gShellDebug1HiiHandle, L"pci");
ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
+
//
// No document say it's impossible for a RootBridgeIo protocol handle
// to have more than one address space descriptors, so find out every
@@ -2600,7 +2612,7 @@ ShellCommandRunPci ( Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd);
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_BUS_RANGE_ERR), gShellDebug1HiiHandle, L"pci");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI_BUS_RANGE_ERR), gShellDebug1HiiHandle, L"pci");
ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
@@ -2622,14 +2634,15 @@ ShellCommandRunPci ( ShellStatus = SHELL_ABORTED;
goto Done;
}
+
Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
IoDev->Pci.Read (
- IoDev,
- EfiPciWidthUint16,
- Address,
- 1,
- &PciHeader.VendorId
- );
+ IoDev,
+ EfiPciWidthUint16,
+ Address,
+ 1,
+ &PciHeader.VendorId
+ );
//
// If VendorId = 0xffff, there does not exist a device at this
@@ -2638,60 +2651,69 @@ ShellCommandRunPci ( // will be no more functions in the same device, so we can break
// loop to deal with the next device.
//
- if (PciHeader.VendorId == 0xffff && Func == 0) {
+ if ((PciHeader.VendorId == 0xffff) && (Func == 0)) {
break;
}
if (PciHeader.VendorId != 0xffff) {
-
if (PrintTitle) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_TITLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI_TITLE), gShellDebug1HiiHandle);
PrintTitle = FALSE;
}
IoDev->Pci.Read (
- IoDev,
- EfiPciWidthUint32,
- Address,
- sizeof (PciHeader) / sizeof (UINT32),
- &PciHeader
- );
-
- ShellPrintHiiEx(
- -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P1), gShellDebug1HiiHandle,
+ IoDev,
+ EfiPciWidthUint32,
+ Address,
+ sizeof (PciHeader) / sizeof (UINT32),
+ &PciHeader
+ );
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_PCI_LINE_P1),
+ gShellDebug1HiiHandle,
IoDev->SegmentNumber,
Bus,
Device,
Func
- );
+ );
PciPrintClassCode (PciHeader.ClassCode, FALSE);
- ShellPrintHiiEx(
- -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P2), gShellDebug1HiiHandle,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_PCI_LINE_P2),
+ gShellDebug1HiiHandle,
PciHeader.VendorId,
PciHeader.DeviceId,
PciHeader.ClassCode[0]
- );
+ );
ScreenCount += 2;
- if (ScreenCount >= ScreenSize && ScreenSize != 0) {
+ if ((ScreenCount >= ScreenSize) && (ScreenSize != 0)) {
//
// If ScreenSize == 0 we have the console redirected so don't
// block updates
//
ScreenCount = 0;
}
+
//
// If this is not a multi-function device, we can leave the loop
// to deal with the next device.
//
- if (Func == 0 && ((PciHeader.HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00)) {
+ if ((Func == 0) && ((PciHeader.HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00)) {
break;
}
}
}
}
}
+
//
// If Descriptor is NULL, Configuration() returns EFI_UNSUPPRORED,
// we assume the bus range is 0~PCI_MAX_BUS. After enumerated all
@@ -2707,23 +2729,23 @@ ShellCommandRunPci ( goto Done;
}
- ExplainData = FALSE;
- Segment = 0;
- Bus = 0;
- Device = 0;
- Func = 0;
- ExtendedCapability = 0xFFFF;
- if (ShellCommandLineGetFlag(Package, L"-i")) {
+ ExplainData = FALSE;
+ Segment = 0;
+ Bus = 0;
+ Device = 0;
+ Func = 0;
+ ExtendedCapability = 0xFFFF;
+ if (ShellCommandLineGetFlag (Package, L"-i")) {
ExplainData = TRUE;
}
- Temp = ShellCommandLineGetValue(Package, L"-s");
+ Temp = ShellCommandLineGetValue (Package, L"-s");
if (Temp != NULL) {
//
// Input converted to hexadecimal number.
//
if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {
- Segment = (UINT16) RetVal;
+ Segment = (UINT16)RetVal;
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -2735,13 +2757,13 @@ ShellCommandRunPci ( // The first Argument(except "-i") is assumed to be Bus number, second
// to be Device number, and third to be Func number.
//
- Temp = ShellCommandLineGetRawValue(Package, 1);
+ Temp = ShellCommandLineGetRawValue (Package, 1);
if (Temp != NULL) {
//
// Input converted to hexadecimal number.
//
if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {
- Bus = (UINT16) RetVal;
+ Bus = (UINT16)RetVal;
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -2749,46 +2771,47 @@ ShellCommandRunPci ( }
if (Bus > PCI_MAX_BUS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
}
- Temp = ShellCommandLineGetRawValue(Package, 2);
+
+ Temp = ShellCommandLineGetRawValue (Package, 2);
if (Temp != NULL) {
//
// Input converted to hexadecimal number.
//
if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {
- Device = (UINT16) RetVal;
+ Device = (UINT16)RetVal;
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- if (Device > PCI_MAX_DEVICE){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp);
+ if (Device > PCI_MAX_DEVICE) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
}
- Temp = ShellCommandLineGetRawValue(Package, 3);
+ Temp = ShellCommandLineGetRawValue (Package, 3);
if (Temp != NULL) {
//
// Input converted to hexadecimal number.
//
if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {
- Func = (UINT16) RetVal;
+ Func = (UINT16)RetVal;
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- if (Func > PCI_MAX_FUNC){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp);
+ if (Func > PCI_MAX_FUNC) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
@@ -2800,7 +2823,7 @@ ShellCommandRunPci ( // Input converted to hexadecimal number.
//
if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {
- ExtendedCapability = (UINT16) RetVal;
+ ExtendedCapability = (UINT16)RetVal;
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -2813,40 +2836,45 @@ ShellCommandRunPci ( // bus range covers the current bus
//
Status = PciFindProtocolInterface (
- HandleBuf,
- HandleCount,
- Segment,
- Bus,
- &IoDev
- );
+ HandleBuf,
+ HandleCount,
+ Segment,
+ Bus,
+ &IoDev
+ );
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(
- -1, -1, NULL, STRING_TOKEN (STR_PCI_NO_FIND), gShellDebug1HiiHandle, L"pci",
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_PCI_NO_FIND),
+ gShellDebug1HiiHandle,
+ L"pci",
Segment,
Bus
- );
+ );
ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
- Status = IoDev->Pci.Read (
- IoDev,
- EfiPciWidthUint8,
- Address,
- sizeof (ConfigSpace),
- &ConfigSpace
- );
+ Status = IoDev->Pci.Read (
+ IoDev,
+ EfiPciWidthUint8,
+ Address,
+ sizeof (ConfigSpace),
+ &ConfigSpace
+ );
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_NO_CFG), gShellDebug1HiiHandle, L"pci");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI_NO_CFG), gShellDebug1HiiHandle, L"pci");
ShellStatus = SHELL_ACCESS_DENIED;
goto Done;
}
mConfigSpace = &ConfigSpace;
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -2860,7 +2888,7 @@ ShellCommandRunPci ( Bus,
Device,
Func
- );
+ );
//
// Dump standard header of configuration space
@@ -2868,7 +2896,7 @@ ShellCommandRunPci ( SizeOfHeader = sizeof (ConfigSpace.Common) + sizeof (ConfigSpace.NonCommon);
DumpHex (2, 0, SizeOfHeader, &ConfigSpace);
- ShellPrintEx(-1,-1, L"\r\n");
+ ShellPrintEx (-1, -1, L"\r\n");
//
// Dump device dependent Part of configuration space
@@ -2878,11 +2906,11 @@ ShellCommandRunPci ( SizeOfHeader,
sizeof (ConfigSpace) - SizeOfHeader,
ConfigSpace.Data
- );
+ );
ExtendedConfigSpace = NULL;
ExtendedConfigSize = 0;
- PcieCapabilityPtr = LocatePciCapability (&ConfigSpace, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ PcieCapabilityPtr = LocatePciCapability (&ConfigSpace, EFI_PCI_CAPABILITY_ID_PCIEXP);
if (PcieCapabilityPtr != 0) {
ExtendedConfigSize = 0x1000 - EFI_PCIE_CAPABILITY_BASE_OFFSET;
ExtendedConfigSpace = AllocatePool (ExtendedConfigSize);
@@ -2921,7 +2949,7 @@ ShellCommandRunPci ( PciExplainPci (&ConfigSpace, Address, IoDev);
if ((ExtendedConfigSpace != NULL) && !ShellGetExecutionBreakFlag ()) {
PciExplainPciExpress (
- (PCI_CAPABILITY_PCIEXP *) ((UINT8 *) &ConfigSpace + PcieCapabilityPtr),
+ (PCI_CAPABILITY_PCIEXP *)((UINT8 *)&ConfigSpace + PcieCapabilityPtr),
ExtendedConfigSpace,
ExtendedConfigSize,
ExtendedCapability
@@ -2929,13 +2957,16 @@ ShellCommandRunPci ( }
}
}
+
Done:
if (HandleBuf != NULL) {
FreePool (HandleBuf);
}
+
if (Package != NULL) {
ShellCommandLineFreeVarList (Package);
}
+
mConfigSpace = NULL;
return ShellStatus;
}
@@ -2958,19 +2989,19 @@ Done: **/
EFI_STATUS
PciFindProtocolInterface (
- IN EFI_HANDLE *HandleBuf,
- IN UINTN HandleCount,
- IN UINT16 Segment,
- IN UINT16 Bus,
- OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev
+ IN EFI_HANDLE *HandleBuf,
+ IN UINTN HandleCount,
+ IN UINT16 Segment,
+ IN UINT16 Bus,
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev
)
{
- UINTN Index;
- EFI_STATUS Status;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
- UINT16 MinBus;
- UINT16 MaxBus;
- BOOLEAN IsEnd;
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
+ UINT16 MinBus;
+ UINT16 MaxBus;
+ BOOLEAN IsEnd;
//
// Go through all handles, until the one meets the criteria is found
@@ -2980,11 +3011,12 @@ PciFindProtocolInterface ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// When Descriptors == NULL, the Configuration() is not implemented,
// so we only check the Segment number
//
- if (Descriptors == NULL && Segment == (*IoDev)->SegmentNumber) {
+ if ((Descriptors == NULL) && (Segment == (*IoDev)->SegmentNumber)) {
return EFI_SUCCESS;
}
@@ -3002,7 +3034,7 @@ PciFindProtocolInterface ( break;
}
- if (MinBus <= Bus && MaxBus >= Bus) {
+ if ((MinBus <= Bus) && (MaxBus >= Bus)) {
return EFI_SUCCESS;
}
}
@@ -3023,9 +3055,9 @@ PciFindProtocolInterface ( **/
EFI_STATUS
PciGetProtocolAndResource (
- IN EFI_HANDLE Handle,
- OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,
- OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors
+ IN EFI_HANDLE Handle,
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,
+ OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors
)
{
EFI_STATUS Status;
@@ -3034,22 +3066,22 @@ PciGetProtocolAndResource ( // Get inferface from protocol
//
Status = gBS->HandleProtocol (
- Handle,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID**)IoDev
- );
+ Handle,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ (VOID **)IoDev
+ );
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Call Configuration() to get address space descriptors
//
- Status = (*IoDev)->Configuration (*IoDev, (VOID**)Descriptors);
+ Status = (*IoDev)->Configuration (*IoDev, (VOID **)Descriptors);
if (Status == EFI_UNSUPPORTED) {
*Descriptors = NULL;
return EFI_SUCCESS;
-
} else {
return Status;
}
@@ -3087,6 +3119,7 @@ PciGetNextBusRange ( *MaxBus = PCI_MAX_BUS;
return EFI_SUCCESS;
}
+
//
// *Descriptors points to one or more address space descriptors, which
// ends with a end tagged descriptor. Examine each of the descriptors,
@@ -3096,8 +3129,8 @@ PciGetNextBusRange ( while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
- *MinBus = (UINT16) (*Descriptors)->AddrRangeMin;
- *MaxBus = (UINT16) (*Descriptors)->AddrRangeMax;
+ *MinBus = (UINT16)(*Descriptors)->AddrRangeMin;
+ *MaxBus = (UINT16)(*Descriptors)->AddrRangeMax;
(*Descriptors)++;
return (EFI_SUCCESS);
}
@@ -3123,13 +3156,13 @@ PciGetNextBusRange ( **/
VOID
PciExplainPci (
- IN PCI_CONFIG_SPACE *ConfigSpace,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
+ IN PCI_CONFIG_SPACE *ConfigSpace,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
)
{
- PCI_DEVICE_INDEPENDENT_REGION *Common;
- PCI_HEADER_TYPE HeaderType;
+ PCI_DEVICE_INDEPENDENT_REGION *Common;
+ PCI_HEADER_TYPE HeaderType;
Common = &(ConfigSpace->Common);
@@ -3138,12 +3171,17 @@ PciExplainPci ( //
// Print Vendor Id and Device Id
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_VID_DID), gShellDebug1HiiHandle,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_PCI_LINE_VID_DID),
+ gShellDebug1HiiHandle,
INDEX_OF (&(Common->VendorId)),
Common->VendorId,
INDEX_OF (&(Common->DeviceId)),
Common->DeviceId
- );
+ );
//
// Print register Command
@@ -3158,82 +3196,96 @@ PciExplainPci ( //
// Print register Revision ID
//
- ShellPrintEx(-1, -1, L"\r\n");
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_RID), gShellDebug1HiiHandle,
+ ShellPrintEx (-1, -1, L"\r\n");
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_PCI_LINE_RID),
+ gShellDebug1HiiHandle,
INDEX_OF (&(Common->RevisionID)),
Common->RevisionID
- );
+ );
//
// Print register BIST
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_BIST), gShellDebug1HiiHandle, INDEX_OF (&(Common->BIST)));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_BIST), gShellDebug1HiiHandle, INDEX_OF (&(Common->BIST)));
if ((Common->BIST & BIT7) != 0) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP), gShellDebug1HiiHandle, 0x0f & Common->BIST);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP), gShellDebug1HiiHandle, 0x0f & Common->BIST);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP_NO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP_NO), gShellDebug1HiiHandle);
}
+
//
// Print register Cache Line Size
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_CACHE_LINE_SIZE),
gShellDebug1HiiHandle,
INDEX_OF (&(Common->CacheLineSize)),
Common->CacheLineSize
- );
+ );
//
// Print register Latency Timer
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_LATENCY_TIMER),
gShellDebug1HiiHandle,
INDEX_OF (&(Common->LatencyTimer)),
Common->LatencyTimer
- );
+ );
//
// Print register Header Type
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_HEADER_TYPE),
gShellDebug1HiiHandle,
INDEX_OF (&(Common->HeaderType)),
Common->HeaderType
- );
+ );
if ((Common->HeaderType & BIT7) != 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MULTI_FUNCTION), gShellDebug1HiiHandle);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_MULTI_FUNCTION), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SINGLE_FUNCTION), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_SINGLE_FUNCTION), gShellDebug1HiiHandle);
}
- HeaderType = (PCI_HEADER_TYPE)(UINT8) (Common->HeaderType & 0x7f);
+ HeaderType = (PCI_HEADER_TYPE)(UINT8)(Common->HeaderType & 0x7f);
switch (HeaderType) {
- case PciDevice:
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_PCI_DEVICE), gShellDebug1HiiHandle);
- break;
+ case PciDevice:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_PCI_DEVICE), gShellDebug1HiiHandle);
+ break;
- case PciP2pBridge:
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_P2P_BRIDGE), gShellDebug1HiiHandle);
- break;
+ case PciP2pBridge:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_P2P_BRIDGE), gShellDebug1HiiHandle);
+ break;
- case PciCardBusBridge:
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_BRIDGE), gShellDebug1HiiHandle);
- break;
+ case PciCardBusBridge:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_CARDBUS_BRIDGE), gShellDebug1HiiHandle);
+ break;
- default:
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED), gShellDebug1HiiHandle);
- HeaderType = PciUndefined;
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_RESERVED), gShellDebug1HiiHandle);
+ HeaderType = PciUndefined;
}
//
// Print register Class Code
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CLASS), gShellDebug1HiiHandle);
- PciPrintClassCode ((UINT8 *) Common->ClassCode, TRUE);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_CLASS), gShellDebug1HiiHandle);
+ PciPrintClassCode ((UINT8 *)Common->ClassCode, TRUE);
ShellPrintEx (-1, -1, L"\r\n");
}
@@ -3248,9 +3300,9 @@ PciExplainPci ( **/
EFI_STATUS
PciExplainDeviceData (
- IN PCI_DEVICE_HEADER_TYPE_REGION *Device,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
+ IN PCI_DEVICE_HEADER_TYPE_REGION *Device,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
)
{
UINTN Index;
@@ -3263,10 +3315,10 @@ PciExplainDeviceData ( // exist. If these no Bar for this function, print "none", otherwise
// list detail information about this Bar.
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDR), gShellDebug1HiiHandle, INDEX_OF (Device->Bar));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_BASE_ADDR), gShellDebug1HiiHandle, INDEX_OF (Device->Bar));
- BarExist = FALSE;
- BarCount = sizeof (Device->Bar) / sizeof (Device->Bar[0]);
+ BarExist = FALSE;
+ BarCount = sizeof (Device->Bar) / sizeof (Device->Bar[0]);
for (Index = 0; Index < BarCount; Index++) {
if (Device->Bar[Index] == 0) {
continue;
@@ -3274,17 +3326,17 @@ PciExplainDeviceData ( if (!BarExist) {
BarExist = TRUE;
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_START_TYPE), gShellDebug1HiiHandle);
ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------");
}
Status = PciExplainBar (
- &(Device->Bar[Index]),
- &(mConfigSpace->Common.Command),
- Address,
- IoDev,
- &Index
- );
+ &(Device->Bar[Index]),
+ &(mConfigSpace->Common.Command),
+ Address,
+ IoDev,
+ &Index
+ );
if (EFI_ERROR (Status)) {
break;
@@ -3292,8 +3344,7 @@ PciExplainDeviceData ( }
if (!BarExist) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);
} else {
ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------");
}
@@ -3302,86 +3353,113 @@ PciExplainDeviceData ( // Print register Expansion ROM Base Address
//
if ((Device->ExpansionRomBar & BIT0) == 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_EXPANSION_ROM_DISABLED), gShellDebug1HiiHandle, INDEX_OF (&(Device->ExpansionRomBar)));
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_EXPANSION_ROM_DISABLED), gShellDebug1HiiHandle, INDEX_OF (&(Device->ExpansionRomBar)));
} else {
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->ExpansionRomBar)),
Device->ExpansionRomBar
- );
+ );
}
+
//
// Print register Cardbus CIS ptr
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_CARDBUS_CIS),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->CISPtr)),
Device->CISPtr
- );
+ );
//
// Print register Sub-vendor ID and subsystem ID
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->SubsystemVendorID)),
Device->SubsystemVendorID
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SUBSYSTEM_ID),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->SubsystemID)),
Device->SubsystemID
- );
+ );
//
// Print register Capabilities Ptr
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->CapabilityPtr)),
Device->CapabilityPtr
- );
+ );
//
// Print register Interrupt Line and interrupt pin
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_INTERRUPT_LINE),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->InterruptLine)),
Device->InterruptLine
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_INTERRUPT_PIN),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->InterruptPin)),
Device->InterruptPin
- );
+ );
//
// Print register Min_Gnt and Max_Lat
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MIN_GNT),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->MinGnt)),
Device->MinGnt
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MAX_LAT),
gShellDebug1HiiHandle,
INDEX_OF (&(Device->MaxLat)),
Device->MaxLat
- );
+ );
return EFI_SUCCESS;
}
@@ -3397,9 +3475,9 @@ PciExplainDeviceData ( **/
EFI_STATUS
PciExplainBridgeData (
- IN PCI_BRIDGE_CONTROL_REGISTER *Bridge,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
+ IN PCI_BRIDGE_CONTROL_REGISTER *Bridge,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
)
{
UINTN Index;
@@ -3413,10 +3491,10 @@ PciExplainBridgeData ( // exist. If these no Bar for this function, print "none", otherwise
// list detail information about this Bar.
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDRESS), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->Bar)));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_BASE_ADDRESS), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->Bar)));
- BarExist = FALSE;
- BarCount = sizeof (Bridge->Bar) / sizeof (Bridge->Bar[0]);
+ BarExist = FALSE;
+ BarCount = sizeof (Bridge->Bar) / sizeof (Bridge->Bar[0]);
for (Index = 0; Index < BarCount; Index++) {
if (Bridge->Bar[Index] == 0) {
@@ -3425,17 +3503,17 @@ PciExplainBridgeData ( if (!BarExist) {
BarExist = TRUE;
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_START_TYPE_2), gShellDebug1HiiHandle);
ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------");
}
Status = PciExplainBar (
- &(Bridge->Bar[Index]),
- &(mConfigSpace->Common.Command),
- Address,
- IoDev,
- &Index
- );
+ &(Bridge->Bar[Index]),
+ &(mConfigSpace->Common.Command),
+ Address,
+ IoDev,
+ &Index
+ );
if (EFI_ERROR (Status)) {
break;
@@ -3443,7 +3521,7 @@ PciExplainBridgeData ( }
if (!BarExist) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);
} else {
ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------");
}
@@ -3452,42 +3530,51 @@ PciExplainBridgeData ( // Expansion register ROM Base Address
//
if ((Bridge->ExpansionRomBAR & BIT0) == 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO_EXPANSION_ROM), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->ExpansionRomBAR)));
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NO_EXPANSION_ROM), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->ExpansionRomBAR)));
} else {
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE_2),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->ExpansionRomBAR)),
Bridge->ExpansionRomBAR
- );
+ );
}
+
//
// Print Bus Numbers(Primary, Secondary, and Subordinate
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_BUS_NUMBERS),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->PrimaryBus)),
INDEX_OF (&(Bridge->SecondaryBus)),
INDEX_OF (&(Bridge->SubordinateBus))
- );
+ );
ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n");
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->PrimaryBus);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SecondaryBus);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SubordinateBus);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->PrimaryBus);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SecondaryBus);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SubordinateBus);
//
// Print register Secondary Latency Timer
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SECONDARY_TIMER),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->SecondaryLatencyTimer)),
Bridge->SecondaryLatencyTimer
- );
+ );
//
// Print register Secondary Status
@@ -3499,68 +3586,86 @@ PciExplainBridgeData ( // types: I/O, memory, and pre-fetchable memory. For each resource type,
// base and limit address are listed.
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_RESOURCE_TYPE), gShellDebug1HiiHandle);
ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n");
//
// IO Base & Limit
//
- IoAddress32 = (Bridge->IoBaseUpper16 << 16 | Bridge->IoBase << 8);
+ IoAddress32 = (Bridge->IoBaseUpper16 << 16 | Bridge->IoBase << 8);
IoAddress32 &= 0xfffff000;
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_TWO_VARS),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->IoBase)),
IoAddress32
- );
+ );
- IoAddress32 = (Bridge->IoLimitUpper16 << 16 | Bridge->IoLimit << 8);
+ IoAddress32 = (Bridge->IoLimitUpper16 << 16 | Bridge->IoLimit << 8);
IoAddress32 |= 0x00000fff;
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR), gShellDebug1HiiHandle, IoAddress32);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_ONE_VAR), gShellDebug1HiiHandle, IoAddress32);
//
// Memory Base & Limit
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MEMORY),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->MemoryBase)),
(Bridge->MemoryBase << 16) & 0xfff00000
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_ONE_VAR),
gShellDebug1HiiHandle,
(Bridge->MemoryLimit << 16) | 0x000fffff
- );
+ );
//
// Pre-fetch-able Memory Base & Limit
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_PREFETCHABLE),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->PrefetchableMemoryBase)),
Bridge->PrefetchableBaseUpper32,
(Bridge->PrefetchableMemoryBase << 16) & 0xfff00000
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_TWO_VARS_2),
gShellDebug1HiiHandle,
Bridge->PrefetchableLimitUpper32,
(Bridge->PrefetchableMemoryLimit << 16) | 0x000fffff
- );
+ );
//
// Print register Capabilities Pointer
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR_2),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->CapabilityPtr)),
Bridge->CapabilityPtr
- );
+ );
//
// Print register Bridge Control
@@ -3570,19 +3675,25 @@ PciExplainBridgeData ( //
// Print register Interrupt Line & PIN
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_2),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->InterruptLine)),
Bridge->InterruptLine
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_INTERRUPT_PIN),
gShellDebug1HiiHandle,
INDEX_OF (&(Bridge->InterruptPin)),
Bridge->InterruptPin
- );
+ );
return EFI_SUCCESS;
}
@@ -3600,28 +3711,28 @@ PciExplainBridgeData ( **/
EFI_STATUS
PciExplainBar (
- IN UINT32 *Bar,
- IN UINT16 *Command,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,
- IN OUT UINTN *Index
+ IN UINT32 *Bar,
+ IN UINT16 *Command,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,
+ IN OUT UINTN *Index
)
{
- UINT16 OldCommand;
- UINT16 NewCommand;
- UINT64 Bar64;
- UINT32 OldBar32;
- UINT32 NewBar32;
- UINT64 OldBar64;
- UINT64 NewBar64;
- BOOLEAN IsMem;
- BOOLEAN IsBar32;
- UINT64 RegAddress;
-
- IsBar32 = TRUE;
- Bar64 = 0;
- NewBar32 = 0;
- NewBar64 = 0;
+ UINT16 OldCommand;
+ UINT16 NewCommand;
+ UINT64 Bar64;
+ UINT32 OldBar32;
+ UINT32 NewBar32;
+ UINT64 OldBar64;
+ UINT64 NewBar64;
+ BOOLEAN IsMem;
+ BOOLEAN IsBar32;
+ UINT64 RegAddress;
+
+ IsBar32 = TRUE;
+ Bar64 = 0;
+ NewBar32 = 0;
+ NewBar64 = 0;
//
// According the bar type, list detail about this bar, for example: 32 or
@@ -3633,42 +3744,38 @@ PciExplainBar ( //
IsMem = TRUE;
- if ((*Bar & BIT1) == 0 && (*Bar & BIT2) == 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_32_BITS), gShellDebug1HiiHandle);
-
- } else if ((*Bar & BIT1) == 0 && (*Bar & BIT2) != 0) {
+ if (((*Bar & BIT1) == 0) && ((*Bar & BIT2) == 0)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_32_BITS), gShellDebug1HiiHandle);
+ } else if (((*Bar & BIT1) == 0) && ((*Bar & BIT2) != 0)) {
Bar64 = 0x0;
CopyMem (&Bar64, Bar, sizeof (UINT64));
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, (UINT32) RShiftU64 ((Bar64 & 0xfffffffffffffff0ULL), 32));
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_3), gShellDebug1HiiHandle, (UINT32) (Bar64 & 0xfffffffffffffff0ULL));
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_64_BITS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, (UINT32)RShiftU64 ((Bar64 & 0xfffffffffffffff0ULL), 32));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_ONE_VAR_3), gShellDebug1HiiHandle, (UINT32)(Bar64 & 0xfffffffffffffff0ULL));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_64_BITS), gShellDebug1HiiHandle);
IsBar32 = FALSE;
*Index += 1;
-
} else {
//
// Reserved
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_MEM_2), gShellDebug1HiiHandle);
}
if ((*Bar & BIT3) == 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO), gShellDebug1HiiHandle);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NO), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_YES), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_YES), gShellDebug1HiiHandle);
}
-
} else {
//
// This bar is of io type
//
IsMem = FALSE;
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_4), gShellDebug1HiiHandle, *Bar & 0xfffffffc);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_ONE_VAR_4), gShellDebug1HiiHandle, *Bar & 0xfffffffc);
ShellPrintEx (-1, -1, L"I/O ");
}
@@ -3682,9 +3789,9 @@ PciExplainBar ( //
// Disable io & mem access
//
- OldCommand = *Command;
- NewCommand = (UINT16) (OldCommand & 0xfffc);
- RegAddress = Address | INDEX_OF (Command);
+ OldCommand = *Command;
+ NewCommand = (UINT16)(OldCommand & 0xfffc);
+ RegAddress = Address | INDEX_OF (Command);
IoDev->Pci.Write (IoDev, EfiPciWidthUint16, RegAddress, 1, &NewCommand);
RegAddress = Address | INDEX_OF (Bar);
@@ -3693,24 +3800,22 @@ PciExplainBar ( // Read after write the BAR to get the size
//
if (IsBar32) {
- OldBar32 = *Bar;
- NewBar32 = 0xffffffff;
+ OldBar32 = *Bar;
+ NewBar32 = 0xffffffff;
IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 1, &NewBar32);
IoDev->Pci.Read (IoDev, EfiPciWidthUint32, RegAddress, 1, &NewBar32);
IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 1, &OldBar32);
if (IsMem) {
- NewBar32 = NewBar32 & 0xfffffff0;
- NewBar32 = (~NewBar32) + 1;
-
+ NewBar32 = NewBar32 & 0xfffffff0;
+ NewBar32 = (~NewBar32) + 1;
} else {
- NewBar32 = NewBar32 & 0xfffffffc;
- NewBar32 = (~NewBar32) + 1;
- NewBar32 = NewBar32 & 0x0000ffff;
+ NewBar32 = NewBar32 & 0xfffffffc;
+ NewBar32 = (~NewBar32) + 1;
+ NewBar32 = NewBar32 & 0x0000ffff;
}
} else {
-
OldBar64 = 0x0;
CopyMem (&OldBar64, Bar, sizeof (UINT64));
NewBar64 = 0xffffffffffffffffULL;
@@ -3720,15 +3825,15 @@ PciExplainBar ( IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &OldBar64);
if (IsMem) {
- NewBar64 = NewBar64 & 0xfffffffffffffff0ULL;
- NewBar64 = (~NewBar64) + 1;
-
+ NewBar64 = NewBar64 & 0xfffffffffffffff0ULL;
+ NewBar64 = (~NewBar64) + 1;
} else {
- NewBar64 = NewBar64 & 0xfffffffffffffffcULL;
- NewBar64 = (~NewBar64) + 1;
- NewBar64 = NewBar64 & 0x000000000000ffff;
+ NewBar64 = NewBar64 & 0xfffffffffffffffcULL;
+ NewBar64 = (~NewBar64) + 1;
+ NewBar64 = NewBar64 & 0x000000000000ffff;
}
}
+
//
// Enable io & mem access
//
@@ -3737,24 +3842,25 @@ PciExplainBar ( if (IsMem) {
if (IsBar32) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32), gShellDebug1HiiHandle, NewBar32);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_2), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffff0) - 1);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NEWBAR_32), gShellDebug1HiiHandle, NewBar32);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NEWBAR_32_2), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffff0) - 1);
} else {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) RShiftU64 (NewBar64, 32));
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) NewBar64);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32)RShiftU64 (NewBar64, 32));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32)NewBar64);
ShellPrintEx (-1, -1, L" ");
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_RSHIFT),
gShellDebug1HiiHandle,
- (UINT32) RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1), 32)
- );
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) (NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1));
-
+ (UINT32)RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1), 32)
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32)(NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1));
}
} else {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_3), gShellDebug1HiiHandle, NewBar32);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_4), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffffc) - 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NEWBAR_32_3), gShellDebug1HiiHandle, NewBar32);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NEWBAR_32_4), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffffc) - 1);
}
return EFI_SUCCESS;
@@ -3771,20 +3877,23 @@ PciExplainBar ( **/
EFI_STATUS
PciExplainCardBusData (
- IN PCI_CARDBUS_CONTROL_REGISTER *CardBus,
- IN UINT64 Address,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
+ IN PCI_CARDBUS_CONTROL_REGISTER *CardBus,
+ IN UINT64 Address,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev
)
{
BOOLEAN Io32Bit;
PCI_CARDBUS_DATA *CardBusData;
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_CARDBUS_SOCKET),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBus->CardBusSocketReg)),
CardBus->CardBusSocketReg
- );
+ );
//
// Print Secondary Status
@@ -3795,85 +3904,106 @@ PciExplainCardBusData ( // Print Bus Numbers(Primary bus number, CardBus bus number, and
// Subordinate bus number
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_BUS_NUMBERS_2),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBus->PciBusNumber)),
INDEX_OF (&(CardBus->CardBusBusNumber)),
INDEX_OF (&(CardBus->SubordinateBusNumber))
- );
+ );
ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n");
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS), gShellDebug1HiiHandle, CardBus->PciBusNumber);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_2), gShellDebug1HiiHandle, CardBus->CardBusBusNumber);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_3), gShellDebug1HiiHandle, CardBus->SubordinateBusNumber);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_CARDBUS), gShellDebug1HiiHandle, CardBus->PciBusNumber);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_CARDBUS_2), gShellDebug1HiiHandle, CardBus->CardBusBusNumber);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_CARDBUS_3), gShellDebug1HiiHandle, CardBus->SubordinateBusNumber);
//
// Print CardBus Latency Timer
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_CARDBUS_LATENCY),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBus->CardBusLatencyTimer)),
CardBus->CardBusLatencyTimer
- );
+ );
//
// Print Memory/Io ranges this cardbus bridge forwards
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_RESOURCE_TYPE_2), gShellDebug1HiiHandle);
ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n");
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MEM_3),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBus->MemoryBase0)),
CardBus->BridgeControl & BIT8 ? L" Prefetchable" : L"Non-Prefetchable",
CardBus->MemoryBase0 & 0xfffff000,
CardBus->MemoryLimit0 | 0x00000fff
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MEM_3),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBus->MemoryBase1)),
CardBus->BridgeControl & BIT9 ? L" Prefetchable" : L"Non-Prefetchable",
CardBus->MemoryBase1 & 0xfffff000,
CardBus->MemoryLimit1 | 0x00000fff
- );
+ );
- Io32Bit = (BOOLEAN) (CardBus->IoBase0 & BIT0);
- ShellPrintHiiEx(-1, -1, NULL,
+ Io32Bit = (BOOLEAN)(CardBus->IoBase0 & BIT0);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_IO_2),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBus->IoBase0)),
Io32Bit ? L" 32 bit" : L" 16 bit",
CardBus->IoBase0 & (Io32Bit ? 0xfffffffc : 0x0000fffc),
(CardBus->IoLimit0 & (Io32Bit ? 0xffffffff : 0x0000ffff)) | 0x00000003
- );
+ );
- Io32Bit = (BOOLEAN) (CardBus->IoBase1 & BIT0);
- ShellPrintHiiEx(-1, -1, NULL,
+ Io32Bit = (BOOLEAN)(CardBus->IoBase1 & BIT0);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_IO_2),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBus->IoBase1)),
Io32Bit ? L" 32 bit" : L" 16 bit",
CardBus->IoBase1 & (Io32Bit ? 0xfffffffc : 0x0000fffc),
(CardBus->IoLimit1 & (Io32Bit ? 0xffffffff : 0x0000ffff)) | 0x00000003
- );
+ );
//
// Print register Interrupt Line & PIN
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_3),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBus->InterruptLine)),
CardBus->InterruptLine,
INDEX_OF (&(CardBus->InterruptPin)),
CardBus->InterruptPin
- );
+ );
//
// Print register Bridge Control
@@ -3885,23 +4015,29 @@ PciExplainCardBusData ( // bridge. Fields include: Sub VendorId, Subsystem ID, and Legacy Mode Base
// Address.
//
- CardBusData = (PCI_CARDBUS_DATA *) ((UINT8 *) CardBus + sizeof (PCI_CARDBUS_CONTROL_REGISTER));
+ CardBusData = (PCI_CARDBUS_DATA *)((UINT8 *)CardBus + sizeof (PCI_CARDBUS_CONTROL_REGISTER));
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID_2),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBusData->SubVendorId)),
CardBusData->SubVendorId,
INDEX_OF (&(CardBusData->SubSystemId)),
CardBusData->SubSystemId
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_OPTIONAL),
gShellDebug1HiiHandle,
INDEX_OF (&(CardBusData->LegacyBase)),
CardBusData->LegacyBase
- );
+ );
return EFI_SUCCESS;
}
@@ -3919,88 +4055,100 @@ PciExplainCardBusData ( **/
EFI_STATUS
PciExplainStatus (
- IN UINT16 *Status,
- IN BOOLEAN MainStatus,
- IN PCI_HEADER_TYPE HeaderType
+ IN UINT16 *Status,
+ IN BOOLEAN MainStatus,
+ IN PCI_HEADER_TYPE HeaderType
)
{
if (MainStatus) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status);
} else {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SECONDARY_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_SECONDARY_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status);
}
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEW_CAPABILITIES), gShellDebug1HiiHandle, (*Status & BIT4) != 0);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_NEW_CAPABILITIES), gShellDebug1HiiHandle, (*Status & BIT4) != 0);
//
// Bit 5 is meaningless for CardBus Bridge
//
if (HeaderType == PciCardBusBridge) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_66_CAPABLE), gShellDebug1HiiHandle, (*Status & BIT5) != 0);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_66_CAPABLE), gShellDebug1HiiHandle, (*Status & BIT5) != 0);
} else {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_66_CAPABLE_2), gShellDebug1HiiHandle, (*Status & BIT5) != 0);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_66_CAPABLE_2), gShellDebug1HiiHandle, (*Status & BIT5) != 0);
}
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_FAST_BACK), gShellDebug1HiiHandle, (*Status & BIT7) != 0);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_FAST_BACK), gShellDebug1HiiHandle, (*Status & BIT7) != 0);
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MASTER_DATA), gShellDebug1HiiHandle, (*Status & BIT8) != 0);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_MASTER_DATA), gShellDebug1HiiHandle, (*Status & BIT8) != 0);
//
// Bit 9 and bit 10 together decides the DEVSEL timing
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_DEVSEL_TIMING), gShellDebug1HiiHandle);
- if ((*Status & BIT9) == 0 && (*Status & BIT10) == 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_FAST), gShellDebug1HiiHandle);
-
- } else if ((*Status & BIT9) != 0 && (*Status & BIT10) == 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEDIUM), gShellDebug1HiiHandle);
-
- } else if ((*Status & BIT9) == 0 && (*Status & BIT10) != 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SLOW), gShellDebug1HiiHandle);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_DEVSEL_TIMING), gShellDebug1HiiHandle);
+ if (((*Status & BIT9) == 0) && ((*Status & BIT10) == 0)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_FAST), gShellDebug1HiiHandle);
+ } else if (((*Status & BIT9) != 0) && ((*Status & BIT10) == 0)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_MEDIUM), gShellDebug1HiiHandle);
+ } else if (((*Status & BIT9) == 0) && ((*Status & BIT10) != 0)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_SLOW), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_RESERVED_2), gShellDebug1HiiHandle);
}
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SIGNALED_TARGET),
gShellDebug1HiiHandle,
(*Status & BIT11) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_RECEIVED_TARGET),
gShellDebug1HiiHandle,
(*Status & BIT12) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_RECEIVED_MASTER),
gShellDebug1HiiHandle,
(*Status & BIT13) != 0
- );
+ );
if (MainStatus) {
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SIGNALED_ERROR),
gShellDebug1HiiHandle,
(*Status & BIT14) != 0
- );
-
+ );
} else {
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_RECEIVED_ERROR),
gShellDebug1HiiHandle,
(*Status & BIT14) != 0
- );
+ );
}
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_DETECTED_ERROR),
gShellDebug1HiiHandle,
(*Status & BIT15) != 0
- );
+ );
return EFI_SUCCESS;
}
@@ -4014,76 +4162,106 @@ PciExplainStatus ( **/
EFI_STATUS
PciExplainCommand (
- IN UINT16 *Command
+ IN UINT16 *Command
)
{
//
// Print the binary value of register Command
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_COMMAND), gShellDebug1HiiHandle, INDEX_OF (Command), *Command);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PCI2_COMMAND), gShellDebug1HiiHandle, INDEX_OF (Command), *Command);
//
// Explain register Command bit by bit
//
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SPACE_ACCESS_DENIED),
gShellDebug1HiiHandle,
(*Command & BIT0) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MEMORY_SPACE),
gShellDebug1HiiHandle,
(*Command & BIT1) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_BEHAVE_BUS_MASTER),
gShellDebug1HiiHandle,
(*Command & BIT2) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MONITOR_SPECIAL_CYCLE),
gShellDebug1HiiHandle,
(*Command & BIT3) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MEM_WRITE_INVALIDATE),
gShellDebug1HiiHandle,
(*Command & BIT4) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_PALETTE_SNOOPING),
gShellDebug1HiiHandle,
(*Command & BIT5) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_ASSERT_PERR),
gShellDebug1HiiHandle,
(*Command & BIT6) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_DO_ADDR_STEPPING),
gShellDebug1HiiHandle,
(*Command & BIT7) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SERR_DRIVER),
gShellDebug1HiiHandle,
(*Command & BIT8) != 0
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_FAST_BACK_2),
gShellDebug1HiiHandle,
(*Command & BIT9) != 0
- );
+ );
return EFI_SUCCESS;
}
@@ -4098,95 +4276,139 @@ PciExplainCommand ( **/
EFI_STATUS
PciExplainBridgeControl (
- IN UINT16 *BridgeControl,
- IN PCI_HEADER_TYPE HeaderType
+ IN UINT16 *BridgeControl,
+ IN PCI_HEADER_TYPE HeaderType
)
{
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_BRIDGE_CONTROL),
gShellDebug1HiiHandle,
INDEX_OF (BridgeControl),
*BridgeControl
- );
+ );
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_PARITY_ERROR),
gShellDebug1HiiHandle,
(*BridgeControl & BIT0) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SERR_ENABLE),
gShellDebug1HiiHandle,
(*BridgeControl & BIT1) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_ISA_ENABLE),
gShellDebug1HiiHandle,
(*BridgeControl & BIT2) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_VGA_ENABLE),
gShellDebug1HiiHandle,
(*BridgeControl & BIT3) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_MASTER_ABORT),
gShellDebug1HiiHandle,
(*BridgeControl & BIT5) != 0
- );
+ );
//
// Register Bridge Control has some slight differences between P2P bridge
// and Cardbus bridge from bit 6 to bit 11.
//
if (HeaderType == PciP2pBridge) {
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SECONDARY_BUS_RESET),
gShellDebug1HiiHandle,
(*BridgeControl & BIT6) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_FAST_ENABLE),
gShellDebug1HiiHandle,
(*BridgeControl & BIT7) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_PRIMARY_DISCARD_TIMER),
gShellDebug1HiiHandle,
- (*BridgeControl & BIT8)!=0 ? L"2^10" : L"2^15"
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ (*BridgeControl & BIT8) != 0 ? L"2^10" : L"2^15"
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_SECONDARY_DISCARD_TIMER),
gShellDebug1HiiHandle,
- (*BridgeControl & BIT9)!=0 ? L"2^10" : L"2^15"
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ (*BridgeControl & BIT9) != 0 ? L"2^10" : L"2^15"
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_DISCARD_TIMER_STATUS),
gShellDebug1HiiHandle,
(*BridgeControl & BIT10) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_DISCARD_TIMER_SERR),
gShellDebug1HiiHandle,
(*BridgeControl & BIT11) != 0
- );
-
+ );
} else {
- ShellPrintHiiEx(-1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_CARDBUS_RESET),
gShellDebug1HiiHandle,
(*BridgeControl & BIT6) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_IREQ_ENABLE),
gShellDebug1HiiHandle,
(*BridgeControl & BIT7) != 0
- );
- ShellPrintHiiEx(-1, -1, NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI2_WRITE_POSTING_ENABLE),
gShellDebug1HiiHandle,
(*BridgeControl & BIT10) != 0
- );
+ );
}
return EFI_SUCCESS;
@@ -4203,8 +4425,8 @@ PciExplainBridgeControl ( **/
UINT8
LocatePciCapability (
- IN PCI_CONFIG_SPACE *ConfigSpace,
- IN UINT8 CapabilityId
+ IN PCI_CONFIG_SPACE *ConfigSpace,
+ IN UINT8 CapabilityId
)
{
UINT8 CapabilityPtr;
@@ -4232,7 +4454,7 @@ LocatePciCapability ( }
while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) {
- CapabilityEntry = (EFI_PCI_CAPABILITY_HDR *) ((UINT8 *) ConfigSpace + CapabilityPtr);
+ CapabilityEntry = (EFI_PCI_CAPABILITY_HDR *)((UINT8 *)ConfigSpace + CapabilityPtr);
if (CapabilityEntry->CapabilityID == CapabilityId) {
return CapabilityPtr;
}
@@ -4260,40 +4482,51 @@ LocatePciCapability ( **/
EFI_STATUS
ExplainPcieCapReg (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- CHAR16 *DevicePortType;
+ CHAR16 *DevicePortType;
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Capability Version(3:0): %E0x%04x%N\r\n",
PciExpressCap->Capability.Bits.Version
- );
+ );
if (PciExpressCap->Capability.Bits.DevicePortType < ARRAY_SIZE (DevicePortTypeTable)) {
DevicePortType = DevicePortTypeTable[PciExpressCap->Capability.Bits.DevicePortType];
} else {
DevicePortType = L"Unknown Type";
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Device/PortType(7:4): %E%s%N\r\n",
DevicePortType
- );
+ );
//
// 'Slot Implemented' is only valid for:
// a) Root Port of PCI Express Root Complex, or
// b) Downstream Port of PCI Express Switch
//
- if (PciExpressCap->Capability.Bits.DevicePortType== PCIE_DEVICE_PORT_TYPE_ROOT_PORT ||
- PciExpressCap->Capability.Bits.DevicePortType == PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT) {
- ShellPrintEx (-1, -1,
+ if ((PciExpressCap->Capability.Bits.DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_PORT) ||
+ (PciExpressCap->Capability.Bits.DevicePortType == PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT))
+ {
+ ShellPrintEx (
+ -1,
+ -1,
L" Slot Implemented(8): %E%d%N\r\n",
PciExpressCap->Capability.Bits.SlotImplemented
- );
+ );
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Interrupt Message Number(13:9): %E0x%05x%N\r\n",
PciExpressCap->Capability.Bits.InterruptMessageNumber
- );
+ );
return EFI_SUCCESS;
}
@@ -4306,7 +4539,7 @@ ExplainPcieCapReg ( **/
EFI_STATUS
ExplainPcieDeviceCap (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
UINT8 DevicePortType;
@@ -4320,14 +4553,19 @@ ExplainPcieDeviceCap ( } else {
ShellPrintEx (-1, -1, L"%EUnknown%N\r\n");
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Phantom Functions Supported(4:3): %E%d%N\r\n",
PciExpressCap->DeviceCapability.Bits.PhantomFunctions
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Extended Tag Field Supported(5): %E%d-bit Tag field supported%N\r\n",
PciExpressCap->DeviceCapability.Bits.ExtendedTagField ? 8 : 5
- );
+ );
//
// Endpoint L0s and L1 Acceptable Latency is only valid for Endpoint
//
@@ -4344,6 +4582,7 @@ ExplainPcieDeviceCap ( ShellPrintEx (-1, -1, L"%ENo limit%N\r\n");
}
}
+
ShellPrintEx (-1, -1, L" Endpoint L1 Acceptable Latency(11:9): ");
if (L1Latency < 7) {
ShellPrintEx (-1, -1, L"%EMaximum of %d us%N\r\n", 1 << (L1Latency + 1));
@@ -4351,34 +4590,45 @@ ExplainPcieDeviceCap ( ShellPrintEx (-1, -1, L"%ENo limit%N\r\n");
}
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Role-based Error Reporting(15): %E%d%N\r\n",
PciExpressCap->DeviceCapability.Bits.RoleBasedErrorReporting
- );
+ );
//
// Only valid for Upstream Port:
// a) Captured Slot Power Limit Value
// b) Captured Slot Power Scale
//
if (DevicePortType == PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT) {
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Captured Slot Power Limit Value(25:18): %E0x%02x%N\r\n",
PciExpressCap->DeviceCapability.Bits.CapturedSlotPowerLimitValue
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Captured Slot Power Limit Scale(27:26): %E%s%N\r\n",
SlotPwrLmtScaleTable[PciExpressCap->DeviceCapability.Bits.CapturedSlotPowerLimitScale]
- );
+ );
}
+
//
// Function Level Reset Capability is only valid for Endpoint
//
if (IS_PCIE_ENDPOINT (DevicePortType)) {
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Function Level Reset Capability(28): %E%d%N\r\n",
PciExpressCap->DeviceCapability.Bits.FunctionLevelReset
- );
+ );
}
+
return EFI_SUCCESS;
}
@@ -4391,66 +4641,89 @@ ExplainPcieDeviceCap ( **/
EFI_STATUS
ExplainPcieDeviceControl (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Correctable Error Reporting Enable(0): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.CorrectableError
);
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Non-Fatal Error Reporting Enable(1): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.NonFatalError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Fatal Error Reporting Enable(2): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.FatalError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Unsupported Request Reporting Enable(3): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.UnsupportedRequest
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Enable Relaxed Ordering(4): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.RelaxedOrdering
- );
+ );
ShellPrintEx (-1, -1, L" Max_Payload_Size(7:5): ");
if (PciExpressCap->DeviceControl.Bits.MaxPayloadSize < 6) {
ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PciExpressCap->DeviceControl.Bits.MaxPayloadSize + 7));
} else {
ShellPrintEx (-1, -1, L"%EUnknown%N\r\n");
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Extended Tag Field Enable(8): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.ExtendedTagField
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Phantom Functions Enable(9): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.PhantomFunctions
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Auxiliary (AUX) Power PM Enable(10): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.AuxPower
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Enable No Snoop(11): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.NoSnoop
- );
+ );
ShellPrintEx (-1, -1, L" Max_Read_Request_Size(14:12): ");
if (PciExpressCap->DeviceControl.Bits.MaxReadRequestSize < 6) {
ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PciExpressCap->DeviceControl.Bits.MaxReadRequestSize + 7));
} else {
ShellPrintEx (-1, -1, L"%EUnknown%N\r\n");
}
+
//
// Read operation is only valid for PCI Express to PCI/PCI-X Bridges
//
if (PciExpressCap->Capability.Bits.DevicePortType == PCIE_DEVICE_PORT_TYPE_PCIE_TO_PCI_BRIDGE) {
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Bridge Configuration Retry Enable(15): %E%d%N\r\n",
PciExpressCap->DeviceControl.Bits.BridgeConfigurationRetryOrFunctionLevelReset
- );
+ );
}
+
return EFI_SUCCESS;
}
@@ -4463,33 +4736,45 @@ ExplainPcieDeviceControl ( **/
EFI_STATUS
ExplainPcieDeviceStatus (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Correctable Error Detected(0): %E%d%N\r\n",
PciExpressCap->DeviceStatus.Bits.CorrectableError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Non-Fatal Error Detected(1): %E%d%N\r\n",
PciExpressCap->DeviceStatus.Bits.NonFatalError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Fatal Error Detected(2): %E%d%N\r\n",
PciExpressCap->DeviceStatus.Bits.FatalError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Unsupported Request Detected(3): %E%d%N\r\n",
PciExpressCap->DeviceStatus.Bits.UnsupportedRequest
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" AUX Power Detected(4): %E%d%N\r\n",
PciExpressCap->DeviceStatus.Bits.AuxPower
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Transactions Pending(5): %E%d%N\r\n",
PciExpressCap->DeviceStatus.Bits.TransactionsPending
- );
+ );
return EFI_SUCCESS;
}
@@ -4502,11 +4787,11 @@ ExplainPcieDeviceStatus ( **/
EFI_STATUS
ExplainPcieLinkCap (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- CHAR16 *MaxLinkSpeed;
- CHAR16 *AspmValue;
+ CHAR16 *MaxLinkSpeed;
+ CHAR16 *AspmValue;
switch (PciExpressCap->LinkCapability.Bits.MaxLinkSpeed) {
case 1:
@@ -4528,14 +4813,19 @@ ExplainPcieLinkCap ( MaxLinkSpeed = L"Reserved";
break;
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Maximum Link Speed(3:0): %E%s%N\r\n",
MaxLinkSpeed
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Maximum Link Width(9:4): %Ex%d%N\r\n",
PciExpressCap->LinkCapability.Bits.MaxLinkWidth
- );
+ );
switch (PciExpressCap->LinkCapability.Bits.Aspm) {
case 0:
AspmValue = L"Not";
@@ -4553,38 +4843,55 @@ ExplainPcieLinkCap ( AspmValue = L"Reserved";
break;
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Active State Power Management Support(11:10): %E%s Supported%N\r\n",
AspmValue
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" L0s Exit Latency(14:12): %E%s%N\r\n",
L0sLatencyStrTable[PciExpressCap->LinkCapability.Bits.L0sExitLatency]
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" L1 Exit Latency(17:15): %E%s%N\r\n",
L1LatencyStrTable[PciExpressCap->LinkCapability.Bits.L1ExitLatency]
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Clock Power Management(18): %E%d%N\r\n",
PciExpressCap->LinkCapability.Bits.ClockPowerManagement
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Surprise Down Error Reporting Capable(19): %E%d%N\r\n",
PciExpressCap->LinkCapability.Bits.SurpriseDownError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Data Link Layer Link Active Reporting Capable(20): %E%d%N\r\n",
PciExpressCap->LinkCapability.Bits.DataLinkLayerLinkActive
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Link Bandwidth Notification Capability(21): %E%d%N\r\n",
PciExpressCap->LinkCapability.Bits.LinkBandwidthNotification
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Port Number(31:24): %E0x%02x%N\r\n",
PciExpressCap->LinkCapability.Bits.PortNumber
- );
+ );
return EFI_SUCCESS;
}
@@ -4597,25 +4904,30 @@ ExplainPcieLinkCap ( **/
EFI_STATUS
ExplainPcieLinkControl (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
UINT8 DevicePortType;
- DevicePortType = (UINT8)PciExpressCap->Capability.Bits.DevicePortType;
- ShellPrintEx (-1, -1,
+ DevicePortType = (UINT8)PciExpressCap->Capability.Bits.DevicePortType;
+ ShellPrintEx (
+ -1,
+ -1,
L" Active State Power Management Control(1:0): %E%s%N\r\n",
ASPMCtrlStrTable[PciExpressCap->LinkControl.Bits.AspmControl]
- );
+ );
//
// RCB is not applicable to switches
//
- if (!IS_PCIE_SWITCH(DevicePortType)) {
- ShellPrintEx (-1, -1,
+ if (!IS_PCIE_SWITCH (DevicePortType)) {
+ ShellPrintEx (
+ -1,
+ -1,
L" Read Completion Boundary (RCB)(3): %E%d byte%N\r\n",
1 << (PciExpressCap->LinkControl.Bits.ReadCompletionBoundary + 6)
- );
+ );
}
+
//
// Link Disable is reserved on
// a) Endpoints
@@ -4623,37 +4935,53 @@ ExplainPcieLinkControl ( // c) Upstream Ports of Switches
//
if (!IS_PCIE_ENDPOINT (DevicePortType) &&
- DevicePortType != PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT &&
- DevicePortType != PCIE_DEVICE_PORT_TYPE_PCIE_TO_PCI_BRIDGE) {
- ShellPrintEx (-1, -1,
+ (DevicePortType != PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT) &&
+ (DevicePortType != PCIE_DEVICE_PORT_TYPE_PCIE_TO_PCI_BRIDGE))
+ {
+ ShellPrintEx (
+ -1,
+ -1,
L" Link Disable(4): %E%d%N\r\n",
PciExpressCap->LinkControl.Bits.LinkDisable
- );
+ );
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Common Clock Configuration(6): %E%d%N\r\n",
PciExpressCap->LinkControl.Bits.CommonClockConfiguration
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Extended Synch(7): %E%d%N\r\n",
PciExpressCap->LinkControl.Bits.ExtendedSynch
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Enable Clock Power Management(8): %E%d%N\r\n",
PciExpressCap->LinkControl.Bits.ClockPowerManagement
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Hardware Autonomous Width Disable(9): %E%d%N\r\n",
PciExpressCap->LinkControl.Bits.HardwareAutonomousWidthDisable
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Link Bandwidth Management Interrupt Enable(10): %E%d%N\r\n",
PciExpressCap->LinkControl.Bits.LinkBandwidthManagementInterrupt
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Link Autonomous Bandwidth Interrupt Enable(11): %E%d%N\r\n",
PciExpressCap->LinkControl.Bits.LinkAutonomousBandwidthInterrupt
- );
+ );
return EFI_SUCCESS;
}
@@ -4666,10 +4994,10 @@ ExplainPcieLinkControl ( **/
EFI_STATUS
ExplainPcieLinkStatus (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- CHAR16 *CurLinkSpeed;
+ CHAR16 *CurLinkSpeed;
switch (PciExpressCap->LinkStatus.Bits.CurrentLinkSpeed) {
case 1:
@@ -4691,34 +5019,49 @@ ExplainPcieLinkStatus ( CurLinkSpeed = L"Reserved";
break;
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Current Link Speed(3:0): %E%s%N\r\n",
CurLinkSpeed
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Negotiated Link Width(9:4): %Ex%d%N\r\n",
PciExpressCap->LinkStatus.Bits.NegotiatedLinkWidth
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Link Training(11): %E%d%N\r\n",
PciExpressCap->LinkStatus.Bits.LinkTraining
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Slot Clock Configuration(12): %E%d%N\r\n",
PciExpressCap->LinkStatus.Bits.SlotClockConfiguration
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Data Link Layer Link Active(13): %E%d%N\r\n",
PciExpressCap->LinkStatus.Bits.DataLinkLayerLinkActive
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Link Bandwidth Management Status(14): %E%d%N\r\n",
PciExpressCap->LinkStatus.Bits.LinkBandwidthManagement
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Link Autonomous Bandwidth Status(15): %E%d%N\r\n",
PciExpressCap->LinkStatus.Bits.LinkAutonomousBandwidth
- );
+ );
return EFI_SUCCESS;
}
@@ -4731,57 +5074,81 @@ ExplainPcieLinkStatus ( **/
EFI_STATUS
ExplainPcieSlotCap (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Attention Button Present(0): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.AttentionButton
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Power Controller Present(1): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.PowerController
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" MRL Sensor Present(2): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.MrlSensor
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Attention Indicator Present(3): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.AttentionIndicator
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Power Indicator Present(4): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.PowerIndicator
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Hot-Plug Surprise(5): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.HotPlugSurprise
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Hot-Plug Capable(6): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.HotPlugCapable
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Slot Power Limit Value(14:7): %E0x%02x%N\r\n",
PciExpressCap->SlotCapability.Bits.SlotPowerLimitValue
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Slot Power Limit Scale(16:15): %E%s%N\r\n",
SlotPwrLmtScaleTable[PciExpressCap->SlotCapability.Bits.SlotPowerLimitScale]
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Electromechanical Interlock Present(17): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.ElectromechanicalInterlock
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" No Command Completed Support(18): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.NoCommandCompleted
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Physical Slot Number(31:19): %E%d%N\r\n",
PciExpressCap->SlotCapability.Bits.PhysicalSlotNumber
- );
+ );
return EFI_SUCCESS;
}
@@ -4795,57 +5162,79 @@ ExplainPcieSlotCap ( **/
EFI_STATUS
ExplainPcieSlotControl (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Attention Button Pressed Enable(0): %E%d%N\r\n",
PciExpressCap->SlotControl.Bits.AttentionButtonPressed
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Power Fault Detected Enable(1): %E%d%N\r\n",
PciExpressCap->SlotControl.Bits.PowerFaultDetected
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" MRL Sensor Changed Enable(2): %E%d%N\r\n",
PciExpressCap->SlotControl.Bits.MrlSensorChanged
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Presence Detect Changed Enable(3): %E%d%N\r\n",
PciExpressCap->SlotControl.Bits.PresenceDetectChanged
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Command Completed Interrupt Enable(4): %E%d%N\r\n",
PciExpressCap->SlotControl.Bits.CommandCompletedInterrupt
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Hot-Plug Interrupt Enable(5): %E%d%N\r\n",
PciExpressCap->SlotControl.Bits.HotPlugInterrupt
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Attention Indicator Control(7:6): %E%s%N\r\n",
IndicatorTable[
- PciExpressCap->SlotControl.Bits.AttentionIndicator]
- );
- ShellPrintEx (-1, -1,
+ PciExpressCap->SlotControl.Bits.AttentionIndicator]
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Power Indicator Control(9:8): %E%s%N\r\n",
IndicatorTable[PciExpressCap->SlotControl.Bits.PowerIndicator]
- );
+ );
ShellPrintEx (-1, -1, L" Power Controller Control(10): %EPower ");
if (
- PciExpressCap->SlotControl.Bits.PowerController) {
+ PciExpressCap->SlotControl.Bits.PowerController)
+ {
ShellPrintEx (-1, -1, L"Off%N\r\n");
} else {
ShellPrintEx (-1, -1, L"On%N\r\n");
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Electromechanical Interlock Control(11): %E%d%N\r\n",
PciExpressCap->SlotControl.Bits.ElectromechanicalInterlock
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Data Link Layer State Changed Enable(12): %E%d%N\r\n",
PciExpressCap->SlotControl.Bits.DataLinkLayerStateChanged
- );
+ );
return EFI_SUCCESS;
}
@@ -4858,54 +5247,72 @@ ExplainPcieSlotControl ( **/
EFI_STATUS
ExplainPcieSlotStatus (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" Attention Button Pressed(0): %E%d%N\r\n",
PciExpressCap->SlotStatus.Bits.AttentionButtonPressed
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Power Fault Detected(1): %E%d%N\r\n",
PciExpressCap->SlotStatus.Bits.PowerFaultDetected
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" MRL Sensor Changed(2): %E%d%N\r\n",
PciExpressCap->SlotStatus.Bits.MrlSensorChanged
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Presence Detect Changed(3): %E%d%N\r\n",
PciExpressCap->SlotStatus.Bits.PresenceDetectChanged
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" Command Completed(4): %E%d%N\r\n",
PciExpressCap->SlotStatus.Bits.CommandCompleted
- );
+ );
ShellPrintEx (-1, -1, L" MRL Sensor State(5): %EMRL ");
if (
- PciExpressCap->SlotStatus.Bits.MrlSensor) {
+ PciExpressCap->SlotStatus.Bits.MrlSensor)
+ {
ShellPrintEx (-1, -1, L" Opened%N\r\n");
} else {
ShellPrintEx (-1, -1, L" Closed%N\r\n");
}
+
ShellPrintEx (-1, -1, L" Presence Detect State(6): ");
if (
- PciExpressCap->SlotStatus.Bits.PresenceDetect) {
+ PciExpressCap->SlotStatus.Bits.PresenceDetect)
+ {
ShellPrintEx (-1, -1, L"%ECard Present in slot%N\r\n");
} else {
ShellPrintEx (-1, -1, L"%ESlot Empty%N\r\n");
}
+
ShellPrintEx (-1, -1, L" Electromechanical Interlock Status(7): %EElectromechanical Interlock ");
if (
- PciExpressCap->SlotStatus.Bits.ElectromechanicalInterlock) {
+ PciExpressCap->SlotStatus.Bits.ElectromechanicalInterlock)
+ {
ShellPrintEx (-1, -1, L"Engaged%N\r\n");
} else {
ShellPrintEx (-1, -1, L"Disengaged%N\r\n");
}
- ShellPrintEx (-1, -1,
+
+ ShellPrintEx (
+ -1,
+ -1,
L" Data Link Layer State Changed(8): %E%d%N\r\n",
PciExpressCap->SlotStatus.Bits.DataLinkLayerStateChanged
- );
+ );
return EFI_SUCCESS;
}
@@ -4918,29 +5325,39 @@ ExplainPcieSlotStatus ( **/
EFI_STATUS
ExplainPcieRootControl (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" System Error on Correctable Error Enable(0): %E%d%N\r\n",
PciExpressCap->RootControl.Bits.SystemErrorOnCorrectableError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" System Error on Non-Fatal Error Enable(1): %E%d%N\r\n",
PciExpressCap->RootControl.Bits.SystemErrorOnNonFatalError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" System Error on Fatal Error Enable(2): %E%d%N\r\n",
PciExpressCap->RootControl.Bits.SystemErrorOnFatalError
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" PME Interrupt Enable(3): %E%d%N\r\n",
PciExpressCap->RootControl.Bits.PmeInterrupt
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" CRS Software Visibility Enable(4): %E%d%N\r\n",
PciExpressCap->RootControl.Bits.CrsSoftwareVisibility
- );
+ );
return EFI_SUCCESS;
}
@@ -4954,13 +5371,15 @@ ExplainPcieRootControl ( **/
EFI_STATUS
ExplainPcieRootCap (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" CRS Software Visibility(0): %E%d%N\r\n",
PciExpressCap->RootCapability.Bits.CrsSoftwareVisibility
- );
+ );
return EFI_SUCCESS;
}
@@ -4974,21 +5393,27 @@ ExplainPcieRootCap ( **/
EFI_STATUS
ExplainPcieRootStatus (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L" PME Requester ID(15:0): %E0x%04x%N\r\n",
PciExpressCap->RootStatus.Bits.PmeRequesterId
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" PME Status(16): %E%d%N\r\n",
PciExpressCap->RootStatus.Bits.PmeStatus
- );
- ShellPrintEx (-1, -1,
+ );
+ ShellPrintEx (
+ -1,
+ -1,
L" PME Pending(17): %E%d%N\r\n",
PciExpressCap->RootStatus.Bits.PmePending
- );
+ );
return EFI_SUCCESS;
}
@@ -5000,15 +5425,18 @@ ExplainPcieRootStatus ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityLinkControl (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_LINK_CONTROL),
gShellDebug1HiiHandle,
Header->RootComplexLinkCapabilities,
@@ -5017,9 +5445,9 @@ PrintInterpretedExtendedCompatibilityLinkControl ( );
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5032,15 +5460,18 @@ PrintInterpretedExtendedCompatibilityLinkControl ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityPowerBudgeting (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_POWER),
gShellDebug1HiiHandle,
Header->DataSelect,
@@ -5049,9 +5480,9 @@ PrintInterpretedExtendedCompatibilityPowerBudgeting ( );
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5064,32 +5495,37 @@ PrintInterpretedExtendedCompatibilityPowerBudgeting ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityAcs (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED *Header;
UINT16 VectorSize;
UINT16 LoopCounter;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED*)HeaderAddress;
- VectorSize = 0;
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED *)HeaderAddress;
+ VectorSize = 0;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_ACS),
gShellDebug1HiiHandle,
Header->AcsCapability,
Header->AcsControl
);
- if (PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_CONTROL(Header)) {
- VectorSize = PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_VECTOR_SIZE(Header);
+ if (PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_CONTROL (Header)) {
+ VectorSize = PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_VECTOR_SIZE (Header);
if (VectorSize == 0) {
VectorSize = 256;
}
- for (LoopCounter = 0 ; LoopCounter * 8 < VectorSize ; LoopCounter++) {
- ShellPrintHiiEx(
- -1, -1, NULL,
+
+ for (LoopCounter = 0; LoopCounter * 8 < VectorSize; LoopCounter++) {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_ACS2),
gShellDebug1HiiHandle,
LoopCounter + 1,
@@ -5097,11 +5533,12 @@ PrintInterpretedExtendedCompatibilityAcs ( );
}
}
+
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED) + (VectorSize / 8) - 1,
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED) + (VectorSize / 8) - 1,
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5114,15 +5551,18 @@ PrintInterpretedExtendedCompatibilityAcs ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityLatencyToleranceReporting (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_LAT),
gShellDebug1HiiHandle,
Header->MaxSnoopLatency,
@@ -5130,9 +5570,9 @@ PrintInterpretedExtendedCompatibilityLatencyToleranceReporting ( );
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5145,24 +5585,27 @@ PrintInterpretedExtendedCompatibilityLatencyToleranceReporting ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilitySerialNumber (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_SN),
gShellDebug1HiiHandle,
Header->SerialNumber
);
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5175,15 +5618,18 @@ PrintInterpretedExtendedCompatibilitySerialNumber ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityRcrb (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_RCRB),
gShellDebug1HiiHandle,
Header->VendorId,
@@ -5193,9 +5639,9 @@ PrintInterpretedExtendedCompatibilityRcrb ( );
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5208,24 +5654,27 @@ PrintInterpretedExtendedCompatibilityRcrb ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityVendorSpecific (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_VEN),
gShellDebug1HiiHandle,
Header->VendorSpecificHeader
);
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_GET_SIZE(Header),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_GET_SIZE (Header),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5238,24 +5687,27 @@ PrintInterpretedExtendedCompatibilityVendorSpecific ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityECEA (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_ECEA),
gShellDebug1HiiHandle,
Header->AssociationBitmap
);
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5268,15 +5720,18 @@ PrintInterpretedExtendedCompatibilityECEA ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityAri (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_ARI),
gShellDebug1HiiHandle,
Header->AriCapability,
@@ -5284,9 +5739,9 @@ PrintInterpretedExtendedCompatibilityAri ( );
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5299,16 +5754,19 @@ PrintInterpretedExtendedCompatibilityAri ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityDynamicPowerAllocation (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION *Header;
- UINT8 LinkCount;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION *Header;
+ UINT8 LinkCount;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION *)HeaderAddress;
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_DPA),
gShellDebug1HiiHandle,
Header->DpaCapability,
@@ -5316,20 +5774,23 @@ PrintInterpretedExtendedCompatibilityDynamicPowerAllocation ( Header->DpaStatus,
Header->DpaControl
);
- for (LinkCount = 0 ; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header) + 1 ; LinkCount++) {
- ShellPrintHiiEx(
- -1, -1, NULL,
+ for (LinkCount = 0; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX (Header) + 1; LinkCount++) {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_DPA2),
gShellDebug1HiiHandle,
LinkCount+1,
Header->DpaPowerAllocationArray[LinkCount]
);
}
+
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION) - 1 + PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION) - 1 + PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX (Header),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5342,35 +5803,41 @@ PrintInterpretedExtendedCompatibilityDynamicPowerAllocation ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityLinkDeclaration (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION *Header;
UINT8 LinkCount;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION*)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION *)HeaderAddress;
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR),
gShellDebug1HiiHandle,
Header->ElementSelfDescription
);
- for (LinkCount = 0 ; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header) ; LinkCount++) {
- ShellPrintHiiEx(
- -1, -1, NULL,
+ for (LinkCount = 0; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT (Header); LinkCount++) {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR2),
gShellDebug1HiiHandle,
LinkCount+1,
Header->LinkEntry[LinkCount]
);
}
+
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION) + (PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header)-1)*sizeof(UINT32),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION) + (PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT (Header)-1)*sizeof (UINT32),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5383,15 +5850,18 @@ PrintInterpretedExtendedCompatibilityLinkDeclaration ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityAer (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_AER),
gShellDebug1HiiHandle,
Header->UncorrectableErrorStatus,
@@ -5415,9 +5885,9 @@ PrintInterpretedExtendedCompatibilityAer ( );
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
}
@@ -5431,16 +5901,19 @@ PrintInterpretedExtendedCompatibilityAer ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityMulticast (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress,
- IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCapPtr
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress,
+ IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCapPtr
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST *Header;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST *)HeaderAddress;
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_MULTICAST),
gShellDebug1HiiHandle,
Header->MultiCastCapability,
@@ -5454,9 +5927,9 @@ PrintInterpretedExtendedCompatibilityMulticast ( DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
@@ -5470,17 +5943,20 @@ PrintInterpretedExtendedCompatibilityMulticast ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityVirtualChannel (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY *Header;
CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC *CapabilityItem;
UINT32 ItemCount;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY*)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY *)HeaderAddress;
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_VC_BASE),
gShellDebug1HiiHandle,
Header->ExtendedVcCount,
@@ -5490,10 +5966,12 @@ PrintInterpretedExtendedCompatibilityVirtualChannel ( Header->PortVcControl,
Header->PortVcStatus
);
- for (ItemCount = 0 ; ItemCount < Header->ExtendedVcCount ; ItemCount++) {
+ for (ItemCount = 0; ItemCount < Header->ExtendedVcCount; ItemCount++) {
CapabilityItem = &Header->Capability[ItemCount];
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_VC_ITEM),
gShellDebug1HiiHandle,
ItemCount+1,
@@ -5506,10 +5984,10 @@ PrintInterpretedExtendedCompatibilityVirtualChannel ( DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY)
+ Header->ExtendedVcCount * sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC),
- (VOID *) (HeaderAddress)
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
@@ -5523,17 +6001,20 @@ PrintInterpretedExtendedCompatibilityVirtualChannel ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityResizeableBar (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR *Header;
- UINT32 ItemCount;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR *Header;
+ UINT32 ItemCount;
- for (ItemCount = 0 ; ItemCount < (UINT32)GET_NUMBER_RESIZABLE_BARS(Header) ; ItemCount++) {
- ShellPrintHiiEx(
- -1, -1, NULL,
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR *)HeaderAddress;
+
+ for (ItemCount = 0; ItemCount < (UINT32)GET_NUMBER_RESIZABLE_BARS (Header); ItemCount++) {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_RESIZE_BAR),
gShellDebug1HiiHandle,
ItemCount+1,
@@ -5544,9 +6025,9 @@ PrintInterpretedExtendedCompatibilityResizeableBar ( DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- (UINT32)GET_NUMBER_RESIZABLE_BARS(Header) * sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ (UINT32)GET_NUMBER_RESIZABLE_BARS (Header) * sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
@@ -5560,15 +6041,18 @@ PrintInterpretedExtendedCompatibilityResizeableBar ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilityTph (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH *Header;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH *)HeaderAddress;
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_TPH),
gShellDebug1HiiHandle,
Header->TphRequesterCapability,
@@ -5576,16 +6060,16 @@ PrintInterpretedExtendedCompatibilityTph ( );
DumpHex (
8,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)Header->TphStTable - (UINT8*)HeadersBaseAddress),
- GET_TPH_TABLE_SIZE(Header),
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)Header->TphStTable - (UINT8 *)HeadersBaseAddress),
+ GET_TPH_TABLE_SIZE (Header),
(VOID *)Header->TphStTable
);
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
- sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH) + GET_TPH_TABLE_SIZE(Header) - sizeof(UINT16),
- (VOID *) (HeaderAddress)
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
+ sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH) + GET_TPH_TABLE_SIZE (Header) - sizeof (UINT16),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
@@ -5600,16 +6084,19 @@ PrintInterpretedExtendedCompatibilityTph ( **/
EFI_STATUS
PrintInterpretedExtendedCompatibilitySecondary (
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress,
- IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCap
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress,
+ IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCap
)
{
- CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE *Header;
- Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE*)HeaderAddress;
+ CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE *Header;
+
+ Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE *)HeaderAddress;
- ShellPrintHiiEx(
- -1, -1, NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_PCI_EXT_CAP_SECONDARY),
gShellDebug1HiiHandle,
Header->LinkControl3.Uint32,
@@ -5617,17 +6104,17 @@ PrintInterpretedExtendedCompatibilitySecondary ( );
DumpHex (
8,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)Header->EqualizationControl - (UINT8*)HeadersBaseAddress),
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)Header->EqualizationControl - (UINT8 *)HeadersBaseAddress),
PciExpressCap->LinkCapability.Bits.MaxLinkWidth * sizeof (PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL),
(VOID *)Header->EqualizationControl
);
DumpHex (
4,
- EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),
+ EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8 *)HeaderAddress - (UINT8 *)HeadersBaseAddress),
sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE) - sizeof (Header->EqualizationControl)
- + PciExpressCap->LinkCapability.Bits.MaxLinkWidth * sizeof (PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL),
- (VOID *) (HeaderAddress)
+ + PciExpressCap->LinkCapability.Bits.MaxLinkWidth * sizeof (PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL),
+ (VOID *)(HeaderAddress)
);
return (EFI_SUCCESS);
@@ -5641,59 +6128,60 @@ PrintInterpretedExtendedCompatibilitySecondary ( @param[in] PciExpressCapPtr The address of the PCIe capabilities structure.
**/
EFI_STATUS
-PrintPciExtendedCapabilityDetails(
- IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress,
- IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
- IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCapPtr
+PrintPciExtendedCapabilityDetails (
+ IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress,
+ IN CONST PCI_EXP_EXT_HDR *HeaderAddress,
+ IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCapPtr
)
{
- switch (HeaderAddress->CapabilityId){
+ switch (HeaderAddress->CapabilityId) {
case PCI_EXPRESS_EXTENDED_CAPABILITY_ADVANCED_ERROR_REPORTING_ID:
- return PrintInterpretedExtendedCompatibilityAer(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityAer (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_CONTROL_ID:
- return PrintInterpretedExtendedCompatibilityLinkControl(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityLinkControl (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_ID:
- return PrintInterpretedExtendedCompatibilityLinkDeclaration(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityLinkDeclaration (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_SERIAL_NUMBER_ID:
- return PrintInterpretedExtendedCompatibilitySerialNumber(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilitySerialNumber (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_POWER_BUDGETING_ID:
- return PrintInterpretedExtendedCompatibilityPowerBudgeting(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityPowerBudgeting (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_ID:
- return PrintInterpretedExtendedCompatibilityAcs(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityAcs (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_LATENCE_TOLERANCE_REPORTING_ID:
- return PrintInterpretedExtendedCompatibilityLatencyToleranceReporting(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityLatencyToleranceReporting (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_ID:
- return PrintInterpretedExtendedCompatibilityAri(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityAri (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_RCRB_HEADER_ID:
- return PrintInterpretedExtendedCompatibilityRcrb(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityRcrb (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_ID:
- return PrintInterpretedExtendedCompatibilityVendorSpecific(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityVendorSpecific (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_ID:
- return PrintInterpretedExtendedCompatibilityDynamicPowerAllocation(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityDynamicPowerAllocation (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_ID:
- return PrintInterpretedExtendedCompatibilityECEA(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityECEA (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_VIRTUAL_CHANNEL_ID:
case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTI_FUNCTION_VIRTUAL_CHANNEL_ID:
- return PrintInterpretedExtendedCompatibilityVirtualChannel(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityVirtualChannel (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTICAST_ID:
//
// should only be present if PCIE_CAP_DEVICEPORT_TYPE(PciExpressCapPtr->PcieCapReg) == 0100b, 0101b, or 0110b
//
- return PrintInterpretedExtendedCompatibilityMulticast(HeaderAddress, HeadersBaseAddress, PciExpressCapPtr);
+ return PrintInterpretedExtendedCompatibilityMulticast (HeaderAddress, HeadersBaseAddress, PciExpressCapPtr);
case PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID:
- return PrintInterpretedExtendedCompatibilityResizeableBar(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityResizeableBar (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_TPH_ID:
- return PrintInterpretedExtendedCompatibilityTph(HeaderAddress, HeadersBaseAddress);
+ return PrintInterpretedExtendedCompatibilityTph (HeaderAddress, HeadersBaseAddress);
case PCI_EXPRESS_EXTENDED_CAPABILITY_SECONDARY_PCIE_ID:
- return PrintInterpretedExtendedCompatibilitySecondary(HeaderAddress, HeadersBaseAddress, PciExpressCapPtr);
+ return PrintInterpretedExtendedCompatibilitySecondary (HeaderAddress, HeadersBaseAddress, PciExpressCapPtr);
default:
- ShellPrintEx (-1, -1,
+ ShellPrintEx (
+ -1,
+ -1,
L"Unknown PCIe extended capability ID (%04xh). No interpretation available.\r\n",
HeaderAddress->CapabilityId
);
return EFI_SUCCESS;
- };
-
+ }
}
/**
@@ -5706,50 +6194,56 @@ PrintPciExtendedCapabilityDetails( **/
VOID
PciExplainPciExpress (
- IN PCI_CAPABILITY_PCIEXP *PciExpressCap,
- IN UINT8 *ExtendedConfigSpace,
- IN UINTN ExtendedConfigSize,
- IN CONST UINT16 ExtendedCapability
+ IN PCI_CAPABILITY_PCIEXP *PciExpressCap,
+ IN UINT8 *ExtendedConfigSpace,
+ IN UINTN ExtendedConfigSize,
+ IN CONST UINT16 ExtendedCapability
)
{
- UINT8 DevicePortType;
- UINTN Index;
- UINT8 *RegAddr;
- UINTN RegValue;
- PCI_EXP_EXT_HDR *ExtHdr;
+ UINT8 DevicePortType;
+ UINTN Index;
+ UINT8 *RegAddr;
+ UINTN RegValue;
+ PCI_EXP_EXT_HDR *ExtHdr;
DevicePortType = (UINT8)PciExpressCap->Capability.Bits.DevicePortType;
ShellPrintEx (-1, -1, L"\r\nPci Express device capability structure:\r\n");
for (Index = 0; PcieExplainList[Index].Type < PcieExplainTypeMax; Index++) {
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
return;
}
- RegAddr = (UINT8 *) PciExpressCap + PcieExplainList[Index].Offset;
+
+ RegAddr = (UINT8 *)PciExpressCap + PcieExplainList[Index].Offset;
switch (PcieExplainList[Index].Width) {
case FieldWidthUINT8:
- RegValue = *(UINT8 *) RegAddr;
+ RegValue = *(UINT8 *)RegAddr;
break;
case FieldWidthUINT16:
- RegValue = *(UINT16 *) RegAddr;
+ RegValue = *(UINT16 *)RegAddr;
break;
case FieldWidthUINT32:
- RegValue = *(UINT32 *) RegAddr;
+ RegValue = *(UINT32 *)RegAddr;
break;
default:
RegValue = 0;
break;
}
- ShellPrintHiiEx(-1, -1, NULL,
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
PcieExplainList[Index].Token,
gShellDebug1HiiHandle,
PcieExplainList[Index].Offset,
RegValue
- );
+ );
if (PcieExplainList[Index].Func == NULL) {
continue;
}
+
switch (PcieExplainList[Index].Type) {
case PcieExplainTypeLink:
//
@@ -5757,10 +6251,12 @@ PciExplainPciExpress ( // a) Root Complex Integrated Endpoint
// b) Root Complex Event Collector
//
- if (DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT ||
- DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_EVENT_COLLECTOR) {
+ if ((DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT) ||
+ (DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_EVENT_COLLECTOR))
+ {
continue;
}
+
break;
case PcieExplainTypeSlot:
//
@@ -5769,11 +6265,13 @@ PciExplainPciExpress ( // b) Downstream Port of PCI Express Switch
// and when SlotImplemented bit is set in PCIE cap register.
//
- if ((DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_PORT &&
- DevicePortType != PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT) ||
- !PciExpressCap->Capability.Bits.SlotImplemented) {
+ if (((DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_PORT) &&
+ (DevicePortType != PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT)) ||
+ !PciExpressCap->Capability.Bits.SlotImplemented)
+ {
continue;
}
+
break;
case PcieExplainTypeRoot:
//
@@ -5783,31 +6281,34 @@ PciExplainPciExpress ( if (DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_PORT) {
continue;
}
+
break;
default:
break;
}
+
PcieExplainList[Index].Func (PciExpressCap);
}
- ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
+ ExtHdr = (PCI_EXP_EXT_HDR *)ExtendedConfigSpace;
while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && ExtHdr->CapabilityId != 0xFFFF) {
//
// Process this item
//
- if (ExtendedCapability == 0xFFFF || ExtendedCapability == ExtHdr->CapabilityId) {
+ if ((ExtendedCapability == 0xFFFF) || (ExtendedCapability == ExtHdr->CapabilityId)) {
//
// Print this item
//
- PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR*)ExtendedConfigSpace, ExtHdr, PciExpressCap);
+ PrintPciExtendedCapabilityDetails ((PCI_EXP_EXT_HDR *)ExtendedConfigSpace, ExtHdr, PciExpressCap);
}
//
// Advance to the next item if it exists
//
- if (ExtHdr->NextCapabilityOffset != 0 &&
- (ExtHdr->NextCapabilityOffset <= (UINT32) (ExtendedConfigSize + EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR)))) {
- ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
+ if ((ExtHdr->NextCapabilityOffset != 0) &&
+ (ExtHdr->NextCapabilityOffset <= (UINT32)(ExtendedConfigSize + EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR))))
+ {
+ ExtHdr = (PCI_EXP_EXT_HDR *)(ExtendedConfigSpace + ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
} else {
break;
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h index 6e423d521e..d2896675bf 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h @@ -17,7 +17,7 @@ typedef enum { PciUndefined
} PCI_HEADER_TYPE;
-#define INDEX_OF(Field) ((UINT8 *) (Field) - (UINT8 *) mConfigSpace)
+#define INDEX_OF(Field) ((UINT8 *) (Field) - (UINT8 *) mConfigSpace)
#define IS_PCIE_ENDPOINT(DevicePortType) \
((DevicePortType) == PCIE_DEVICE_PORT_TYPE_PCIE_ENDPOINT || \
@@ -33,24 +33,24 @@ typedef enum { // Data region after PCI configuration header(for cardbus bridge)
//
typedef struct {
- UINT16 SubVendorId; // Subsystem Vendor ID
- UINT16 SubSystemId; // Subsystem ID
- UINT32 LegacyBase; // Optional 16-Bit PC Card Legacy
+ UINT16 SubVendorId; // Subsystem Vendor ID
+ UINT16 SubSystemId; // Subsystem ID
+ UINT32 LegacyBase; // Optional 16-Bit PC Card Legacy
// Mode Base Address
//
- UINT32 Data[46];
+ UINT32 Data[46];
} PCI_CARDBUS_DATA;
typedef union {
- PCI_DEVICE_HEADER_TYPE_REGION Device;
- PCI_BRIDGE_CONTROL_REGISTER Bridge;
- PCI_CARDBUS_CONTROL_REGISTER CardBus;
+ PCI_DEVICE_HEADER_TYPE_REGION Device;
+ PCI_BRIDGE_CONTROL_REGISTER Bridge;
+ PCI_CARDBUS_CONTROL_REGISTER CardBus;
} NON_COMMON_UNION;
typedef struct {
- PCI_DEVICE_INDEPENDENT_REGION Common;
- NON_COMMON_UNION NonCommon;
- UINT32 Data[48];
+ PCI_DEVICE_INDEPENDENT_REGION Common;
+ NON_COMMON_UNION NonCommon;
+ UINT32 Data[48];
} PCI_CONFIG_SPACE;
#pragma pack()
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c index eb415a3f16..99cc448942 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c @@ -24,8 +24,8 @@ **/
SHELL_STATUS
DisplaySettings (
- IN UINTN HandleIdx,
- IN BOOLEAN HandleValid
+ IN UINTN HandleIdx,
+ IN BOOLEAN HandleValid
)
{
EFI_SERIAL_IO_PROTOCOL *SerialIo;
@@ -37,88 +37,89 @@ DisplaySettings ( CHAR16 Parity;
SHELL_STATUS ShellStatus;
- Handles = NULL;
- StopBits = NULL;
+ Handles = NULL;
+ StopBits = NULL;
ShellStatus = SHELL_SUCCESS;
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles);
+ Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles);
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode");
return SHELL_INVALID_PARAMETER;
}
for (Index = 0; Index < NoHandles; Index++) {
if (HandleValid) {
- if (ConvertHandleIndexToHandle(HandleIdx) != Handles[Index]) {
+ if (ConvertHandleIndexToHandle (HandleIdx) != Handles[Index]) {
continue;
}
}
- Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID**)&SerialIo);
+ Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID **)&SerialIo);
if (!EFI_ERROR (Status)) {
switch (SerialIo->Mode->Parity) {
- case DefaultParity:
+ case DefaultParity:
- Parity = 'D';
- break;
+ Parity = 'D';
+ break;
- case NoParity:
+ case NoParity:
- Parity = 'N';
- break;
+ Parity = 'N';
+ break;
- case EvenParity:
+ case EvenParity:
- Parity = 'E';
- break;
+ Parity = 'E';
+ break;
- case OddParity:
+ case OddParity:
- Parity = 'O';
- break;
+ Parity = 'O';
+ break;
- case MarkParity:
+ case MarkParity:
- Parity = 'M';
- break;
+ Parity = 'M';
+ break;
- case SpaceParity:
+ case SpaceParity:
- Parity = 'S';
- break;
+ Parity = 'S';
+ break;
- default:
+ default:
- Parity = 'U';
+ Parity = 'U';
}
switch (SerialIo->Mode->StopBits) {
- case DefaultStopBits:
+ case DefaultStopBits:
- StopBits = L"Default";
- break;
+ StopBits = L"Default";
+ break;
- case OneStopBit:
+ case OneStopBit:
- StopBits = L"1";
- break;
+ StopBits = L"1";
+ break;
- case TwoStopBits:
+ case TwoStopBits:
- StopBits = L"2";
- break;
+ StopBits = L"2";
+ break;
- case OneFiveStopBits:
+ case OneFiveStopBits:
- StopBits = L"1.5";
- break;
+ StopBits = L"1.5";
+ break;
- default:
+ default:
- StopBits = L"Unknown";
+ StopBits = L"Unknown";
}
- ShellPrintHiiEx(
+
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -130,9 +131,9 @@ DisplaySettings ( Parity,
SerialIo->Mode->DataBits,
StopBits
- );
+ );
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode");
ShellStatus = SHELL_NOT_FOUND;
break;
}
@@ -143,8 +144,8 @@ DisplaySettings ( }
if (Index == NoHandles) {
- if ((NoHandles != 0 && HandleValid) || 0 == NoHandles) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NOT_FOUND), gShellDebug1HiiHandle, L"sermode");
+ if (((NoHandles != 0) && HandleValid) || (0 == NoHandles)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NOT_FOUND), gShellDebug1HiiHandle, L"sermode");
ShellStatus = SHELL_NOT_FOUND;
}
}
@@ -191,27 +192,27 @@ ShellCommandRunSerMode ( Package = NULL;
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"sermode", 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"sermode", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetCount(Package) < 6 && ShellCommandLineGetCount(Package) > 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"sermode");
+ if ((ShellCommandLineGetCount (Package) < 6) && (ShellCommandLineGetCount (Package) > 2)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"sermode");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) > 6) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"sermode");
+ } else if (ShellCommandLineGetCount (Package) > 6) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"sermode");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Temp = ShellCommandLineGetRawValue(Package, 1);
+ Temp = ShellCommandLineGetRawValue (Package, 1);
if (Temp != NULL) {
- Status = ShellConvertStringToUint64(Temp, &Intermediate, TRUE, FALSE);
+ Status = ShellConvertStringToUint64 (Temp, &Intermediate, TRUE, FALSE);
HandleIdx = (UINTN)Intermediate;
- Temp = ShellCommandLineGetRawValue(Package, 2);
+ Temp = ShellCommandLineGetRawValue (Package, 2);
if (Temp == NULL) {
ShellStatus = DisplaySettings (HandleIdx, TRUE);
goto Done;
@@ -220,95 +221,101 @@ ShellCommandRunSerMode ( ShellStatus = DisplaySettings (0, FALSE);
goto Done;
}
- Temp = ShellCommandLineGetRawValue(Package, 2);
+
+ Temp = ShellCommandLineGetRawValue (Package, 2);
if (Temp != NULL) {
- BaudRate = ShellStrToUintn(Temp);
+ BaudRate = ShellStrToUintn (Temp);
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
BaudRate = 0;
}
- Temp = ShellCommandLineGetRawValue(Package, 3);
- if (Temp == NULL || StrLen(Temp)>1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp);
+
+ Temp = ShellCommandLineGetRawValue (Package, 3);
+ if ((Temp == NULL) || (StrLen (Temp) > 1)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- switch(Temp[0]){
- case 'd':
- case 'D':
- Parity = DefaultParity;
- break;
- case 'n':
- case 'N':
- Parity = NoParity;
- break;
- case 'e':
- case 'E':
- Parity = EvenParity;
- break;
- case 'o':
- case 'O':
- Parity = OddParity;
- break;
- case 'm':
- case 'M':
- Parity = MarkParity;
- break;
- case 's':
- case 'S':
- Parity = SpaceParity;
- break;
- default:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp);
- ShellStatus = SHELL_INVALID_PARAMETER;
- goto Done;
+ switch (Temp[0]) {
+ case 'd':
+ case 'D':
+ Parity = DefaultParity;
+ break;
+ case 'n':
+ case 'N':
+ Parity = NoParity;
+ break;
+ case 'e':
+ case 'E':
+ Parity = EvenParity;
+ break;
+ case 'o':
+ case 'O':
+ Parity = OddParity;
+ break;
+ case 'm':
+ case 'M':
+ Parity = MarkParity;
+ break;
+ case 's':
+ case 'S':
+ Parity = SpaceParity;
+ break;
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto Done;
}
}
- Temp = ShellCommandLineGetRawValue(Package, 4);
+
+ Temp = ShellCommandLineGetRawValue (Package, 4);
if (Temp != NULL) {
- DataBits = ShellStrToUintn(Temp);
+ DataBits = ShellStrToUintn (Temp);
} else {
//
// make sure this is some number not in the list below.
//
DataBits = 0;
}
+
switch (DataBits) {
- case 4:
- case 7:
- case 8:
- break;
- default:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp);
- ShellStatus = SHELL_INVALID_PARAMETER;
- goto Done;
+ case 4:
+ case 7:
+ case 8:
+ break;
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto Done;
}
- Temp = ShellCommandLineGetRawValue(Package, 5);
- Value = ShellStrToUintn(Temp);
+
+ Temp = ShellCommandLineGetRawValue (Package, 5);
+ Value = ShellStrToUintn (Temp);
switch (Value) {
- case 0:
- StopBits = DefaultStopBits;
- break;
+ case 0:
+ StopBits = DefaultStopBits;
+ break;
- case 1:
- StopBits = OneStopBit;
- break;
+ case 1:
+ StopBits = OneStopBit;
+ break;
- case 2:
- StopBits = TwoStopBits;
- break;
+ case 2:
+ StopBits = TwoStopBits;
+ break;
- case 15:
- StopBits = OneFiveStopBits;
- break;
+ case 15:
+ StopBits = OneFiveStopBits;
+ break;
- default:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp);
- ShellStatus = SHELL_INVALID_PARAMETER;
- goto Done;
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"sermode", Temp);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto Done;
}
- Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles);
+
+ Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles);
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle, L"sermode");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
@@ -318,39 +325,40 @@ ShellCommandRunSerMode ( continue;
}
- Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID**)&SerialIo);
+ Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID **)&SerialIo);
if (!EFI_ERROR (Status)) {
Status = SerialIo->SetAttributes (
- SerialIo,
- (UINT64) BaudRate,
- SerialIo->Mode->ReceiveFifoDepth,
- SerialIo->Mode->Timeout,
- Parity,
- (UINT8) DataBits,
- StopBits
- );
+ SerialIo,
+ (UINT64)BaudRate,
+ SerialIo->Mode->ReceiveFifoDepth,
+ SerialIo->Mode->Timeout,
+ Parity,
+ (UINT8)DataBits,
+ StopBits
+ );
if (EFI_ERROR (Status)) {
if (Status == EFI_INVALID_PARAMETER) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_UNSUPPORTED), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index]));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_UNSUPPORTED), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex (Handles[Index]));
ShellStatus = SHELL_UNSUPPORTED;
} else if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_DEV_ERROR), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index]));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_DEV_ERROR), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex (Handles[Index]));
ShellStatus = SHELL_ACCESS_DENIED;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_FAIL), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index]));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_FAIL), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex (Handles[Index]));
ShellStatus = SHELL_ACCESS_DENIED;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_HANDLE), gShellDebug1HiiHandle, ConvertHandleToHandleIndex(Handles[Index]));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_HANDLE), gShellDebug1HiiHandle, ConvertHandleToHandleIndex (Handles[Index]));
}
+
break;
}
}
}
}
- if (ShellStatus == SHELL_SUCCESS && Index == NoHandles) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_BAD_HANDLE), gShellDebug1HiiHandle, L"sermode", HandleIdx);
+ if ((ShellStatus == SHELL_SUCCESS) && (Index == NoHandles)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SERMODE_BAD_HANDLE), gShellDebug1HiiHandle, L"sermode", HandleIdx);
ShellStatus = SHELL_INVALID_PARAMETER;
}
@@ -358,8 +366,10 @@ Done: if (Package != NULL) {
ShellCommandLineFreeVarList (Package);
}
+
if (Handles != NULL) {
FreePool (Handles);
}
+
return ShellStatus;
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetSize.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetSize.c index 9c1fa72c64..e5bacde638 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetSize.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetSize.c @@ -22,78 +22,81 @@ ShellCommandRunSetSize ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Temp1;
- UINTN NewSize;
- UINTN LoopVar;
- SHELL_FILE_HANDLE FileHandle;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Temp1;
+ UINTN NewSize;
+ UINTN LoopVar;
+ SHELL_FILE_HANDLE FileHandle;
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
//
// 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"setsize", 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"setsize", 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_FEW), gShellDebug1HiiHandle, L"setsize");
+ if (ShellCommandLineGetCount (Package) < 3) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"setsize");
ShellStatus = SHELL_INVALID_PARAMETER;
- NewSize = 0;
+ NewSize = 0;
} else {
- Temp1 = ShellCommandLineGetRawValue(Package, 1);
- if (!ShellIsHexOrDecimalNumber(Temp1, FALSE, FALSE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SIZE_NOT_SPEC), gShellDebug1HiiHandle, L"setsize");
+ Temp1 = ShellCommandLineGetRawValue (Package, 1);
+ if (!ShellIsHexOrDecimalNumber (Temp1, FALSE, FALSE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SIZE_NOT_SPEC), gShellDebug1HiiHandle, L"setsize");
ShellStatus = SHELL_INVALID_PARAMETER;
- NewSize = 0;
+ NewSize = 0;
} else {
- NewSize = ShellStrToUintn(Temp1);
+ NewSize = ShellStrToUintn (Temp1);
}
}
- for (LoopVar = 2 ; LoopVar < ShellCommandLineGetCount(Package) && ShellStatus == SHELL_SUCCESS ; LoopVar++) {
- Status = ShellOpenFileByName(ShellCommandLineGetRawValue(Package, LoopVar), &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
- if (EFI_ERROR(Status)) {
- Status = ShellOpenFileByName(ShellCommandLineGetRawValue(Package, LoopVar), &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
+
+ for (LoopVar = 2; LoopVar < ShellCommandLineGetCount (Package) && ShellStatus == SHELL_SUCCESS; LoopVar++) {
+ Status = ShellOpenFileByName (ShellCommandLineGetRawValue (Package, LoopVar), &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
+ if (EFI_ERROR (Status)) {
+ Status = ShellOpenFileByName (ShellCommandLineGetRawValue (Package, LoopVar), &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
}
- if (EFI_ERROR(Status) && LoopVar == 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle, L"setsize");
+
+ if (EFI_ERROR (Status) && (LoopVar == 2)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle, L"setsize");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"setsize", ShellCommandLineGetRawValue(Package, LoopVar));
+ } else if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"setsize", ShellCommandLineGetRawValue (Package, LoopVar));
ShellStatus = SHELL_INVALID_PARAMETER;
break;
} else {
- Status = FileHandleSetSize(FileHandle, NewSize);
+ Status = FileHandleSetSize (FileHandle, NewSize);
if (Status == EFI_VOLUME_FULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_VOLUME_FULL), gShellDebug1HiiHandle, L"setsize");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VOLUME_FULL), gShellDebug1HiiHandle, L"setsize");
ShellStatus = SHELL_VOLUME_FULL;
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_SIZE_FAIL), gShellDebug1HiiHandle, L"setsize", ShellCommandLineGetRawValue(Package, LoopVar));
+ } else if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_SIZE_FAIL), gShellDebug1HiiHandle, L"setsize", ShellCommandLineGetRawValue (Package, LoopVar));
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_SIZE_DONE), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, LoopVar));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_SIZE_DONE), gShellDebug1HiiHandle, ShellCommandLineGetRawValue (Package, LoopVar));
}
- ShellCloseFile(&FileHandle);
+
+ ShellCloseFile (&FileHandle);
}
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c index 015d842abe..61788d1993 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c @@ -9,21 +9,21 @@ #include "UefiShellDebug1CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-guid", TypeValue},
- {L"-bs", TypeFlag},
- {L"-rt", TypeFlag},
- {L"-nv", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-guid", TypeValue },
+ { L"-bs", TypeFlag },
+ { L"-rt", TypeFlag },
+ { L"-nv", TypeFlag },
+ { NULL, TypeMax }
+};
typedef enum {
- DataTypeHexNumber = 0,
- DataTypeHexArray = 1,
- DataTypeAscii = 2,
- DataTypeUnicode = 3,
- DataTypeDevicePath = 4,
- DataTypeUnKnow = 5
+ DataTypeHexNumber = 0,
+ DataTypeHexArray = 1,
+ DataTypeAscii = 2,
+ DataTypeUnicode = 3,
+ DataTypeDevicePath = 4,
+ DataTypeUnKnow = 5
} DATA_TYPE;
typedef union {
@@ -49,13 +49,14 @@ IsStringOfHexNibbles ( IN CONST CHAR16 *String
)
{
- CONST CHAR16 *Pos;
+ CONST CHAR16 *Pos;
for (Pos = String; *Pos != L'\0'; ++Pos) {
if (!ShellIsHexaDecimalDigitCharacter (*Pos)) {
return FALSE;
}
}
+
return TRUE;
}
@@ -71,14 +72,14 @@ TestDataType ( IN CONST CHAR16 *Data
)
{
- if (Data[0] == L'0' && (Data[1] == L'x' || Data[1] == L'X')) {
- if (IsStringOfHexNibbles (Data+2) && StrLen (Data + 2) <= 16) {
+ if ((Data[0] == L'0') && ((Data[1] == L'x') || (Data[1] == L'X'))) {
+ if (IsStringOfHexNibbles (Data+2) && (StrLen (Data + 2) <= 16)) {
return DataTypeHexNumber;
} else {
return DataTypeUnKnow;
}
} else if (Data[0] == L'H') {
- if (IsStringOfHexNibbles (Data + 1) && StrLen (Data + 1) % 2 == 0) {
+ if (IsStringOfHexNibbles (Data + 1) && (StrLen (Data + 1) % 2 == 0)) {
return DataTypeHexArray;
} else {
return DataTypeUnKnow;
@@ -87,11 +88,11 @@ TestDataType ( return DataTypeAscii;
} else if (Data[0] == L'L') {
return DataTypeUnicode;
- } else if (Data[0] == L'P' || StrnCmp (Data, L"--", 2) == 0) {
+ } else if ((Data[0] == L'P') || (StrnCmp (Data, L"--", 2) == 0)) {
return DataTypeDevicePath;
}
- if (IsStringOfHexNibbles (Data) && StrLen (Data) % 2 == 0) {
+ if (IsStringOfHexNibbles (Data) && (StrLen (Data) % 2 == 0)) {
return DataTypeHexArray;
}
@@ -114,9 +115,9 @@ TestDataType ( **/
EFI_STATUS
ParseParameterData (
- IN CONST CHAR16 *Data,
- OUT VOID *Buffer,
- IN OUT UINTN *BufferSize
+ IN CONST CHAR16 *Data,
+ OUT VOID *Buffer,
+ IN OUT UINTN *BufferSize
)
{
UINT64 HexNumber;
@@ -127,14 +128,14 @@ ParseParameterData ( EFI_DEVICE_PATH_PROTOCOL *DevPath;
EFI_STATUS Status;
- HexNumber = 0;
- HexNumberLen = 0;
- Size = 0;
- AsciiBuffer = NULL;
- DevPath = NULL;
- Status = EFI_SUCCESS;
+ HexNumber = 0;
+ HexNumberLen = 0;
+ Size = 0;
+ AsciiBuffer = NULL;
+ DevPath = NULL;
+ Status = EFI_SUCCESS;
- if (Data == NULL || BufferSize == NULL) {
+ if ((Data == NULL) || (BufferSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -145,20 +146,22 @@ ParseParameterData ( //
StrHexToUint64S (Data + 2, NULL, &HexNumber);
HexNumberLen = StrLen (Data + 2);
- if (HexNumberLen >= 1 && HexNumberLen <= 2) {
+ if ((HexNumberLen >= 1) && (HexNumberLen <= 2)) {
Size = 1;
- } else if (HexNumberLen >= 3 && HexNumberLen <= 4) {
+ } else if ((HexNumberLen >= 3) && (HexNumberLen <= 4)) {
Size = 2;
- } else if (HexNumberLen >= 5 && HexNumberLen <= 8) {
+ } else if ((HexNumberLen >= 5) && (HexNumberLen <= 8)) {
Size = 4;
- } else if (HexNumberLen >= 9 && HexNumberLen <= 16) {
+ } else if ((HexNumberLen >= 9) && (HexNumberLen <= 16)) {
Size = 8;
}
- if (Buffer != NULL && *BufferSize >= Size) {
- CopyMem(Buffer, (VOID *)&HexNumber, Size);
+
+ if ((Buffer != NULL) && (*BufferSize >= Size)) {
+ CopyMem (Buffer, (VOID *)&HexNumber, Size);
} else {
Status = EFI_BUFFER_TOO_SMALL;
}
+
*BufferSize = Size;
} else if (DataType == DataTypeHexArray) {
//
@@ -169,11 +172,12 @@ ParseParameterData ( }
Size = StrLen (Data) / 2;
- if (Buffer != NULL && *BufferSize >= Size) {
- StrHexToBytes(Data, StrLen (Data), (UINT8 *)Buffer, Size);
+ if ((Buffer != NULL) && (*BufferSize >= Size)) {
+ StrHexToBytes (Data, StrLen (Data), (UINT8 *)Buffer, Size);
} else {
Status = EFI_BUFFER_TOO_SMALL;
}
+
*BufferSize = Size;
} else if (DataType == DataTypeAscii) {
//
@@ -182,6 +186,7 @@ ParseParameterData ( if (*Data == L'S') {
Data = Data + 1;
}
+
AsciiBuffer = AllocateZeroPool (StrSize (Data) / 2);
if (AsciiBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -189,13 +194,15 @@ ParseParameterData ( AsciiSPrint (AsciiBuffer, StrSize (Data) / 2, "%s", (CHAR8 *)Data);
Size = StrSize (Data) / 2 - 1;
- if (Buffer != NULL && *BufferSize >= Size) {
+ if ((Buffer != NULL) && (*BufferSize >= Size)) {
CopyMem (Buffer, AsciiBuffer, Size);
} else {
Status = EFI_BUFFER_TOO_SMALL;
}
+
*BufferSize = Size;
}
+
SHELL_FREE_NON_NULL (AsciiBuffer);
} else if (DataType == DataTypeUnicode) {
//
@@ -204,12 +211,14 @@ ParseParameterData ( if (*Data == L'L') {
Data = Data + 1;
}
+
Size = StrSize (Data) - sizeof (CHAR16);
- if (Buffer != NULL && *BufferSize >= Size) {
+ if ((Buffer != NULL) && (*BufferSize >= Size)) {
CopyMem (Buffer, Data, Size);
} else {
Status = EFI_BUFFER_TOO_SMALL;
}
+
*BufferSize = Size;
} else if (DataType == DataTypeDevicePath) {
if (*Data == L'P') {
@@ -217,19 +226,22 @@ ParseParameterData ( } else if (StrnCmp (Data, L"--", 2) == 0) {
Data = Data + 2;
}
+
DevPath = ConvertTextToDevicePath (Data);
if (DevPath == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_DPFT), gShellDebug1HiiHandle, L"setvar");
Status = EFI_INVALID_PARAMETER;
} else {
Size = GetDevicePathSize (DevPath);
- if (Buffer != NULL && *BufferSize >= Size) {
+ if ((Buffer != NULL) && (*BufferSize >= Size)) {
CopyMem (Buffer, DevPath, Size);
} else {
Status = EFI_BUFFER_TOO_SMALL;
}
+
*BufferSize = Size;
}
+
SHELL_FREE_NON_NULL (DevPath);
} else {
Status = EFI_INVALID_PARAMETER;
@@ -251,23 +263,23 @@ ParseParameterData ( **/
EFI_STATUS
GetVariableDataFromParameter (
- IN CONST LIST_ENTRY *Package,
- OUT UINT8 **Buffer,
- OUT UINTN *BufferSize
+ IN CONST LIST_ENTRY *Package,
+ OUT UINT8 **Buffer,
+ OUT UINTN *BufferSize
)
{
- CONST CHAR16 *TempData;
- UINTN Index;
- UINTN TotalSize;
- UINTN Size;
- UINT8 *BufferWalker;
- EFI_STATUS Status;
-
- TotalSize = 0;
- Size = 0;
- Status = EFI_SUCCESS;
-
- if (BufferSize == NULL || Buffer == NULL || ShellCommandLineGetCount (Package) < 3) {
+ CONST CHAR16 *TempData;
+ UINTN Index;
+ UINTN TotalSize;
+ UINTN Size;
+ UINT8 *BufferWalker;
+ EFI_STATUS Status;
+
+ TotalSize = 0;
+ Size = 0;
+ Status = EFI_SUCCESS;
+
+ if ((BufferSize == NULL) || (Buffer == NULL) || (ShellCommandLineGetCount (Package) < 3)) {
return EFI_INVALID_PARAMETER;
}
@@ -281,8 +293,8 @@ GetVariableDataFromParameter ( }
TempData = TempData + 1;
- Size = 0;
- Status = ParseParameterData (TempData, NULL, &Size);
+ Size = 0;
+ Status = ParseParameterData (TempData, NULL, &Size);
if (EFI_ERROR (Status)) {
if (Status == EFI_BUFFER_TOO_SMALL) {
//
@@ -295,13 +307,14 @@ GetVariableDataFromParameter ( } else if (Status == EFI_NOT_FOUND) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_DPFT), gShellDebug1HiiHandle, L"setvar");
}
+
return Status;
}
}
}
*BufferSize = TotalSize;
- *Buffer = AllocateZeroPool (TotalSize);
+ *Buffer = AllocateZeroPool (TotalSize);
if (*Buffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -311,11 +324,11 @@ GetVariableDataFromParameter ( TempData = ShellCommandLineGetRawValue (Package, Index);
TempData = TempData + 1;
- Size = TotalSize;
+ Size = TotalSize;
Status = ParseParameterData (TempData, (VOID *)BufferWalker, &Size);
if (!EFI_ERROR (Status)) {
BufferWalker = BufferWalker + Size;
- TotalSize = TotalSize - Size;
+ TotalSize = TotalSize - Size;
} else {
return Status;
}
@@ -338,131 +351,139 @@ ShellCommandRunSetVar ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- RETURN_STATUS RStatus;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *VariableName;
- EFI_GUID Guid;
- CONST CHAR16 *StringGuid;
- UINT32 Attributes;
- VOID *Buffer;
- UINTN Size;
- UINTN LoopVar;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- Buffer = NULL;
- Size = 0;
- Attributes = 0;
+ EFI_STATUS Status;
+ RETURN_STATUS RStatus;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *VariableName;
+ EFI_GUID Guid;
+ CONST CHAR16 *StringGuid;
+ UINT32 Attributes;
+ VOID *Buffer;
+ UINTN Size;
+ UINTN LoopVar;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ Buffer = NULL;
+ Size = 0;
+ Attributes = 0;
//
// 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"setvar", 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"setvar", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
- } else if (ShellCommandLineCheckDuplicate (Package,&ProblemParam) != EFI_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DUPLICATE), gShellDebug1HiiHandle, L"setvar", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
+ } else if (ShellCommandLineCheckDuplicate (Package, &ProblemParam) != EFI_SUCCESS) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_DUPLICATE), gShellDebug1HiiHandle, L"setvar", ProblemParam);
+ FreePool (ProblemParam);
+ ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- if (ShellCommandLineGetCount(Package) < 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"setvar");
+ if (ShellCommandLineGetCount (Package) < 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"setvar");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- VariableName = ShellCommandLineGetRawValue(Package, 1);
- if (!ShellCommandLineGetFlag(Package, L"-guid")){
- CopyGuid(&Guid, &gEfiGlobalVariableGuid);
+ VariableName = ShellCommandLineGetRawValue (Package, 1);
+ if (!ShellCommandLineGetFlag (Package, L"-guid")) {
+ CopyGuid (&Guid, &gEfiGlobalVariableGuid);
} else {
- StringGuid = ShellCommandLineGetValue(Package, L"-guid");
- RStatus = StrToGuid (StringGuid, &Guid);
+ StringGuid = ShellCommandLineGetValue (Package, L"-guid");
+ RStatus = StrToGuid (StringGuid, &Guid);
if (RETURN_ERROR (RStatus) || (StringGuid[GUID_STRING_LENGTH] != L'\0')) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"setvar", StringGuid);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"setvar", StringGuid);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
- if (ShellCommandLineGetCount(Package) == 2) {
+ if (ShellCommandLineGetCount (Package) == 2) {
//
// Display
//
- Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer);
+ Status = gRT->GetVariable ((CHAR16 *)VariableName, &Guid, &Attributes, &Size, Buffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
- Buffer = AllocateZeroPool(Size);
- Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer);
+ Buffer = AllocateZeroPool (Size);
+ Status = gRT->GetVariable ((CHAR16 *)VariableName, &Guid, &Attributes, &Size, Buffer);
}
- if (!EFI_ERROR(Status) && Buffer != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_SETVAR_PRINT), gShellDebug1HiiHandle, &Guid, VariableName, Size);
+
+ if (!EFI_ERROR (Status) && (Buffer != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SETVAR_PRINT), gShellDebug1HiiHandle, &Guid, VariableName, Size);
for (LoopVar = 0; LoopVar < Size; LoopVar++) {
- ShellPrintEx(-1, -1, L"%02x ", ((UINT8*)Buffer)[LoopVar]);
+ ShellPrintEx (-1, -1, L"%02x ", ((UINT8 *)Buffer)[LoopVar]);
}
- ShellPrintEx(-1, -1, L"\r\n");
+
+ ShellPrintEx (-1, -1, L"\r\n");
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_GET), gShellDebug1HiiHandle, L"setvar", &Guid, VariableName);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_GET), gShellDebug1HiiHandle, L"setvar", &Guid, VariableName);
ShellStatus = SHELL_ACCESS_DENIED;
}
} else {
//
// Create, Delete or Modify.
//
- Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer);
+ Status = gRT->GetVariable ((CHAR16 *)VariableName, &Guid, &Attributes, &Size, Buffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
- Buffer = AllocateZeroPool(Size);
- Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer);
+ Buffer = AllocateZeroPool (Size);
+ Status = gRT->GetVariable ((CHAR16 *)VariableName, &Guid, &Attributes, &Size, Buffer);
}
- if (EFI_ERROR(Status) || Buffer == NULL) {
+
+ if (EFI_ERROR (Status) || (Buffer == NULL)) {
//
// Creating a new variable. determine attributes from command line.
//
Attributes = 0;
- if (ShellCommandLineGetFlag(Package, L"-bs")) {
+ if (ShellCommandLineGetFlag (Package, L"-bs")) {
Attributes |= EFI_VARIABLE_BOOTSERVICE_ACCESS;
}
- if (ShellCommandLineGetFlag(Package, L"-rt")) {
+
+ if (ShellCommandLineGetFlag (Package, L"-rt")) {
Attributes |= EFI_VARIABLE_RUNTIME_ACCESS |
EFI_VARIABLE_BOOTSERVICE_ACCESS;
}
- if (ShellCommandLineGetFlag(Package, L"-nv")) {
+
+ if (ShellCommandLineGetFlag (Package, L"-nv")) {
Attributes |= EFI_VARIABLE_NON_VOLATILE;
}
}
- SHELL_FREE_NON_NULL(Buffer);
- Size = 0;
- Status = GetVariableDataFromParameter(Package, (UINT8 **)&Buffer, &Size);
- if (!EFI_ERROR(Status)) {
- Status = gRT->SetVariable((CHAR16*)VariableName, &Guid, Attributes, Size, Buffer);
+ SHELL_FREE_NON_NULL (Buffer);
+
+ Size = 0;
+ Status = GetVariableDataFromParameter (Package, (UINT8 **)&Buffer, &Size);
+ if (!EFI_ERROR (Status)) {
+ Status = gRT->SetVariable ((CHAR16 *)VariableName, &Guid, Attributes, Size, Buffer);
}
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_SETVAR_ERROR_SET), gShellDebug1HiiHandle, L"setvar", &Guid, VariableName);
+
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_SET), gShellDebug1HiiHandle, L"setvar", &Guid, VariableName);
ShellStatus = SHELL_ACCESS_DENIED;
} else {
- ASSERT(ShellStatus == SHELL_SUCCESS);
+ ASSERT (ShellStatus == SHELL_SUCCESS);
}
}
}
+
ShellCommandLineFreeVarList (Package);
}
if (Buffer != NULL) {
- FreePool(Buffer);
+ FreePool (Buffer);
}
return (ShellStatus);
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c index 984c178890..9a38ffddeb 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c @@ -19,46 +19,46 @@ **/
VOID
DisplaySELAccessMethod (
- IN CONST UINT8 Key,
- IN CONST UINT8 Option
+ IN CONST UINT8 Key,
+ IN CONST UINT8 Option
)
{
//
// Print prompt
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
//
// Print value info
//
switch (Key) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT), gShellDebug1HiiHandle);
- break;
-
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS), gShellDebug1HiiHandle);
- break;
-
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT), gShellDebug1HiiHandle);
- break;
-
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS), gShellDebug1HiiHandle);
- break;
-
- case 4:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL), gShellDebug1HiiHandle);
- break;
-
- default:
- if (Key <= 0x7f) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);
- } else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM), gShellDebug1HiiHandle);
- }
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT), gShellDebug1HiiHandle);
+ break;
+
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS), gShellDebug1HiiHandle);
+ break;
+
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT), gShellDebug1HiiHandle);
+ break;
+
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS), gShellDebug1HiiHandle);
+ break;
+
+ case 4:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL), gShellDebug1HiiHandle);
+ break;
+
+ default:
+ if (Key <= 0x7f) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM), gShellDebug1HiiHandle);
+ }
}
}
@@ -70,33 +70,33 @@ DisplaySELAccessMethod ( **/
VOID
DisplaySELLogStatus (
- UINT8 Key,
- UINT8 Option
+ UINT8 Key,
+ UINT8 Option
)
{
//
// Print prompt
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
//
// Print value info
//
if ((Key & 0x01) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);
}
if ((Key & 0x02) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL), gShellDebug1HiiHandle);
}
if ((Key & 0xFC) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO), gShellDebug1HiiHandle, Key & 0xFC);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO), gShellDebug1HiiHandle, Key & 0xFC);
}
}
@@ -108,27 +108,27 @@ DisplaySELLogStatus ( **/
VOID
DisplaySysEventLogHeaderFormat (
- UINT8 Key,
- UINT8 Option
+ UINT8 Key,
+ UINT8 Option
)
{
//
// Print prompt
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
//
// Print value info
//
if (Key == 0x00) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);
} else if (Key == 0x01) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);
} else if (Key <= 0x7f) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);
}
}
@@ -140,23 +140,23 @@ DisplaySysEventLogHeaderFormat ( **/
VOID
DisplaySELLogHeaderLen (
- UINT8 Key,
- UINT8 Option
+ UINT8 Key,
+ UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D), gShellDebug1HiiHandle, Key & 0x7F);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D), gShellDebug1HiiHandle, Key & 0x7F);
//
// The most-significant bit of the field specifies
// whether (0) or not (1) the record has been read
//
if ((Key & 0x80) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ), gShellDebug1HiiHandle);
}
}
@@ -167,19 +167,22 @@ DisplaySELLogHeaderLen ( **/
VOID
DisplaySysEventLogHeaderType1 (
- IN UINT8 *LogHeader
+ IN UINT8 *LogHeader
)
{
- LOG_HEADER_TYPE1_FORMAT *Header;
+ LOG_HEADER_TYPE1_FORMAT *Header;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG), gShellDebug1HiiHandle);
//
// Print Log Header Type1 Format info
//
- Header = (LOG_HEADER_TYPE1_FORMAT *) (LogHeader);
+ Header = (LOG_HEADER_TYPE1_FORMAT *)(LogHeader);
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_OEM_RESERVED),
gShellDebug1HiiHandle,
Header->OEMReserved[0],
@@ -187,21 +190,24 @@ DisplaySysEventLogHeaderType1 ( Header->OEMReserved[2],
Header->OEMReserved[3],
Header->OEMReserved[4]
- );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->Metw);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->Meci);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT), gShellDebug1HiiHandle, Header->ChecksumOffset);
- ShellPrintHiiEx(-1,-1,NULL,
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->Metw);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->Meci);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT), gShellDebug1HiiHandle, Header->ChecksumOffset);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RESERVED),
gShellDebug1HiiHandle,
Header->OEMReserved[0],
Header->OEMReserved[1],
Header->OEMReserved[2]
- );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION), gShellDebug1HiiHandle, Header->HeaderRevision);
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION), gShellDebug1HiiHandle, Header->HeaderRevision);
}
/**
@@ -212,27 +218,27 @@ DisplaySysEventLogHeaderType1 ( **/
VOID
DisplaySysEventLogHeader (
- UINT8 LogHeaderFormat,
- UINT8 *LogHeader
+ UINT8 LogHeaderFormat,
+ UINT8 *LogHeader
)
{
//
// Print prompt
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER), gShellDebug1HiiHandle);
//
// Print value info
//
if (LogHeaderFormat == 0x00) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);
} else if (LogHeaderFormat == 0x01) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);
DisplaySysEventLogHeaderType1 (LogHeader);
} else if (LogHeaderFormat <= 0x7f) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);
}
}
@@ -244,8 +250,8 @@ DisplaySysEventLogHeader ( **/
VOID
DisplayElVdfInfo (
- UINT8 ElVdfType,
- UINT8 *VarData
+ UINT8 ElVdfType,
+ UINT8 *VarData
)
{
UINT16 *Word;
@@ -260,60 +266,60 @@ DisplayElVdfInfo ( // Display Type description
//
switch (ElVdfType) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT), gShellDebug1HiiHandle);
- break;
-
- case 1:
- Word = (UINT16 *) (VarData + 1);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);
- break;
-
- case 2:
- Dword = (UINT32 *) (VarData + 1);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
- break;
-
- case 3:
- Word = (UINT16 *) (VarData + 1);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);
- //
- // Followed by a multiple-event counter
- //
- Dword = (UINT32 *) (VarData + 1);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
- break;
-
- case 4:
- Dword = (UINT32 *) (VarData + 1);
- DisplayPostResultsBitmapDw1 (*Dword, SHOW_DETAIL);
- Dword++;
- DisplayPostResultsBitmapDw2 (*Dword, SHOW_DETAIL);
- break;
-
- case 5:
- Dword = (UINT32 *) (VarData + 1);
- DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);
- break;
-
- case 6:
- Dword = (UINT32 *) (VarData + 1);
- DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);
- //
- // Followed by a multiple-event counter
- //
- Dword = (UINT32 *) (VarData + 1);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
- break;
-
- default:
- if (ElVdfType <= 0x7F) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN), gShellDebug1HiiHandle);
- } else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM), gShellDebug1HiiHandle);
- }
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT), gShellDebug1HiiHandle);
+ break;
+
+ case 1:
+ Word = (UINT16 *)(VarData + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);
+ break;
+
+ case 2:
+ Dword = (UINT32 *)(VarData + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
+ break;
+
+ case 3:
+ Word = (UINT16 *)(VarData + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);
+ //
+ // Followed by a multiple-event counter
+ //
+ Dword = (UINT32 *)(VarData + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
+ break;
+
+ case 4:
+ Dword = (UINT32 *)(VarData + 1);
+ DisplayPostResultsBitmapDw1 (*Dword, SHOW_DETAIL);
+ Dword++;
+ DisplayPostResultsBitmapDw2 (*Dword, SHOW_DETAIL);
+ break;
+
+ case 5:
+ Dword = (UINT32 *)(VarData + 1);
+ DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);
+ break;
+
+ case 6:
+ Dword = (UINT32 *)(VarData + 1);
+ DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);
+ //
+ // Followed by a multiple-event counter
+ //
+ Dword = (UINT32 *)(VarData + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
+ break;
+
+ default:
+ if (ElVdfType <= 0x7F) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN), gShellDebug1HiiHandle);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM), gShellDebug1HiiHandle);
+ }
}
}
@@ -329,25 +335,24 @@ DisplaySysEventLogData ( UINT16 LogAreaLength
)
{
- LOG_RECORD_FORMAT *Log;
- UINT8 ElVdfType;
+ LOG_RECORD_FORMAT *Log;
+ UINT8 ElVdfType;
//
// Event Log Variable Data Format Types
//
- UINTN Offset;
+ UINTN Offset;
//
// Print prompt
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2), gShellDebug1HiiHandle);
//
// Print Log info
//
- Offset = 0;
- Log = (LOG_RECORD_FORMAT *) LogData;
+ Offset = 0;
+ Log = (LOG_RECORD_FORMAT *)LogData;
while (Log != NULL && Log->Type != END_OF_LOG && Offset < LogAreaLength) {
-
if (Log != NULL) {
//
// Display Event Log Record Information
@@ -362,21 +367,24 @@ DisplaySysEventLogData ( // (as read from CMOS) of the occurrence of the event
// So Print as hex and represent decimal
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle);
- if (Log != NULL && Log->Year >= 80 && Log->Year <= 99) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle);
+ if ((Log != NULL) && (Log->Year >= 80) && (Log->Year <= 99)) {
Print (L"19");
- } else if (Log != NULL && Log->Year <= 79) {
+ } else if ((Log != NULL) && (Log->Year <= 79)) {
Print (L"20");
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
//
// Get a Event Log Record
//
- Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
+ Log = (LOG_RECORD_FORMAT *)(LogData + Offset);
continue;
}
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),
gShellDebug1HiiHandle,
Log->Year,
@@ -385,7 +393,7 @@ DisplaySysEventLogData ( Log->Hour,
Log->Minute,
Log->Second
- );
+ );
//
// Display Variable Data Format
@@ -394,7 +402,7 @@ DisplaySysEventLogData ( //
// Get a Event Log Record
//
- Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
+ Log = (LOG_RECORD_FORMAT *)(LogData + Offset);
continue;
}
@@ -403,7 +411,7 @@ DisplaySysEventLogData ( //
// Get a Event Log Record
//
- Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
+ Log = (LOG_RECORD_FORMAT *)(LogData + Offset);
}
}
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h index 0a24ada655..bb26924259 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h @@ -14,28 +14,28 @@ #pragma pack(1)
typedef struct {
- UINT8 Type;
- UINT8 Length;
- UINT8 Year;
- UINT8 Month;
- UINT8 Day;
- UINT8 Hour;
- UINT8 Minute;
- UINT8 Second;
- UINT8 LogVariableData[1];
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Year;
+ UINT8 Month;
+ UINT8 Day;
+ UINT8 Hour;
+ UINT8 Minute;
+ UINT8 Second;
+ UINT8 LogVariableData[1];
} LOG_RECORD_FORMAT;
typedef struct {
- UINT8 OEMReserved[5];
- UINT8 Metw; // Multiple Event Time Window
- UINT8 Meci; // Multiple Event Count Increment
- UINT8 CMOSAddress; // Pre-boot Event Log Reset - CMOS Address
- UINT8 CMOSBitIndex; // Pre-boot Event Log Reset - CMOS Bit Index
- UINT8 StartingOffset; // CMOS Checksum - Starting Offset
- UINT8 ByteCount; // CMOS Checksum - Byte Count
- UINT8 ChecksumOffset; // CMOS Checksum - Checksum Offset
- UINT8 Reserved[3];
- UINT8 HeaderRevision;
+ UINT8 OEMReserved[5];
+ UINT8 Metw; // Multiple Event Time Window
+ UINT8 Meci; // Multiple Event Count Increment
+ UINT8 CMOSAddress; // Pre-boot Event Log Reset - CMOS Address
+ UINT8 CMOSBitIndex; // Pre-boot Event Log Reset - CMOS Bit Index
+ UINT8 StartingOffset; // CMOS Checksum - Starting Offset
+ UINT8 ByteCount; // CMOS Checksum - Byte Count
+ UINT8 ChecksumOffset; // CMOS Checksum - Checksum Offset
+ UINT8 Reserved[3];
+ UINT8 HeaderRevision;
} LOG_HEADER_TYPE1_FORMAT;
#pragma pack()
@@ -51,8 +51,8 @@ typedef struct { **/
VOID
DisplaySELAccessMethod (
- IN CONST UINT8 Key,
- IN CONST UINT8 Option
+ IN CONST UINT8 Key,
+ IN CONST UINT8 Option
);
/**
@@ -63,8 +63,8 @@ DisplaySELAccessMethod ( **/
VOID
DisplaySELLogStatus (
- UINT8 Key,
- UINT8 Option
+ UINT8 Key,
+ UINT8 Option
);
/**
@@ -75,8 +75,8 @@ DisplaySELLogStatus ( **/
VOID
DisplaySysEventLogHeaderFormat (
- UINT8 Key,
- UINT8 Option
+ UINT8 Key,
+ UINT8 Option
);
/**
@@ -87,8 +87,8 @@ DisplaySysEventLogHeaderFormat ( **/
VOID
DisplaySysEventLogHeader (
- UINT8 LogHeaderFormat,
- UINT8 *LogHeader
+ UINT8 LogHeaderFormat,
+ UINT8 *LogHeader
);
/**
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c index dad9b3c1ff..a9ea3e13b0 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c @@ -6,20 +6,19 @@ **/
-
#include "UefiShellDebug1CommandsLib.h"
#include <Guid/SmBios.h>
#include "LibSmbiosView.h"
#include "SmbiosView.h"
-STATIC UINT8 mInit = 0;
-STATIC UINT8 m64Init = 0;
-STATIC SMBIOS_TABLE_ENTRY_POINT *mSmbiosTable = NULL;
-STATIC SMBIOS_TABLE_3_0_ENTRY_POINT *mSmbios64BitTable = NULL;
-STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct;
-STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct;
-STATIC SMBIOS_STRUCTURE_POINTER m_Smbios64BitStruct;
-STATIC SMBIOS_STRUCTURE_POINTER *mSmbios64BitStruct = &m_Smbios64BitStruct;
+STATIC UINT8 mInit = 0;
+STATIC UINT8 m64Init = 0;
+STATIC SMBIOS_TABLE_ENTRY_POINT *mSmbiosTable = NULL;
+STATIC SMBIOS_TABLE_3_0_ENTRY_POINT *mSmbios64BitTable = NULL;
+STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct;
+STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct;
+STATIC SMBIOS_STRUCTURE_POINTER m_Smbios64BitStruct;
+STATIC SMBIOS_STRUCTURE_POINTER *mSmbios64BitStruct = &m_Smbios64BitStruct;
/**
Init the SMBIOS VIEW API's environment.
@@ -39,25 +38,27 @@ LibSmbiosInit ( if (mInit == 1) {
return EFI_SUCCESS;
}
+
//
// Get SMBIOS table from System Configure table
//
- Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID**)&mSmbiosTable);
+ Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **)&mSmbiosTable);
if (mSmbiosTable == NULL) {
return EFI_NOT_FOUND;
}
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status);
return Status;
}
+
//
// Init SMBIOS structure table address
//
- mSmbiosStruct->Raw = (UINT8 *) (UINTN) (mSmbiosTable->TableAddress);
+ mSmbiosStruct->Raw = (UINT8 *)(UINTN)(mSmbiosTable->TableAddress);
- mInit = 1;
+ mInit = 1;
return EFI_SUCCESS;
}
@@ -79,25 +80,27 @@ LibSmbios64BitInit ( if (m64Init == 1) {
return EFI_SUCCESS;
}
+
//
// Get SMBIOS table from System Configure table
//
- Status = GetSystemConfigurationTable (&gEfiSmbios3TableGuid, (VOID**)&mSmbios64BitTable);
+ Status = GetSystemConfigurationTable (&gEfiSmbios3TableGuid, (VOID **)&mSmbios64BitTable);
if (mSmbios64BitTable == NULL) {
return EFI_NOT_FOUND;
}
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status);
return Status;
}
+
//
// Init SMBIOS structure table address
//
- mSmbios64BitStruct->Raw = (UINT8 *) (UINTN) (mSmbios64BitTable->TableAddress);
+ mSmbios64BitStruct->Raw = (UINT8 *)(UINTN)(mSmbios64BitTable->TableAddress);
- m64Init = 1;
+ m64Init = 1;
return EFI_SUCCESS;
}
@@ -144,7 +147,7 @@ LibSmbios64BitCleanup ( **/
VOID
LibSmbiosGetEPS (
- OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure
+ OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure
)
{
//
@@ -160,7 +163,7 @@ LibSmbiosGetEPS ( **/
VOID
LibSmbios64BitGetEPS (
- OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure
+ OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure
)
{
//
@@ -178,10 +181,10 @@ LibSmbios64BitGetEPS ( @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
-CHAR8*
+CHAR8 *
LibGetSmbiosString (
- IN SMBIOS_STRUCTURE_POINTER *Smbios,
- IN UINT16 StringNumber
+ IN SMBIOS_STRUCTURE_POINTER *Smbios,
+ IN UINT16 StringNumber
)
{
UINT16 Index;
@@ -192,7 +195,7 @@ LibGetSmbiosString ( //
// Skip over formatted section
//
- String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length);
+ String = (CHAR8 *)(Smbios->Raw + Smbios->Hdr->Length);
//
// Look through unformated section
@@ -201,10 +204,13 @@ LibGetSmbiosString ( if (StringNumber == Index) {
return String;
}
+
//
// Skip string
//
- for (; *String != 0; String++);
+ for ( ; *String != 0; String++) {
+ }
+
String++;
if (*String == 0) {
@@ -254,7 +260,7 @@ LibGetSmbiosStructure ( }
if ((Buffer == NULL) || (Length == NULL)) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC), gShellDebug1HiiHandle);
return DMI_INVALID_HANDLE;
}
@@ -267,11 +273,11 @@ LibGetSmbiosStructure ( //
// Walk to next structure
//
- LibGetSmbiosString (&Smbios, (UINT16) (-1));
+ LibGetSmbiosString (&Smbios, (UINT16)(-1));
//
// Length = Next structure head - this structure head
//
- *Length = (UINT16) (Smbios.Raw - Raw);
+ *Length = (UINT16)(Smbios.Raw - Raw);
*Buffer = Raw;
//
// update with the next structure handle.
@@ -281,12 +287,14 @@ LibGetSmbiosStructure ( } else {
*Handle = INVALID_HANDLE;
}
+
return DMI_SUCCESS;
}
+
//
// Walk to next structure
//
- LibGetSmbiosString (&Smbios, (UINT16) (-1));
+ LibGetSmbiosString (&Smbios, (UINT16)(-1));
}
*Handle = INVALID_HANDLE;
@@ -326,12 +334,12 @@ LibGetSmbios64BitStructure ( }
if ((Buffer == NULL) || (Length == NULL)) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC), gShellDebug1HiiHandle);
return DMI_INVALID_HANDLE;
}
- *Length = 0;
- Smbios.Hdr = mSmbios64BitStruct->Hdr;
+ *Length = 0;
+ Smbios.Hdr = mSmbios64BitStruct->Hdr;
SmbiosEnd.Raw = Smbios.Raw + mSmbios64BitTableLength;
while (Smbios.Raw < SmbiosEnd.Raw) {
@@ -340,11 +348,11 @@ LibGetSmbios64BitStructure ( //
// Walk to next structure
//
- LibGetSmbiosString (&Smbios, (UINT16) (-1));
+ LibGetSmbiosString (&Smbios, (UINT16)(-1));
//
// Length = Next structure head - this structure head
//
- *Length = (UINT16) (Smbios.Raw - Raw);
+ *Length = (UINT16)(Smbios.Raw - Raw);
*Buffer = Raw;
//
// update with the next structure handle.
@@ -354,12 +362,14 @@ LibGetSmbios64BitStructure ( } else {
*Handle = INVALID_HANDLE;
}
+
return DMI_SUCCESS;
}
+
//
// Walk to next structure
//
- LibGetSmbiosString (&Smbios, (UINT16) (-1));
+ LibGetSmbiosString (&Smbios, (UINT16)(-1));
}
*Handle = INVALID_HANDLE;
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h index 14013fe29a..87ae6e91c6 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h @@ -11,22 +11,22 @@ #include <IndustryStandard/SmBios.h>
-#define DMI_SUCCESS 0x00
-#define DMI_UNKNOWN_FUNCTION 0x81
-#define DMI_FUNCTION_NOT_SUPPORTED 0x82
-#define DMI_INVALID_HANDLE 0x83
-#define DMI_BAD_PARAMETER 0x84
-#define DMI_INVALID_SUBFUNCTION 0x85
-#define DMI_NO_CHANGE 0x86
-#define DMI_ADD_STRUCTURE_FAILED 0x87
-#define DMI_READ_ONLY 0x8D
-#define DMI_LOCK_NOT_SUPPORTED 0x90
-#define DMI_CURRENTLY_LOCKED 0x91
-#define DMI_INVALID_LOCK 0x92
-
-#define INVALID_HANDLE (UINT16) (-1)
-
-#define EFI_SMBIOSERR(val) EFIERR (0x30000 | val)
+#define DMI_SUCCESS 0x00
+#define DMI_UNKNOWN_FUNCTION 0x81
+#define DMI_FUNCTION_NOT_SUPPORTED 0x82
+#define DMI_INVALID_HANDLE 0x83
+#define DMI_BAD_PARAMETER 0x84
+#define DMI_INVALID_SUBFUNCTION 0x85
+#define DMI_NO_CHANGE 0x86
+#define DMI_ADD_STRUCTURE_FAILED 0x87
+#define DMI_READ_ONLY 0x8D
+#define DMI_LOCK_NOT_SUPPORTED 0x90
+#define DMI_CURRENTLY_LOCKED 0x91
+#define DMI_INVALID_LOCK 0x92
+
+#define INVALID_HANDLE (UINT16) (-1)
+
+#define EFI_SMBIOSERR(val) EFIERR (0x30000 | val)
#define EFI_SMBIOSERR_FAILURE EFI_SMBIOSERR (1)
#define EFI_SMBIOSERR_STRUCT_NOT_FOUND EFI_SMBIOSERR (2)
@@ -76,7 +76,7 @@ LibSmbios64BitCleanup ( **/
VOID
LibSmbiosGetEPS (
- OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure
+ OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure
);
/**
@@ -86,7 +86,7 @@ LibSmbiosGetEPS ( **/
VOID
LibSmbios64BitGetEPS (
- OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure
+ OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure
);
/**
@@ -98,10 +98,10 @@ LibSmbios64BitGetEPS ( @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
-CHAR8*
+CHAR8 *
LibGetSmbiosString (
- IN SMBIOS_STRUCTURE_POINTER *Smbios,
- IN UINT16 StringNumber
+ IN SMBIOS_STRUCTURE_POINTER *Smbios,
+ IN UINT16 StringNumber
);
/**
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c index 8d757c0014..b144600a25 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c @@ -14,11 +14,10 @@ #include "QueryTable.h"
#include "EventLogInfo.h"
-
//
// Get the certain bit of 'value'
//
-#define BIT(value, bit) ((value) & ((UINT64) 1) << (bit))
+#define BIT(value, bit) ((value) & ((UINT64) 1) << (bit))
//
// Check if above or equal to version
@@ -94,21 +93,23 @@ **/
VOID
MemToString (
- IN OUT VOID *Dest,
- IN VOID *Src,
- IN UINTN Length
+ IN OUT VOID *Dest,
+ IN VOID *Src,
+ IN UINTN Length
)
{
- UINT8 *SrcBuffer;
- UINT8 *DestBuffer;
- SrcBuffer = (UINT8 *) Src;
- DestBuffer = (UINT8 *) Dest;
+ UINT8 *SrcBuffer;
+ UINT8 *DestBuffer;
+
+ SrcBuffer = (UINT8 *)Src;
+ DestBuffer = (UINT8 *)Dest;
//
// copy byte by byte
//
- while ((Length--)!=0) {
+ while ((Length--) != 0) {
*DestBuffer++ = *SrcBuffer++;
}
+
//
// append a NULL terminator
//
@@ -133,61 +134,73 @@ SmbiosPrintEPSInfo ( IN UINT8 Option
)
{
- UINT8 Anchor[5];
- UINT8 InAnchor[6];
+ UINT8 Anchor[5];
+ UINT8 InAnchor[6];
if (SmbiosTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle);
- return ;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle);
+ return;
}
if (Option == SHOW_NONE) {
- return ;
+ return;
}
if (Option >= SHOW_NORMAL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_SIGN), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_SIGN), gShellDebug1HiiHandle);
MemToString (Anchor, SmbiosTable->AnchorString, 4);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor);
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM),
gShellDebug1HiiHandle,
SmbiosTable->EntryPointStructureChecksum
- );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength);
- ShellPrintHiiEx(-1,-1,NULL,
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VERSION),
gShellDebug1HiiHandle,
SmbiosTable->MajorVersion,
SmbiosTable->MinorVersion
- );
- ShellPrintHiiEx(-1,-1,NULL,
+ );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NUMBER_STRUCT),
gShellDebug1HiiHandle,
SmbiosTable->NumberOfSmbiosStructures
- );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_STRUCT_SIZE), gShellDebug1HiiHandle, SmbiosTable->MaxStructureSize);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_LENGTH), gShellDebug1HiiHandle, SmbiosTable->TableLength);
-
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_STRUCT_SIZE), gShellDebug1HiiHandle, SmbiosTable->MaxStructureSize);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_LENGTH), gShellDebug1HiiHandle, SmbiosTable->TableLength);
}
+
//
// If SHOW_ALL, also print followings.
//
if (Option >= SHOW_DETAIL) {
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION),
gShellDebug1HiiHandle,
SmbiosTable->EntryPointRevision
- );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BCD_REVISION), gShellDebug1HiiHandle, SmbiosTable->SmbiosBcdRevision);
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BCD_REVISION), gShellDebug1HiiHandle, SmbiosTable->SmbiosBcdRevision);
//
// Since raw data is not string, add a NULL terminater.
//
MemToString (InAnchor, SmbiosTable->IntermediateAnchorString, 5);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_ACHOR), gShellDebug1HiiHandle, InAnchor);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_CHECKSUM), gShellDebug1HiiHandle, SmbiosTable->IntermediateChecksum);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMATTED_AREA), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_ACHOR), gShellDebug1HiiHandle, InAnchor);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_CHECKSUM), gShellDebug1HiiHandle, SmbiosTable->IntermediateChecksum);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMATTED_AREA), gShellDebug1HiiHandle);
DumpHex (2, 0, 5, SmbiosTable->FormattedArea);
}
@@ -206,58 +219,70 @@ Smbios64BitPrintEPSInfo ( IN UINT8 Option
)
{
- UINT8 Anchor[5];
+ UINT8 Anchor[5];
if (SmbiosTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle);
- return ;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle);
+ return;
}
if (Option == SHOW_NONE) {
- return ;
+ return;
}
if (Option >= SHOW_NORMAL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_64_BIT_ENTRY_POINT_SIGN), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_64_BIT_ENTRY_POINT_SIGN), gShellDebug1HiiHandle);
MemToString (Anchor, SmbiosTable->AnchorString, 5);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor);
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM),
gShellDebug1HiiHandle,
SmbiosTable->EntryPointStructureChecksum
- );
+ );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength);
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VERSION),
gShellDebug1HiiHandle,
SmbiosTable->MajorVersion,
SmbiosTable->MinorVersion
- );
+ );
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DOCREV),
gShellDebug1HiiHandle,
SmbiosTable->DocRev
- );
-
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_MAX_SIZE), gShellDebug1HiiHandle, SmbiosTable->TableMaximumSize);
+ );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_MAX_SIZE), gShellDebug1HiiHandle, SmbiosTable->TableMaximumSize);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress);
}
+
//
// If SHOW_ALL, also print followings.
//
if (Option >= SHOW_DETAIL) {
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION),
gShellDebug1HiiHandle,
SmbiosTable->EntryPointRevision
- );
+ );
}
Print (L"\n");
@@ -279,9 +304,9 @@ SmbiosPrintStructure ( IN UINT8 Option
)
{
- UINT8 Index;
- UINT8 Index2;
- UINT8 *Buffer;
+ UINT8 Index;
+ UINT8 Index2;
+ UINT8 *Buffer;
if (Struct == NULL) {
return EFI_INVALID_PARAMETER;
@@ -291,268 +316,286 @@ SmbiosPrintStructure ( return EFI_SUCCESS;
}
- Buffer = (UINT8 *) (UINTN) (Struct->Raw);
+ Buffer = (UINT8 *)(UINTN)(Struct->Raw);
//
// Display structure header
//
DisplayStructureTypeInfo (Struct->Hdr->Type, SHOW_DETAIL);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMAT_PART_LEN), gShellDebug1HiiHandle, Struct->Hdr->Length);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, Struct->Hdr->Handle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMAT_PART_LEN), gShellDebug1HiiHandle, Struct->Hdr->Length);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, Struct->Hdr->Handle);
if (Option == SHOW_OUTLINE) {
return EFI_SUCCESS;
}
switch (Struct->Hdr->Type) {
- //
- // BIOS Information (Type 0)
- //
- case 0:
- PRINT_PENDING_STRING (Struct, Type0, Vendor);
- PRINT_PENDING_STRING (Struct, Type0, BiosVersion);
- PRINT_STRUCT_VALUE_H (Struct, Type0, BiosSegment);
- PRINT_PENDING_STRING (Struct, Type0, BiosReleaseDate);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (Struct->Type0->BiosSize + 1));
+ //
+ // BIOS Information (Type 0)
+ //
+ case 0:
+ PRINT_PENDING_STRING (Struct, Type0, Vendor);
+ PRINT_PENDING_STRING (Struct, Type0, BiosVersion);
+ PRINT_STRUCT_VALUE_H (Struct, Type0, BiosSegment);
+ PRINT_PENDING_STRING (Struct, Type0, BiosReleaseDate);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (Struct->Type0->BiosSize + 1));
- DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type0->BiosCharacteristics)), Option);
+ DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *)(UINTN)&(Struct->Type0->BiosCharacteristics)), Option);
- if (Struct->Hdr->Length > 0x12) {
- DisplayBiosCharacteristicsExt1 (Struct->Type0->BIOSCharacteristicsExtensionBytes[0], Option);
- }
- if (Struct->Hdr->Length > 0x13) {
- DisplayBiosCharacteristicsExt2 (Struct->Type0->BIOSCharacteristicsExtensionBytes[1], Option);
- }
+ if (Struct->Hdr->Length > 0x12) {
+ DisplayBiosCharacteristicsExt1 (Struct->Type0->BIOSCharacteristicsExtensionBytes[0], Option);
+ }
- if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x14)) {
- PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMajorRelease);
- PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMinorRelease);
- PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMajorRelease);
- PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMinorRelease);
- }
- if (AE_SMBIOS_VERSION (0x3, 0x1) && (Struct->Hdr->Length > 0x18)) {
- ShellPrintHiiEx (
- -1,
- -1,
- NULL,
- STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTENDED_BIOS_SIZE),
- gShellDebug1HiiHandle,
- Struct->Type0->ExtendedBiosSize.Size,
- (Struct->Type0->ExtendedBiosSize.Unit == 0x0) ? L"MB": L"GB"
- );
- }
- break;
+ if (Struct->Hdr->Length > 0x13) {
+ DisplayBiosCharacteristicsExt2 (Struct->Type0->BIOSCharacteristicsExtensionBytes[1], Option);
+ }
- //
- // System Information (Type 1)
- //
- case 1:
- PRINT_PENDING_STRING (Struct, Type1, Manufacturer);
- PRINT_PENDING_STRING (Struct, Type1, ProductName);
- PRINT_PENDING_STRING (Struct, Type1, Version);
- PRINT_PENDING_STRING (Struct, Type1, SerialNumber);
- PRINT_BIT_FIELD (Struct, Type1, Uuid, 16);
- DisplaySystemWakeupType (Struct->Type1->WakeUpType, Option);
- if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x19)) {
- PRINT_PENDING_STRING (Struct, Type1, SKUNumber);
- PRINT_PENDING_STRING (Struct, Type1, Family);
- }
+ if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x14)) {
+ PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMajorRelease);
+ PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMinorRelease);
+ PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMajorRelease);
+ PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMinorRelease);
+ }
- break;
+ if (AE_SMBIOS_VERSION (0x3, 0x1) && (Struct->Hdr->Length > 0x18)) {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTENDED_BIOS_SIZE),
+ gShellDebug1HiiHandle,
+ Struct->Type0->ExtendedBiosSize.Size,
+ (Struct->Type0->ExtendedBiosSize.Unit == 0x0) ? L"MB" : L"GB"
+ );
+ }
- //
- // Baseboard Information (Type 2)
- //
- case 2:
- PRINT_PENDING_STRING (Struct, Type2, Manufacturer);
- PRINT_PENDING_STRING (Struct, Type2, ProductName);
- PRINT_PENDING_STRING (Struct, Type2, Version);
- PRINT_PENDING_STRING (Struct, Type2, SerialNumber);
- if (Struct->Hdr->Length > 0x8) {
- PRINT_PENDING_STRING (Struct, Type2, AssetTag);
- DisplayBaseBoardFeatureFlags (*(UINT8 *) &Struct->Type2->FeatureFlag, Option);
- PRINT_PENDING_STRING (Struct, Type2, LocationInChassis);
- PRINT_STRUCT_VALUE_H (Struct, Type2, ChassisHandle);
- DisplayBaseBoardBoardType (Struct->Type2->BoardType, Option);
- }
- break;
-
- //
- // System Enclosure (Type 3)
- //
- case 3:
- PRINT_PENDING_STRING (Struct, Type3, Manufacturer);
- PRINT_STRUCT_VALUE (Struct, Type3, Type);
- DisplaySystemEnclosureType (Struct->Type3->Type, Option);
- PRINT_PENDING_STRING (Struct, Type3, Version);
- PRINT_PENDING_STRING (Struct, Type3, SerialNumber);
- PRINT_PENDING_STRING (Struct, Type3, AssetTag);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOTUP_STATE), gShellDebug1HiiHandle);
- DisplaySystemEnclosureStatus (Struct->Type3->BootupState, Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_STATE), gShellDebug1HiiHandle);
- DisplaySystemEnclosureStatus (Struct->Type3->PowerSupplyState, Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THERMAL_STATE), gShellDebug1HiiHandle);
- DisplaySystemEnclosureStatus (Struct->Type3->ThermalState, Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SECURITY_STATUS), gShellDebug1HiiHandle);
- DisplaySESecurityStatus (Struct->Type3->SecurityStatus, Option);
- if (AE_SMBIOS_VERSION (0x2, 0x3)) {
- if (Struct->Hdr->Length > 0xD) {
- PRINT_BIT_FIELD (Struct, Type3, OemDefined, 4);
+ break;
+
+ //
+ // System Information (Type 1)
+ //
+ case 1:
+ PRINT_PENDING_STRING (Struct, Type1, Manufacturer);
+ PRINT_PENDING_STRING (Struct, Type1, ProductName);
+ PRINT_PENDING_STRING (Struct, Type1, Version);
+ PRINT_PENDING_STRING (Struct, Type1, SerialNumber);
+ PRINT_BIT_FIELD (Struct, Type1, Uuid, 16);
+ DisplaySystemWakeupType (Struct->Type1->WakeUpType, Option);
+ if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x19)) {
+ PRINT_PENDING_STRING (Struct, Type1, SKUNumber);
+ PRINT_PENDING_STRING (Struct, Type1, Family);
}
- if (Struct->Hdr->Length > 0x11) {
- PRINT_STRUCT_VALUE (Struct, Type3, Height);
+
+ break;
+
+ //
+ // Baseboard Information (Type 2)
+ //
+ case 2:
+ PRINT_PENDING_STRING (Struct, Type2, Manufacturer);
+ PRINT_PENDING_STRING (Struct, Type2, ProductName);
+ PRINT_PENDING_STRING (Struct, Type2, Version);
+ PRINT_PENDING_STRING (Struct, Type2, SerialNumber);
+ if (Struct->Hdr->Length > 0x8) {
+ PRINT_PENDING_STRING (Struct, Type2, AssetTag);
+ DisplayBaseBoardFeatureFlags (*(UINT8 *)&Struct->Type2->FeatureFlag, Option);
+ PRINT_PENDING_STRING (Struct, Type2, LocationInChassis);
+ PRINT_STRUCT_VALUE_H (Struct, Type2, ChassisHandle);
+ DisplayBaseBoardBoardType (Struct->Type2->BoardType, Option);
}
- if (Struct->Hdr->Length > 0x12) {
- PRINT_STRUCT_VALUE (Struct, Type3, NumberofPowerCords);
+
+ break;
+
+ //
+ // System Enclosure (Type 3)
+ //
+ case 3:
+ PRINT_PENDING_STRING (Struct, Type3, Manufacturer);
+ PRINT_STRUCT_VALUE (Struct, Type3, Type);
+ DisplaySystemEnclosureType (Struct->Type3->Type, Option);
+ PRINT_PENDING_STRING (Struct, Type3, Version);
+ PRINT_PENDING_STRING (Struct, Type3, SerialNumber);
+ PRINT_PENDING_STRING (Struct, Type3, AssetTag);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOTUP_STATE), gShellDebug1HiiHandle);
+ DisplaySystemEnclosureStatus (Struct->Type3->BootupState, Option);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_STATE), gShellDebug1HiiHandle);
+ DisplaySystemEnclosureStatus (Struct->Type3->PowerSupplyState, Option);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THERMAL_STATE), gShellDebug1HiiHandle);
+ DisplaySystemEnclosureStatus (Struct->Type3->ThermalState, Option);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SECURITY_STATUS), gShellDebug1HiiHandle);
+ DisplaySESecurityStatus (Struct->Type3->SecurityStatus, Option);
+ if (AE_SMBIOS_VERSION (0x2, 0x3)) {
+ if (Struct->Hdr->Length > 0xD) {
+ PRINT_BIT_FIELD (Struct, Type3, OemDefined, 4);
+ }
+
+ if (Struct->Hdr->Length > 0x11) {
+ PRINT_STRUCT_VALUE (Struct, Type3, Height);
+ }
+
+ if (Struct->Hdr->Length > 0x12) {
+ PRINT_STRUCT_VALUE (Struct, Type3, NumberofPowerCords);
+ }
+
+ if (Struct->Hdr->Length > 0x13) {
+ PRINT_STRUCT_VALUE (Struct, Type3, ContainedElementCount);
+ }
+
+ if (Struct->Hdr->Length > 0x14) {
+ PRINT_STRUCT_VALUE (Struct, Type3, ContainedElementRecordLength);
+ }
+
+ if (Struct->Hdr->Length > 0x15) {
+ for (Index = 0; Index < Struct->Type3->ContainedElementCount; Index++) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONTAINED_ELEMENT), gShellDebug1HiiHandle, Index+1);
+ for (Index2 = 0; Index2 < Struct->Type3->ContainedElementRecordLength; Index2++) {
+ Print (L"%02X ", Buffer[0x15 + (Index * Struct->Type3->ContainedElementRecordLength) + Index2]);
+ }
+
+ Print (L"\n");
+ }
+ }
}
- if (Struct->Hdr->Length > 0x13) {
- PRINT_STRUCT_VALUE (Struct, Type3, ContainedElementCount);
+
+ if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) {
+ if (Struct->Hdr->Length > (0x15 + (Struct->Type3->ContainedElementCount * Struct->Type3->ContainedElementRecordLength))) {
+ PRINT_SMBIOS_STRING (Struct, Buffer[0x15 + (Struct->Type3->ContainedElementCount * Struct->Type3->ContainedElementRecordLength)], SKUNumber);
+ }
+ }
+
+ break;
+
+ //
+ // Processor Information (Type 4)
+ //
+ case 4:
+ PRINT_SMBIOS_STRING (Struct, Struct->Type4->Socket, SocketDesignation)
+ DisplayProcessorType (Struct->Type4->ProcessorType, Option);
+ if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x28) &&
+ (Struct->Type4->ProcessorFamily == 0xFE))
+ {
+ //
+ // Get family from ProcessorFamily2 field
+ //
+ DisplayProcessorFamily2 (Struct->Type4->ProcessorFamily2, Option);
+ } else {
+ DisplayProcessorFamily (Struct->Type4->ProcessorFamily, Option);
}
- if (Struct->Hdr->Length > 0x14) {
- PRINT_STRUCT_VALUE (Struct, Type3, ContainedElementRecordLength);
+
+ PRINT_PENDING_STRING (Struct, Type4, ProcessorManufacturer);
+ PRINT_BIT_FIELD (Struct, Type4, ProcessorId, 8);
+ PRINT_PENDING_STRING (Struct, Type4, ProcessorVersion);
+ DisplayProcessorVoltage (*(UINT8 *)&(Struct->Type4->Voltage), Option);
+ PRINT_STRUCT_VALUE (Struct, Type4, ExternalClock);
+ PRINT_STRUCT_VALUE (Struct, Type4, MaxSpeed);
+ PRINT_STRUCT_VALUE (Struct, Type4, CurrentSpeed);
+ DisplayProcessorStatus (Struct->Type4->Status, Option);
+ DisplayProcessorUpgrade (Struct->Type4->ProcessorUpgrade, Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type4, L1CacheHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type4, L2CacheHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type4, L3CacheHandle);
+ if (AE_SMBIOS_VERSION (0x2, 0x3) && (Struct->Hdr->Length > 0x20)) {
+ PRINT_PENDING_STRING (Struct, Type4, SerialNumber);
+ PRINT_PENDING_STRING (Struct, Type4, AssetTag);
+ PRINT_PENDING_STRING (Struct, Type4, PartNumber);
}
- if (Struct->Hdr->Length > 0x15) {
- for (Index = 0; Index < Struct->Type3->ContainedElementCount; Index++) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONTAINED_ELEMENT), gShellDebug1HiiHandle, Index+1);
- for (Index2 = 0; Index2< Struct->Type3->ContainedElementRecordLength; Index2++) {
- Print (L"%02X ", Buffer[0x15 + (Index * Struct->Type3->ContainedElementRecordLength) + Index2]);
- }
- Print (L"\n");
- }
+
+ if (AE_SMBIOS_VERSION (0x2, 0x5) && (Struct->Hdr->Length > 0x23)) {
+ PRINT_STRUCT_VALUE (Struct, Type4, CoreCount);
+ PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount);
+ PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount);
+ DisplayProcessorCharacteristics (Struct->Type4->ProcessorCharacteristics, Option);
}
- }
- if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) {
- if (Struct->Hdr->Length > (0x15 + (Struct->Type3->ContainedElementCount * Struct->Type3->ContainedElementRecordLength))) {
- PRINT_SMBIOS_STRING (Struct, Buffer[0x15 + (Struct->Type3->ContainedElementCount * Struct->Type3->ContainedElementRecordLength)], SKUNumber);
+
+ if ((SmbiosMajorVersion >= 0x3) && (Struct->Hdr->Length > 0x2A)) {
+ PRINT_STRUCT_VALUE (Struct, Type4, CoreCount2);
+ PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount2);
+ PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount2);
}
- }
- break;
- //
- // Processor Information (Type 4)
- //
- case 4:
- PRINT_SMBIOS_STRING (Struct, Struct->Type4->Socket, SocketDesignation)
- DisplayProcessorType (Struct->Type4->ProcessorType, Option);
- if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x28) &&
- (Struct->Type4->ProcessorFamily == 0xFE)) {
- //
- // Get family from ProcessorFamily2 field
- //
- DisplayProcessorFamily2 (Struct->Type4->ProcessorFamily2, Option);
- } else {
- DisplayProcessorFamily (Struct->Type4->ProcessorFamily, Option);
- }
- PRINT_PENDING_STRING (Struct, Type4, ProcessorManufacturer);
- PRINT_BIT_FIELD (Struct, Type4, ProcessorId, 8);
- PRINT_PENDING_STRING (Struct, Type4, ProcessorVersion);
- DisplayProcessorVoltage (*(UINT8 *) &(Struct->Type4->Voltage), Option);
- PRINT_STRUCT_VALUE (Struct, Type4, ExternalClock);
- PRINT_STRUCT_VALUE (Struct, Type4, MaxSpeed);
- PRINT_STRUCT_VALUE (Struct, Type4, CurrentSpeed);
- DisplayProcessorStatus (Struct->Type4->Status, Option);
- DisplayProcessorUpgrade (Struct->Type4->ProcessorUpgrade, Option);
- PRINT_STRUCT_VALUE_H (Struct, Type4, L1CacheHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type4, L2CacheHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type4, L3CacheHandle);
- if (AE_SMBIOS_VERSION (0x2, 0x3) && (Struct->Hdr->Length > 0x20)) {
- PRINT_PENDING_STRING (Struct, Type4, SerialNumber);
- PRINT_PENDING_STRING (Struct, Type4, AssetTag);
- PRINT_PENDING_STRING (Struct, Type4, PartNumber);
- }
- if (AE_SMBIOS_VERSION (0x2, 0x5) && (Struct->Hdr->Length > 0x23)) {
- PRINT_STRUCT_VALUE (Struct, Type4, CoreCount);
- PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount);
- PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount);
- DisplayProcessorCharacteristics (Struct->Type4->ProcessorCharacteristics, Option);
- }
- if ((SmbiosMajorVersion >= 0x3) && (Struct->Hdr->Length > 0x2A)) {
- PRINT_STRUCT_VALUE (Struct, Type4, CoreCount2);
- PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount2);
- PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount2);
- }
- break;
+ break;
- //
- // Memory Controller Information (Type 5)
- //
- case 5:
+ //
+ // Memory Controller Information (Type 5)
+ //
+ case 5:
{
- UINT8 SlotNum;
+ UINT8 SlotNum;
SlotNum = Struct->Type5->AssociatedMemorySlotNum;
DisplayMcErrorDetectMethod (Struct->Type5->ErrDetectMethod, Option);
- DisplayMcErrorCorrectCapability (*(UINT8 *) &(Struct->Type5->ErrCorrectCapability), Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRT), gShellDebug1HiiHandle);
+ DisplayMcErrorCorrectCapability (*(UINT8 *)&(Struct->Type5->ErrCorrectCapability), Option);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRT), gShellDebug1HiiHandle);
DisplayMcInterleaveSupport (Struct->Type5->SupportInterleave, Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CURRENT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CURRENT), gShellDebug1HiiHandle);
DisplayMcInterleaveSupport (Struct->Type5->CurrentInterleave, Option);
DisplayMaxMemoryModuleSize (Struct->Type5->MaxMemoryModuleSize, SlotNum, Option);
- DisplayMcMemorySpeeds (*(UINT16 *) &(Struct->Type5->SupportSpeed), Option);
+ DisplayMcMemorySpeeds (*(UINT16 *)&(Struct->Type5->SupportSpeed), Option);
DisplayMmMemoryType (Struct->Type5->SupportMemoryType, Option);
DisplayMemoryModuleVoltage (Struct->Type5->MemoryModuleVoltage, Option);
PRINT_STRUCT_VALUE (Struct, Type5, AssociatedMemorySlotNum);
//
// According to SMBIOS Specification, offset 0x0F
//
- DisplayMemoryModuleConfigHandles ((UINT16 *) (&Buffer[0x0F]), SlotNum, Option);
+ DisplayMemoryModuleConfigHandles ((UINT16 *)(&Buffer[0x0F]), SlotNum, Option);
DisplayMcErrorCorrectCapability (Buffer[0x0F + 2 * SlotNum], Option);
+ break;
}
- break;
-
- //
- // Memory Module Information (Type 6)
- //
- case 6:
- PRINT_PENDING_STRING (Struct, Type6, SocketDesignation);
- DisplayMmBankConnections (Struct->Type6->BankConnections, Option);
- PRINT_STRUCT_VALUE (Struct, Type6, CurrentSpeed);
- DisplayMmMemoryType (*(UINT16 *) &(Struct->Type6->CurrentMemoryType), Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INSTALLED), gShellDebug1HiiHandle);
- DisplayMmMemorySize (*(UINT8 *) &(Struct->Type6->InstalledSize), Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle);
- DisplayMmMemorySize (*(UINT8 *) &(Struct->Type6->EnabledSize), Option);
- DisplayMmErrorStatus (Struct->Type6->ErrorStatus, Option);
- break;
-
- //
- // Cache Information (Type 7)
- //
- case 7:
- PRINT_PENDING_STRING (Struct, Type7, SocketDesignation);
- DisplayCacheConfiguration (Struct->Type7->CacheConfiguration, Option);
- PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize);
- PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize);
- PRINT_STRUCT_VALUE_H (Struct, Type7, SupportedSRAMType);
- PRINT_STRUCT_VALUE_H (Struct, Type7, CurrentSRAMType);
- DisplayCacheSRAMType (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type7->CurrentSRAMType)), Option);
- PRINT_STRUCT_VALUE_H (Struct, Type7, CacheSpeed);
- DisplayCacheErrCorrectingType (Struct->Type7->ErrorCorrectionType, Option);
- DisplayCacheSystemCacheType (Struct->Type7->SystemCacheType, Option);
- DisplayCacheAssociativity (Struct->Type7->Associativity, Option);
- if (AE_SMBIOS_VERSION (0x3, 0x1) && (Struct->Hdr->Length > 0x13)) {
- PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize2);
- PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize2);
- }
- break;
- //
- // Port Connector Information (Type 8)
- //
- case 8:
- PRINT_PENDING_STRING (Struct, Type8, InternalReferenceDesignator);
- Print (L"Internal ");
- DisplayPortConnectorType (Struct->Type8->InternalConnectorType, Option);
- PRINT_PENDING_STRING (Struct, Type8, ExternalReferenceDesignator);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTERNAL), gShellDebug1HiiHandle);
- DisplayPortConnectorType (Struct->Type8->ExternalConnectorType, Option);
- DisplayPortType (Struct->Type8->PortType, Option);
- break;
+ //
+ // Memory Module Information (Type 6)
+ //
+ case 6:
+ PRINT_PENDING_STRING (Struct, Type6, SocketDesignation);
+ DisplayMmBankConnections (Struct->Type6->BankConnections, Option);
+ PRINT_STRUCT_VALUE (Struct, Type6, CurrentSpeed);
+ DisplayMmMemoryType (*(UINT16 *)&(Struct->Type6->CurrentMemoryType), Option);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INSTALLED), gShellDebug1HiiHandle);
+ DisplayMmMemorySize (*(UINT8 *)&(Struct->Type6->InstalledSize), Option);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle);
+ DisplayMmMemorySize (*(UINT8 *)&(Struct->Type6->EnabledSize), Option);
+ DisplayMmErrorStatus (Struct->Type6->ErrorStatus, Option);
+ break;
- //
- // System Slots (Type 9)
- //
- case 9:
+ //
+ // Cache Information (Type 7)
+ //
+ case 7:
+ PRINT_PENDING_STRING (Struct, Type7, SocketDesignation);
+ DisplayCacheConfiguration (Struct->Type7->CacheConfiguration, Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize);
+ PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize);
+ PRINT_STRUCT_VALUE_H (Struct, Type7, SupportedSRAMType);
+ PRINT_STRUCT_VALUE_H (Struct, Type7, CurrentSRAMType);
+ DisplayCacheSRAMType (ReadUnaligned16 ((UINT16 *)(UINTN)&(Struct->Type7->CurrentSRAMType)), Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type7, CacheSpeed);
+ DisplayCacheErrCorrectingType (Struct->Type7->ErrorCorrectionType, Option);
+ DisplayCacheSystemCacheType (Struct->Type7->SystemCacheType, Option);
+ DisplayCacheAssociativity (Struct->Type7->Associativity, Option);
+ if (AE_SMBIOS_VERSION (0x3, 0x1) && (Struct->Hdr->Length > 0x13)) {
+ PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize2);
+ PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize2);
+ }
+
+ break;
+
+ //
+ // Port Connector Information (Type 8)
+ //
+ case 8:
+ PRINT_PENDING_STRING (Struct, Type8, InternalReferenceDesignator);
+ Print (L"Internal ");
+ DisplayPortConnectorType (Struct->Type8->InternalConnectorType, Option);
+ PRINT_PENDING_STRING (Struct, Type8, ExternalReferenceDesignator);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTERNAL), gShellDebug1HiiHandle);
+ DisplayPortConnectorType (Struct->Type8->ExternalConnectorType, Option);
+ DisplayPortType (Struct->Type8->PortType, Option);
+ break;
+
+ //
+ // System Slots (Type 9)
+ //
+ case 9:
{
MISC_SLOT_PEER_GROUP *PeerGroupPtr;
UINT8 PeerGroupCount;
@@ -566,100 +609,107 @@ SmbiosPrintStructure ( Struct->Type9->SlotID,
Struct->Type9->SlotType,
Option
- );
- DisplaySlotCharacteristics1 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics1), Option);
- DisplaySlotCharacteristics2 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics2), Option);
+ );
+ DisplaySlotCharacteristics1 (*(UINT8 *)&(Struct->Type9->SlotCharacteristics1), Option);
+ DisplaySlotCharacteristics2 (*(UINT8 *)&(Struct->Type9->SlotCharacteristics2), Option);
if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
}
+
if (AE_SMBIOS_VERSION (0x3, 0x2)) {
if (Struct->Hdr->Length > 0x11) {
PRINT_STRUCT_VALUE (Struct, Type9, DataBusWidth);
}
+
if (Struct->Hdr->Length > 0x12) {
PRINT_STRUCT_VALUE (Struct, Type9, PeerGroupingCount);
PeerGroupCount = Struct->Type9->PeerGroupingCount;
PeerGroupPtr = Struct->Type9->PeerGroups;
for (Index = 0; Index < PeerGroupCount; Index++) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].SegmentGroupNum);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].BusNum);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].DevFuncNum);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, PeerGroupPtr[Index].DataBusWidth);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].SegmentGroupNum);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].BusNum);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].DevFuncNum);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, PeerGroupPtr[Index].DataBusWidth);
}
}
}
+
+ break;
}
- break;
- //
- // On Board Devices Information (Type 10)
- //
- case 10:
+ //
+ // On Board Devices Information (Type 10)
+ //
+ case 10:
{
- UINTN NumOfDevice;
+ UINTN NumOfDevice;
NumOfDevice = (Struct->Type10->Hdr.Length - sizeof (SMBIOS_STRUCTURE)) / (2 * sizeof (UINT8));
for (Index = 0; Index < NumOfDevice; Index++) {
- ShellPrintEx(-1,-1,(((Struct->Type10->Device[Index].DeviceType) & 0x80) != 0) ? L"Device Enabled\n": L"Device Disabled\n");
+ ShellPrintEx (-1, -1, (((Struct->Type10->Device[Index].DeviceType) & 0x80) != 0) ? L"Device Enabled\n" : L"Device Disabled\n");
DisplayOnboardDeviceTypes ((Struct->Type10->Device[Index].DeviceType) & 0x7F, Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DESC_STRING), gShellDebug1HiiHandle);
- ShellPrintEx(-1,-1,L"%a\n",LibGetSmbiosString (Struct, Struct->Type10->Device[Index].DescriptionString));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DESC_STRING), gShellDebug1HiiHandle);
+ ShellPrintEx (-1, -1, L"%a\n", LibGetSmbiosString (Struct, Struct->Type10->Device[Index].DescriptionString));
}
- }
- break;
- //
- // Oem Strings (Type 11)
- //
- case 11:
- PRINT_STRUCT_VALUE (Struct, Type11, StringCount);
- for (Index = 1; Index <= Struct->Type11->StringCount; Index++) {
- ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (Struct, Index));
+ break;
}
- break;
- //
- // System Configuration Options (Type 12)
- //
- case 12:
- PRINT_STRUCT_VALUE (Struct, Type12, StringCount);
- for (Index = 1; Index <= Struct->Type12->StringCount; Index++) {
- ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (Struct, Index));
- }
- break;
+ //
+ // Oem Strings (Type 11)
+ //
+ case 11:
+ PRINT_STRUCT_VALUE (Struct, Type11, StringCount);
+ for (Index = 1; Index <= Struct->Type11->StringCount; Index++) {
+ ShellPrintEx (-1, -1, L"%a\n", LibGetSmbiosString (Struct, Index));
+ }
- //
- // BIOS Language Information (Type 13)
- //
- case 13:
- PRINT_STRUCT_VALUE (Struct, Type13, InstallableLanguages);
- PRINT_STRUCT_VALUE (Struct, Type13, Flags);
- PRINT_BIT_FIELD (Struct, Type13, Reserved, 15);
- PRINT_PENDING_STRING (Struct, Type13, CurrentLanguages);
- break;
+ break;
- //
- // Group Associations (Type 14)
- //
- case 14:
+ //
+ // System Configuration Options (Type 12)
+ //
+ case 12:
+ PRINT_STRUCT_VALUE (Struct, Type12, StringCount);
+ for (Index = 1; Index <= Struct->Type12->StringCount; Index++) {
+ ShellPrintEx (-1, -1, L"%a\n", LibGetSmbiosString (Struct, Index));
+ }
+
+ break;
+
+ //
+ // BIOS Language Information (Type 13)
+ //
+ case 13:
+ PRINT_STRUCT_VALUE (Struct, Type13, InstallableLanguages);
+ PRINT_STRUCT_VALUE (Struct, Type13, Flags);
+ PRINT_BIT_FIELD (Struct, Type13, Reserved, 15);
+ PRINT_PENDING_STRING (Struct, Type13, CurrentLanguages);
+ break;
+
+ //
+ // Group Associations (Type 14)
+ //
+ case 14:
{
- UINT8 NumOfItem;
+ UINT8 NumOfItem;
NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3;
PRINT_PENDING_STRING (Struct, Type14, GroupName);
for (Index = 0; Index < NumOfItem; Index++) {
- ShellPrintEx(-1,-1,L"ItemType %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemType);
- ShellPrintEx(-1,-1,L"ItemHandle %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemHandle);
+ ShellPrintEx (-1, -1, L"ItemType %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemType);
+ ShellPrintEx (-1, -1, L"ItemHandle %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemHandle);
}
+
+ break;
}
- break;
- //
- // System Event Log (Type 15)
- //
- case 15:
+ //
+ // System Event Log (Type 15)
+ //
+ case 15:
{
EVENT_LOG_TYPE *Ptr;
UINT8 Count;
@@ -684,29 +734,33 @@ SmbiosPrintStructure ( // Display all Event Log type descriptors supported by system
//
for (Index = 0; Index < Count; Index++, Ptr++) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRTED_EVENT), gShellDebug1HiiHandle, Index + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRTED_EVENT), gShellDebug1HiiHandle, Index + 1);
DisplaySELTypes (Ptr->LogType, Option);
DisplaySELVarDataFormatType (Ptr->DataFormatType, Option);
}
if (Option >= SHOW_DETAIL) {
switch (Struct->Type15->AccessMethod) {
- case 03:
- AccessMethodAddress = (UINT8 *) (UINTN) (Struct->Type15->AccessMethodAddress);
- break;
-
- case 00:
- case 01:
- case 02:
- case 04:
- default:
- ShellPrintHiiEx(-1,-1,NULL,
- STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACCESS_METHOD_NOT_SUPOPRTED),
- gShellDebug1HiiHandle,
- Struct->Type15->AccessMethod
- );
- return EFI_UNSUPPORTED;
+ case 03:
+ AccessMethodAddress = (UINT8 *)(UINTN)(Struct->Type15->AccessMethodAddress);
+ break;
+
+ case 00:
+ case 01:
+ case 02:
+ case 04:
+ default:
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACCESS_METHOD_NOT_SUPOPRTED),
+ gShellDebug1HiiHandle,
+ Struct->Type15->AccessMethod
+ );
+ return EFI_UNSUPPORTED;
}
+
//
// Display Event Log Header
//
@@ -716,7 +770,7 @@ SmbiosPrintStructure ( DisplaySysEventLogHeader (
Struct->Type15->LogHeaderFormat,
AccessMethodAddress + Struct->Type15->LogHeaderStartOffset
- );
+ );
//
// Display all Event Log data
@@ -728,347 +782,359 @@ SmbiosPrintStructure ( AccessMethodAddress + Struct->Type15->LogDataStartOffset,
(UINT16)
(
- Struct->Type15->LogAreaLength -
- (Struct->Type15->LogDataStartOffset - Struct->Type15->LogHeaderStartOffset)
+ Struct->Type15->LogAreaLength -
+ (Struct->Type15->LogDataStartOffset - Struct->Type15->LogHeaderStartOffset)
)
- );
+ );
}
-
}
+
+ break;
}
- break;
-
- //
- // Physical Memory Array (Type 16)
- //
- case 16:
- DisplayPMALocation (Struct->Type16->Location, Option);
- DisplayPMAUse (Struct->Type16->Use, Option);
- DisplayPMAErrorCorrectionTypes (
- Struct->Type16->MemoryErrorCorrection,
- Option
- );
- PRINT_STRUCT_VALUE_H (Struct, Type16, MaximumCapacity);
- PRINT_STRUCT_VALUE_H (Struct, Type16, MemoryErrorInformationHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type16, NumberOfMemoryDevices);
- if (AE_SMBIOS_VERSION (0x2, 0x7) && Struct->Hdr->Length > 0xF) {
- PRINT_STRUCT_VALUE_LH (Struct, Type16, ExtendedMaximumCapacity);
- }
- break;
-
- //
- // Memory Device (Type 17)
- //
- case 17:
- PRINT_STRUCT_VALUE_H (Struct, Type17, MemoryArrayHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type17, MemoryErrorInformationHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type17, TotalWidth);
- PRINT_STRUCT_VALUE_H (Struct, Type17, DataWidth);
- PRINT_STRUCT_VALUE (Struct, Type17, Size);
- DisplayMemoryDeviceFormFactor (Struct->Type17->FormFactor, Option);
- PRINT_STRUCT_VALUE_H (Struct, Type17, DeviceSet);
- PRINT_PENDING_STRING (Struct, Type17, DeviceLocator);
- PRINT_PENDING_STRING (Struct, Type17, BankLocator);
- DisplayMemoryDeviceType (Struct->Type17->MemoryType, Option);
- DisplayMemoryDeviceTypeDetail (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type17->TypeDetail)), Option);
- PRINT_STRUCT_VALUE_H (Struct, Type17, Speed);
- PRINT_PENDING_STRING (Struct, Type17, Manufacturer);
- PRINT_PENDING_STRING (Struct, Type17, SerialNumber);
- PRINT_PENDING_STRING (Struct, Type17, AssetTag);
- PRINT_PENDING_STRING (Struct, Type17, PartNumber);
- if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x1B)) {
- PRINT_STRUCT_VALUE_H (Struct, Type17, Attributes);
- }
- if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x1C)) {
- PRINT_STRUCT_VALUE (Struct, Type17, ExtendedSize);
- PRINT_STRUCT_VALUE_H (Struct, Type17, ConfiguredMemoryClockSpeed);
- }
- if (AE_SMBIOS_VERSION (0x2, 0x8) && (Struct->Hdr->Length > 0x22)) {
- PRINT_STRUCT_VALUE (Struct, Type17, MinimumVoltage);
- PRINT_STRUCT_VALUE (Struct, Type17, MaximumVoltage);
- PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredVoltage);
- }
- if (AE_SMBIOS_VERSION (0x3, 0x2)) {
- if (Struct->Hdr->Length > 0x28) {
- DisplayMemoryDeviceMemoryTechnology (Struct->Type17->MemoryTechnology, Option);
- DisplayMemoryDeviceMemoryOperatingModeCapability (Struct->Type17->MemoryOperatingModeCapability.Uint16, Option);
- PRINT_PENDING_STRING (Struct, Type17, FirmwareVersion);
- PRINT_STRUCT_VALUE_H (Struct, Type17, ModuleManufacturerID);
- PRINT_STRUCT_VALUE_H (Struct, Type17, ModuleProductID);
- PRINT_STRUCT_VALUE_H (Struct, Type17, MemorySubsystemControllerManufacturerID);
- PRINT_STRUCT_VALUE_H (Struct, Type17, MemorySubsystemControllerProductID);
+
+ //
+ // Physical Memory Array (Type 16)
+ //
+ case 16:
+ DisplayPMALocation (Struct->Type16->Location, Option);
+ DisplayPMAUse (Struct->Type16->Use, Option);
+ DisplayPMAErrorCorrectionTypes (
+ Struct->Type16->MemoryErrorCorrection,
+ Option
+ );
+ PRINT_STRUCT_VALUE_H (Struct, Type16, MaximumCapacity);
+ PRINT_STRUCT_VALUE_H (Struct, Type16, MemoryErrorInformationHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type16, NumberOfMemoryDevices);
+ if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xF)) {
+ PRINT_STRUCT_VALUE_LH (Struct, Type16, ExtendedMaximumCapacity);
}
- if (Struct->Hdr->Length > 0x34) {
- PRINT_STRUCT_VALUE_LH (Struct, Type17, NonVolatileSize);
+
+ break;
+
+ //
+ // Memory Device (Type 17)
+ //
+ case 17:
+ PRINT_STRUCT_VALUE_H (Struct, Type17, MemoryArrayHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, MemoryErrorInformationHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, TotalWidth);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, DataWidth);
+ PRINT_STRUCT_VALUE (Struct, Type17, Size);
+ DisplayMemoryDeviceFormFactor (Struct->Type17->FormFactor, Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, DeviceSet);
+ PRINT_PENDING_STRING (Struct, Type17, DeviceLocator);
+ PRINT_PENDING_STRING (Struct, Type17, BankLocator);
+ DisplayMemoryDeviceType (Struct->Type17->MemoryType, Option);
+ DisplayMemoryDeviceTypeDetail (ReadUnaligned16 ((UINT16 *)(UINTN)&(Struct->Type17->TypeDetail)), Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, Speed);
+ PRINT_PENDING_STRING (Struct, Type17, Manufacturer);
+ PRINT_PENDING_STRING (Struct, Type17, SerialNumber);
+ PRINT_PENDING_STRING (Struct, Type17, AssetTag);
+ PRINT_PENDING_STRING (Struct, Type17, PartNumber);
+ if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x1B)) {
+ PRINT_STRUCT_VALUE_H (Struct, Type17, Attributes);
}
- if (Struct->Hdr->Length > 0x3C) {
- PRINT_STRUCT_VALUE_LH (Struct, Type17, VolatileSize);
+
+ if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x1C)) {
+ PRINT_STRUCT_VALUE (Struct, Type17, ExtendedSize);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, ConfiguredMemoryClockSpeed);
}
- if (Struct->Hdr->Length > 0x44) {
- PRINT_STRUCT_VALUE_LH (Struct, Type17, CacheSize);
+
+ if (AE_SMBIOS_VERSION (0x2, 0x8) && (Struct->Hdr->Length > 0x22)) {
+ PRINT_STRUCT_VALUE (Struct, Type17, MinimumVoltage);
+ PRINT_STRUCT_VALUE (Struct, Type17, MaximumVoltage);
+ PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredVoltage);
}
- if (Struct->Hdr->Length > 0x4C) {
- PRINT_STRUCT_VALUE_LH (Struct, Type17, LogicalSize);
+
+ if (AE_SMBIOS_VERSION (0x3, 0x2)) {
+ if (Struct->Hdr->Length > 0x28) {
+ DisplayMemoryDeviceMemoryTechnology (Struct->Type17->MemoryTechnology, Option);
+ DisplayMemoryDeviceMemoryOperatingModeCapability (Struct->Type17->MemoryOperatingModeCapability.Uint16, Option);
+ PRINT_PENDING_STRING (Struct, Type17, FirmwareVersion);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, ModuleManufacturerID);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, ModuleProductID);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, MemorySubsystemControllerManufacturerID);
+ PRINT_STRUCT_VALUE_H (Struct, Type17, MemorySubsystemControllerProductID);
+ }
+
+ if (Struct->Hdr->Length > 0x34) {
+ PRINT_STRUCT_VALUE_LH (Struct, Type17, NonVolatileSize);
+ }
+
+ if (Struct->Hdr->Length > 0x3C) {
+ PRINT_STRUCT_VALUE_LH (Struct, Type17, VolatileSize);
+ }
+
+ if (Struct->Hdr->Length > 0x44) {
+ PRINT_STRUCT_VALUE_LH (Struct, Type17, CacheSize);
+ }
+
+ if (Struct->Hdr->Length > 0x4C) {
+ PRINT_STRUCT_VALUE_LH (Struct, Type17, LogicalSize);
+ }
}
- }
- break;
-
- //
- // 32-bit Memory Error Information (Type 18)
- //
- case 18:
- DisplayMemoryErrorType (Struct->Type18->ErrorType, Option);
- DisplayMemoryErrorGranularity (
- Struct->Type18->ErrorGranularity,
- Option
- );
- DisplayMemoryErrorOperation (Struct->Type18->ErrorOperation, Option);
- PRINT_STRUCT_VALUE_H (Struct, Type18, VendorSyndrome);
- PRINT_STRUCT_VALUE_H (Struct, Type18, MemoryArrayErrorAddress);
- PRINT_STRUCT_VALUE_H (Struct, Type18, DeviceErrorAddress);
- PRINT_STRUCT_VALUE_H (Struct, Type18, ErrorResolution);
- break;
-
- //
- // Memory Array Mapped Address (Type 19)
- //
- case 19:
- PRINT_STRUCT_VALUE_H (Struct, Type19, StartingAddress);
- PRINT_STRUCT_VALUE_H (Struct, Type19, EndingAddress);
- PRINT_STRUCT_VALUE_H (Struct, Type19, MemoryArrayHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type19, PartitionWidth);
- if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xF)) {
- PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress);
- PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress);
- }
- break;
-
- //
- // Memory Device Mapped Address (Type 20)
- //
- case 20:
- PRINT_STRUCT_VALUE_H (Struct, Type20, StartingAddress);
- PRINT_STRUCT_VALUE_H (Struct, Type20, EndingAddress);
- PRINT_STRUCT_VALUE_H (Struct, Type20, MemoryDeviceHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type20, MemoryArrayMappedAddressHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type20, PartitionRowPosition);
- PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavePosition);
- PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavedDataDepth);
- if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) {
- PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress);
- PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress);
- }
- break;
-
- //
- // Built-in Pointing Device (Type 21)
- //
- case 21:
- DisplayPointingDeviceType (Struct->Type21->Type, Option);
- DisplayPointingDeviceInterface (Struct->Type21->Interface, Option);
- PRINT_STRUCT_VALUE (Struct, Type21, NumberOfButtons);
- break;
-
- //
- // Portable Battery (Type 22)
- //
- case 22:
- PRINT_PENDING_STRING (Struct, Type22, Location);
- PRINT_PENDING_STRING (Struct, Type22, Manufacturer);
- PRINT_PENDING_STRING (Struct, Type22, ManufactureDate);
- PRINT_PENDING_STRING (Struct, Type22, SerialNumber);
- PRINT_PENDING_STRING (Struct, Type22, DeviceName);
- DisplayPBDeviceChemistry (
- Struct->Type22->DeviceChemistry,
- Option
- );
- PRINT_STRUCT_VALUE_H (Struct, Type22, DeviceCapacity);
- PRINT_STRUCT_VALUE_H (Struct, Type22, DesignVoltage);
- PRINT_PENDING_STRING (Struct, Type22, SBDSVersionNumber);
- PRINT_STRUCT_VALUE_H (Struct, Type22, MaximumErrorInBatteryData);
- PRINT_STRUCT_VALUE_H (Struct, Type22, SBDSSerialNumber);
- DisplaySBDSManufactureDate (
- Struct->Type22->SBDSManufactureDate,
- Option
- );
- PRINT_PENDING_STRING (Struct, Type22, SBDSDeviceChemistry);
- PRINT_STRUCT_VALUE_H (Struct, Type22, DesignCapacityMultiplier);
- PRINT_STRUCT_VALUE_H (Struct, Type22, OEMSpecific);
- break;
-
- //
- // System Reset (Type 23)
- //
- case 23:
- DisplaySystemResetCapabilities (
- Struct->Type23->Capabilities,
- Option
- );
- PRINT_STRUCT_VALUE_H (Struct, Type23, ResetCount);
- PRINT_STRUCT_VALUE_H (Struct, Type23, ResetLimit);
- PRINT_STRUCT_VALUE_H (Struct, Type23, TimerInterval);
- PRINT_STRUCT_VALUE_H (Struct, Type23, Timeout);
- break;
-
- //
- // Hardware Security (Type 24)
- //
- case 24:
- DisplayHardwareSecuritySettings (
- Struct->Type24->HardwareSecuritySettings,
- Option
- );
- break;
-
- //
- // System Power Controls (Type 25)
- //
- case 25:
- PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMonth);
- PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnDayOfMonth);
- PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnHour);
- PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMinute);
- PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnSecond);
- break;
-
- //
- // Voltage Probe (Type 26)
- //
- case 26:
- PRINT_PENDING_STRING (Struct, Type26, Description);
- DisplayVPLocation (*(UINT8 *) &(Struct->Type26->LocationAndStatus), Option);
- DisplayVPStatus (*(UINT8 *) &(Struct->Type26->LocationAndStatus), Option);
- PRINT_STRUCT_VALUE_H (Struct, Type26, MaximumValue);
- PRINT_STRUCT_VALUE_H (Struct, Type26, MinimumValue);
- PRINT_STRUCT_VALUE_H (Struct, Type26, Resolution);
- PRINT_STRUCT_VALUE_H (Struct, Type26, Tolerance);
- PRINT_STRUCT_VALUE_H (Struct, Type26, Accuracy);
- PRINT_STRUCT_VALUE_H (Struct, Type26, OEMDefined);
- PRINT_STRUCT_VALUE_H (Struct, Type26, NominalValue);
- break;
-
- //
- // Cooling Device (Type 27)
- //
- case 27:
- PRINT_STRUCT_VALUE_H (Struct, Type27, TemperatureProbeHandle);
- DisplayCoolingDeviceStatus (*(UINT8 *) &(Struct->Type27->DeviceTypeAndStatus), Option);
- DisplayCoolingDeviceType (*(UINT8 *) &(Struct->Type27->DeviceTypeAndStatus), Option);
- PRINT_STRUCT_VALUE_H (Struct, Type27, CoolingUnitGroup);
- PRINT_STRUCT_VALUE_H (Struct, Type27, OEMDefined);
- PRINT_STRUCT_VALUE_H (Struct, Type27, NominalSpeed);
- if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xE)) {
- PRINT_PENDING_STRING (Struct, Type27, Description);
- }
- break;
- //
- // Temperature Probe (Type 28)
- //
- case 28:
- PRINT_PENDING_STRING (Struct, Type28, Description);
- DisplayTemperatureProbeStatus (*(UINT8 *) &(Struct->Type28->LocationAndStatus), Option);
- DisplayTemperatureProbeLoc (*(UINT8 *) &(Struct->Type28->LocationAndStatus), Option);
- PRINT_STRUCT_VALUE_H (Struct, Type28, MaximumValue);
- PRINT_STRUCT_VALUE_H (Struct, Type28, MinimumValue);
- PRINT_STRUCT_VALUE_H (Struct, Type28, Resolution);
- PRINT_STRUCT_VALUE_H (Struct, Type28, Tolerance);
- PRINT_STRUCT_VALUE_H (Struct, Type28, Accuracy);
- PRINT_STRUCT_VALUE_H (Struct, Type28, OEMDefined);
- PRINT_STRUCT_VALUE_H (Struct, Type28, NominalValue);
- break;
+ break;
- //
- // Electrical Current Probe (Type 29)
- //
- case 29:
- PRINT_PENDING_STRING (Struct, Type29, Description);
- DisplayECPStatus (*(UINT8 *) &(Struct->Type29->LocationAndStatus), Option);
- DisplayECPLoc (*(UINT8 *) &(Struct->Type29->LocationAndStatus), Option);
- PRINT_STRUCT_VALUE_H (Struct, Type29, MaximumValue);
- PRINT_STRUCT_VALUE_H (Struct, Type29, MinimumValue);
- PRINT_STRUCT_VALUE_H (Struct, Type29, Resolution);
- PRINT_STRUCT_VALUE_H (Struct, Type29, Tolerance);
- PRINT_STRUCT_VALUE_H (Struct, Type29, Accuracy);
- PRINT_STRUCT_VALUE_H (Struct, Type29, OEMDefined);
- PRINT_STRUCT_VALUE_H (Struct, Type29, NominalValue);
- break;
+ //
+ // 32-bit Memory Error Information (Type 18)
+ //
+ case 18:
+ DisplayMemoryErrorType (Struct->Type18->ErrorType, Option);
+ DisplayMemoryErrorGranularity (
+ Struct->Type18->ErrorGranularity,
+ Option
+ );
+ DisplayMemoryErrorOperation (Struct->Type18->ErrorOperation, Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type18, VendorSyndrome);
+ PRINT_STRUCT_VALUE_H (Struct, Type18, MemoryArrayErrorAddress);
+ PRINT_STRUCT_VALUE_H (Struct, Type18, DeviceErrorAddress);
+ PRINT_STRUCT_VALUE_H (Struct, Type18, ErrorResolution);
+ break;
- //
- // Out-of-Band Remote Access (Type 30)
- //
- case 30:
- PRINT_PENDING_STRING (Struct, Type30, ManufacturerName);
- DisplayOBRAConnections (Struct->Type30->Connections, Option);
- break;
+ //
+ // Memory Array Mapped Address (Type 19)
+ //
+ case 19:
+ PRINT_STRUCT_VALUE_H (Struct, Type19, StartingAddress);
+ PRINT_STRUCT_VALUE_H (Struct, Type19, EndingAddress);
+ PRINT_STRUCT_VALUE_H (Struct, Type19, MemoryArrayHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type19, PartitionWidth);
+ if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xF)) {
+ PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress);
+ PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress);
+ }
- //
- // Boot Integrity Services (BIS) Entry Point (Type 31)
- //
- case 31:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31), gShellDebug1HiiHandle);
- break;
+ break;
- //
- // System Boot Information (Type 32)
- //
- case 32:
- PRINT_BIT_FIELD (Struct, Type32, Reserved, 6);
- DisplaySystemBootStatus (Struct->Type32->BootStatus, Option);
- break;
+ //
+ // Memory Device Mapped Address (Type 20)
+ //
+ case 20:
+ PRINT_STRUCT_VALUE_H (Struct, Type20, StartingAddress);
+ PRINT_STRUCT_VALUE_H (Struct, Type20, EndingAddress);
+ PRINT_STRUCT_VALUE_H (Struct, Type20, MemoryDeviceHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type20, MemoryArrayMappedAddressHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type20, PartitionRowPosition);
+ PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavePosition);
+ PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavedDataDepth);
+ if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) {
+ PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress);
+ PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress);
+ }
- //
- // 64-Bit Memory Error Information (Type 33)
- //
- case 33:
- DisplayMemoryErrorType (Struct->Type33->ErrorType, Option);
- DisplayMemoryErrorGranularity (
- Struct->Type33->ErrorGranularity,
- Option
- );
- DisplayMemoryErrorOperation (Struct->Type33->ErrorOperation, Option);
- PRINT_STRUCT_VALUE_H (Struct, Type33, VendorSyndrome);
- PRINT_STRUCT_VALUE_LH (Struct, Type33, MemoryArrayErrorAddress);
- PRINT_STRUCT_VALUE_LH (Struct, Type33, DeviceErrorAddress);
- PRINT_STRUCT_VALUE_H (Struct, Type33, ErrorResolution);
- break;
+ break;
- //
- // Management Device (Type 34)
- //
- case 34:
- PRINT_PENDING_STRING (Struct, Type34, Description);
- DisplayMDType (Struct->Type34->Type, Option);
- PRINT_STRUCT_VALUE_H (Struct, Type34, Address);
- DisplayMDAddressType (Struct->Type34->AddressType, Option);
- break;
+ //
+ // Built-in Pointing Device (Type 21)
+ //
+ case 21:
+ DisplayPointingDeviceType (Struct->Type21->Type, Option);
+ DisplayPointingDeviceInterface (Struct->Type21->Interface, Option);
+ PRINT_STRUCT_VALUE (Struct, Type21, NumberOfButtons);
+ break;
- //
- // Management Device Component (Type 35)
- //
- case 35:
- PRINT_PENDING_STRING (Struct, Type35, Description);
- PRINT_STRUCT_VALUE_H (Struct, Type35, ManagementDeviceHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type35, ComponentHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type35, ThresholdHandle);
- break;
+ //
+ // Portable Battery (Type 22)
+ //
+ case 22:
+ PRINT_PENDING_STRING (Struct, Type22, Location);
+ PRINT_PENDING_STRING (Struct, Type22, Manufacturer);
+ PRINT_PENDING_STRING (Struct, Type22, ManufactureDate);
+ PRINT_PENDING_STRING (Struct, Type22, SerialNumber);
+ PRINT_PENDING_STRING (Struct, Type22, DeviceName);
+ DisplayPBDeviceChemistry (
+ Struct->Type22->DeviceChemistry,
+ Option
+ );
+ PRINT_STRUCT_VALUE_H (Struct, Type22, DeviceCapacity);
+ PRINT_STRUCT_VALUE_H (Struct, Type22, DesignVoltage);
+ PRINT_PENDING_STRING (Struct, Type22, SBDSVersionNumber);
+ PRINT_STRUCT_VALUE_H (Struct, Type22, MaximumErrorInBatteryData);
+ PRINT_STRUCT_VALUE_H (Struct, Type22, SBDSSerialNumber);
+ DisplaySBDSManufactureDate (
+ Struct->Type22->SBDSManufactureDate,
+ Option
+ );
+ PRINT_PENDING_STRING (Struct, Type22, SBDSDeviceChemistry);
+ PRINT_STRUCT_VALUE_H (Struct, Type22, DesignCapacityMultiplier);
+ PRINT_STRUCT_VALUE_H (Struct, Type22, OEMSpecific);
+ break;
- //
- // Management Device Threshold Data (Type 36)
- //
- case 36:
- PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonCritical);
- PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdNonCritical);
- PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdCritical);
- PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdCritical);
- PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonRecoverable);
- PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdNonRecoverable);
- break;
+ //
+ // System Reset (Type 23)
+ //
+ case 23:
+ DisplaySystemResetCapabilities (
+ Struct->Type23->Capabilities,
+ Option
+ );
+ PRINT_STRUCT_VALUE_H (Struct, Type23, ResetCount);
+ PRINT_STRUCT_VALUE_H (Struct, Type23, ResetLimit);
+ PRINT_STRUCT_VALUE_H (Struct, Type23, TimerInterval);
+ PRINT_STRUCT_VALUE_H (Struct, Type23, Timeout);
+ break;
- //
- // Memory Channel (Type 37)
- //
- case 37:
+ //
+ // Hardware Security (Type 24)
+ //
+ case 24:
+ DisplayHardwareSecuritySettings (
+ Struct->Type24->HardwareSecuritySettings,
+ Option
+ );
+ break;
+
+ //
+ // System Power Controls (Type 25)
+ //
+ case 25:
+ PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMonth);
+ PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnDayOfMonth);
+ PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnHour);
+ PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMinute);
+ PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnSecond);
+ break;
+
+ //
+ // Voltage Probe (Type 26)
+ //
+ case 26:
+ PRINT_PENDING_STRING (Struct, Type26, Description);
+ DisplayVPLocation (*(UINT8 *)&(Struct->Type26->LocationAndStatus), Option);
+ DisplayVPStatus (*(UINT8 *)&(Struct->Type26->LocationAndStatus), Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type26, MaximumValue);
+ PRINT_STRUCT_VALUE_H (Struct, Type26, MinimumValue);
+ PRINT_STRUCT_VALUE_H (Struct, Type26, Resolution);
+ PRINT_STRUCT_VALUE_H (Struct, Type26, Tolerance);
+ PRINT_STRUCT_VALUE_H (Struct, Type26, Accuracy);
+ PRINT_STRUCT_VALUE_H (Struct, Type26, OEMDefined);
+ PRINT_STRUCT_VALUE_H (Struct, Type26, NominalValue);
+ break;
+
+ //
+ // Cooling Device (Type 27)
+ //
+ case 27:
+ PRINT_STRUCT_VALUE_H (Struct, Type27, TemperatureProbeHandle);
+ DisplayCoolingDeviceStatus (*(UINT8 *)&(Struct->Type27->DeviceTypeAndStatus), Option);
+ DisplayCoolingDeviceType (*(UINT8 *)&(Struct->Type27->DeviceTypeAndStatus), Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type27, CoolingUnitGroup);
+ PRINT_STRUCT_VALUE_H (Struct, Type27, OEMDefined);
+ PRINT_STRUCT_VALUE_H (Struct, Type27, NominalSpeed);
+ if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xE)) {
+ PRINT_PENDING_STRING (Struct, Type27, Description);
+ }
+
+ break;
+
+ //
+ // Temperature Probe (Type 28)
+ //
+ case 28:
+ PRINT_PENDING_STRING (Struct, Type28, Description);
+ DisplayTemperatureProbeStatus (*(UINT8 *)&(Struct->Type28->LocationAndStatus), Option);
+ DisplayTemperatureProbeLoc (*(UINT8 *)&(Struct->Type28->LocationAndStatus), Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type28, MaximumValue);
+ PRINT_STRUCT_VALUE_H (Struct, Type28, MinimumValue);
+ PRINT_STRUCT_VALUE_H (Struct, Type28, Resolution);
+ PRINT_STRUCT_VALUE_H (Struct, Type28, Tolerance);
+ PRINT_STRUCT_VALUE_H (Struct, Type28, Accuracy);
+ PRINT_STRUCT_VALUE_H (Struct, Type28, OEMDefined);
+ PRINT_STRUCT_VALUE_H (Struct, Type28, NominalValue);
+ break;
+
+ //
+ // Electrical Current Probe (Type 29)
+ //
+ case 29:
+ PRINT_PENDING_STRING (Struct, Type29, Description);
+ DisplayECPStatus (*(UINT8 *)&(Struct->Type29->LocationAndStatus), Option);
+ DisplayECPLoc (*(UINT8 *)&(Struct->Type29->LocationAndStatus), Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type29, MaximumValue);
+ PRINT_STRUCT_VALUE_H (Struct, Type29, MinimumValue);
+ PRINT_STRUCT_VALUE_H (Struct, Type29, Resolution);
+ PRINT_STRUCT_VALUE_H (Struct, Type29, Tolerance);
+ PRINT_STRUCT_VALUE_H (Struct, Type29, Accuracy);
+ PRINT_STRUCT_VALUE_H (Struct, Type29, OEMDefined);
+ PRINT_STRUCT_VALUE_H (Struct, Type29, NominalValue);
+ break;
+
+ //
+ // Out-of-Band Remote Access (Type 30)
+ //
+ case 30:
+ PRINT_PENDING_STRING (Struct, Type30, ManufacturerName);
+ DisplayOBRAConnections (Struct->Type30->Connections, Option);
+ break;
+
+ //
+ // Boot Integrity Services (BIS) Entry Point (Type 31)
+ //
+ case 31:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31), gShellDebug1HiiHandle);
+ break;
+
+ //
+ // System Boot Information (Type 32)
+ //
+ case 32:
+ PRINT_BIT_FIELD (Struct, Type32, Reserved, 6);
+ DisplaySystemBootStatus (Struct->Type32->BootStatus, Option);
+ break;
+
+ //
+ // 64-Bit Memory Error Information (Type 33)
+ //
+ case 33:
+ DisplayMemoryErrorType (Struct->Type33->ErrorType, Option);
+ DisplayMemoryErrorGranularity (
+ Struct->Type33->ErrorGranularity,
+ Option
+ );
+ DisplayMemoryErrorOperation (Struct->Type33->ErrorOperation, Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type33, VendorSyndrome);
+ PRINT_STRUCT_VALUE_LH (Struct, Type33, MemoryArrayErrorAddress);
+ PRINT_STRUCT_VALUE_LH (Struct, Type33, DeviceErrorAddress);
+ PRINT_STRUCT_VALUE_H (Struct, Type33, ErrorResolution);
+ break;
+
+ //
+ // Management Device (Type 34)
+ //
+ case 34:
+ PRINT_PENDING_STRING (Struct, Type34, Description);
+ DisplayMDType (Struct->Type34->Type, Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type34, Address);
+ DisplayMDAddressType (Struct->Type34->AddressType, Option);
+ break;
+
+ //
+ // Management Device Component (Type 35)
+ //
+ case 35:
+ PRINT_PENDING_STRING (Struct, Type35, Description);
+ PRINT_STRUCT_VALUE_H (Struct, Type35, ManagementDeviceHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type35, ComponentHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type35, ThresholdHandle);
+ break;
+
+ //
+ // Management Device Threshold Data (Type 36)
+ //
+ case 36:
+ PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonCritical);
+ PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdNonCritical);
+ PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdCritical);
+ PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdCritical);
+ PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonRecoverable);
+ PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdNonRecoverable);
+ break;
+
+ //
+ // Memory Channel (Type 37)
+ //
+ case 37:
{
UINT8 Count;
MEMORY_DEVICE *Ptr;
@@ -1079,54 +1145,55 @@ SmbiosPrintStructure ( Count = Struct->Type37->MemoryDeviceCount;
Ptr = Struct->Type37->MemoryDevice;
for (Index = 0; Index < Count; Index++) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE), gShellDebug1HiiHandle, Index + 1);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD), gShellDebug1HiiHandle, Ptr[Index].DeviceLoad);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE), gShellDebug1HiiHandle, Ptr[Index].DeviceHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE), gShellDebug1HiiHandle, Index + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD), gShellDebug1HiiHandle, Ptr[Index].DeviceLoad);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE), gShellDebug1HiiHandle, Ptr[Index].DeviceHandle);
}
+
+ break;
}
- break;
- //
- // IPMI Device Information (Type 38)
- //
- case 38:
- DisplayIPMIDIBMCInterfaceType (Struct->Type38->InterfaceType, Option);
- PRINT_STRUCT_VALUE_H (Struct, Type38, IPMISpecificationRevision);
- PRINT_STRUCT_VALUE_H (Struct, Type38, I2CSlaveAddress);
- PRINT_STRUCT_VALUE_H (Struct, Type38, NVStorageDeviceAddress);
- PRINT_STRUCT_VALUE_LH (Struct, Type38, BaseAddress);
- break;
+ //
+ // IPMI Device Information (Type 38)
+ //
+ case 38:
+ DisplayIPMIDIBMCInterfaceType (Struct->Type38->InterfaceType, Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type38, IPMISpecificationRevision);
+ PRINT_STRUCT_VALUE_H (Struct, Type38, I2CSlaveAddress);
+ PRINT_STRUCT_VALUE_H (Struct, Type38, NVStorageDeviceAddress);
+ PRINT_STRUCT_VALUE_LH (Struct, Type38, BaseAddress);
+ break;
- //
- // System Power Supply (Type 39)
- //
- case 39:
- PRINT_STRUCT_VALUE_H (Struct, Type39, PowerUnitGroup);
- PRINT_PENDING_STRING (Struct, Type39, Location);
- PRINT_PENDING_STRING (Struct, Type39, DeviceName);
- PRINT_PENDING_STRING (Struct, Type39, Manufacturer);
- PRINT_PENDING_STRING (Struct, Type39, SerialNumber);
- PRINT_PENDING_STRING (Struct, Type39, AssetTagNumber);
- PRINT_PENDING_STRING (Struct, Type39, ModelPartNumber);
- PRINT_PENDING_STRING (Struct, Type39, RevisionLevel);
- PRINT_STRUCT_VALUE_H (Struct, Type39, MaxPowerCapacity);
- DisplaySPSCharacteristics (
- *(UINT16 *) &(Struct->Type39->PowerSupplyCharacteristics),
- Option
- );
- PRINT_STRUCT_VALUE_H (Struct, Type39, InputVoltageProbeHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type39, CoolingDeviceHandle);
- PRINT_STRUCT_VALUE_H (Struct, Type39, InputCurrentProbeHandle);
- break;
+ //
+ // System Power Supply (Type 39)
+ //
+ case 39:
+ PRINT_STRUCT_VALUE_H (Struct, Type39, PowerUnitGroup);
+ PRINT_PENDING_STRING (Struct, Type39, Location);
+ PRINT_PENDING_STRING (Struct, Type39, DeviceName);
+ PRINT_PENDING_STRING (Struct, Type39, Manufacturer);
+ PRINT_PENDING_STRING (Struct, Type39, SerialNumber);
+ PRINT_PENDING_STRING (Struct, Type39, AssetTagNumber);
+ PRINT_PENDING_STRING (Struct, Type39, ModelPartNumber);
+ PRINT_PENDING_STRING (Struct, Type39, RevisionLevel);
+ PRINT_STRUCT_VALUE_H (Struct, Type39, MaxPowerCapacity);
+ DisplaySPSCharacteristics (
+ *(UINT16 *)&(Struct->Type39->PowerSupplyCharacteristics),
+ Option
+ );
+ PRINT_STRUCT_VALUE_H (Struct, Type39, InputVoltageProbeHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type39, CoolingDeviceHandle);
+ PRINT_STRUCT_VALUE_H (Struct, Type39, InputCurrentProbeHandle);
+ break;
- //
- // Additional Information (Type 40)
- //
- case 40:
+ //
+ // Additional Information (Type 40)
+ //
+ case 40:
{
- UINT8 NumberOfEntries;
- UINT8 EntryLength;
- ADDITIONAL_INFORMATION_ENTRY *Entries;
+ UINT8 NumberOfEntries;
+ UINT8 EntryLength;
+ ADDITIONAL_INFORMATION_ENTRY *Entries;
EntryLength = 0;
Entries = Struct->Type40->AdditionalInfoEntries;
@@ -1136,78 +1203,80 @@ SmbiosPrintStructure ( for (Index = 0; Index < NumberOfEntries; Index++) {
EntryLength = Entries->EntryLength;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTRYLEN), gShellDebug1HiiHandle, EntryLength);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDHANDLE), gShellDebug1HiiHandle, Entries->ReferencedHandle);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDOFFSET), gShellDebug1HiiHandle, Entries->ReferencedOffset);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTRYLEN), gShellDebug1HiiHandle, EntryLength);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDHANDLE), gShellDebug1HiiHandle, Entries->ReferencedHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDOFFSET), gShellDebug1HiiHandle, Entries->ReferencedOffset);
PRINT_SMBIOS_STRING (Struct, Entries->EntryString, String);
PRINT_SMBIOS_BIT_FIELD (Struct, Entries->Value, Value, EntryLength - 5);
- Entries = (ADDITIONAL_INFORMATION_ENTRY *) ((UINT8 *)Entries + EntryLength);
+ Entries = (ADDITIONAL_INFORMATION_ENTRY *)((UINT8 *)Entries + EntryLength);
}
+
+ break;
}
- break;
- //
- // Onboard Devices Extended Information (Type 41)
- //
- case 41:
- PRINT_PENDING_STRING (Struct, Type41, ReferenceDesignation);
- ShellPrintEx(-1,-1,(((Struct->Type41->DeviceType) & 0x80) != 0) ? L"Device Enabled\n": L"Device Disabled\n");
- DisplayOnboardDeviceTypes ((Struct->Type41->DeviceType) & 0x7F, Option);
- PRINT_STRUCT_VALUE_H (Struct, Type41, DeviceTypeInstance);
- PRINT_STRUCT_VALUE_H (Struct, Type41, SegmentGroupNum);
- PRINT_STRUCT_VALUE_H (Struct, Type41, BusNum);
- PRINT_STRUCT_VALUE_H (Struct, Type41, DevFuncNum);
- break;
+ //
+ // Onboard Devices Extended Information (Type 41)
+ //
+ case 41:
+ PRINT_PENDING_STRING (Struct, Type41, ReferenceDesignation);
+ ShellPrintEx (-1, -1, (((Struct->Type41->DeviceType) & 0x80) != 0) ? L"Device Enabled\n" : L"Device Disabled\n");
+ DisplayOnboardDeviceTypes ((Struct->Type41->DeviceType) & 0x7F, Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type41, DeviceTypeInstance);
+ PRINT_STRUCT_VALUE_H (Struct, Type41, SegmentGroupNum);
+ PRINT_STRUCT_VALUE_H (Struct, Type41, BusNum);
+ PRINT_STRUCT_VALUE_H (Struct, Type41, DevFuncNum);
+ break;
- //
- // Management Controller Host Interface (Type 42)
- //
- case 42:
- DisplayMCHostInterfaceType (Struct->Type42->InterfaceType, Option);
- if (AE_SMBIOS_VERSION (0x3, 0x2)) {
- PRINT_STRUCT_VALUE_H (Struct, Type42, InterfaceTypeSpecificDataLength);
- PRINT_BIT_FIELD (Struct, Type42, InterfaceTypeSpecificData, Struct->Type42->InterfaceTypeSpecificDataLength);
- }
- break;
+ //
+ // Management Controller Host Interface (Type 42)
+ //
+ case 42:
+ DisplayMCHostInterfaceType (Struct->Type42->InterfaceType, Option);
+ if (AE_SMBIOS_VERSION (0x3, 0x2)) {
+ PRINT_STRUCT_VALUE_H (Struct, Type42, InterfaceTypeSpecificDataLength);
+ PRINT_BIT_FIELD (Struct, Type42, InterfaceTypeSpecificData, Struct->Type42->InterfaceTypeSpecificDataLength);
+ }
- //
- // TPM Device (Type 43)
- //
- case 43:
- PRINT_BIT_FIELD (Struct, Type43, VendorID, 4);
- PRINT_STRUCT_VALUE_H (Struct, Type43, MajorSpecVersion);
- PRINT_STRUCT_VALUE_H (Struct, Type43, MinorSpecVersion);
- PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion1);
- PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion2);
- PRINT_PENDING_STRING (Struct, Type43, Description);
- DisplayTpmDeviceCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type43->Characteristics)), Option);
- PRINT_STRUCT_VALUE_H (Struct, Type43, OemDefined);
- break;
+ break;
- //
- // Processor Additional Information (Type 44)
- //
- case 44:
- DisplayProcessorArchitectureType (Struct->Type44->ProcessorSpecificBlock.ProcessorArchType, Option);
- break;
+ //
+ // TPM Device (Type 43)
+ //
+ case 43:
+ PRINT_BIT_FIELD (Struct, Type43, VendorID, 4);
+ PRINT_STRUCT_VALUE_H (Struct, Type43, MajorSpecVersion);
+ PRINT_STRUCT_VALUE_H (Struct, Type43, MinorSpecVersion);
+ PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion1);
+ PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion2);
+ PRINT_PENDING_STRING (Struct, Type43, Description);
+ DisplayTpmDeviceCharacteristics (ReadUnaligned64 ((UINT64 *)(UINTN)&(Struct->Type43->Characteristics)), Option);
+ PRINT_STRUCT_VALUE_H (Struct, Type43, OemDefined);
+ break;
- //
- // Inactive (Type 126)
- //
- case 126:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INACTIVE_STRUCT), gShellDebug1HiiHandle);
- break;
+ //
+ // Processor Additional Information (Type 44)
+ //
+ case 44:
+ DisplayProcessorArchitectureType (Struct->Type44->ProcessorSpecificBlock.ProcessorArchType, Option);
+ break;
- //
- // End-of-Table (Type 127)
- //
- case 127:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THIS_STRUCT_END_TABLE), gShellDebug1HiiHandle);
- break;
+ //
+ // Inactive (Type 126)
+ //
+ case 126:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INACTIVE_STRUCT), gShellDebug1HiiHandle);
+ break;
+
+ //
+ // End-of-Table (Type 127)
+ //
+ case 127:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THIS_STRUCT_END_TABLE), gShellDebug1HiiHandle);
+ break;
- default:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE_UNDEFINED), gShellDebug1HiiHandle);
- break;
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE_UNDEFINED), gShellDebug1HiiHandle);
+ break;
}
return EFI_SUCCESS;
@@ -1228,7 +1297,7 @@ DisplayBiosCharacteristics ( //
// Print header
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR), gShellDebug1HiiHandle);
//
// print option
//
@@ -1240,137 +1309,138 @@ DisplayBiosCharacteristics ( // are designed not to deal with UINT64
//
if (BIT (Chara, 0) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 1) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 2) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN_BIT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 3) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 4) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ISA_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ISA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 5) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 6) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EISA_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EISA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 7) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PCI_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PCI_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 8) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 9) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PLUG_PLAY_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PLUG_PLAY_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 10) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_APM_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_APM_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 11) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE), gShellDebug1HiiHandle);
}
if (BIT (Chara, 12) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SHADOWING), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SHADOWING), gShellDebug1HiiHandle);
}
if (BIT (Chara, 13) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VESA_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VESA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 14) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ECSD_SUPPORT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ECSD_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 15) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_CD_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_CD_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 16) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SELECTED_BOOT_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SELECTED_BOOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 17) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 18) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD), gShellDebug1HiiHandle);
}
if (BIT (Chara, 19) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER), gShellDebug1HiiHandle);
}
if (BIT (Chara, 20) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC), gShellDebug1HiiHandle);
}
if (BIT (Chara, 21) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA), gShellDebug1HiiHandle);
}
if (BIT (Chara, 22) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 23) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB), gShellDebug1HiiHandle);
}
if (BIT (Chara, 24) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_720_KB), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_720_KB), gShellDebug1HiiHandle);
}
if (BIT (Chara, 25) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB), gShellDebug1HiiHandle);
}
if (BIT (Chara, 26) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 27) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 28) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 29) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 30) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 31) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NEC_PC_98), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NEC_PC_98), gShellDebug1HiiHandle);
}
+
//
// Just print the Reserved
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_32_47), gShellDebug1HiiHandle);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_48_64), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_32_47), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_48_64), gShellDebug1HiiHandle);
}
/**
@@ -1381,11 +1451,11 @@ DisplayBiosCharacteristics ( **/
VOID
DisplayBiosCharacteristicsExt1 (
- IN UINT8 Byte1,
- IN UINT8 Option
+ IN UINT8 Byte1,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION), gShellDebug1HiiHandle);
//
// Print option
//
@@ -1395,35 +1465,35 @@ DisplayBiosCharacteristicsExt1 ( // check bit and print
//
if (BIT (Byte1, 0) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 1) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USB_LEGACY_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USB_LEGACY_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 2) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AGP_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AGP_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 3) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_I2O_BOOT_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_I2O_BOOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 4) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 5) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 6) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_1394_BOOT_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_1394_BOOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 7) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED), gShellDebug1HiiHandle);
}
}
@@ -1435,41 +1505,44 @@ DisplayBiosCharacteristicsExt1 ( **/
VOID
DisplayBiosCharacteristicsExt2 (
- IN UINT8 byte2,
- IN UINT8 Option
+ IN UINT8 byte2,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION_2), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (byte2, Option);
if (BIT (byte2, 0) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP), gShellDebug1HiiHandle);
}
if (BIT (byte2, 1) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT), gShellDebug1HiiHandle);
}
if (AE_SMBIOS_VERSION (0x2, 0x4)) {
if (BIT (byte2, 2) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLE_TAR_CONT_DIST), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLE_TAR_CONT_DIST), gShellDebug1HiiHandle);
}
+
if (AE_SMBIOS_VERSION (0x2, 0x7)) {
if (BIT (byte2, 3) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UEFI_SPEC_SUPPORT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UEFI_SPEC_SUPPORT), gShellDebug1HiiHandle);
}
+
if (BIT (byte2, 4) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VIRTUAL_MACHINE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VIRTUAL_MACHINE), gShellDebug1HiiHandle);
}
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 5);
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 5);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 3);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 3);
}
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 2);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 2);
}
}
@@ -1481,14 +1554,14 @@ DisplayBiosCharacteristicsExt2 ( **/
VOID
DisplayProcessorFamily (
- UINT8 Family,
- UINT8 Option
+ UINT8 Family,
+ UINT8 Option
)
{
//
// Print prompt message
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle);
//
// Print option
//
@@ -1498,802 +1571,802 @@ DisplayProcessorFamily ( // Use switch to check
//
switch (Family) {
- case 0x01:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER), gShellDebug1HiiHandle);
- break;
-
- case 0x02:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 0x01:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER), gShellDebug1HiiHandle);
+ break;
- case 0x03:
- Print (L"8086\n");
- break;
+ case 0x02:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
- case 0x04:
- Print (L"80286\n");
- break;
+ case 0x03:
+ Print (L"8086\n");
+ break;
- case 0x05:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL386_PROCESSOR), gShellDebug1HiiHandle);
- break;
+ case 0x04:
+ Print (L"80286\n");
+ break;
- case 0x06:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL486_PROCESSOR), gShellDebug1HiiHandle);
- break;
+ case 0x05:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL386_PROCESSOR), gShellDebug1HiiHandle);
+ break;
- case 0x07:
- Print (L"8087\n");
- break;
+ case 0x06:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL486_PROCESSOR), gShellDebug1HiiHandle);
+ break;
- case 0x08:
- Print (L"80287\n");
- break;
+ case 0x07:
+ Print (L"8087\n");
+ break;
- case 0x09:
- Print (L"80387\n");
- break;
+ case 0x08:
+ Print (L"80287\n");
+ break;
- case 0x0A:
- Print (L"80487\n");
- break;
+ case 0x09:
+ Print (L"80387\n");
+ break;
- case 0x0B:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x0A:
+ Print (L"80487\n");
+ break;
- case 0x0C:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PRO_PROC), gShellDebug1HiiHandle);
- break;
+ case 0x0B:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x0D:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_II_PROC), gShellDebug1HiiHandle);
- break;
+ case 0x0C:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PRO_PROC), gShellDebug1HiiHandle);
+ break;
- case 0x0E:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_MMX), gShellDebug1HiiHandle);
- break;
+ case 0x0D:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_II_PROC), gShellDebug1HiiHandle);
+ break;
- case 0x0F:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CELERON_PROC), gShellDebug1HiiHandle);
- break;
+ case 0x0E:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_MMX), gShellDebug1HiiHandle);
+ break;
- case 0x10:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_XEON_PROC), gShellDebug1HiiHandle);
- break;
+ case 0x0F:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CELERON_PROC), gShellDebug1HiiHandle);
+ break;
- case 0x11:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_PROC), gShellDebug1HiiHandle);
- break;
+ case 0x10:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_XEON_PROC), gShellDebug1HiiHandle);
+ break;
- case 0x12:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_M1_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x11:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_PROC), gShellDebug1HiiHandle);
+ break;
- case 0x13:
- Print (L"M2 Family\n");
- break;
+ case 0x12:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_M1_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x14:
- Print (L"Intel Celeron M\n");
- break;
+ case 0x13:
+ Print (L"M2 Family\n");
+ break;
- case 0x15:
- Print (L"Intel Pentium 4 HT\n");
- break;
+ case 0x14:
+ Print (L"Intel Celeron M\n");
+ break;
- case 0x18:
- Print (L"AMD Duron\n");
- break;
+ case 0x15:
+ Print (L"Intel Pentium 4 HT\n");
+ break;
- case 0x19:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_K5_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x18:
+ Print (L"AMD Duron\n");
+ break;
- case 0x1A:
- Print (L"K6 Family\n");
- break;
+ case 0x19:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_K5_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x1B:
- Print (L"K6-2\n");
- break;
+ case 0x1A:
+ Print (L"K6 Family\n");
+ break;
- case 0x1C:
- Print (L"K6-3\n");
- break;
+ case 0x1B:
+ Print (L"K6-2\n");
+ break;
- case 0x1D:
- Print (L"AMD Althon Processor Family\n");
- break;
+ case 0x1C:
+ Print (L"K6-3\n");
+ break;
- case 0x1E:
- Print (L"AMD 29000 Family\n");
- break;
+ case 0x1D:
+ Print (L"AMD Althon Processor Family\n");
+ break;
- case 0x1F:
- Print (L"K6-2+\n");
- break;
+ case 0x1E:
+ Print (L"AMD 29000 Family\n");
+ break;
- case 0x20:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x1F:
+ Print (L"K6-2+\n");
+ break;
- case 0x21:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_601), gShellDebug1HiiHandle);
- break;
+ case 0x20:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x22:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603), gShellDebug1HiiHandle);
- break;
+ case 0x21:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_601), gShellDebug1HiiHandle);
+ break;
- case 0x23:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603_PLUS), gShellDebug1HiiHandle);
- break;
+ case 0x22:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603), gShellDebug1HiiHandle);
+ break;
- case 0x24:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_604), gShellDebug1HiiHandle);
- break;
+ case 0x23:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603_PLUS), gShellDebug1HiiHandle);
+ break;
- case 0x25:
- Print (L"Power PC 620\n");
- break;
+ case 0x24:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_604), gShellDebug1HiiHandle);
+ break;
- case 0x26:
- Print (L"Power PC 704\n");
- break;
+ case 0x25:
+ Print (L"Power PC 620\n");
+ break;
- case 0x27:
- Print (L"Power PC 750\n");
- break;
+ case 0x26:
+ Print (L"Power PC 704\n");
+ break;
- case 0x28:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO), gShellDebug1HiiHandle);
- break;
+ case 0x27:
+ Print (L"Power PC 750\n");
+ break;
- case 0x29:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO_MOBILE), gShellDebug1HiiHandle);
- break;
+ case 0x28:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO), gShellDebug1HiiHandle);
+ break;
- case 0x2A:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_SOLO_MOBILE), gShellDebug1HiiHandle);
- break;
+ case 0x29:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO_MOBILE), gShellDebug1HiiHandle);
+ break;
- case 0x2B:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_ATOM), gShellDebug1HiiHandle);
- break;
+ case 0x2A:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_SOLO_MOBILE), gShellDebug1HiiHandle);
+ break;
- case 0x2C:
- Print (L"Intel(R) Core(TM) M processor\n");
- break;
+ case 0x2B:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_ATOM), gShellDebug1HiiHandle);
+ break;
- case 0x2D:
- Print (L"Intel(R) Core(TM) m3 processor\n");
- break;
+ case 0x2C:
+ Print (L"Intel(R) Core(TM) M processor\n");
+ break;
- case 0x2E:
- Print (L"Intel(R) Core(TM) m5 processor\n");
- break;
+ case 0x2D:
+ Print (L"Intel(R) Core(TM) m3 processor\n");
+ break;
- case 0x2F:
- Print (L"Intel(R) Core(TM) m7 processor\n");
- break;
+ case 0x2E:
+ Print (L"Intel(R) Core(TM) m5 processor\n");
+ break;
- case 0x30:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ALPHA_FAMILY_2), gShellDebug1HiiHandle);
- break;
+ case 0x2F:
+ Print (L"Intel(R) Core(TM) m7 processor\n");
+ break;
- case 0x31:
- Print (L"Alpha 21064\n");
- break;
+ case 0x30:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ALPHA_FAMILY_2), gShellDebug1HiiHandle);
+ break;
- case 0x32:
- Print (L"Alpha 21066\n");
- break;
+ case 0x31:
+ Print (L"Alpha 21064\n");
+ break;
- case 0x33:
- Print (L"Alpha 21164\n");
- break;
+ case 0x32:
+ Print (L"Alpha 21066\n");
+ break;
- case 0x34:
- Print (L"Alpha 21164PC\n");
- break;
+ case 0x33:
+ Print (L"Alpha 21164\n");
+ break;
- case 0x35:
- Print (L"Alpha 21164a\n");
- break;
+ case 0x34:
+ Print (L"Alpha 21164PC\n");
+ break;
- case 0x36:
- Print (L"Alpha 21264\n");
- break;
+ case 0x35:
+ Print (L"Alpha 21164a\n");
+ break;
- case 0x37:
- Print (L"Alpha 21364\n");
- break;
+ case 0x36:
+ Print (L"Alpha 21264\n");
+ break;
- case 0x38:
- Print (L"AMD Turion II Ultra Dual-Core Mobile M Processor Family\n");
- break;
+ case 0x37:
+ Print (L"Alpha 21364\n");
+ break;
- case 0x39:
- Print (L"AMD Turion II Dual-Core Mobile M Processor Family\n");
- break;
+ case 0x38:
+ Print (L"AMD Turion II Ultra Dual-Core Mobile M Processor Family\n");
+ break;
- case 0x3A:
- Print (L"AMD Althon II Dual-Core M Processor Family\n");
- break;
+ case 0x39:
+ Print (L"AMD Turion II Dual-Core Mobile M Processor Family\n");
+ break;
- case 0x3B:
- Print (L"AMD Opteron 6100 Series Processor\n");
- break;
+ case 0x3A:
+ Print (L"AMD Althon II Dual-Core M Processor Family\n");
+ break;
- case 0x3C:
- Print (L"AMD Opteron 4100 Series Processor\n");
- break;
+ case 0x3B:
+ Print (L"AMD Opteron 6100 Series Processor\n");
+ break;
- case 0x3D:
- Print (L"AMD Opteron 6200 Series Processor\n");
- break;
+ case 0x3C:
+ Print (L"AMD Opteron 4100 Series Processor\n");
+ break;
- case 0x3E:
- Print (L"AMD Opteron 4200 Series Processor\n");
- break;
+ case 0x3D:
+ Print (L"AMD Opteron 6200 Series Processor\n");
+ break;
- case 0x3F:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_FX_SERIES), gShellDebug1HiiHandle);
- break;
+ case 0x3E:
+ Print (L"AMD Opteron 4200 Series Processor\n");
+ break;
- case 0x40:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MIPS_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x3F:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_FX_SERIES), gShellDebug1HiiHandle);
+ break;
- case 0x41:
- Print (L"MIPS R4000\n");
- break;
+ case 0x40:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MIPS_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x42:
- Print (L"MIPS R4200\n");
- break;
+ case 0x41:
+ Print (L"MIPS R4000\n");
+ break;
- case 0x43:
- Print (L"MIPS R4400\n");
- break;
+ case 0x42:
+ Print (L"MIPS R4200\n");
+ break;
- case 0x44:
- Print (L"MIPS R4600\n");
- break;
+ case 0x43:
+ Print (L"MIPS R4400\n");
+ break;
- case 0x45:
- Print (L"MIPS R10000\n");
- break;
+ case 0x44:
+ Print (L"MIPS R4600\n");
+ break;
- case 0x46:
- Print (L"AMD C-Series Processor\n");
- break;
+ case 0x45:
+ Print (L"MIPS R10000\n");
+ break;
- case 0x47:
- Print (L"AMD E-Series Processor\n");
- break;
+ case 0x46:
+ Print (L"AMD C-Series Processor\n");
+ break;
- case 0x48:
- Print (L"AMD A-Series Processor\n");
- break;
+ case 0x47:
+ Print (L"AMD E-Series Processor\n");
+ break;
- case 0x49:
- Print (L"AMD G-Series Processor\n");
- break;
+ case 0x48:
+ Print (L"AMD A-Series Processor\n");
+ break;
- case 0x4A:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_Z_SERIES), gShellDebug1HiiHandle);
- break;
+ case 0x49:
+ Print (L"AMD G-Series Processor\n");
+ break;
- case 0x4B:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_R_SERIES), gShellDebug1HiiHandle);
- break;
+ case 0x4A:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_Z_SERIES), gShellDebug1HiiHandle);
+ break;
- case 0x4C:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_4300_SERIES), gShellDebug1HiiHandle);
- break;
+ case 0x4B:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_R_SERIES), gShellDebug1HiiHandle);
+ break;
- case 0x4D:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_6300_SERIES), gShellDebug1HiiHandle);
- break;
+ case 0x4C:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_4300_SERIES), gShellDebug1HiiHandle);
+ break;
- case 0x4E:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3300_SERIES), gShellDebug1HiiHandle);
- break;
+ case 0x4D:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_6300_SERIES), gShellDebug1HiiHandle);
+ break;
- case 0x4F:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_FIREPRO_SERIES), gShellDebug1HiiHandle);
- break;
+ case 0x4E:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3300_SERIES), gShellDebug1HiiHandle);
+ break;
- case 0x50:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SPARC_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x4F:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_FIREPRO_SERIES), gShellDebug1HiiHandle);
+ break;
- case 0x51:
- Print (L"SuperSparc\n");
- break;
+ case 0x50:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SPARC_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x52:
- Print (L"microSparc II\n");
- break;
+ case 0x51:
+ Print (L"SuperSparc\n");
+ break;
- case 0x53:
- Print (L"microSparc IIep\n");
- break;
+ case 0x52:
+ Print (L"microSparc II\n");
+ break;
- case 0x54:
- Print (L"UltraSparc\n");
- break;
+ case 0x53:
+ Print (L"microSparc IIep\n");
+ break;
- case 0x55:
- Print (L"UltraSparc II\n");
- break;
+ case 0x54:
+ Print (L"UltraSparc\n");
+ break;
- case 0x56:
- Print (L"UltraSparcIIi\n");
- break;
+ case 0x55:
+ Print (L"UltraSparc II\n");
+ break;
- case 0x57:
- Print (L"UltraSparcIII\n");
- break;
+ case 0x56:
+ Print (L"UltraSparcIIi\n");
+ break;
- case 0x58:
- Print (L"UltraSparcIIIi\n");
- break;
+ case 0x57:
+ Print (L"UltraSparcIII\n");
+ break;
- case 0x60:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_68040_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x58:
+ Print (L"UltraSparcIIIi\n");
+ break;
- case 0x61:
- Print (L"68xx\n");
- break;
+ case 0x60:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_68040_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x62:
- Print (L"68000\n");
- break;
+ case 0x61:
+ Print (L"68xx\n");
+ break;
- case 0x63:
- Print (L"68010\n");
- break;
+ case 0x62:
+ Print (L"68000\n");
+ break;
- case 0x64:
- Print (L"68020\n");
- break;
+ case 0x63:
+ Print (L"68010\n");
+ break;
- case 0x65:
- Print (L"68030\n");
- break;
+ case 0x64:
+ Print (L"68020\n");
+ break;
- case 0x66:
- Print (L"AMD Athlon(TM) X4 Quad-Core Processor Family\n");
- break;
+ case 0x65:
+ Print (L"68030\n");
+ break;
- case 0x67:
- Print (L"AMD Opteron(TM) X1000 Series Processor\n");
- break;
+ case 0x66:
+ Print (L"AMD Athlon(TM) X4 Quad-Core Processor Family\n");
+ break;
- case 0x68:
- Print (L"AMD Opteron(TM) X2000 Series APU\n");
- break;
+ case 0x67:
+ Print (L"AMD Opteron(TM) X1000 Series Processor\n");
+ break;
- case 0x69:
- Print (L"AMD Opteron(TM) A-Series Processor\n");
- break;
+ case 0x68:
+ Print (L"AMD Opteron(TM) X2000 Series APU\n");
+ break;
- case 0x6A:
- Print (L"AMD Opteron(TM) X3000 Series APU\n");
- break;
+ case 0x69:
+ Print (L"AMD Opteron(TM) A-Series Processor\n");
+ break;
- case 0x6B:
- Print (L"AMD Zen Processor Family\n");
- break;
+ case 0x6A:
+ Print (L"AMD Opteron(TM) X3000 Series APU\n");
+ break;
- case 0x70:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HOBBIT_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x6B:
+ Print (L"AMD Zen Processor Family\n");
+ break;
- case 0x78:
- Print (L"Crusoe TM5000\n");
- break;
+ case 0x70:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HOBBIT_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x79:
- Print (L"Crusoe TM3000\n");
- break;
+ case 0x78:
+ Print (L"Crusoe TM5000\n");
+ break;
- case 0x7A:
- Print (L"Efficeon TM8000\n");
- break;
+ case 0x79:
+ Print (L"Crusoe TM3000\n");
+ break;
- case 0x80:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WEITEK), gShellDebug1HiiHandle);
- break;
+ case 0x7A:
+ Print (L"Efficeon TM8000\n");
+ break;
- case 0x82:
- Print (L"Itanium\n");
- break;
+ case 0x80:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WEITEK), gShellDebug1HiiHandle);
+ break;
- case 0x83:
- Print (L"AMD Athlon64\n");
- break;
+ case 0x82:
+ Print (L"Itanium\n");
+ break;
- case 0x84:
- Print (L"AMD Opteron\n");
- break;
+ case 0x83:
+ Print (L"AMD Athlon64\n");
+ break;
- case 0x85:
- Print (L"AMD Sempron\n");
- break;
+ case 0x84:
+ Print (L"AMD Opteron\n");
+ break;
- case 0x86:
- Print (L"AMD Turion64 Mobile\n");
- break;
+ case 0x85:
+ Print (L"AMD Sempron\n");
+ break;
- case 0x87:
- Print (L"Dual-Core AMD Opteron\n");
- break;
+ case 0x86:
+ Print (L"AMD Turion64 Mobile\n");
+ break;
- case 0x88:
- Print (L"AMD Athlon 64X2 DualCore\n");
- break;
+ case 0x87:
+ Print (L"Dual-Core AMD Opteron\n");
+ break;
- case 0x89:
- Print (L"AMD Turion 64X2 Mobile\n");
- break;
+ case 0x88:
+ Print (L"AMD Athlon 64X2 DualCore\n");
+ break;
- case 0x8A:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0x89:
+ Print (L"AMD Turion 64X2 Mobile\n");
+ break;
- case 0x8B:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_THIRD_GENERATION), gShellDebug1HiiHandle);
- break;
+ case 0x8A:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0x8C:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_FX_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0x8B:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_THIRD_GENERATION), gShellDebug1HiiHandle);
+ break;
- case 0x8D:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X4_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0x8C:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_FX_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0x8E:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X2_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0x8D:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X4_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0x8F:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_X2_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0x8E:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X2_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0x90:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PA_RISC_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x8F:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_X2_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0x91:
- Print (L"PA-RISC 8500\n");
- break;
+ case 0x90:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PA_RISC_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0x92:
- Print (L"PA-RISC 8000\n");
- break;
+ case 0x91:
+ Print (L"PA-RISC 8500\n");
+ break;
- case 0x93:
- Print (L"PA-RISC 7300LC\n");
- break;
+ case 0x92:
+ Print (L"PA-RISC 8000\n");
+ break;
- case 0x94:
- Print (L"PA-RISC 7200\n");
- break;
+ case 0x93:
+ Print (L"PA-RISC 7300LC\n");
+ break;
- case 0x95:
- Print (L"PA-RISC 7100LC\n");
- break;
+ case 0x94:
+ Print (L"PA-RISC 7200\n");
+ break;
- case 0x96:
- Print (L"PA-RISC 7100\n");
- break;
+ case 0x95:
+ Print (L"PA-RISC 7100LC\n");
+ break;
- case 0xA0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_V30_FAMILY), gShellDebug1HiiHandle);
- break;
+ case 0x96:
+ Print (L"PA-RISC 7100\n");
+ break;
- case 0xA1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3200_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_V30_FAMILY), gShellDebug1HiiHandle);
+ break;
- case 0xA2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3000_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3200_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xA3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5300_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3000_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xA4:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5100_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5300_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xA5:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5000_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA4:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5100_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xA6:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_LV_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA5:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5000_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xA7:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_ULV_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA6:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_LV_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xA8:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7100_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA7:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_ULV_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xA9:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5400_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA8:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7100_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xAA:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xA9:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5400_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xAB:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5200_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xAA:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xAC:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7200_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xAB:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5200_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xAD:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7300_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xAC:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7200_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xAE:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xAD:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7300_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xAF:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_MULTI_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xAE:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xB0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_XEON), gShellDebug1HiiHandle);
- break;
+ case 0xAF:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_MULTI_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xB1:
- Print (L"Pentium III Processorwith Intel SpeedStep Technology\n");
- break;
+ case 0xB0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_XEON), gShellDebug1HiiHandle);
+ break;
- case 0xB2:
- Print (L"Pentium 4 processor\n");
- break;
+ case 0xB1:
+ Print (L"Pentium III Processorwith Intel SpeedStep Technology\n");
+ break;
- case 0xB3:
- Print (L"Intel Xeon Processor\n");
- break;
+ case 0xB2:
+ Print (L"Pentium 4 processor\n");
+ break;
- case 0xB4:
- Print (L"AS400 Family\n");
- break;
+ case 0xB3:
+ Print (L"Intel Xeon Processor\n");
+ break;
- case 0xB5:
- Print (L"Intel Xeon processor MP\n");
- break;
+ case 0xB4:
+ Print (L"AS400 Family\n");
+ break;
- case 0xB6:
- Print (L"AMD Althon XP Processor Family\n");
- break;
+ case 0xB5:
+ Print (L"Intel Xeon processor MP\n");
+ break;
- case 0xB7:
- Print (L"AMD Althon MP Promcessor Family\n");
- break;
+ case 0xB6:
+ Print (L"AMD Althon XP Processor Family\n");
+ break;
- case 0xB8:
- Print (L"Intel Itanium 2 processor\n");
- break;
+ case 0xB7:
+ Print (L"AMD Althon MP Promcessor Family\n");
+ break;
- case 0xB9:
- Print (L"Intel Penium M processor\n");
- break;
+ case 0xB8:
+ Print (L"Intel Itanium 2 processor\n");
+ break;
- case 0xBA:
- Print (L"Intel Celeron D processor\n");
- break;
+ case 0xB9:
+ Print (L"Intel Penium M processor\n");
+ break;
- case 0xBB:
- Print (L"Intel Pentium D processor\n");
- break;
+ case 0xBA:
+ Print (L"Intel Celeron D processor\n");
+ break;
- case 0xBC:
- Print (L"Intel Pentium Processor Extreme Edition\n");
- break;
+ case 0xBB:
+ Print (L"Intel Pentium D processor\n");
+ break;
- case 0xBD:
- Print (L"Intel Core Solo Processor\n");
- break;
+ case 0xBC:
+ Print (L"Intel Pentium Processor Extreme Edition\n");
+ break;
- case 0xBF:
- Print (L"Intel Core 2 Duo Processor\n");
- break;
+ case 0xBD:
+ Print (L"Intel Core Solo Processor\n");
+ break;
- case 0xC0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO), gShellDebug1HiiHandle);
- break;
+ case 0xBF:
+ Print (L"Intel Core 2 Duo Processor\n");
+ break;
- case 0xC1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle);
- break;
+ case 0xC0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO), gShellDebug1HiiHandle);
+ break;
- case 0xC2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_QUAD), gShellDebug1HiiHandle);
- break;
+ case 0xC1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle);
+ break;
- case 0xC3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle);
- break;
+ case 0xC2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_QUAD), gShellDebug1HiiHandle);
+ break;
- case 0xC4:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_DUO_MOBILE), gShellDebug1HiiHandle);
- break;
+ case 0xC3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle);
+ break;
- case 0xC5:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO_MOBILE), gShellDebug1HiiHandle);
- break;
+ case 0xC4:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_DUO_MOBILE), gShellDebug1HiiHandle);
+ break;
- case 0xC6:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_I7), gShellDebug1HiiHandle);
- break;
+ case 0xC5:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO_MOBILE), gShellDebug1HiiHandle);
+ break;
- case 0xC7:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CELERON_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xC6:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_I7), gShellDebug1HiiHandle);
+ break;
- case 0xC8:
- Print (L"IBM 390\n");
- break;
+ case 0xC7:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CELERON_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xC9:
- Print (L"G4\n");
- break;
+ case 0xC8:
+ Print (L"IBM 390\n");
+ break;
- case 0xCA:
- Print (L"G5\n");
- break;
+ case 0xC9:
+ Print (L"G4\n");
+ break;
- case 0xCB:
- Print (L"G6\n");
- break;
+ case 0xCA:
+ Print (L"G5\n");
+ break;
- case 0xCC:
- Print (L"zArchitecture\n");
- break;
+ case 0xCB:
+ Print (L"G6\n");
+ break;
- case 0xCD:
- Print (L"Intel Core i5 processor\n");
- break;
+ case 0xCC:
+ Print (L"zArchitecture\n");
+ break;
- case 0xCE:
- Print (L"Intel Core i3 processor\n");
- break;
+ case 0xCD:
+ Print (L"Intel Core i5 processor\n");
+ break;
- case 0xCF:
- Print (L"Intel Core i9 processor\n");
- break;
+ case 0xCE:
+ Print (L"Intel Core i3 processor\n");
+ break;
- case 0xD2:
- Print (L"ViaC7M\n");
- break;
+ case 0xCF:
+ Print (L"Intel Core i9 processor\n");
+ break;
- case 0xD3:
- Print (L"ViaC7D\n");
- break;
+ case 0xD2:
+ Print (L"ViaC7M\n");
+ break;
- case 0xD4:
- Print (L"ViaC7\n");
- break;
+ case 0xD3:
+ Print (L"ViaC7D\n");
+ break;
- case 0xD5:
- Print (L"Eden\n");
- break;
+ case 0xD4:
+ Print (L"ViaC7\n");
+ break;
- case 0xD6:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_MULTI_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xD5:
+ Print (L"Eden\n");
+ break;
- case 0xD7:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xD6:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_MULTI_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xD8:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xD7:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xDA:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xD8:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xDB:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xDA:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xDD:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xDB:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xDE:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xDD:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xDF:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_MULTI_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xDE:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xE0:
- Print (L"Multi-Core Intel Xeon processor 3400 Series\n");
- break;
+ case 0xDF:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_MULTI_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xE4:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3000_SERIES), gShellDebug1HiiHandle);
- break;
+ case 0xE0:
+ Print (L"Multi-Core Intel Xeon processor 3400 Series\n");
+ break;
- case 0xE5:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_II), gShellDebug1HiiHandle);
- break;
+ case 0xE4:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3000_SERIES), gShellDebug1HiiHandle);
+ break;
+ case 0xE5:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_II), gShellDebug1HiiHandle);
+ break;
- case 0xE6:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_EMBEDDED_OPTERON_QUAD_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xE6:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_EMBEDDED_OPTERON_QUAD_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xE7:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_TRIPLE_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xE7:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_TRIPLE_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xE8:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_ULTRA_DUAL_CORE_MOBILE), gShellDebug1HiiHandle);
- break;
+ case 0xE8:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_ULTRA_DUAL_CORE_MOBILE), gShellDebug1HiiHandle);
+ break;
- case 0xE9:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_DUAL_CORE_MOBILE), gShellDebug1HiiHandle);
- break;
+ case 0xE9:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_DUAL_CORE_MOBILE), gShellDebug1HiiHandle);
+ break;
- case 0xEA:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_DUAL_CORE), gShellDebug1HiiHandle);
- break;
+ case 0xEA:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_DUAL_CORE), gShellDebug1HiiHandle);
+ break;
- case 0xEB:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_SI), gShellDebug1HiiHandle);
- break;
+ case 0xEB:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_SI), gShellDebug1HiiHandle);
+ break;
- case 0xEC:
- Print (L"AMD Phenom II Processor Family\n");
- break;
+ case 0xEC:
+ Print (L"AMD Phenom II Processor Family\n");
+ break;
- case 0xED:
- Print (L"AMD Althon II Processor Family\n");
- break;
+ case 0xED:
+ Print (L"AMD Althon II Processor Family\n");
+ break;
- case 0xEE:
- Print (L"Six-Core AMD Opteron Processor Family\n");
- break;
+ case 0xEE:
+ Print (L"Six-Core AMD Opteron Processor Family\n");
+ break;
- case 0xEF:
- Print (L"AMD Sempron M Processor Family\n");
- break;
+ case 0xEF:
+ Print (L"AMD Sempron M Processor Family\n");
+ break;
- case 0xFA:
- Print (L"i860\n");
- break;
+ case 0xFA:
+ Print (L"i860\n");
+ break;
- case 0xFB:
- Print (L"i960\n");
- break;
+ case 0xFB:
+ Print (L"i960\n");
+ break;
- default:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle);
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle);
}
+
//
// end switch
//
@@ -2307,14 +2380,14 @@ DisplayProcessorFamily ( **/
VOID
DisplayProcessorFamily2 (
- IN UINT16 Family2,
- IN UINT8 Option
+ IN UINT16 Family2,
+ IN UINT8 Option
)
{
//
// Print prompt message
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle);
//
// Print option
@@ -2386,9 +2459,8 @@ DisplayProcessorFamily2 ( break;
default:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle);
}
-
}
/**
@@ -2415,47 +2487,48 @@ DisplayProcessorFamily2 ( **/
VOID
DisplayProcessorVoltage (
- IN UINT8 Voltage,
- IN UINT8 Option
+ IN UINT8 Voltage,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_INFO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_INFO), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (Voltage, Option);
if (BIT (Voltage, 7) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_CURRENT_VOLTAGE), gShellDebug1HiiHandle, (Voltage - 0x80));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_CURRENT_VOLTAGE), gShellDebug1HiiHandle, (Voltage - 0x80));
} else {
if (BIT (Voltage, 0) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_5V_SUPOPRTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_5V_SUPOPRTED), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 1) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_33V_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_33V_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 2) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_29V_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_29V_SUPPORTED), gShellDebug1HiiHandle);
}
+
//
// check the reserved zero bits:
//
if (BIT (Voltage, 3) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 4) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 5) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 6) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT6_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT6_NOT_ZERO), gShellDebug1HiiHandle);
}
}
}
@@ -2482,60 +2555,62 @@ Bits 2:0 CPU Status **/
VOID
DisplayProcessorStatus (
- IN UINT8 Status,
- IN UINT8 Option
+ IN UINT8 Status,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_STATUS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_STATUS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
if (BIT (Status, 7) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT7_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT7_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (Status, 5) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (Status, 4) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (Status, 3) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle);
}
+
//
// Check BIT 6
//
if (BIT (Status, 6) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_POPULATED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_POPULATED), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_UNPOPULATED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_UNPOPULATED), gShellDebug1HiiHandle);
}
+
//
// Check BITs 2:0
//
switch (Status & 0x07) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_ENABLED), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_ENABLED), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DISABLED_BY_USER), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DISABLED_BY_USER), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DIABLED_BY_BIOS), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DIABLED_BY_BIOS), gShellDebug1HiiHandle);
+ break;
- case 4:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_IDLE), gShellDebug1HiiHandle);
- break;
+ case 4:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_IDLE), gShellDebug1HiiHandle);
+ break;
- case 7:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHERS), gShellDebug1HiiHandle);
- break;
+ case 7:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHERS), gShellDebug1HiiHandle);
+ break;
- default:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
}
}
@@ -2548,22 +2623,23 @@ DisplayProcessorStatus ( **/
VOID
DisplayMaxMemoryModuleSize (
- IN UINT8 Size,
- IN UINT8 SlotNum,
- IN UINT8 Option
+ IN UINT8 Size,
+ IN UINT8 SlotNum,
+ IN UINT8 Option
)
{
- UINTN MaxSize;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE_LARGEST_MEM), gShellDebug1HiiHandle);
+ UINTN MaxSize;
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE_LARGEST_MEM), gShellDebug1HiiHandle);
//
// MaxSize is determined by follow formula
//
- MaxSize = (UINTN) 1 << Size;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize);
+ MaxSize = (UINTN)1 << Size;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize);
if (Option >= SHOW_DETAIL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_AMOUNT_MEM), gShellDebug1HiiHandle);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize, SlotNum, MaxSize * SlotNum);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_AMOUNT_MEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize, SlotNum, MaxSize * SlotNum);
}
}
@@ -2576,25 +2652,26 @@ DisplayMaxMemoryModuleSize ( **/
VOID
DisplayMemoryModuleConfigHandles (
- IN UINT16 *Handles,
- IN UINT8 SlotNum,
- IN UINT8 Option
+ IN UINT16 *Handles,
+ IN UINT8 SlotNum,
+ IN UINT8 Option
)
{
- UINT8 Index;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_CONTROLLED), gShellDebug1HiiHandle, SlotNum);
+ UINT8 Index;
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_CONTROLLED), gShellDebug1HiiHandle, SlotNum);
if (Option >= SHOW_DETAIL) {
//
// No handle, Handles is INVALID.
//
if (SlotNum == 0) {
- return ;
+ return;
}
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_LIST_CONTROLLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_LIST_CONTROLLED), gShellDebug1HiiHandle);
for (Index = 0; Index < SlotNum; Index++) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLE), gShellDebug1HiiHandle, Index + 1, Handles[Index]);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLE), gShellDebug1HiiHandle, Index + 1, Handles[Index]);
}
}
}
@@ -2607,14 +2684,14 @@ DisplayMemoryModuleConfigHandles ( **/
VOID
DisplayMmBankConnections (
- IN UINT8 BankConnections,
- IN UINT8 Option
+ IN UINT8 BankConnections,
+ IN UINT8 Option
)
{
- UINT8 High;
- UINT8 Low;
+ UINT8 High;
+ UINT8 Low;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_CONNECTIONS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_CONNECTIONS), gShellDebug1HiiHandle);
//
// Print option
//
@@ -2623,19 +2700,19 @@ DisplayMmBankConnections ( //
// Divide it to high and low
//
- High = (UINT8) (BankConnections & 0xF0);
- Low = (UINT8) (BankConnections & 0x0F);
+ High = (UINT8)(BankConnections & 0xF0);
+ Low = (UINT8)(BankConnections & 0x0F);
if (High != 0xF) {
if (Low != 0xF) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS), gShellDebug1HiiHandle, High, Low, High, Low);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS), gShellDebug1HiiHandle, High, Low, High, Low);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, High, High);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, High, High);
}
} else {
if (Low != 0xF) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, Low, Low);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, Low, Low);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BANKS_CONNECTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BANKS_CONNECTED), gShellDebug1HiiHandle);
}
}
}
@@ -2656,12 +2733,13 @@ DisplayMmBankConnections ( **/
VOID
DisplayMmMemorySize (
- IN UINT8 Size,
- IN UINT8 Option
+ IN UINT8 Size,
+ IN UINT8 Option
)
{
- UINT8 Value;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEMORY_SIZE), gShellDebug1HiiHandle);
+ UINT8 Value;
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEMORY_SIZE), gShellDebug1HiiHandle);
//
// Print option
//
@@ -2670,21 +2748,21 @@ DisplayMmMemorySize ( //
// Get the low bits(0-6 bit)
//
- Value = (UINT8) (Size & 0x7F);
+ Value = (UINT8)(Size & 0x7F);
if (Value == 0x7D) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE_NOT_DETERMINABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE_NOT_DETERMINABLE), gShellDebug1HiiHandle);
} else if (Value == 0x7E) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MODULE_INSTALLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MODULE_INSTALLED), gShellDebug1HiiHandle);
} else if (Value == 0x7F) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_INSTALLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_INSTALLED), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE), gShellDebug1HiiHandle, 1 << Value);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE), gShellDebug1HiiHandle, 1 << Value);
}
if (BIT (Size, 7) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_DOUBLE_BANK), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_DOUBLE_BANK), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_SINGLE_BANK), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_SINGLE_BANK), gShellDebug1HiiHandle);
}
}
@@ -2718,91 +2796,90 @@ Bits 2:0 Cache Level **/
VOID
DisplayCacheConfiguration (
- IN UINT16 CacheConfiguration,
- IN UINT8 Option
+ IN UINT16 CacheConfiguration,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_CONFIGURATION), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_CONFIGURATION), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (CacheConfiguration, Option);
if (BIT (CacheConfiguration, 15) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT15_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT15_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 14) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT14_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT14_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 13) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT13_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT13_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 12) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT12_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT12_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 11) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT11_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT11_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 10) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT10_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT10_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 4) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
}
//
// Check BITs 9:8
//
switch ((CacheConfiguration & 0x300) >> 8) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_THROUGH), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_THROUGH), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_BACK), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_BACK), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_VARIES_WITH_MEM_ADDR), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_VARIES_WITH_MEM_ADDR), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
}
//
// Check BIT 7
//
if (BIT (CacheConfiguration, 7) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
}
//
// Check BITs 6:5
//
switch ((CacheConfiguration & 0x60) >> 5) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_INTERNAL), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_INTERNAL), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_EXTERNAL), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_EXTERNAL), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
}
//
// Check BIT 3
//
if (BIT (CacheConfiguration, 3) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_SOCKETED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_SOCKETED), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_NOT_SOCKETED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_NOT_SOCKETED), gShellDebug1HiiHandle);
}
-
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_LEVEL), gShellDebug1HiiHandle, (CacheConfiguration & 0x07) + 1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_LEVEL), gShellDebug1HiiHandle, (CacheConfiguration & 0x07) + 1);
}
/**
@@ -2826,64 +2903,66 @@ DisplaySystemSlotId ( //
DisplaySystemSlotType (SlotType, Option);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_ID), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_ID), gShellDebug1HiiHandle);
//
// print option
//
PRINT_INFO_OPTION (SlotType, Option);
switch (SlotType) {
- //
- // Slot Type: MCA
- //
- case 0x04:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_MICRO_CHAN), gShellDebug1HiiHandle);
- if (SlotId > 0 && SlotId < 15) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId);
- } else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle);
- }
- break;
+ //
+ // Slot Type: MCA
+ //
+ case 0x04:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_MICRO_CHAN), gShellDebug1HiiHandle);
+ if ((SlotId > 0) && (SlotId < 15)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle);
+ }
- //
- // EISA
- //
- case 0x05:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_EISA_NUM), gShellDebug1HiiHandle);
- if (SlotId > 0 && SlotId < 15) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId);
- } else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle);
- }
- break;
+ break;
- //
- // Slot Type: PCI
- //
- case 0x06:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
- break;
+ //
+ // EISA
+ //
+ case 0x05:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_EISA_NUM), gShellDebug1HiiHandle);
+ if ((SlotId > 0) && (SlotId < 15)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle);
+ }
- //
- // PCMCIA
- //
- case 0x07:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_IDENTIFIES_ADAPTER_NUM), gShellDebug1HiiHandle, SlotId);
- break;
+ break;
- //
- // Slot Type: PCI-E
- //
- case 0xA5:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
- break;
+ //
+ // Slot Type: PCI
+ //
+ case 0x06:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
+ break;
- default:
- if ((SlotType >= 0x0E && SlotType <= 0x12) || (SlotType >= 0xA6 && SlotType <= 0xB6)){
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
- } else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_SLOT_ID), gShellDebug1HiiHandle);
- }
+ //
+ // PCMCIA
+ //
+ case 0x07:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_IDENTIFIES_ADAPTER_NUM), gShellDebug1HiiHandle, SlotId);
+ break;
+
+ //
+ // Slot Type: PCI-E
+ //
+ case 0xA5:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
+ break;
+
+ default:
+ if (((SlotType >= 0x0E) && (SlotType <= 0x12)) || ((SlotType >= 0xA6) && (SlotType <= 0xB6))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_SLOT_ID), gShellDebug1HiiHandle);
+ }
}
}
@@ -2895,11 +2974,11 @@ DisplaySystemSlotId ( **/
VOID
DisplaySystemBootStatus (
- IN UINT8 Parameter,
- IN UINT8 Option
+ IN UINT8 Parameter,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_BOOT_STATUS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_BOOT_STATUS), gShellDebug1HiiHandle);
//
// Print option
//
@@ -2909,31 +2988,31 @@ DisplaySystemBootStatus ( // Check value and print
//
if (Parameter == 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_ERRORS_DETECTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_ERRORS_DETECTED), gShellDebug1HiiHandle);
} else if (Parameter == 1) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BOOTABLE_MEDIA), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BOOTABLE_MEDIA), gShellDebug1HiiHandle);
} else if (Parameter == 2) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NORMAL_OP_SYSTEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NORMAL_OP_SYSTEM), gShellDebug1HiiHandle);
} else if (Parameter == 3) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_DETECTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_DETECTED), gShellDebug1HiiHandle);
} else if (Parameter == 4) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM), gShellDebug1HiiHandle);
} else if (Parameter == 5) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USER_REQUESTED_BOOT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USER_REQUESTED_BOOT), gShellDebug1HiiHandle);
} else if (Parameter == 6) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_SECURITY_VIOLATION), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_SECURITY_VIOLATION), gShellDebug1HiiHandle);
} else if (Parameter == 7) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PREV_REQ_IMAGE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PREV_REQ_IMAGE), gShellDebug1HiiHandle);
} else if (Parameter == 8) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER), gShellDebug1HiiHandle);
- } else if (Parameter >= 9 && Parameter <= 127) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FUTURE_ASSIGNMENT), gShellDebug1HiiHandle);
- } else if (Parameter >= 128 && Parameter <= 191) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VENDOR_OEM_SPECIFIC), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER), gShellDebug1HiiHandle);
+ } else if ((Parameter >= 9) && (Parameter <= 127)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FUTURE_ASSIGNMENT), gShellDebug1HiiHandle);
+ } else if ((Parameter >= 128) && (Parameter <= 191)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VENDOR_OEM_SPECIFIC), gShellDebug1HiiHandle);
} else if (Parameter >= 192) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRODUCT_SPEC_IMPLMENTATION), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRODUCT_SPEC_IMPLMENTATION), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_VALUE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_VALUE), gShellDebug1HiiHandle);
}
}
@@ -2956,11 +3035,11 @@ DisplaySBDSManufactureDate ( IN UINT8 Option
)
{
- UINTN Day;
- UINTN Month;
- UINTN Year;
+ UINTN Day;
+ UINTN Month;
+ UINTN Year;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SBDS_MANUFACTURE_DATE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SBDS_MANUFACTURE_DATE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Date, Option);
//
// Print date
@@ -2968,8 +3047,7 @@ DisplaySBDSManufactureDate ( Day = Date & 0x001F;
Month = (Date & 0x01E0) >> 5;
Year = ((Date & 0xFE00) >> 9) + 1980;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONTH_DAY_YEAR), gShellDebug1HiiHandle, Day, Month, Year);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONTH_DAY_YEAR), gShellDebug1HiiHandle, Day, Month, Year);
}
/**
@@ -2999,73 +3077,77 @@ Identifies the system-reset capabilities for the system. **/
VOID
DisplaySystemResetCapabilities (
- IN UINT8 Reset,
- IN UINT8 Option
+ IN UINT8 Reset,
+ IN UINT8 Option
)
{
- UINTN Temp;
+ UINTN Temp;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_RESET_CAPABILITIES), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_RESET_CAPABILITIES), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Reset, Option);
//
// Check reserved bits 7:6
//
if ((Reset & 0xC0) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO), gShellDebug1HiiHandle);
}
+
//
// Watch dog
//
if (BIT (Reset, 5) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER_2), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_NOT_CONTAIN_TIMER), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_NOT_CONTAIN_TIMER), gShellDebug1HiiHandle);
}
+
//
// Boot Option on Limit
//
Temp = (Reset & 0x18) >> 3;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION_LIMIT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION_LIMIT), gShellDebug1HiiHandle);
switch (Temp) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT), gShellDebug1HiiHandle);
+ break;
}
+
//
// Boot Option
//
Temp = (Reset & 0x06) >> 1;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION), gShellDebug1HiiHandle);
switch (Temp) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT), gShellDebug1HiiHandle);
+ break;
}
+
//
// Reset enable flag
//
@@ -3108,102 +3190,105 @@ Bits 1:0 Front Panel Reset Status, one of: **/
VOID
DisplayHardwareSecuritySettings (
- IN UINT8 Settings,
- IN UINT8 Option
+ IN UINT8 Settings,
+ IN UINT8 Option
)
{
- UINTN Temp;
+ UINTN Temp;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HARDWARE_SECURITY_SET), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HARDWARE_SECURITY_SET), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Settings, Option);
//
// Power-on Password Status
//
Temp = (Settings & 0xC0) >> 6;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_ON_PASSWORD), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_ON_PASSWORD), gShellDebug1HiiHandle);
switch (Temp) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
}
+
//
// Keyboard Password Status
//
Temp = (Settings & 0x30) >> 4;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_PASSWORD), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_PASSWORD), gShellDebug1HiiHandle);
switch (Temp) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
}
+
//
// Administrator Password Status
//
Temp = (Settings & 0x0C) >> 2;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ADMIN_PASSWORD_STATUS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ADMIN_PASSWORD_STATUS), gShellDebug1HiiHandle);
switch (Temp) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
}
+
//
// Front Panel Reset Status
//
Temp = Settings & 0x3;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FRONT_PANEL_RESET), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FRONT_PANEL_RESET), gShellDebug1HiiHandle);
switch (Temp) {
- case 0:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
- break;
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
+ break;
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
}
}
@@ -3215,34 +3300,36 @@ DisplayHardwareSecuritySettings ( **/
VOID
DisplayOBRAConnections (
- IN UINT8 Connections,
- IN UINT8 Option
+ IN UINT8 Connections,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONNECTIONS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONNECTIONS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Connections, Option);
//
// Check reserved bits 7:2
//
if ((Connections & 0xFC) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO_2), gShellDebug1HiiHandle);
}
+
//
// Outbound Connection
//
if (BIT (Connections, 1) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OUTBOUND_CONN_ENABLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OUTBOUND_CONN_ENABLED), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTUBOUND_CONN_DISABLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTUBOUND_CONN_DISABLED), gShellDebug1HiiHandle);
}
+
//
// Inbound Connection
//
if (BIT (Connections, 0) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOIUND_CONN_ENABLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOIUND_CONN_ENABLED), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOUND_CONN_DISABLED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOUND_CONN_DISABLED), gShellDebug1HiiHandle);
}
}
@@ -3258,144 +3345,150 @@ DisplaySPSCharacteristics ( IN UINT8 Option
)
{
- UINTN Temp;
+ UINTN Temp;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_CHAR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_CHAR), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Characteristics, Option);
//
// Check reserved bits 15:14
//
if ((Characteristics & 0xC000) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_15_14_RSVD), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_15_14_RSVD), gShellDebug1HiiHandle);
}
+
//
// Bits 13:10 - DMTF Power Supply Type
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TYPE), gShellDebug1HiiHandle);
Temp = (Characteristics & 0x1C00) >> 10;
switch (Temp) {
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LINEAR), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LINEAR), gShellDebug1HiiHandle);
+ break;
- case 4:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SWITCHING), gShellDebug1HiiHandle);
- break;
+ case 4:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SWITCHING), gShellDebug1HiiHandle);
+ break;
- case 5:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BATTERY), gShellDebug1HiiHandle);
- break;
+ case 5:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BATTERY), gShellDebug1HiiHandle);
+ break;
- case 6:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UPS), gShellDebug1HiiHandle);
- break;
+ case 6:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UPS), gShellDebug1HiiHandle);
+ break;
- case 7:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONVERTER), gShellDebug1HiiHandle);
- break;
+ case 7:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONVERTER), gShellDebug1HiiHandle);
+ break;
- case 8:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_REGULATOR), gShellDebug1HiiHandle);
- break;
+ case 8:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_REGULATOR), gShellDebug1HiiHandle);
+ break;
- default:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_2), gShellDebug1HiiHandle);
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_2), gShellDebug1HiiHandle);
}
+
//
// Bits 9:7 - Status
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STATUS_DASH), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STATUS_DASH), gShellDebug1HiiHandle);
Temp = (Characteristics & 0x380) >> 7;
switch (Temp) {
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OK), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OK), gShellDebug1HiiHandle);
+ break;
- case 4:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NON_CRITICAL), gShellDebug1HiiHandle);
- break;
+ case 4:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NON_CRITICAL), gShellDebug1HiiHandle);
+ break;
- case 5:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CRITICAL_POWER_SUPPLY), gShellDebug1HiiHandle);
- break;
+ case 5:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CRITICAL_POWER_SUPPLY), gShellDebug1HiiHandle);
+ break;
- default:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED), gShellDebug1HiiHandle);
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED), gShellDebug1HiiHandle);
}
+
//
// Bits 6:3 - DMTF Input Voltage Range Switching
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INPUT_VOLTAGE_RANGE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INPUT_VOLTAGE_RANGE), gShellDebug1HiiHandle);
Temp = (Characteristics & 0x78) >> 3;
switch (Temp) {
- case 1:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
- break;
+ case 1:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
+ break;
- case 2:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
- break;
+ case 2:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
+ break;
- case 3:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MANUAL), gShellDebug1HiiHandle);
- break;
+ case 3:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MANUAL), gShellDebug1HiiHandle);
+ break;
- case 4:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AUTO_SWITCH), gShellDebug1HiiHandle);
- break;
+ case 4:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AUTO_SWITCH), gShellDebug1HiiHandle);
+ break;
- case 5:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WIDE_RANGE), gShellDebug1HiiHandle);
- break;
+ case 5:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WIDE_RANGE), gShellDebug1HiiHandle);
+ break;
- case 6:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_APPLICABLE), gShellDebug1HiiHandle);
- break;
+ case 6:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_APPLICABLE), gShellDebug1HiiHandle);
+ break;
- default:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_3), gShellDebug1HiiHandle);
- break;
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_3), gShellDebug1HiiHandle);
+ break;
}
+
//
// Power supply is unplugged from the wall
//
if (BIT (Characteristics, 2) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_UNPLUGGED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_UNPLUGGED), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PLUGGED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PLUGGED), gShellDebug1HiiHandle);
}
+
//
// Power supply is present
//
if (BIT (Characteristics, 1) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PRESENT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PRESENT), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_PRESENT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_PRESENT), gShellDebug1HiiHandle);
}
+
//
// hot replaceable
//
if (BIT (Characteristics, 0) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_REPLACE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_REPLACE), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_REPLACE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_REPLACE), gShellDebug1HiiHandle);
}
}
@@ -3414,7 +3507,7 @@ DisplayTpmDeviceCharacteristics ( //
// Print header
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR), gShellDebug1HiiHandle);
//
// print option
//
@@ -3426,31 +3519,31 @@ DisplayTpmDeviceCharacteristics ( // are designed not to deal with UINT64
//
if (BIT (Chara, 0) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 1) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
}
+
if (BIT (Chara, 2) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 3) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_FWU), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_FWU), gShellDebug1HiiHandle);
}
if (BIT (Chara, 4) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_PLAT_SW), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_PLAT_SW), gShellDebug1HiiHandle);
}
if (BIT (Chara, 5) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_OEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_OEM), gShellDebug1HiiHandle);
}
//
// Just print the Reserved
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_06_63), gShellDebug1HiiHandle);
-
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_06_63), gShellDebug1HiiHandle);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h index fd219773de..8ecec693ad 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h @@ -22,8 +22,8 @@ extern UINT8 SmbiosMinorVersion; //
// SHOW_ALL: WaitEnter() not wait input.
//
-#define SHOW_ALL 0x04
-#define SHOW_STATISTICS 0x05
+#define SHOW_ALL 0x04
+#define SHOW_STATISTICS 0x05
#define AS_UINT16(pData) (*((UINT16 *) pData))
#define AS_UINT32(pData) (*((UINT32 *) pData))
@@ -89,8 +89,8 @@ DisplayBiosCharacteristics ( **/
VOID
DisplayBiosCharacteristicsExt1 (
- IN UINT8 Byte1,
- IN UINT8 Option
+ IN UINT8 Byte1,
+ IN UINT8 Option
);
/**
@@ -101,8 +101,8 @@ DisplayBiosCharacteristicsExt1 ( **/
VOID
DisplayBiosCharacteristicsExt2 (
- IN UINT8 Byte2,
- IN UINT8 Option
+ IN UINT8 Byte2,
+ IN UINT8 Option
);
/**
@@ -113,8 +113,8 @@ DisplayBiosCharacteristicsExt2 ( **/
VOID
DisplayProcessorFamily (
- UINT8 Family,
- UINT8 Option
+ UINT8 Family,
+ UINT8 Option
);
/**
@@ -125,8 +125,8 @@ DisplayProcessorFamily ( **/
VOID
DisplayProcessorFamily2 (
- IN UINT16 Family2,
- IN UINT8 Option
+ IN UINT16 Family2,
+ IN UINT8 Option
);
/**
@@ -153,8 +153,8 @@ DisplayProcessorFamily2 ( **/
VOID
DisplayProcessorVoltage (
- IN UINT8 Voltage,
- IN UINT8 Option
+ IN UINT8 Voltage,
+ IN UINT8 Option
);
/**
@@ -179,8 +179,8 @@ Bits 2:0 CPU Status **/
VOID
DisplayProcessorStatus (
- IN UINT8 Status,
- IN UINT8 Option
+ IN UINT8 Status,
+ IN UINT8 Option
);
/**
@@ -192,9 +192,9 @@ DisplayProcessorStatus ( **/
VOID
DisplayMaxMemoryModuleSize (
- IN UINT8 Size,
- IN UINT8 SlotNum,
- IN UINT8 Option
+ IN UINT8 Size,
+ IN UINT8 SlotNum,
+ IN UINT8 Option
);
/**
@@ -206,9 +206,9 @@ DisplayMaxMemoryModuleSize ( **/
VOID
DisplayMemoryModuleConfigHandles (
- IN UINT16 *Handles,
- IN UINT8 SlotNum,
- IN UINT8 Option
+ IN UINT16 *Handles,
+ IN UINT8 SlotNum,
+ IN UINT8 Option
);
/**
@@ -219,8 +219,8 @@ DisplayMemoryModuleConfigHandles ( **/
VOID
DisplayMmBankConnections (
- IN UINT8 BankConnections,
- IN UINT8 Option
+ IN UINT8 BankConnections,
+ IN UINT8 Option
);
/**
@@ -239,8 +239,8 @@ DisplayMmBankConnections ( **/
VOID
DisplayMmMemorySize (
- IN UINT8 Size,
- IN UINT8 Option
+ IN UINT8 Size,
+ IN UINT8 Option
);
/**
@@ -273,8 +273,8 @@ Bits 2:0 Cache Level **/
VOID
DisplayCacheConfiguration (
- IN UINT16 CacheConfiguration,
- IN UINT8 Option
+ IN UINT16 CacheConfiguration,
+ IN UINT8 Option
);
/**
@@ -339,8 +339,8 @@ DisplaySBDSManufactureDate ( **/
VOID
DisplaySystemResetCapabilities (
- IN UINT8 Reset,
- IN UINT8 Option
+ IN UINT8 Reset,
+ IN UINT8 Option
);
/**
@@ -375,8 +375,8 @@ DisplaySystemResetCapabilities ( **/
VOID
DisplayHardwareSecuritySettings (
- IN UINT8 Settings,
- IN UINT8 Option
+ IN UINT8 Settings,
+ IN UINT8 Option
);
/**
@@ -387,8 +387,8 @@ DisplayHardwareSecuritySettings ( **/
VOID
DisplayOBRAConnections (
- IN UINT8 Connections,
- IN UINT8 Option
+ IN UINT8 Connections,
+ IN UINT8 Option
);
/**
@@ -399,8 +399,8 @@ DisplayOBRAConnections ( **/
VOID
DisplaySystemBootStatus (
- IN UINT8 Parameter,
- IN UINT8 Option
+ IN UINT8 Parameter,
+ IN UINT8 Option
);
/**
@@ -435,7 +435,8 @@ DisplayTpmDeviceCharacteristics ( **/
VOID
DisplayProcessorArchitectureType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
+
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c index c312a7f8f2..c4a6acb167 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c @@ -643,7 +643,6 @@ TABLE_ITEM ProcessorCharacteristicsTable[] = { }
};
-
TABLE_ITEM McErrorDetectMethodTable[] = {
{
0x01,
@@ -2690,7 +2689,6 @@ TABLE_ITEM MemoryDeviceMemoryOperatingModeCapabilityTable[] = { }
};
-
TABLE_ITEM MemoryErrorTypeTable[] = {
{
0x01,
@@ -3570,7 +3568,6 @@ TABLE_ITEM StructureTypeInfoTable[] = { },
};
-
/**
Given a table and a Key, return the responding info.
@@ -3597,32 +3594,33 @@ TABLE_ITEM StructureTypeInfoTable[] = { **/
UINT8
QueryTable (
- IN TABLE_ITEM *Table,
- IN UINTN Number,
- IN UINT8 Key,
- IN OUT CHAR16 *Info,
- IN UINTN InfoLen
+ IN TABLE_ITEM *Table,
+ IN UINTN Number,
+ IN UINT8 Key,
+ IN OUT CHAR16 *Info,
+ IN UINTN InfoLen
)
{
- UINTN Index;
+ UINTN Index;
//
// High byte and Low byte of word
//
- UINT8 High;
- UINT8 Low;
+ UINT8 High;
+ UINT8 Low;
for (Index = 0; Index < Number; Index++) {
- High = (UINT8) (Table[Index].Key >> 8);
- Low = (UINT8) (Table[Index].Key & 0x00FF);
+ High = (UINT8)(Table[Index].Key >> 8);
+ Low = (UINT8)(Table[Index].Key & 0x00FF);
//
// Check if Key is in the range
// or if Key == Value in the table
//
- if ((High > Low && Key >= Low && Key <= High)
- || (Table[Index].Key == Key)) {
+ if ( ((High > Low) && (Key >= Low) && (Key <= High))
+ || (Table[Index].Key == Key))
+ {
StrnCpyS (Info, InfoLen, Table[Index].Info, InfoLen - 1);
- StrnCatS (Info, InfoLen, L"\n", InfoLen - 1 - StrLen(Info));
+ StrnCatS (Info, InfoLen, L"\n", InfoLen - 1 - StrLen (Info));
return Key;
}
}
@@ -3640,26 +3638,26 @@ QueryTable ( **/
VOID
PrintBitsInfo (
- IN TABLE_ITEM *Table,
- IN UINTN Number,
- IN UINT32 Bits
+ IN TABLE_ITEM *Table,
+ IN UINTN Number,
+ IN UINT32 Bits
)
{
//
// Get certain bit of 'Value':
//
-#define BIT(Value, bit) ((Value) & ((UINT32) 1) << (bit))
+ #define BIT(Value, bit) ((Value) & ((UINT32) 1) << (bit))
//
// Clear certain bit of 'Value':
//
-#define CLR_BIT(Value, bit) ((Value) -= (BIT (Value, bit)))
+ #define CLR_BIT(Value, bit) ((Value) -= (BIT (Value, bit)))
- UINTN Index;
- UINT32 Value;
- BOOLEAN FirstInfo;
+ UINTN Index;
+ UINT32 Value;
+ BOOLEAN FirstInfo;
FirstInfo = TRUE;
- Value = Bits;
+ Value = Bits;
//
// query the table and print information
//
@@ -3671,6 +3669,7 @@ PrintBitsInfo ( //
Print (L" | ");
}
+
Print (Table[Index].Info);
FirstInfo = FALSE;
@@ -3685,19 +3684,23 @@ PrintBitsInfo ( // There is no any info if FirstInfo is still TRUE.
//
if (FirstInfo) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_NO_INFO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_NO_INFO), gShellDebug1HiiHandle);
}
if (Value != 0) {
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_BITS_SET),
gShellDebug1HiiHandle,
Value
- );
+ );
}
Print (L"\n");
}
+
//
// //////////////////////////////////////////////////////////////////
//
@@ -3730,11 +3733,11 @@ PrintBitsInfo ( **/
VOID
DisplaySystemWakeupType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_WAKEUP_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_WAKEUP_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (SystemWakeupTypeTable, Type);
}
@@ -3747,11 +3750,11 @@ DisplaySystemWakeupType ( **/
VOID
DisplayBaseBoardFeatureFlags (
- IN UINT8 FeatureFlags,
- IN UINT8 Option
+ IN UINT8 FeatureFlags,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_FEATURE_FLAGS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_FEATURE_FLAGS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (FeatureFlags, Option);
PRINT_BITS_INFO (BaseBoardFeatureFlagsTable, FeatureFlags);
}
@@ -3763,12 +3766,12 @@ DisplayBaseBoardFeatureFlags ( @param[in] Option The optional information.
**/
VOID
-DisplayBaseBoardBoardType(
- IN UINT8 Type,
- IN UINT8 Option
+DisplayBaseBoardBoardType (
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_BOARD_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_BOARD_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (BaseBoardBoardTypeTable, Type);
}
@@ -3781,11 +3784,11 @@ DisplayBaseBoardBoardType( **/
VOID
DisplaySystemEnclosureType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
//
// query table and print info
@@ -3793,7 +3796,7 @@ DisplaySystemEnclosureType ( PRINT_TABLE_ITEM (SystemEnclosureTypeTable, Type);
if (BIT (Type, 7) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CHASSIS_LOCK_PRESENT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CHASSIS_LOCK_PRESENT), gShellDebug1HiiHandle);
}
}
@@ -3805,11 +3808,11 @@ DisplaySystemEnclosureType ( **/
VOID
DisplaySystemEnclosureStatus (
- IN UINT8 Status,
- IN UINT8 Option
+ IN UINT8 Status,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_STATUS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_STATUS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
PRINT_TABLE_ITEM (SystemEnclosureStatusTable, Status);
}
@@ -3822,11 +3825,11 @@ DisplaySystemEnclosureStatus ( **/
VOID
DisplaySESecurityStatus (
- IN UINT8 Status,
- IN UINT8 Option
+ IN UINT8 Status,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_SECURITY), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_SECURITY), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
PRINT_TABLE_ITEM (SESecurityStatusTable, Status);
}
@@ -3839,11 +3842,11 @@ DisplaySESecurityStatus ( **/
VOID
DisplayProcessorType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (ProcessorTypeTable, Type);
}
@@ -3856,11 +3859,11 @@ DisplayProcessorType ( **/
VOID
DisplayProcessorUpgrade (
- IN UINT8 Upgrade,
- IN UINT8 Option
+ IN UINT8 Upgrade,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_UPDATE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_UPDATE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Upgrade, Option);
PRINT_TABLE_ITEM (ProcessorUpgradeTable, Upgrade);
}
@@ -3873,11 +3876,11 @@ DisplayProcessorUpgrade ( **/
VOID
DisplayProcessorCharacteristics (
- IN UINT16 Type,
- IN UINT8 Option
+ IN UINT16 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_CHARACTERISTICS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_CHARACTERISTICS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_BITS_INFO (ProcessorCharacteristicsTable, Type);
}
@@ -3890,11 +3893,11 @@ DisplayProcessorCharacteristics ( **/
VOID
DisplayMcErrorDetectMethod (
- IN UINT8 Method,
- IN UINT8 Option
+ IN UINT8 Method,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DETECTMETHOD), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DETECTMETHOD), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Method, Option);
PRINT_TABLE_ITEM (McErrorDetectMethodTable, Method);
}
@@ -3907,11 +3910,11 @@ DisplayMcErrorDetectMethod ( **/
VOID
DisplayMcErrorCorrectCapability (
- IN UINT8 Capability,
- IN UINT8 Option
+ IN UINT8 Capability,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CORRECT_CAPABILITY), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CORRECT_CAPABILITY), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Capability, Option);
PRINT_BITS_INFO (McErrorCorrectCapabilityTable, Capability);
}
@@ -3924,11 +3927,11 @@ DisplayMcErrorCorrectCapability ( **/
VOID
DisplayMcInterleaveSupport (
- IN UINT8 Support,
- IN UINT8 Option
+ IN UINT8 Support,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_INTERLEAVE_SUPPORT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_INTERLEAVE_SUPPORT), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Support, Option);
PRINT_TABLE_ITEM (McInterleaveSupportTable, Support);
}
@@ -3945,7 +3948,7 @@ DisplayMcMemorySpeeds ( IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MEMORY_SPEED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MEMORY_SPEED), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Speed, Option);
PRINT_BITS_INFO (McMemorySpeedsTable, Speed);
}
@@ -3958,11 +3961,11 @@ DisplayMcMemorySpeeds ( **/
VOID
DisplayMemoryModuleVoltage (
- IN UINT8 Voltage,
- IN UINT8 Option
+ IN UINT8 Voltage,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_REQUIRED_VOLTAGES), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_REQUIRED_VOLTAGES), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Voltage, Option);
PRINT_BITS_INFO (MemoryModuleVoltageTable, Voltage);
}
@@ -3979,7 +3982,7 @@ DisplayMmMemoryType ( IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_BITS_INFO (MmMemoryTypeTable, Type);
}
@@ -3992,11 +3995,11 @@ DisplayMmMemoryType ( **/
VOID
DisplayMmErrorStatus (
- IN UINT8 Status,
- IN UINT8 Option
+ IN UINT8 Status,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_ERROR_STATUS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_ERROR_STATUS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
PRINT_BITS_INFO (MmErrorStatusTable, Status);
}
@@ -4013,9 +4016,9 @@ DisplayCacheSRAMType ( IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SRAM_TYPE), gShellDebug1HiiHandle);
- PRINT_INFO_OPTION ((UINT8) Type, Option);
- PRINT_BITS_INFO (CacheSRAMTypeTable, (UINT8) Type);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SRAM_TYPE), gShellDebug1HiiHandle);
+ PRINT_INFO_OPTION ((UINT8)Type, Option);
+ PRINT_BITS_INFO (CacheSRAMTypeTable, (UINT8)Type);
}
/**
@@ -4026,11 +4029,11 @@ DisplayCacheSRAMType ( **/
VOID
DisplayCacheErrCorrectingType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ERROR_CORRECTING), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ERROR_CORRECTING), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (CacheErrCorrectingTypeTable, Type);
}
@@ -4043,11 +4046,11 @@ DisplayCacheErrCorrectingType ( **/
VOID
DisplayCacheSystemCacheType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SYSTEM_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SYSTEM_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (CacheSystemCacheTypeTable, Type);
}
@@ -4060,11 +4063,11 @@ DisplayCacheSystemCacheType ( **/
VOID
DisplayCacheAssociativity (
- IN UINT8 Associativity,
- IN UINT8 Option
+ IN UINT8 Associativity,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ASSOCIATIVITY), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ASSOCIATIVITY), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Associativity, Option);
PRINT_TABLE_ITEM (CacheAssociativityTable, Associativity);
}
@@ -4077,11 +4080,11 @@ DisplayCacheAssociativity ( **/
VOID
DisplayPortConnectorType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_CONNECTOR_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_CONNECTOR_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (PortConnectorTypeTable, Type);
}
@@ -4094,11 +4097,11 @@ DisplayPortConnectorType ( **/
VOID
DisplayPortType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (PortTypeTable, Type);
}
@@ -4111,11 +4114,11 @@ DisplayPortType ( **/
VOID
DisplaySystemSlotType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (SystemSlotTypeTable, Type);
}
@@ -4128,11 +4131,11 @@ DisplaySystemSlotType ( **/
VOID
DisplaySystemSlotDataBusWidth (
- IN UINT8 Width,
- IN UINT8 Option
+ IN UINT8 Width,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_DATA), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_DATA), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Width, Option);
PRINT_TABLE_ITEM (SystemSlotDataBusWidthTable, Width);
}
@@ -4145,11 +4148,11 @@ DisplaySystemSlotDataBusWidth ( **/
VOID
DisplaySystemSlotCurrentUsage (
- IN UINT8 Usage,
- IN UINT8 Option
+ IN UINT8 Usage,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_CURRENT_USAGE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_CURRENT_USAGE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Usage, Option);
PRINT_TABLE_ITEM (SystemSlotCurrentUsageTable, Usage);
}
@@ -4162,11 +4165,11 @@ DisplaySystemSlotCurrentUsage ( **/
VOID
DisplaySystemSlotLength (
- IN UINT8 Length,
- IN UINT8 Option
+ IN UINT8 Length,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_LENGTH), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_LENGTH), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Length, Option);
PRINT_TABLE_ITEM (SystemSlotLengthTable, Length);
}
@@ -4179,11 +4182,11 @@ DisplaySystemSlotLength ( **/
VOID
DisplaySlotCharacteristics1 (
- IN UINT8 Chara1,
- IN UINT8 Option
+ IN UINT8 Chara1,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Chara1, Option);
PRINT_BITS_INFO (SlotCharacteristics1Table, Chara1);
}
@@ -4196,11 +4199,11 @@ DisplaySlotCharacteristics1 ( **/
VOID
DisplaySlotCharacteristics2 (
- IN UINT8 Chara2,
- IN UINT8 Option
+ IN UINT8 Chara2,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS_2), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS_2), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Chara2, Option);
PRINT_BITS_INFO (SlotCharacteristics2Table, Chara2);
}
@@ -4213,11 +4216,11 @@ DisplaySlotCharacteristics2 ( **/
VOID
DisplayOnboardDeviceTypes (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ONBOARD_DEVICE_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ONBOARD_DEVICE_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (OnboardDeviceTypesTable, Type);
}
@@ -4230,11 +4233,11 @@ DisplayOnboardDeviceTypes ( **/
VOID
DisplaySELTypes (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_EVENT_LOG_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_EVENT_LOG_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (SELTypesTable, Type);
}
@@ -4247,11 +4250,11 @@ DisplaySELTypes ( **/
VOID
DisplaySELVarDataFormatType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_EVENT_LOG_VAR_DATA_FORMAT), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_EVENT_LOG_VAR_DATA_FORMAT), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (SELVarDataFormatTypeTable, Type);
}
@@ -4268,7 +4271,7 @@ DisplayPostResultsBitmapDw1 ( IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_BITMAP), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_BITMAP), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_BITS_INFO (PostResultsBitmapDw1Table, Key);
}
@@ -4285,7 +4288,7 @@ DisplayPostResultsBitmapDw2 ( IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_SECOND_DWORD), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_SECOND_DWORD), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_BITS_INFO (PostResultsBitmapDw2Table, Key);
}
@@ -4302,27 +4305,27 @@ DisplaySELSysManagementTypes ( IN UINT8 Option
)
{
- UINT8 Temp;
+ UINT8 Temp;
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_TYPES), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_TYPES), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (SMType, Option);
//
// Deal with wide range Value
//
if (SMType >= 0x80000000) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_OEM_ASSIGNED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_OEM_ASSIGNED), gShellDebug1HiiHandle);
} else if (SMType >= 0x00020000) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);
} else if (SMType >= 0x00010000) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_PROBE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_PROBE), gShellDebug1HiiHandle);
} else if (SMType >= 0x31) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);
} else {
//
// Deal with One byte data
//
- Temp = (UINT8) (SMType & 0x3F);
+ Temp = (UINT8)(SMType & 0x3F);
PRINT_TABLE_ITEM (SELSysManagementTypesTable, Temp);
}
}
@@ -4335,11 +4338,11 @@ DisplaySELSysManagementTypes ( **/
VOID
DisplayPMALocation (
- IN UINT8 Location,
- IN UINT8 Option
+ IN UINT8 Location,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_LOCATION), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_LOCATION), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Location, Option);
PRINT_TABLE_ITEM (PMALocationTable, Location);
}
@@ -4352,11 +4355,11 @@ DisplayPMALocation ( **/
VOID
DisplayPMAUse (
- IN UINT8 Use,
- IN UINT8 Option
+ IN UINT8 Use,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_USE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_USE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Use, Option);
PRINT_TABLE_ITEM (PMAUseTable, Use);
}
@@ -4369,11 +4372,11 @@ DisplayPMAUse ( **/
VOID
DisplayPMAErrorCorrectionTypes (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_ERROR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_ERROR), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (PMAErrorCorrectionTypesTable, Type);
}
@@ -4386,11 +4389,11 @@ DisplayPMAErrorCorrectionTypes ( **/
VOID
DisplayMemoryDeviceFormFactor (
- IN UINT8 FormFactor,
- IN UINT8 Option
+ IN UINT8 FormFactor,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_FORM_FACTOR), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_FORM_FACTOR), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (FormFactor, Option);
PRINT_TABLE_ITEM (MemoryDeviceFormFactorTable, FormFactor);
}
@@ -4403,11 +4406,11 @@ DisplayMemoryDeviceFormFactor ( **/
VOID
DisplayMemoryDeviceType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (MemoryDeviceTypeTable, Type);
}
@@ -4424,7 +4427,7 @@ DisplayMemoryDeviceTypeDetail ( IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE_DETAIL), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE_DETAIL), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Para, Option);
PRINT_BITS_INFO (MemoryDeviceTypeDetailTable, Para);
}
@@ -4441,7 +4444,7 @@ DisplayMemoryDeviceMemoryTechnology ( IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEMORY_TECHNOLOGY), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEMORY_TECHNOLOGY), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Para, Option);
PRINT_TABLE_ITEM (MemoryDeviceMemoryTechnologyTable, Para);
}
@@ -4458,7 +4461,7 @@ DisplayMemoryDeviceMemoryOperatingModeCapability ( IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEM_OPER_MODE_CAPA), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEM_OPER_MODE_CAPA), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Para, Option);
PRINT_BITS_INFO (MemoryDeviceMemoryOperatingModeCapabilityTable, Para);
}
@@ -4471,11 +4474,11 @@ DisplayMemoryDeviceMemoryOperatingModeCapability ( **/
VOID
DisplayMemoryErrorType (
- IN UINT8 ErrorType,
- IN UINT8 Option
+ IN UINT8 ErrorType,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_INFO), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_INFO), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (ErrorType, Option);
PRINT_TABLE_ITEM (MemoryErrorTypeTable, ErrorType);
}
@@ -4488,11 +4491,11 @@ DisplayMemoryErrorType ( **/
VOID
DisplayMemoryErrorGranularity (
- IN UINT8 Granularity,
- IN UINT8 Option
+ IN UINT8 Granularity,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_GRANULARITY), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_GRANULARITY), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Granularity, Option);
PRINT_TABLE_ITEM (MemoryErrorGranularityTable, Granularity);
}
@@ -4505,11 +4508,11 @@ DisplayMemoryErrorGranularity ( **/
VOID
DisplayMemoryErrorOperation (
- IN UINT8 Operation,
- IN UINT8 Option
+ IN UINT8 Operation,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_OP), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_OP), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Operation, Option);
PRINT_TABLE_ITEM (MemoryErrorOperationTable, Operation);
}
@@ -4522,11 +4525,11 @@ DisplayMemoryErrorOperation ( **/
VOID
DisplayPointingDeviceType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (PointingDeviceTypeTable, Type);
}
@@ -4539,11 +4542,11 @@ DisplayPointingDeviceType ( **/
VOID
DisplayPointingDeviceInterface (
- IN UINT8 Interface,
- IN UINT8 Option
+ IN UINT8 Interface,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_INTERFACE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_INTERFACE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Interface, Option);
PRINT_TABLE_ITEM (PointingDeviceInterfaceTable, Interface);
}
@@ -4556,11 +4559,11 @@ DisplayPointingDeviceInterface ( **/
VOID
DisplayPBDeviceChemistry (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORTABLE_BATT_DEV_CHEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORTABLE_BATT_DEV_CHEM), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (PBDeviceChemistryTable, Key);
}
@@ -4573,14 +4576,14 @@ DisplayPBDeviceChemistry ( **/
VOID
DisplayVPLocation (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- UINT8 Loc;
+ UINT8 Loc;
- Loc = (UINT8) ((Key & 0xE0) >> 5);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle);
+ Loc = (UINT8)((Key & 0xE0) >> 5);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Loc, Option);
PRINT_TABLE_ITEM (VPLocationTable, Loc);
}
@@ -4593,14 +4596,14 @@ DisplayVPLocation ( **/
VOID
DisplayVPStatus (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- UINT8 Status;
+ UINT8 Status;
- Status = (UINT8) (Key & 0x1F);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_STATUS), gShellDebug1HiiHandle);
+ Status = (UINT8)(Key & 0x1F);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_STATUS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
PRINT_TABLE_ITEM (VPStatusTable, Status);
}
@@ -4613,14 +4616,14 @@ DisplayVPStatus ( **/
VOID
DisplayCoolingDeviceStatus (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- UINT8 Status;
+ UINT8 Status;
- Status = (UINT8) ((Key & 0xE0) >> 5);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_STATUS), gShellDebug1HiiHandle);
+ Status = (UINT8)((Key & 0xE0) >> 5);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_STATUS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
PRINT_TABLE_ITEM (CoolingDeviceStatusTable, Status);
}
@@ -4633,14 +4636,14 @@ DisplayCoolingDeviceStatus ( **/
VOID
DisplayCoolingDeviceType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- UINT8 Type;
+ UINT8 Type;
- Type = (UINT8) (Key & 0x1F);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_TYPE), gShellDebug1HiiHandle);
+ Type = (UINT8)(Key & 0x1F);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (CoolingDeviceTypeTable, Type);
}
@@ -4653,14 +4656,14 @@ DisplayCoolingDeviceType ( **/
VOID
DisplayTemperatureProbeStatus (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- UINT8 Status;
+ UINT8 Status;
- Status = (UINT8) ((Key & 0xE0) >> 5);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_TEMP_PROBE), gShellDebug1HiiHandle);
+ Status = (UINT8)((Key & 0xE0) >> 5);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_TEMP_PROBE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
PRINT_TABLE_ITEM (TemperatureProbeStatusTable, Status);
}
@@ -4673,14 +4676,14 @@ DisplayTemperatureProbeStatus ( **/
VOID
DisplayTemperatureProbeLoc (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- UINT8 Loc;
+ UINT8 Loc;
- Loc = (UINT8) (Key & 0x1F);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle);
+ Loc = (UINT8)(Key & 0x1F);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Loc, Option);
PRINT_TABLE_ITEM (TemperatureProbeLocTable, Loc);
}
@@ -4693,14 +4696,14 @@ DisplayTemperatureProbeLoc ( **/
VOID
DisplayECPStatus (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- UINT8 Status;
+ UINT8 Status;
- Status = (UINT8) ((Key & 0xE0) >> 5);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_STATUS), gShellDebug1HiiHandle);
+ Status = (UINT8)((Key & 0xE0) >> 5);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_STATUS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
PRINT_TABLE_ITEM (ECPStatusTable, Status);
}
@@ -4713,14 +4716,14 @@ DisplayECPStatus ( **/
VOID
DisplayECPLoc (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- UINT8 Loc;
+ UINT8 Loc;
- Loc = (UINT8) (Key & 0x1F);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_LOC), gShellDebug1HiiHandle);
+ Loc = (UINT8)(Key & 0x1F);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_LOC), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Loc, Option);
PRINT_TABLE_ITEM (ECPLocTable, Loc);
}
@@ -4733,11 +4736,11 @@ DisplayECPLoc ( **/
VOID
DisplayMDType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (MDTypeTable, Key);
}
@@ -4750,11 +4753,11 @@ DisplayMDType ( **/
VOID
DisplayMDAddressType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_ADDR_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_ADDR_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (MDAddressTypeTable, Key);
}
@@ -4767,11 +4770,11 @@ DisplayMDAddressType ( **/
VOID
DisplayMemoryChannelType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CHANNEL_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CHANNEL_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (MemoryChannelTypeTable, Key);
}
@@ -4784,11 +4787,11 @@ DisplayMemoryChannelType ( **/
VOID
DisplayIPMIDIBMCInterfaceType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BMC_INTERFACE_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BMC_INTERFACE_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (IPMIDIBMCInterfaceTypeTable, Key);
}
@@ -4801,11 +4804,11 @@ DisplayIPMIDIBMCInterfaceType ( **/
VOID
DisplayMCHostInterfaceType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MC_HOST_INTERFACE_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MC_HOST_INTERFACE_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (MCHostInterfaceTypeTable, Key);
}
@@ -4818,11 +4821,11 @@ DisplayMCHostInterfaceType ( **/
VOID
DisplayProcessorArchitectureType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
- ShellPrintHiiEx (-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROCESSOR_ARCH_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROCESSOR_ARCH_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (ProcessorArchitectureTypesTable, Key);
}
@@ -4835,14 +4838,14 @@ DisplayProcessorArchitectureType ( **/
VOID
DisplayStructureTypeInfo (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
)
{
//
// display
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_STRUCT_TYPE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_STRUCT_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (StructureTypeInfoTable, Key);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h index 756009b2f2..5111d35f63 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h @@ -12,11 +12,11 @@ #include <IndustryStandard/SmBios.h>
-#define QUERY_TABLE_UNFOUND 0xFF
+#define QUERY_TABLE_UNFOUND 0xFF
typedef struct TABLE_ITEM {
- UINT16 Key;
- CHAR16 *Info;
+ UINT16 Key;
+ CHAR16 *Info;
} TABLE_ITEM;
//
@@ -59,11 +59,11 @@ typedef struct TABLE_ITEM { **/
UINT8
QueryTable (
- IN TABLE_ITEM *Table,
- IN UINTN Number,
- IN UINT8 Key,
- IN OUT CHAR16 *Info,
- IN UINTN InfoLen
+ IN TABLE_ITEM *Table,
+ IN UINTN Number,
+ IN UINT8 Key,
+ IN OUT CHAR16 *Info,
+ IN UINTN InfoLen
);
/**
@@ -74,8 +74,8 @@ QueryTable ( **/
VOID
DisplayStructureTypeInfo (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -86,8 +86,8 @@ DisplayStructureTypeInfo ( **/
VOID
DisplaySystemWakeupType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -98,8 +98,8 @@ DisplaySystemWakeupType ( **/
VOID
DisplayBaseBoardFeatureFlags (
- IN UINT8 FeatureFlags,
- IN UINT8 Option
+ IN UINT8 FeatureFlags,
+ IN UINT8 Option
);
/**
@@ -109,9 +109,9 @@ DisplayBaseBoardFeatureFlags ( @param[in] Option The optional information.
**/
VOID
-DisplayBaseBoardBoardType(
- IN UINT8 Type,
- IN UINT8 Option
+DisplayBaseBoardBoardType (
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -122,8 +122,8 @@ DisplayBaseBoardBoardType( **/
VOID
DisplaySystemEnclosureType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -134,8 +134,8 @@ DisplaySystemEnclosureType ( **/
VOID
DisplaySystemEnclosureStatus (
- IN UINT8 Status,
- IN UINT8 Option
+ IN UINT8 Status,
+ IN UINT8 Option
);
/**
@@ -146,8 +146,8 @@ DisplaySystemEnclosureStatus ( **/
VOID
DisplaySESecurityStatus (
- IN UINT8 Status,
- IN UINT8 Option
+ IN UINT8 Status,
+ IN UINT8 Option
)
;
@@ -159,8 +159,8 @@ DisplaySESecurityStatus ( **/
VOID
DisplayProcessorType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -171,8 +171,8 @@ DisplayProcessorType ( **/
VOID
DisplayProcessorUpgrade (
- IN UINT8 Upgrade,
- IN UINT8 Option
+ IN UINT8 Upgrade,
+ IN UINT8 Option
);
/**
@@ -183,8 +183,8 @@ DisplayProcessorUpgrade ( **/
VOID
DisplayProcessorCharacteristics (
- IN UINT16 Type,
- IN UINT8 Option
+ IN UINT16 Type,
+ IN UINT8 Option
);
/**
@@ -195,8 +195,8 @@ DisplayProcessorCharacteristics ( **/
VOID
DisplayMcErrorDetectMethod (
- IN UINT8 Method,
- IN UINT8 Option
+ IN UINT8 Method,
+ IN UINT8 Option
);
/**
@@ -207,8 +207,8 @@ DisplayMcErrorDetectMethod ( **/
VOID
DisplayMcErrorCorrectCapability (
- IN UINT8 Capability,
- IN UINT8 Option
+ IN UINT8 Capability,
+ IN UINT8 Option
);
/**
@@ -219,8 +219,8 @@ DisplayMcErrorCorrectCapability ( **/
VOID
DisplayMcInterleaveSupport (
- IN UINT8 Support,
- IN UINT8 Option
+ IN UINT8 Support,
+ IN UINT8 Option
);
/**
@@ -243,8 +243,8 @@ DisplayMcMemorySpeeds ( **/
VOID
DisplayMemoryModuleVoltage (
- IN UINT8 Voltage,
- IN UINT8 Option
+ IN UINT8 Voltage,
+ IN UINT8 Option
);
/**
@@ -267,8 +267,8 @@ DisplayMmMemoryType ( **/
VOID
DisplayMmErrorStatus (
- IN UINT8 Status,
- IN UINT8 Option
+ IN UINT8 Status,
+ IN UINT8 Option
);
/**
@@ -291,8 +291,8 @@ DisplayCacheSRAMType ( **/
VOID
DisplayCacheErrCorrectingType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -303,8 +303,8 @@ DisplayCacheErrCorrectingType ( **/
VOID
DisplayCacheSystemCacheType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -315,8 +315,8 @@ DisplayCacheSystemCacheType ( **/
VOID
DisplayCacheAssociativity (
- IN UINT8 Associativity,
- IN UINT8 Option
+ IN UINT8 Associativity,
+ IN UINT8 Option
);
/**
@@ -327,8 +327,8 @@ DisplayCacheAssociativity ( **/
VOID
DisplayPortConnectorType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -339,8 +339,8 @@ DisplayPortConnectorType ( **/
VOID
DisplayPortType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -351,8 +351,8 @@ DisplayPortType ( **/
VOID
DisplaySystemSlotType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -363,8 +363,8 @@ DisplaySystemSlotType ( **/
VOID
DisplaySystemSlotDataBusWidth (
- IN UINT8 Width,
- IN UINT8 Option
+ IN UINT8 Width,
+ IN UINT8 Option
);
/**
@@ -375,8 +375,8 @@ DisplaySystemSlotDataBusWidth ( **/
VOID
DisplaySystemSlotCurrentUsage (
- IN UINT8 Usage,
- IN UINT8 Option
+ IN UINT8 Usage,
+ IN UINT8 Option
);
/**
@@ -387,8 +387,8 @@ DisplaySystemSlotCurrentUsage ( **/
VOID
DisplaySystemSlotLength (
- IN UINT8 Length,
- IN UINT8 Option
+ IN UINT8 Length,
+ IN UINT8 Option
);
/**
@@ -399,8 +399,8 @@ DisplaySystemSlotLength ( **/
VOID
DisplaySlotCharacteristics1 (
- IN UINT8 Chara1,
- IN UINT8 Option
+ IN UINT8 Chara1,
+ IN UINT8 Option
);
/**
@@ -411,8 +411,8 @@ DisplaySlotCharacteristics1 ( **/
VOID
DisplaySlotCharacteristics2 (
- IN UINT8 Chara2,
- IN UINT8 Option
+ IN UINT8 Chara2,
+ IN UINT8 Option
);
/**
@@ -423,8 +423,8 @@ DisplaySlotCharacteristics2 ( **/
VOID
DisplayOnboardDeviceTypes (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -435,8 +435,8 @@ DisplayOnboardDeviceTypes ( **/
VOID
DisplaySELTypes (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -447,8 +447,8 @@ DisplaySELTypes ( **/
VOID
DisplaySELVarDataFormatType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -495,8 +495,8 @@ DisplaySELSysManagementTypes ( **/
VOID
DisplayPMALocation (
- IN UINT8 Location,
- IN UINT8 Option
+ IN UINT8 Location,
+ IN UINT8 Option
);
/**
@@ -507,8 +507,8 @@ DisplayPMALocation ( **/
VOID
DisplayPMAUse (
- IN UINT8 Use,
- IN UINT8 Option
+ IN UINT8 Use,
+ IN UINT8 Option
);
/**
@@ -519,8 +519,8 @@ DisplayPMAUse ( **/
VOID
DisplayPMAErrorCorrectionTypes (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -531,8 +531,8 @@ DisplayPMAErrorCorrectionTypes ( **/
VOID
DisplayMemoryDeviceFormFactor (
- IN UINT8 FormFactor,
- IN UINT8 Option
+ IN UINT8 FormFactor,
+ IN UINT8 Option
);
/**
@@ -543,8 +543,8 @@ DisplayMemoryDeviceFormFactor ( **/
VOID
DisplayMemoryDeviceType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -591,8 +591,8 @@ DisplayMemoryDeviceMemoryOperatingModeCapability ( **/
VOID
DisplayMemoryErrorType (
- IN UINT8 ErrorType,
- IN UINT8 Option
+ IN UINT8 ErrorType,
+ IN UINT8 Option
);
/**
@@ -603,8 +603,8 @@ DisplayMemoryErrorType ( **/
VOID
DisplayMemoryErrorGranularity (
- IN UINT8 Granularity,
- IN UINT8 Option
+ IN UINT8 Granularity,
+ IN UINT8 Option
);
/**
@@ -615,8 +615,8 @@ DisplayMemoryErrorGranularity ( **/
VOID
DisplayMemoryErrorOperation (
- IN UINT8 Operation,
- IN UINT8 Option
+ IN UINT8 Operation,
+ IN UINT8 Option
);
/**
@@ -627,8 +627,8 @@ DisplayMemoryErrorOperation ( **/
VOID
DisplayPointingDeviceType (
- IN UINT8 Type,
- IN UINT8 Option
+ IN UINT8 Type,
+ IN UINT8 Option
);
/**
@@ -639,8 +639,8 @@ DisplayPointingDeviceType ( **/
VOID
DisplayPointingDeviceInterface (
- IN UINT8 Interface,
- IN UINT8 Option
+ IN UINT8 Interface,
+ IN UINT8 Option
);
/**
@@ -651,8 +651,8 @@ DisplayPointingDeviceInterface ( **/
VOID
DisplayPBDeviceChemistry (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -663,8 +663,8 @@ DisplayPBDeviceChemistry ( **/
VOID
DisplayVPLocation (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -675,8 +675,8 @@ DisplayVPLocation ( **/
VOID
DisplayVPStatus (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -687,8 +687,8 @@ DisplayVPStatus ( **/
VOID
DisplayCoolingDeviceStatus (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -699,8 +699,8 @@ DisplayCoolingDeviceStatus ( **/
VOID
DisplayCoolingDeviceType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -711,8 +711,8 @@ DisplayCoolingDeviceType ( **/
VOID
DisplayTemperatureProbeStatus (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -723,8 +723,8 @@ DisplayTemperatureProbeStatus ( **/
VOID
DisplayTemperatureProbeLoc (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -735,8 +735,8 @@ DisplayTemperatureProbeLoc ( **/
VOID
DisplayECPStatus (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -747,8 +747,8 @@ DisplayECPStatus ( **/
VOID
DisplayECPLoc (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -759,8 +759,8 @@ DisplayECPLoc ( **/
VOID
DisplayMDType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -771,8 +771,8 @@ DisplayMDType ( **/
VOID
DisplayMDAddressType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -783,8 +783,8 @@ DisplayMDAddressType ( **/
VOID
DisplayMemoryChannelType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -795,8 +795,8 @@ DisplayMemoryChannelType ( **/
VOID
DisplayIPMIDIBMCInterfaceType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
/**
@@ -807,8 +807,8 @@ DisplayIPMIDIBMCInterfaceType ( **/
VOID
DisplayMCHostInterfaceType (
- IN UINT8 Key,
- IN UINT8 Option
+ IN UINT8 Key,
+ IN UINT8 Option
);
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c index 955ec83715..e9360beb23 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c @@ -13,9 +13,9 @@ #include "PrintInfo.h"
#include "QueryTable.h"
-UINT8 gShowType = SHOW_DETAIL;
-STATIC STRUCTURE_STATISTICS *mStatisticsTable = NULL;
-STATIC STRUCTURE_STATISTICS *mSmbios64BitStatisticsTable = NULL;
+UINT8 gShowType = SHOW_DETAIL;
+STATIC STRUCTURE_STATISTICS *mStatisticsTable = NULL;
+STATIC STRUCTURE_STATISTICS *mSmbios64BitStatisticsTable = NULL;
UINT8 SmbiosMajorVersion;
UINT8 SmbiosMinorVersion;
@@ -23,13 +23,13 @@ UINT8 SmbiosMinorVersion; UINTN mNumberOfSmbios64BitStructures;
UINTN mSmbios64BitTableLength;
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-t", TypeValue},
- {L"-h", TypeValue},
- {L"-s", TypeFlag},
- {L"-a", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-t", TypeValue },
+ { L"-h", TypeValue },
+ { L"-s", TypeFlag },
+ { L"-a", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'smbiosview' command.
@@ -44,16 +44,16 @@ ShellCommandRunSmbiosView ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- UINT8 StructType;
- UINT16 StructHandle;
- EFI_STATUS Status;
- EFI_STATUS Status1;
- EFI_STATUS Status2;
- BOOLEAN RandomView;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Temp;
+ UINT8 StructType;
+ UINT16 StructHandle;
+ EFI_STATUS Status;
+ EFI_STATUS Status1;
+ EFI_STATUS Status2;
+ BOOLEAN RandomView;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Temp;
mStatisticsTable = NULL;
mSmbios64BitStatisticsTable = NULL;
@@ -61,56 +61,56 @@ ShellCommandRunSmbiosView ( ShellStatus = SHELL_SUCCESS;
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"smbiosview", 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"smbiosview", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetCount(Package) > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");
+ if (ShellCommandLineGetCount (Package) > 1) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetValue(Package, L"-t") == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"smbiosview", L"-t");
+ } else if (ShellCommandLineGetFlag (Package, L"-t") && (ShellCommandLineGetValue (Package, L"-t") == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"smbiosview", L"-t");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetValue(Package, L"-h") == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"smbiosview", L"-h");
+ } else if (ShellCommandLineGetFlag (Package, L"-h") && (ShellCommandLineGetValue (Package, L"-h") == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"smbiosview", L"-h");
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (
- (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-h")) ||
- (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-s")) ||
- (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-a")) ||
- (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-s")) ||
- (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-a")) ||
- (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-a"))
- ) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");
+ (ShellCommandLineGetFlag (Package, L"-t") && ShellCommandLineGetFlag (Package, L"-h")) ||
+ (ShellCommandLineGetFlag (Package, L"-t") && ShellCommandLineGetFlag (Package, L"-s")) ||
+ (ShellCommandLineGetFlag (Package, L"-t") && ShellCommandLineGetFlag (Package, L"-a")) ||
+ (ShellCommandLineGetFlag (Package, L"-h") && ShellCommandLineGetFlag (Package, L"-s")) ||
+ (ShellCommandLineGetFlag (Package, L"-h") && ShellCommandLineGetFlag (Package, L"-a")) ||
+ (ShellCommandLineGetFlag (Package, L"-s") && ShellCommandLineGetFlag (Package, L"-a"))
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"smbiosview");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
-
//
// Init Lib
//
Status1 = LibSmbiosInit ();
Status2 = LibSmbios64BitInit ();
if (EFI_ERROR (Status1) && EFI_ERROR (Status2)) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle);
ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
- StructType = STRUCTURE_TYPE_RANDOM;
- RandomView = TRUE;
+ StructType = STRUCTURE_TYPE_RANDOM;
+ RandomView = TRUE;
- Temp = ShellCommandLineGetValue(Package, L"-t");
+ Temp = ShellCommandLineGetValue (Package, L"-t");
if (Temp != NULL) {
- StructType = (UINT8) ShellStrToUintn (Temp);
+ StructType = (UINT8)ShellStrToUintn (Temp);
}
- if (ShellCommandLineGetFlag(Package, L"-a")) {
+ if (ShellCommandLineGetFlag (Package, L"-a")) {
gShowType = SHOW_ALL;
}
@@ -118,14 +118,15 @@ ShellCommandRunSmbiosView ( //
// Initialize the StructHandle to be the first handle
//
- StructHandle = INVALID_HANDLE;
+ StructHandle = INVALID_HANDLE;
LibGetSmbiosStructure (&StructHandle, NULL, NULL);
- Temp = ShellCommandLineGetValue(Package, L"-h");
+ Temp = ShellCommandLineGetValue (Package, L"-h");
if (Temp != NULL) {
RandomView = FALSE;
- StructHandle = (UINT16) ShellStrToUintn(Temp);
+ StructHandle = (UINT16)ShellStrToUintn (Temp);
}
+
//
// build statistics table
//
@@ -135,11 +136,12 @@ ShellCommandRunSmbiosView ( goto Done;
}
- if (ShellCommandLineGetFlag(Package, L"-s")) {
+ if (ShellCommandLineGetFlag (Package, L"-s")) {
Status = DisplayStatisticsTable (SHOW_DETAIL);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_NOT_FOUND;
}
+
goto Show64Bit;
}
@@ -147,7 +149,7 @@ ShellCommandRunSmbiosView ( // Show SMBIOS structure information
//
Status = SMBiosView (StructType, StructHandle, gShowType, RandomView);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
@@ -163,23 +165,25 @@ Show64Bit: ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
+
//
// Initialize the StructHandle to be the first handle
//
- StructHandle = INVALID_HANDLE;
+ StructHandle = INVALID_HANDLE;
LibGetSmbios64BitStructure (&StructHandle, NULL, NULL);
- Temp = ShellCommandLineGetValue(Package, L"-h");
+ Temp = ShellCommandLineGetValue (Package, L"-h");
if (Temp != NULL) {
RandomView = FALSE;
- StructHandle = (UINT16) ShellStrToUintn(Temp);
+ StructHandle = (UINT16)ShellStrToUintn (Temp);
}
- if (ShellCommandLineGetFlag(Package, L"-s")) {
+ if (ShellCommandLineGetFlag (Package, L"-s")) {
Status = DisplaySmbios64BitStatisticsTable (SHOW_DETAIL);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_NOT_FOUND;
}
+
goto Done;
}
@@ -187,12 +191,13 @@ Show64Bit: // Show SMBIOS structure information
//
Status = SMBios64View (StructType, StructHandle, gShowType, RandomView);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_NOT_FOUND;
}
}
}
}
+
Done:
//
// Release resources
@@ -237,16 +242,16 @@ Done: **/
EFI_STATUS
SMBiosView (
- IN UINT8 QueryType,
- IN UINT16 QueryHandle,
- IN UINT8 Option,
- IN BOOLEAN RandomView
+ IN UINT8 QueryType,
+ IN UINT16 QueryHandle,
+ IN UINT8 Option,
+ IN BOOLEAN RandomView
)
{
- UINT16 Handle;
- UINT8 *Buffer;
- UINT16 Length;
- UINTN Index;
+ UINT16 Handle;
+ UINT8 *Buffer;
+ UINT16 Length;
+ UINTN Index;
SMBIOS_STRUCTURE_POINTER SmbiosStruct;
SMBIOS_TABLE_ENTRY_POINT *SMBiosTable;
@@ -254,7 +259,7 @@ SMBiosView ( SMBiosTable = NULL;
LibSmbiosGetEPS (&SMBiosTable);
if (SMBiosTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
return EFI_BAD_BUFFER_SIZE;
}
@@ -267,43 +272,43 @@ SMBiosView ( SmbiosMajorVersion = SMBiosTable->MajorVersion;
SmbiosMinorVersion = SMBiosTable->MinorVersion;
- ShellPrintEx(-1,-1,L"=========================================================\n");
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle);
+ ShellPrintEx (-1, -1, L"=========================================================\n");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle);
if (QueryType == STRUCTURE_TYPE_RANDOM) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType);
}
if (RandomView) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle);
}
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle);
- ShellPrintEx(-1,-1,GetShowTypeString (gShowType));
- ShellPrintEx(-1,-1,L"\n\n");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle);
+ ShellPrintEx (-1, -1, GetShowTypeString (gShowType));
+ ShellPrintEx (-1, -1, L"\n\n");
-/*
- //
- // Get internal commands, such as change options.
- //
- Status = WaitEnter ();
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
+ /*
+ //
+ // Get internal commands, such as change options.
+ //
+ Status = WaitEnter ();
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ return EFI_SUCCESS;
+ }
- return Status;
- }
-*/
+ return Status;
+ }
+ */
//
// Searching and display structure info
//
- Handle = QueryHandle;
+ Handle = QueryHandle;
for (Index = 0; Index < SMBiosTable->NumberOfSmbiosStructures; Index++) {
//
// if reach the end of table, break..
@@ -311,6 +316,7 @@ SMBiosView ( if (Handle == INVALID_HANDLE) {
break;
}
+
//
// handle then point to the next!
//
@@ -325,62 +331,67 @@ SMBiosView ( // if QueryType!=Random, but Hdr->Type==QueryType, also print it.
// only if QueryType != Random and Hdr->Type != QueryType, skiped it.
//
- if (QueryType != STRUCTURE_TYPE_RANDOM && SmbiosStruct.Hdr->Type != QueryType) {
+ if ((QueryType != STRUCTURE_TYPE_RANDOM) && (SmbiosStruct.Hdr->Type != QueryType)) {
continue;
}
- ShellPrintEx(-1,-1,L"\n=========================================================\n");
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintEx (-1, -1, L"\n=========================================================\n");
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT),
gShellDebug1HiiHandle,
SmbiosStruct.Hdr->Type,
SmbiosStruct.Hdr->Handle
- );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length);
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length);
//
// Addr of structure in structure in table
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN) Buffer);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN)Buffer);
DumpHex (0, 0, Length, Buffer);
-/*
- //
- // Get internal commands, such as change options.
- //
- Status = WaitEnter ();
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
+ /*
+ //
+ // Get internal commands, such as change options.
+ //
+ Status = WaitEnter ();
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ return EFI_SUCCESS;
+ }
- return Status;
- }
-*/
+ return Status;
+ }
+ */
if (gShowType != SHOW_NONE) {
//
// Print structure information
//
SmbiosPrintStructure (&SmbiosStruct, gShowType);
- ShellPrintEx(-1,-1,L"\n");
-
-/*
- //
- // Get internal commands, such as change options.
- //
- Status = WaitEnter ();
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
-
- return Status;
- }
-*/
+ ShellPrintEx (-1, -1, L"\n");
+
+ /*
+ //
+ // Get internal commands, such as change options.
+ //
+ Status = WaitEnter ();
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ return EFI_SUCCESS;
+ }
+
+ return Status;
+ }
+ */
}
+
if (!RandomView) {
break;
}
+
//
// Support Execution Interrupt.
//
@@ -389,7 +400,7 @@ SMBiosView ( }
}
- ShellPrintEx(-1,-1,L"\n=========================================================\n");
+ ShellPrintEx (-1, -1, L"\n=========================================================\n");
return EFI_SUCCESS;
}
@@ -410,10 +421,10 @@ SMBiosView ( **/
EFI_STATUS
SMBios64View (
- IN UINT8 QueryType,
- IN UINT16 QueryHandle,
- IN UINT8 Option,
- IN BOOLEAN RandomView
+ IN UINT8 QueryType,
+ IN UINT16 QueryHandle,
+ IN UINT8 Option,
+ IN BOOLEAN RandomView
)
{
UINT16 Handle;
@@ -426,7 +437,7 @@ SMBios64View ( SMBiosTable = NULL;
LibSmbios64BitGetEPS (&SMBiosTable);
if (SMBiosTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
return EFI_BAD_BUFFER_SIZE;
}
@@ -439,43 +450,43 @@ SMBios64View ( SmbiosMajorVersion = SMBiosTable->MajorVersion;
SmbiosMinorVersion = SMBiosTable->MinorVersion;
- ShellPrintEx(-1,-1,L"=========================================================\n");
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle);
+ ShellPrintEx (-1, -1, L"=========================================================\n");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle);
if (QueryType == STRUCTURE_TYPE_RANDOM) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType);
}
if (RandomView) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle);
} else {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle);
}
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle);
- ShellPrintEx(-1,-1,GetShowTypeString (gShowType));
- ShellPrintEx(-1,-1,L"\n\n");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle);
+ ShellPrintEx (-1, -1, GetShowTypeString (gShowType));
+ ShellPrintEx (-1, -1, L"\n\n");
-/*
- //
- // Get internal commands, such as change options.
- //
- Status = WaitEnter ();
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
+ /*
+ //
+ // Get internal commands, such as change options.
+ //
+ Status = WaitEnter ();
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ return EFI_SUCCESS;
+ }
- return Status;
- }
-*/
+ return Status;
+ }
+ */
//
// Searching and display structure info
//
- Handle = QueryHandle;
+ Handle = QueryHandle;
for (Index = 0; Index < mNumberOfSmbios64BitStructures; Index++) {
//
// if reach the end of table, break..
@@ -483,6 +494,7 @@ SMBios64View ( if (Handle == INVALID_HANDLE) {
break;
}
+
//
// handle then point to the next!
//
@@ -497,62 +509,67 @@ SMBios64View ( // if QueryType!=Random, but Hdr->Type==QueryType, also print it.
// only if QueryType != Random and Hdr->Type != QueryType, skiped it.
//
- if (QueryType != STRUCTURE_TYPE_RANDOM && SmbiosStruct.Hdr->Type != QueryType) {
+ if ((QueryType != STRUCTURE_TYPE_RANDOM) && (SmbiosStruct.Hdr->Type != QueryType)) {
continue;
}
- ShellPrintEx(-1,-1,L"\n=========================================================\n");
- ShellPrintHiiEx(-1,-1,NULL,
+ ShellPrintEx (-1, -1, L"\n=========================================================\n");
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT),
gShellDebug1HiiHandle,
SmbiosStruct.Hdr->Type,
SmbiosStruct.Hdr->Handle
- );
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length);
+ );
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length);
//
// Addr of structure in structure in table
//
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN) Buffer);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN)Buffer);
DumpHex (0, 0, Length, Buffer);
-/*
- //
- // Get internal commands, such as change options.
- //
- Status = WaitEnter ();
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
+ /*
+ //
+ // Get internal commands, such as change options.
+ //
+ Status = WaitEnter ();
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ return EFI_SUCCESS;
+ }
- return Status;
- }
-*/
+ return Status;
+ }
+ */
if (gShowType != SHOW_NONE) {
//
// Print structure information
//
SmbiosPrintStructure (&SmbiosStruct, gShowType);
- ShellPrintEx(-1,-1,L"\n");
-
-/*
- //
- // Get internal commands, such as change options.
- //
- Status = WaitEnter ();
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
-
- return Status;
- }
-*/
+ ShellPrintEx (-1, -1, L"\n");
+
+ /*
+ //
+ // Get internal commands, such as change options.
+ //
+ Status = WaitEnter ();
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ return EFI_SUCCESS;
+ }
+
+ return Status;
+ }
+ */
}
+
if (!RandomView) {
break;
}
+
//
// Support Execution Interrupt.
//
@@ -561,7 +578,7 @@ SMBios64View ( }
}
- ShellPrintEx(-1,-1,L"\n=========================================================\n");
+ ShellPrintEx (-1, -1, L"\n=========================================================\n");
return EFI_SUCCESS;
}
@@ -578,11 +595,11 @@ InitSmbiosTableStatistics ( VOID
)
{
- UINT16 Handle;
- UINT8 *Buffer;
- UINT16 Length;
- UINT16 Offset;
- UINT16 Index;
+ UINT16 Handle;
+ UINT8 *Buffer;
+ UINT16 Length;
+ UINT16 Offset;
+ UINT16 Index;
SMBIOS_STRUCTURE_POINTER SmbiosStruct;
SMBIOS_TABLE_ENTRY_POINT *SMBiosTable;
@@ -591,14 +608,15 @@ InitSmbiosTableStatistics ( SMBiosTable = NULL;
LibSmbiosGetEPS (&SMBiosTable);
if (SMBiosTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
return EFI_NOT_FOUND;
}
if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle);
return EFI_INVALID_PARAMETER;
}
+
//
// Allocate memory to mStatisticsTable
//
@@ -607,14 +625,14 @@ InitSmbiosTableStatistics ( mStatisticsTable = NULL;
}
- mStatisticsTable = (STRUCTURE_STATISTICS *) AllocateZeroPool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS));
+ mStatisticsTable = (STRUCTURE_STATISTICS *)AllocateZeroPool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS));
if (mStatisticsTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle);
return EFI_OUT_OF_RESOURCES;
}
- Offset = 0;
+ Offset = 0;
StatisticsPointer = mStatisticsTable;
//
@@ -629,6 +647,7 @@ InitSmbiosTableStatistics ( if (Handle == INVALID_HANDLE) {
break;
}
+
//
// After LibGetSmbiosStructure(), handle then point to the next!
//
@@ -647,9 +666,9 @@ InitSmbiosTableStatistics ( StatisticsPointer->Length = Length;
StatisticsPointer->Addr = Offset;
- Offset = (UINT16) (Offset + Length);
+ Offset = (UINT16)(Offset + Length);
- StatisticsPointer = &mStatisticsTable[Index];
+ StatisticsPointer = &mStatisticsTable[Index];
}
return EFI_SUCCESS;
@@ -664,15 +683,15 @@ InitSmbiosTableStatistics ( **/
EFI_STATUS
CalculateSmbios64BitStructureCountAndLength (
- SMBIOS_TABLE_3_0_ENTRY_POINT *Smbios64EntryPoint,
- UINTN *NumberOfSmbios64Structures,
- UINTN *Smbios64TableLength
-)
+ SMBIOS_TABLE_3_0_ENTRY_POINT *Smbios64EntryPoint,
+ UINTN *NumberOfSmbios64Structures,
+ UINTN *Smbios64TableLength
+ )
{
- SMBIOS_STRUCTURE_POINTER Smbios;
- UINT8 *Raw;
+ SMBIOS_STRUCTURE_POINTER Smbios;
+ UINT8 *Raw;
- *Smbios64TableLength = 0;
+ *Smbios64TableLength = 0;
*NumberOfSmbios64Structures = 0;
Smbios.Raw = (UINT8 *)(UINTN)(Smbios64EntryPoint->TableAddress);
@@ -690,11 +709,11 @@ CalculateSmbios64BitStructureCountAndLength ( //
// Walk to next structure
//
- LibGetSmbiosString (&Smbios, (UINT16) (-1));
+ LibGetSmbiosString (&Smbios, (UINT16)(-1));
//
// Length = Next structure head - this structure head
//
- (*Smbios64TableLength) += ((UINTN) Smbios.Raw - (UINTN) Raw);
+ (*Smbios64TableLength) += ((UINTN)Smbios.Raw - (UINTN)Raw);
if ((*Smbios64TableLength) > Smbios64EntryPoint->TableMaximumSize) {
//
// The actual table length exceeds maximum table size,
@@ -702,6 +721,7 @@ CalculateSmbios64BitStructureCountAndLength ( //
return EFI_INVALID_PARAMETER;
}
+
(*NumberOfSmbios64Structures)++;
}
}
@@ -716,12 +736,12 @@ InitSmbios64BitTableStatistics ( VOID
)
{
- UINT16 Handle;
- UINT8 *Buffer;
- UINT16 Length;
- UINT16 Offset;
- UINT16 Index;
- EFI_STATUS Status;
+ UINT16 Handle;
+ UINT8 *Buffer;
+ UINT16 Length;
+ UINT16 Offset;
+ UINT16 Index;
+ EFI_STATUS Status;
SMBIOS_STRUCTURE_POINTER SmbiosStruct;
SMBIOS_TABLE_3_0_ENTRY_POINT *SMBiosTable;
STRUCTURE_STATISTICS *StatisticsPointer;
@@ -729,14 +749,15 @@ InitSmbios64BitTableStatistics ( SMBiosTable = NULL;
LibSmbios64BitGetEPS (&SMBiosTable);
if (SMBiosTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
return EFI_NOT_FOUND;
}
if (CompareMem (SMBiosTable->AnchorString, "_SM3_", 5) != 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle);
return EFI_INVALID_PARAMETER;
}
+
//
// Allocate memory to mSmbios64BitStatisticsTable
//
@@ -744,6 +765,7 @@ InitSmbios64BitTableStatistics ( FreePool (mSmbios64BitStatisticsTable);
mSmbios64BitStatisticsTable = NULL;
}
+
//
// Calculate number of smbios structures
//
@@ -752,14 +774,14 @@ InitSmbios64BitTableStatistics ( return EFI_INVALID_PARAMETER;
}
- mSmbios64BitStatisticsTable = (STRUCTURE_STATISTICS *) AllocateZeroPool (mNumberOfSmbios64BitStructures * sizeof (STRUCTURE_STATISTICS));
+ mSmbios64BitStatisticsTable = (STRUCTURE_STATISTICS *)AllocateZeroPool (mNumberOfSmbios64BitStructures * sizeof (STRUCTURE_STATISTICS));
if (mSmbios64BitStatisticsTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle);
return EFI_OUT_OF_RESOURCES;
}
- Offset = 0;
+ Offset = 0;
StatisticsPointer = mSmbios64BitStatisticsTable;
//
@@ -774,6 +796,7 @@ InitSmbios64BitTableStatistics ( if (Handle == INVALID_HANDLE) {
break;
}
+
//
// After LibGetSmbios64BitStructure(), handle then point to the next!
//
@@ -792,9 +815,9 @@ InitSmbios64BitTableStatistics ( StatisticsPointer->Length = Length;
StatisticsPointer->Addr = Offset;
- Offset = (UINT16) (Offset + Length);
+ Offset = (UINT16)(Offset + Length);
- StatisticsPointer = &mSmbios64BitStatisticsTable[Index];
+ StatisticsPointer = &mSmbios64BitStatisticsTable[Index];
}
return EFI_SUCCESS;
@@ -809,28 +832,29 @@ InitSmbios64BitTableStatistics ( **/
EFI_STATUS
DisplayStatisticsTable (
- IN UINT8 Option
+ IN UINT8 Option
)
{
- UINTN Index;
- UINTN Num;
- STRUCTURE_STATISTICS *StatisticsPointer;
- SMBIOS_TABLE_ENTRY_POINT *SMBiosTable;
+ UINTN Index;
+ UINTN Num;
+ STRUCTURE_STATISTICS *StatisticsPointer;
+ SMBIOS_TABLE_ENTRY_POINT *SMBiosTable;
SMBiosTable = NULL;
if (Option < SHOW_OUTLINE) {
return EFI_SUCCESS;
}
+
//
// display EPS information firstly
//
LibSmbiosGetEPS (&SMBiosTable);
if (SMBiosTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
return EFI_UNSUPPORTED;
}
- ShellPrintEx(-1,-1,L"\n============================================================\n");
+ ShellPrintEx (-1, -1, L"\n============================================================\n");
SmbiosPrintEPSInfo (SMBiosTable, Option);
if (Option < SHOW_NORMAL) {
@@ -838,43 +862,44 @@ DisplayStatisticsTable ( }
if (mStatisticsTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle);
return EFI_NOT_FOUND;
}
- ShellPrintEx(-1,-1,L"============================================================\n");
+ ShellPrintEx (-1, -1, L"============================================================\n");
StatisticsPointer = &mStatisticsTable[0];
- Num = SMBiosTable->NumberOfSmbiosStructures;
+ Num = SMBiosTable->NumberOfSmbiosStructures;
//
// display statistics table content
//
for (Index = 1; Index <= Num; Index++) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, StatisticsPointer->Index);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, StatisticsPointer->Type);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, StatisticsPointer->Handle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, StatisticsPointer->Index);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, StatisticsPointer->Type);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, StatisticsPointer->Handle);
if (Option >= SHOW_DETAIL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, StatisticsPointer->Addr);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, StatisticsPointer->Length);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, StatisticsPointer->Addr);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, StatisticsPointer->Length);
}
- ShellPrintEx(-1,-1,L"\n");
+ ShellPrintEx (-1, -1, L"\n");
StatisticsPointer = &mStatisticsTable[Index];
-/*
- //
- // Display 20 lines and wait for a page break
- //
- if (Index % 20 == 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle);
- Status = WaitEnter ();
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
- return Status;
- }
- }
-*/
+ /*
+ //
+ // Display 20 lines and wait for a page break
+ //
+ if (Index % 20 == 0) {
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle);
+ Status = WaitEnter ();
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ return EFI_SUCCESS;
+ }
+
+ return Status;
+ }
+ }
+ */
}
return EFI_SUCCESS;
@@ -889,28 +914,29 @@ DisplayStatisticsTable ( **/
EFI_STATUS
DisplaySmbios64BitStatisticsTable (
- IN UINT8 Option
+ IN UINT8 Option
)
{
- UINTN Index;
- UINTN Num;
- STRUCTURE_STATISTICS *StatisticsPointer;
- SMBIOS_TABLE_3_0_ENTRY_POINT *SMBiosTable;
+ UINTN Index;
+ UINTN Num;
+ STRUCTURE_STATISTICS *StatisticsPointer;
+ SMBIOS_TABLE_3_0_ENTRY_POINT *SMBiosTable;
SMBiosTable = NULL;
if (Option < SHOW_OUTLINE) {
return EFI_SUCCESS;
}
+
//
// display EPS information firstly
//
LibSmbios64BitGetEPS (&SMBiosTable);
if (SMBiosTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
return EFI_UNSUPPORTED;
}
- ShellPrintEx(-1,-1,L"\n============================================================\n");
+ ShellPrintEx (-1, -1, L"\n============================================================\n");
Smbios64BitPrintEPSInfo (SMBiosTable, Option);
if (Option < SHOW_NORMAL) {
@@ -918,43 +944,44 @@ DisplaySmbios64BitStatisticsTable ( }
if (mSmbios64BitStatisticsTable == NULL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle);
return EFI_NOT_FOUND;
}
- ShellPrintEx(-1,-1,L"============================================================\n");
+ ShellPrintEx (-1, -1, L"============================================================\n");
StatisticsPointer = &mSmbios64BitStatisticsTable[0];
- Num = mNumberOfSmbios64BitStructures;
+ Num = mNumberOfSmbios64BitStructures;
//
// display statistics table content
//
for (Index = 1; Index <= Num; Index++) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, StatisticsPointer->Index);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, StatisticsPointer->Type);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, StatisticsPointer->Handle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, StatisticsPointer->Index);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, StatisticsPointer->Type);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, StatisticsPointer->Handle);
if (Option >= SHOW_DETAIL) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, StatisticsPointer->Addr);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, StatisticsPointer->Length);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, StatisticsPointer->Addr);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, StatisticsPointer->Length);
}
- ShellPrintEx(-1,-1,L"\n");
+ ShellPrintEx (-1, -1, L"\n");
StatisticsPointer = &mSmbios64BitStatisticsTable[Index];
-/*
- //
- // Display 20 lines and wait for a page break
- //
- if (Index % 20 == 0) {
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle);
- Status = WaitEnter ();
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
- return Status;
- }
- }
-*/
+ /*
+ //
+ // Display 20 lines and wait for a page break
+ //
+ if (Index % 20 == 0) {
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle);
+ Status = WaitEnter ();
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ return EFI_SUCCESS;
+ }
+
+ return Status;
+ }
+ }
+ */
}
return EFI_SUCCESS;
@@ -969,31 +996,29 @@ DisplaySmbios64BitStatisticsTable ( **/
CHAR16 *
GetShowTypeString (
- UINT8 ShowType
+ UINT8 ShowType
)
{
//
// show type
//
switch (ShowType) {
+ case SHOW_NONE:
+ return L"SHOW_NONE";
- case SHOW_NONE:
- return L"SHOW_NONE";
-
- case SHOW_OUTLINE:
- return L"SHOW_OUTLINE";
+ case SHOW_OUTLINE:
+ return L"SHOW_OUTLINE";
- case SHOW_NORMAL:
- return L"SHOW_NORMAL";
+ case SHOW_NORMAL:
+ return L"SHOW_NORMAL";
- case SHOW_DETAIL:
- return L"SHOW_DETAIL";
+ case SHOW_DETAIL:
+ return L"SHOW_DETAIL";
- case SHOW_ALL:
- return L"SHOW_ALL";
+ case SHOW_ALL:
+ return L"SHOW_ALL";
- default:
- return L"Undefined type";
+ default:
+ return L"Undefined type";
}
}
-
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h index b0e03e9d65..0e53093a04 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h @@ -9,15 +9,15 @@ #ifndef _SMBIOS_VIEW_H_
#define _SMBIOS_VIEW_H_
-#define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE
-#define STRUCTURE_TYPE_INVALID (UINT8) 0xFF
+#define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE
+#define STRUCTURE_TYPE_INVALID (UINT8) 0xFF
typedef struct {
- UINT16 Index;
- UINT8 Type;
- UINT16 Handle;
- UINT16 Addr; // offset from table head
- UINT16 Length; // total structure length
+ UINT16 Index;
+ UINT8 Type;
+ UINT16 Handle;
+ UINT16 Addr; // offset from table head
+ UINT16 Length; // total structure length
} STRUCTURE_STATISTICS;
/**
@@ -34,10 +34,10 @@ typedef struct { **/
EFI_STATUS
SMBiosView (
- IN UINT8 QueryType,
- IN UINT16 QueryHandle,
- IN UINT8 Option,
- IN BOOLEAN RandomView
+ IN UINT8 QueryType,
+ IN UINT16 QueryHandle,
+ IN UINT8 Option,
+ IN BOOLEAN RandomView
);
/**
@@ -54,10 +54,10 @@ SMBiosView ( **/
EFI_STATUS
SMBios64View (
- IN UINT8 QueryType,
- IN UINT16 QueryHandle,
- IN UINT8 Option,
- IN BOOLEAN RandomView
+ IN UINT8 QueryType,
+ IN UINT16 QueryHandle,
+ IN UINT8 Option,
+ IN BOOLEAN RandomView
);
/**
@@ -89,7 +89,7 @@ InitSmbios64BitTableStatistics ( **/
EFI_STATUS
DisplayStatisticsTable (
- IN UINT8 Option
+ IN UINT8 Option
);
/**
@@ -101,7 +101,7 @@ DisplayStatisticsTable ( **/
EFI_STATUS
DisplaySmbios64BitStatisticsTable (
- IN UINT8 Option
+ IN UINT8 Option
);
/**
@@ -111,9 +111,9 @@ DisplaySmbios64BitStatisticsTable ( @return A pointer to a string representing the ShowType (or 'undefined type' if not known).
**/
-CHAR16*
+CHAR16 *
GetShowTypeString (
- UINT8 ShowType
+ UINT8 ShowType
);
extern UINT8 gShowType;
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c index f918867f47..c3682eeae4 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c @@ -9,8 +9,8 @@ #include "UefiShellDebug1CommandsLib.h"
#include <Library/BcfgCommandLib.h>
-STATIC CONST CHAR16 mFileName[] = L"Debug1Commands";
-EFI_HII_HANDLE gShellDebug1HiiHandle = NULL;
+STATIC CONST CHAR16 mFileName[] = L"Debug1Commands";
+EFI_HII_HANDLE gShellDebug1HiiHandle = NULL;
/**
Gets the debug file name. This will be used if HII is not working.
@@ -18,7 +18,7 @@ EFI_HII_HANDLE gShellDebug1HiiHandle = NULL; @retval NULL No file is available.
@return The NULL-terminated filename to get help from.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameDebug1 (
VOID
@@ -46,7 +46,7 @@ UefiShellDebug1CommandsLibConstructor ( //
// check our bit of the profiles mask
//
- if ((PcdGet8(PcdShellProfileMask) & BIT1) == 0) {
+ if ((PcdGet8 (PcdShellProfileMask) & BIT1) == 0) {
return (EFI_SUCCESS);
}
@@ -61,27 +61,27 @@ UefiShellDebug1CommandsLibConstructor ( //
// install our shell command handlers that are always installed
//
- ShellCommandRegisterCommandName(L"setsize", ShellCommandRunSetSize , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETSIZE) );
- ShellCommandRegisterCommandName(L"comp", ShellCommandRunComp , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_COMP) );
- ShellCommandRegisterCommandName(L"mode", ShellCommandRunMode , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MODE) );
- ShellCommandRegisterCommandName(L"memmap", ShellCommandRunMemMap , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MEMMAP) );
- ShellCommandRegisterCommandName(L"eficompress", ShellCommandRunEfiCompress , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFICOMPRESS) );
- ShellCommandRegisterCommandName(L"efidecompress", ShellCommandRunEfiDecompress , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFIDCOMPRESS) );
- ShellCommandRegisterCommandName(L"dmem", ShellCommandRunDmem , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMEM) );
- ShellCommandRegisterCommandName(L"loadpcirom", ShellCommandRunLoadPciRom , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_LOAD_PCI_ROM) );
- ShellCommandRegisterCommandName(L"mm", ShellCommandRunMm , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MM) );
- ShellCommandRegisterCommandName(L"setvar", ShellCommandRunSetVar , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETVAR) );
- ShellCommandRegisterCommandName(L"sermode", ShellCommandRunSerMode , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SERMODE) );
- ShellCommandRegisterCommandName(L"pci", ShellCommandRunPci , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_PCI) );
- ShellCommandRegisterCommandName(L"smbiosview", ShellCommandRunSmbiosView , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SMBIOSVIEW) );
- ShellCommandRegisterCommandName(L"dmpstore", ShellCommandRunDmpStore , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMPSTORE) );
- ShellCommandRegisterCommandName(L"dblk", ShellCommandRunDblk , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DBLK) );
- ShellCommandRegisterCommandName(L"edit", ShellCommandRunEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EDIT) );
- ShellCommandRegisterCommandName(L"hexedit", ShellCommandRunHexEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT) );
-
- ShellCommandRegisterAlias(L"dmem", L"mem");
-
- BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Debug1");
+ ShellCommandRegisterCommandName (L"setsize", ShellCommandRunSetSize, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_SETSIZE));
+ ShellCommandRegisterCommandName (L"comp", ShellCommandRunComp, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_COMP));
+ ShellCommandRegisterCommandName (L"mode", ShellCommandRunMode, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_MODE));
+ ShellCommandRegisterCommandName (L"memmap", ShellCommandRunMemMap, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_MEMMAP));
+ ShellCommandRegisterCommandName (L"eficompress", ShellCommandRunEfiCompress, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_EFICOMPRESS));
+ ShellCommandRegisterCommandName (L"efidecompress", ShellCommandRunEfiDecompress, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_EFIDCOMPRESS));
+ ShellCommandRegisterCommandName (L"dmem", ShellCommandRunDmem, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_DMEM));
+ ShellCommandRegisterCommandName (L"loadpcirom", ShellCommandRunLoadPciRom, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_LOAD_PCI_ROM));
+ ShellCommandRegisterCommandName (L"mm", ShellCommandRunMm, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_MM));
+ ShellCommandRegisterCommandName (L"setvar", ShellCommandRunSetVar, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_SETVAR));
+ ShellCommandRegisterCommandName (L"sermode", ShellCommandRunSerMode, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_SERMODE));
+ ShellCommandRegisterCommandName (L"pci", ShellCommandRunPci, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_PCI));
+ ShellCommandRegisterCommandName (L"smbiosview", ShellCommandRunSmbiosView, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_SMBIOSVIEW));
+ ShellCommandRegisterCommandName (L"dmpstore", ShellCommandRunDmpStore, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_DMPSTORE));
+ ShellCommandRegisterCommandName (L"dblk", ShellCommandRunDblk, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_DBLK));
+ ShellCommandRegisterCommandName (L"edit", ShellCommandRunEdit, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_EDIT));
+ ShellCommandRegisterCommandName (L"hexedit", ShellCommandRunHexEdit, ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN (STR_GET_HELP_HEXEDIT));
+
+ ShellCommandRegisterAlias (L"dmem", L"mem");
+
+ BcfgLibraryRegisterBcfgCommand (ImageHandle, SystemTable, L"Debug1");
return (EFI_SUCCESS);
}
@@ -100,14 +100,13 @@ UefiShellDebug1CommandsLibDestructor ( )
{
if (gShellDebug1HiiHandle != NULL) {
- HiiRemovePackages(gShellDebug1HiiHandle);
+ HiiRemovePackages (gShellDebug1HiiHandle);
}
- BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable);
+ BcfgLibraryUnregisterBcfgCommand (ImageHandle, SystemTable);
return (EFI_SUCCESS);
}
-
/**
Function returns a system configuration table that is stored in the
EFI System Table based on the provided GUID.
@@ -120,11 +119,12 @@ UefiShellDebug1CommandsLibDestructor ( **/
EFI_STATUS
GetSystemConfigurationTable (
- IN EFI_GUID *TableGuid,
- IN OUT VOID **Table
+ IN EFI_GUID *TableGuid,
+ IN OUT VOID **Table
)
{
- UINTN Index;
+ UINTN Index;
+
ASSERT (Table != NULL);
for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
@@ -146,13 +146,13 @@ GetSystemConfigurationTable ( **/
VOID
EditorClearLine (
- IN UINTN Row,
- IN UINTN LastCol,
- IN UINTN LastRow
+ IN UINTN Row,
+ IN UINTN LastCol,
+ IN UINTN LastRow
)
{
- UINTN Col;
- CHAR16 Line[200];
+ UINTN Col;
+ CHAR16 Line[200];
if (Row == 0) {
Row = 1;
@@ -180,7 +180,7 @@ EditorClearLine ( //
// print out the blank line
//
- ShellPrintEx ((INT32) Col - 1, (INT32) Row - 1, Line);
+ ShellPrintEx ((INT32)Col - 1, (INT32)Row - 1, Line);
}
}
@@ -194,13 +194,13 @@ EditorClearLine ( **/
BOOLEAN
IsValidFileNameChar (
- IN CONST CHAR16 Ch
+ IN CONST CHAR16 Ch
)
{
//
// See if there are any illegal characters within the name
//
- if (Ch < 0x20 || Ch == L'\"' || Ch == L'*' || Ch == L'/' || Ch == L'<' || Ch == L'>' || Ch == L'?' || Ch == L'|') {
+ if ((Ch < 0x20) || (Ch == L'\"') || (Ch == L'*') || (Ch == L'/') || (Ch == L'<') || (Ch == L'>') || (Ch == L'?') || (Ch == L'|')) {
return FALSE;
}
@@ -217,25 +217,25 @@ IsValidFileNameChar ( **/
BOOLEAN
IsValidFileName (
- IN CONST CHAR16 *Name
+ IN CONST CHAR16 *Name
)
{
-
- UINTN Index;
- UINTN Len;
+ UINTN Index;
+ UINTN Len;
//
// check the length of Name
//
for (Len = 0, Index = StrLen (Name) - 1; Index + 1 != 0; Index--, Len++) {
- if (Name[Index] == '\\' || Name[Index] == ':') {
+ if ((Name[Index] == '\\') || (Name[Index] == ':')) {
break;
}
}
- if (Len == 0 || Len > 255) {
+ if ((Len == 0) || (Len > 255)) {
return FALSE;
}
+
//
// check whether any char in Name not appears in valid file name char
//
@@ -258,14 +258,14 @@ IsValidFileName ( **/
CHAR16 *
EditGetDefaultFileName (
- IN CONST CHAR16 *Extension
+ IN CONST CHAR16 *Extension
)
{
- EFI_STATUS Status;
- UINTN Suffix;
- CHAR16 *FileNameTmp;
+ EFI_STATUS Status;
+ UINTN Suffix;
+ CHAR16 *FileNameTmp;
- Suffix = 0;
+ Suffix = 0;
do {
FileNameTmp = CatSPrint (NULL, L"NewFile%d.%s", Suffix, Extension);
@@ -311,27 +311,27 @@ EditGetDefaultFileName ( **/
EFI_STATUS
ReadFileIntoBuffer (
- IN CONST CHAR16 *FileName,
- OUT VOID **Buffer,
- OUT UINTN *BufferSize OPTIONAL,
- OUT BOOLEAN *ReadOnly
+ IN CONST CHAR16 *FileName,
+ OUT VOID **Buffer,
+ OUT UINTN *BufferSize OPTIONAL,
+ OUT BOOLEAN *ReadOnly
)
{
- VOID *InternalBuffer;
- UINTN FileSize;
- SHELL_FILE_HANDLE FileHandle;
- BOOLEAN CreateFile;
- EFI_STATUS Status;
- EFI_FILE_INFO *Info;
-
- InternalBuffer = NULL;
- FileSize = 0;
- FileHandle = NULL;
- CreateFile = FALSE;
- Status = EFI_SUCCESS;
- Info = NULL;
-
- if (FileName == NULL || Buffer == NULL || ReadOnly == NULL) {
+ VOID *InternalBuffer;
+ UINTN FileSize;
+ SHELL_FILE_HANDLE FileHandle;
+ BOOLEAN CreateFile;
+ EFI_STATUS Status;
+ EFI_FILE_INFO *Info;
+
+ InternalBuffer = NULL;
+ FileSize = 0;
+ FileHandle = NULL;
+ CreateFile = FALSE;
+ Status = EFI_SUCCESS;
+ Info = NULL;
+
+ if ((FileName == NULL) || (Buffer == NULL) || (ReadOnly == NULL)) {
return (EFI_INVALID_PARAMETER);
}
@@ -340,13 +340,13 @@ ReadFileIntoBuffer ( //
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
- if (!EFI_ERROR(Status)) {
- ASSERT(CreateFile == FALSE);
+ if (!EFI_ERROR (Status)) {
+ ASSERT (CreateFile == FALSE);
if (FileHandle == NULL) {
return EFI_LOAD_ERROR;
}
- Info = ShellGetFileInfo(FileHandle);
+ Info = ShellGetFileInfo (FileHandle);
if (Info->Attribute & EFI_FILE_DIRECTORY) {
FreePool (Info);
@@ -358,10 +358,11 @@ ReadFileIntoBuffer ( } else {
*ReadOnly = FALSE;
}
+
//
// get file size
//
- FileSize = (UINTN) Info->FileSize;
+ FileSize = (UINTN)Info->FileSize;
FreePool (Info);
} else if (Status == EFI_NOT_FOUND) {
@@ -379,10 +380,12 @@ ReadFileIntoBuffer ( if (Status == EFI_WARN_DELETE_FAILURE) {
Status = EFI_ACCESS_DENIED;
}
+
if (EFI_ERROR (Status)) {
return Status;
}
}
+
//
// file doesn't exist, so set CreateFile to TRUE and can't be read-only
//
@@ -401,21 +404,23 @@ ReadFileIntoBuffer ( if (InternalBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
//
// read file into InternalBuffer
//
Status = ShellReadFile (FileHandle, &FileSize, InternalBuffer);
- ShellCloseFile(&FileHandle);
+ ShellCloseFile (&FileHandle);
FileHandle = NULL;
if (EFI_ERROR (Status)) {
SHELL_FREE_NON_NULL (InternalBuffer);
return EFI_LOAD_ERROR;
}
}
+
*Buffer = InternalBuffer;
if (BufferSize != NULL) {
*BufferSize = FileSize;
}
- return (EFI_SUCCESS);
+ return (EFI_SUCCESS);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h index 082d488cb2..e738b34490 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h @@ -51,8 +51,7 @@ #include <Library/PrintLib.h>
#include <Library/HandleParsingLib.h>
-
-extern EFI_HII_HANDLE gShellDebug1HiiHandle;
+extern EFI_HII_HANDLE gShellDebug1HiiHandle;
/**
Function returns a system configuration table that is stored in the
@@ -66,8 +65,8 @@ extern EFI_HII_HANDLE gShellDebug1HiiHandle; **/
EFI_STATUS
GetSystemConfigurationTable (
- IN EFI_GUID *TableGuid,
- IN OUT VOID **Table
+ IN EFI_GUID *TableGuid,
+ IN OUT VOID **Table
);
/**
@@ -313,9 +312,9 @@ ShellCommandRunHexEdit ( **/
VOID
EditorClearLine (
- IN UINTN Row,
- IN UINTN LastCol,
- IN UINTN LastRow
+ IN UINTN Row,
+ IN UINTN LastCol,
+ IN UINTN LastRow
);
/**
@@ -328,7 +327,7 @@ EditorClearLine ( **/
BOOLEAN
IsValidFileName (
- IN CONST CHAR16 *Name
+ IN CONST CHAR16 *Name
);
/**
@@ -341,7 +340,7 @@ IsValidFileName ( **/
CHAR16 *
EditGetDefaultFileName (
- IN CONST CHAR16 *Extension
+ IN CONST CHAR16 *Extension
);
/**
@@ -368,10 +367,10 @@ EditGetDefaultFileName ( **/
EFI_STATUS
ReadFileIntoBuffer (
- IN CONST CHAR16 *FileName,
- OUT VOID **Buffer,
- OUT UINTN *BufferSize OPTIONAL,
- OUT BOOLEAN *ReadOnly
+ IN CONST CHAR16 *FileName,
+ OUT VOID **Buffer,
+ OUT UINTN *BufferSize OPTIONAL,
+ OUT BOOLEAN *ReadOnly
);
#endif
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c index 3f4e132674..d7a133c0c5 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c @@ -23,7 +23,7 @@ **/
EFI_STATUS
ShellConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
)
{
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
@@ -36,23 +36,21 @@ ShellConnectDevicePath ( }
PreviousHandle = NULL;
- do{
+ do {
RemainingDevicePath = DevicePathToConnect;
- Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
+ Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
if (!EFI_ERROR (Status) && (Handle != NULL)) {
if (PreviousHandle == Handle) {
Status = EFI_NOT_FOUND;
} else {
PreviousHandle = Handle;
- Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
+ Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
}
}
-
- } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath) );
+ } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath));
return Status;
-
}
/**
@@ -67,20 +65,20 @@ ShellConnectPciRootBridge ( VOID
)
{
- UINTN RootBridgeHandleCount;
- EFI_HANDLE *RootBridgeHandleBuffer;
- UINTN RootBridgeIndex;
- EFI_STATUS Status;
+ UINTN RootBridgeHandleCount;
+ EFI_HANDLE *RootBridgeHandleBuffer;
+ UINTN RootBridgeIndex;
+ EFI_STATUS Status;
RootBridgeHandleCount = 0;
Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiPciRootBridgeIoProtocolGuid,
- NULL,
- &RootBridgeHandleCount,
- &RootBridgeHandleBuffer
- );
+ ByProtocol,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ &RootBridgeHandleCount,
+ &RootBridgeHandleBuffer
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -94,7 +92,6 @@ ShellConnectPciRootBridge ( return EFI_SUCCESS;
}
-
/**
Connect controller(s) and driver(s).
@@ -108,22 +105,22 @@ ShellConnectPciRootBridge ( **/
EFI_STATUS
ConnectControllers (
- IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
- IN CONST EFI_HANDLE DriverHandle OPTIONAL,
- IN CONST BOOLEAN Recursive,
- IN CONST BOOLEAN Output,
- IN CONST BOOLEAN AlwaysOutput
+ IN CONST EFI_HANDLE ControllerHandle OPTIONAL,
+ IN CONST EFI_HANDLE DriverHandle OPTIONAL,
+ IN CONST BOOLEAN Recursive,
+ IN CONST BOOLEAN Output,
+ IN CONST BOOLEAN AlwaysOutput
)
{
- EFI_STATUS Status;
- EFI_STATUS Status2;
- EFI_HANDLE *ControllerHandleList;
- EFI_HANDLE *DriverHandleList;
- EFI_HANDLE *HandleWalker;
+ EFI_STATUS Status;
+ EFI_STATUS Status2;
+ EFI_HANDLE *ControllerHandleList;
+ EFI_HANDLE *DriverHandleList;
+ EFI_HANDLE *HandleWalker;
- ControllerHandleList = NULL;
- Status = EFI_NOT_FOUND;
- Status2 = EFI_NOT_FOUND;
+ ControllerHandleList = NULL;
+ Status = EFI_NOT_FOUND;
+ Status2 = EFI_NOT_FOUND;
//
// If we have a single handle to connect make that a 'list'
@@ -131,10 +128,11 @@ ConnectControllers ( if (DriverHandle == NULL) {
DriverHandleList = NULL;
} else {
- DriverHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE));
+ DriverHandleList = AllocateZeroPool (2*sizeof (EFI_HANDLE));
if (DriverHandleList == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
+
DriverHandleList[0] = DriverHandle;
DriverHandleList[1] = NULL;
}
@@ -144,26 +142,29 @@ ConnectControllers ( // This is where we call the gBS->ConnectController function.
//
if (ControllerHandle == NULL) {
- ControllerHandleList = GetHandleListByProtocol(&gEfiDevicePathProtocolGuid);
+ ControllerHandleList = GetHandleListByProtocol (&gEfiDevicePathProtocolGuid);
for (HandleWalker = ControllerHandleList
- ; HandleWalker != NULL && *HandleWalker != NULL
- ; HandleWalker++
- ){
- Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
- if (!EFI_ERROR(Status)) {
+ ; HandleWalker != NULL && *HandleWalker != NULL
+ ; HandleWalker++
+ )
+ {
+ Status = gBS->ConnectController (*HandleWalker, DriverHandleList, NULL, Recursive);
+ if (!EFI_ERROR (Status)) {
Status2 = EFI_SUCCESS;
}
- if ((Output && !EFI_ERROR(Status)) || AlwaysOutput) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Connect", ConvertHandleToHandleIndex(*HandleWalker), Status);
+
+ if ((Output && !EFI_ERROR (Status)) || AlwaysOutput) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Connect", ConvertHandleToHandleIndex (*HandleWalker), Status);
}
}
} else {
- Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
- if (!EFI_ERROR(Status)) {
+ Status = gBS->ConnectController (ControllerHandle, DriverHandleList, NULL, Recursive);
+ if (!EFI_ERROR (Status)) {
Status2 = EFI_SUCCESS;
}
- if ((Output && !EFI_ERROR(Status)) || AlwaysOutput) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Connect", ConvertHandleToHandleIndex(ControllerHandle), Status);
+
+ if ((Output && !EFI_ERROR (Status)) || AlwaysOutput) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Connect", ConvertHandleToHandleIndex (ControllerHandle), Status);
}
}
@@ -171,11 +172,13 @@ ConnectControllers ( // Free any memory we allocated.
//
if (ControllerHandleList != NULL) {
- FreePool(ControllerHandleList);
+ FreePool (ControllerHandleList);
}
+
if (DriverHandleList != NULL) {
- FreePool(DriverHandleList);
+ FreePool (DriverHandleList);
}
+
return (Status2);
}
@@ -188,7 +191,7 @@ ConnectControllers ( **/
EFI_STATUS
ShellConnectFromDevPaths (
- IN CONST CHAR16 *Key
+ IN CONST CHAR16 *Key
)
{
EFI_DEVICE_PATH_PROTOCOL *DevPath;
@@ -205,24 +208,26 @@ ShellConnectFromDevPaths ( EFI_PCI_IO_PROTOCOL *PciIo;
UINT8 Class[3];
- DevPath = NULL;
- Length = 0;
+ DevPath = NULL;
+ Length = 0;
AtLeastOneConnected = FALSE;
//
// Get the DevicePath buffer from the variable...
//
- Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
+ Status = gRT->GetVariable ((CHAR16 *)Key, (EFI_GUID *)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
if (Status == EFI_BUFFER_TOO_SMALL) {
- DevPath = AllocateZeroPool(Length);
+ DevPath = AllocateZeroPool (Length);
if (DevPath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
+
+ Status = gRT->GetVariable ((CHAR16 *)Key, (EFI_GUID *)&gEfiGlobalVariableGuid, NULL, &Length, DevPath);
if (EFI_ERROR (Status)) {
if (DevPath != NULL) {
FreePool (DevPath);
}
+
return Status;
}
} else if (EFI_ERROR (Status)) {
@@ -244,6 +249,7 @@ ShellConnectFromDevPaths ( if (DevPath != NULL) {
FreePool (DevPath);
}
+
return EFI_UNSUPPORTED;
}
@@ -257,45 +263,46 @@ ShellConnectFromDevPaths ( // connect short form device path
//
if ((DevicePathType (Instance) == MESSAGING_DEVICE_PATH) &&
- ((DevicePathSubType (Instance) == MSG_USB_CLASS_DP)
- || (DevicePathSubType (Instance) == MSG_USB_WWID_DP)
- )) {
-
+ ( (DevicePathSubType (Instance) == MSG_USB_CLASS_DP)
+ || (DevicePathSubType (Instance) == MSG_USB_WWID_DP)
+ ))
+ {
Status = ShellConnectPciRootBridge ();
- if (EFI_ERROR(Status)) {
- FreePool(Instance);
- FreePool(DevPath);
+ if (EFI_ERROR (Status)) {
+ FreePool (Instance);
+ FreePool (DevPath);
return Status;
}
Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiPciIoProtocolGuid,
- NULL,
- &HandleArrayCount,
- &HandleArray
- );
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &HandleArrayCount,
+ &HandleArray
+ );
if (!EFI_ERROR (Status)) {
for (Index = 0; Index < HandleArrayCount; Index++) {
Status = gBS->HandleProtocol (
- HandleArray[Index],
- &gEfiPciIoProtocolGuid,
- (VOID **)&PciIo
- );
+ HandleArray[Index],
+ &gEfiPciIoProtocolGuid,
+ (VOID **)&PciIo
+ );
if (!EFI_ERROR (Status)) {
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class);
if (!EFI_ERROR (Status)) {
if ((PCI_CLASS_SERIAL == Class[2]) &&
- (PCI_CLASS_SERIAL_USB == Class[1])) {
+ (PCI_CLASS_SERIAL_USB == Class[1]))
+ {
Status = gBS->ConnectController (
- HandleArray[Index],
- NULL,
- Instance,
- FALSE
- );
- if (!EFI_ERROR(Status)) {
+ HandleArray[Index],
+ NULL,
+ Instance,
+ FALSE
+ );
+ if (!EFI_ERROR (Status)) {
AtLeastOneConnected = TRUE;
}
}
@@ -316,12 +323,12 @@ ShellConnectFromDevPaths ( AtLeastOneConnected = TRUE;
}
}
- FreePool (Instance);
+ FreePool (Instance);
} while (CopyOfDevPath != NULL);
if (DevPath != NULL) {
- FreePool(DevPath);
+ FreePool (DevPath);
}
if (AtLeastOneConnected) {
@@ -329,7 +336,6 @@ ShellConnectFromDevPaths ( } else {
return EFI_NOT_FOUND;
}
-
}
/**
@@ -355,16 +361,17 @@ ConvertAndConnectControllers ( //
// if only one is NULL verify it's the proper one...
//
- if ( (Handle1 == NULL && Handle2 != NULL)
- || (Handle1 != NULL && Handle2 == NULL)
- ){
+ if ( ((Handle1 == NULL) && (Handle2 != NULL))
+ || ((Handle1 != NULL) && (Handle2 == NULL))
+ )
+ {
//
// Figure out which one should be NULL and move the handle to the right place.
// If Handle1 is NULL then test Handle2 and vise versa.
// The one that DOES has driver binding must be Handle2
//
if (Handle1 == NULL) {
- if (EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+ if (EFI_ERROR (gBS->OpenProtocol (Handle2, &gEfiDriverBindingProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
// swap
Handle1 = Handle2;
Handle2 = NULL;
@@ -372,7 +379,7 @@ ConvertAndConnectControllers ( // We're all good...
}
} else {
- if (EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiDriverBindingProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+ if (EFI_ERROR (gBS->OpenProtocol (Handle1, &gEfiDriverBindingProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
// We're all good...
} else {
// swap
@@ -382,14 +389,14 @@ ConvertAndConnectControllers ( }
}
- return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
+ return (ConnectControllers (Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-c", TypeFlag},
- {L"-r", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-c", TypeFlag },
+ { L"-r", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'connect' command.
@@ -404,101 +411,107 @@ ShellCommandRunConnect ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Param1;
- CONST CHAR16 *Param2;
- UINTN Count;
- EFI_HANDLE Handle1;
- EFI_HANDLE Handle2;
- UINT64 Intermediate;
-
- ShellStatus = SHELL_SUCCESS;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Param1;
+ CONST CHAR16 *Param2;
+ UINTN Count;
+ EFI_HANDLE Handle1;
+ EFI_HANDLE Handle2;
+ UINT64 Intermediate;
+
+ ShellStatus = SHELL_SUCCESS;
//
// 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), gShellDriver1HiiHandle, L"connect", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"connect", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// if more than 2 'value' parameters (plus the name one) or either -r or -c with any value parameters we have too many parameters
//
- Count = (gInReconnect?0x4:0x3);
- if ((ShellCommandLineGetCount(Package) > Count)
- ||(ShellCommandLineGetFlag(Package, L"-c") && ShellCommandLineGetCount(Package)>1)
- ||(ShellCommandLineGetFlag(Package, L"-r") && ShellCommandLineGetCount(Package)>2)
- ||(ShellCommandLineGetFlag(Package, L"-r") && ShellCommandLineGetFlag(Package, L"-c") )
- ){
+ Count = (gInReconnect ? 0x4 : 0x3);
+ if ( (ShellCommandLineGetCount (Package) > Count)
+ || (ShellCommandLineGetFlag (Package, L"-c") && (ShellCommandLineGetCount (Package) > 1))
+ || (ShellCommandLineGetFlag (Package, L"-r") && (ShellCommandLineGetCount (Package) > 2))
+ || (ShellCommandLineGetFlag (Package, L"-r") && ShellCommandLineGetFlag (Package, L"-c"))
+ )
+ {
//
// error for too many parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"connect");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"connect");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetFlag(Package, L"-c")) {
+ } else if (ShellCommandLineGetFlag (Package, L"-c")) {
//
// do the conin and conout from EFI variables
// if the first fails dont 'loose' the error
//
- Status = ShellConnectFromDevPaths(L"ConInDev");
- if (EFI_ERROR(Status)) {
- ShellConnectFromDevPaths(L"ConOutDev");
+ Status = ShellConnectFromDevPaths (L"ConInDev");
+ if (EFI_ERROR (Status)) {
+ ShellConnectFromDevPaths (L"ConOutDev");
} else {
- Status = ShellConnectFromDevPaths(L"ConOutDev");
+ Status = ShellConnectFromDevPaths (L"ConOutDev");
}
- if (EFI_ERROR(Status)) {
- ShellConnectFromDevPaths(L"ErrOutDev");
+
+ if (EFI_ERROR (Status)) {
+ ShellConnectFromDevPaths (L"ErrOutDev");
} else {
- Status = ShellConnectFromDevPaths(L"ErrOutDev");
+ Status = ShellConnectFromDevPaths (L"ErrOutDev");
}
- if (EFI_ERROR(Status)) {
- ShellConnectFromDevPaths(L"ErrOut");
+
+ if (EFI_ERROR (Status)) {
+ ShellConnectFromDevPaths (L"ErrOut");
} else {
- Status = ShellConnectFromDevPaths(L"ErrOut");
+ Status = ShellConnectFromDevPaths (L"ErrOut");
}
- if (EFI_ERROR(Status)) {
- ShellConnectFromDevPaths(L"ConIn");
+
+ if (EFI_ERROR (Status)) {
+ ShellConnectFromDevPaths (L"ConIn");
} else {
- Status = ShellConnectFromDevPaths(L"ConIn");
+ Status = ShellConnectFromDevPaths (L"ConIn");
}
- if (EFI_ERROR(Status)) {
- ShellConnectFromDevPaths(L"ConOut");
+
+ if (EFI_ERROR (Status)) {
+ ShellConnectFromDevPaths (L"ConOut");
} else {
- Status = ShellConnectFromDevPaths(L"ConOut");
+ Status = ShellConnectFromDevPaths (L"ConOut");
}
- if (EFI_ERROR(Status)) {
+
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_DEVICE_ERROR;
}
} else {
//
// 0, 1, or 2 specific handles and possibly recursive
//
- Param1 = ShellCommandLineGetRawValue(Package, 1);
- Param2 = ShellCommandLineGetRawValue(Package, 2);
- Count = ShellCommandLineGetCount(Package);
+ Param1 = ShellCommandLineGetRawValue (Package, 1);
+ Param2 = ShellCommandLineGetRawValue (Package, 2);
+ Count = ShellCommandLineGetCount (Package);
if (Param1 != NULL) {
- Status = ShellConvertStringToUint64(Param1, &Intermediate, TRUE, FALSE);
- Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
+ Status = ShellConvertStringToUint64 (Param1, &Intermediate, TRUE, FALSE);
+ Handle1 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else {
@@ -506,10 +519,10 @@ ShellCommandRunConnect ( }
if (Param2 != NULL) {
- Status = ShellConvertStringToUint64(Param2, &Intermediate, TRUE, FALSE);
- Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
+ Status = ShellConvertStringToUint64 (Param2, &Intermediate, TRUE, FALSE);
+ Handle2 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else {
@@ -517,19 +530,19 @@ ShellCommandRunConnect ( }
if (ShellStatus == SHELL_SUCCESS) {
- if (Param1 != NULL && Handle1 == NULL){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
+ if ((Param1 != NULL) && (Handle1 == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (Param2 != NULL && Handle2 == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
+ } else if ((Param2 != NULL) && (Handle2 == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (Handle2 != NULL && Handle1 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
+ } else if ((Handle2 != NULL) && (Handle1 != NULL) && EFI_ERROR (gBS->OpenProtocol (Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param2);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CONNECT_NONE), gShellDriver1HiiHandle);
+ Status = ConvertAndConnectControllers (Handle1, Handle2, ShellCommandLineGetFlag (Package, L"-r"), (BOOLEAN)(Count != 0));
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CONNECT_NONE), gShellDriver1HiiHandle);
ShellStatus = SHELL_DEVICE_ERROR;
}
}
@@ -538,6 +551,6 @@ ShellCommandRunConnect ( ShellCommandLineFreeVarList (Package);
}
+
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c index 0e6683449c..ddf063713c 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c @@ -9,11 +9,11 @@ #include "UefiShellDriver1CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-d", TypeFlag},
- {L"-l", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-d", TypeFlag },
+ { L"-l", TypeValue },
+ { NULL, TypeMax }
+};
/**
Display a tree starting from this handle.
@@ -28,32 +28,32 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { @retval SHELL_SUCCESS The operation was successful.
**/
SHELL_STATUS
-DoDevTreeForHandle(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST CHAR8 *Lang OPTIONAL,
- IN CONST BOOLEAN UseDevPaths,
- IN CONST UINTN IndentCharCount,
- IN CONST CHAR16 *HiiString
+DoDevTreeForHandle (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST CHAR8 *Lang OPTIONAL,
+ IN CONST BOOLEAN UseDevPaths,
+ IN CONST UINTN IndentCharCount,
+ IN CONST CHAR16 *HiiString
)
{
- SHELL_STATUS ShellStatus;
- EFI_STATUS Status;
- CHAR16 *FormatString;
- CHAR16 *Name;
- EFI_HANDLE *ChildHandleBuffer;
- UINTN ChildCount;
- UINTN LoopVar;
-
- Status = EFI_SUCCESS;
- ShellStatus = SHELL_SUCCESS;
- Name = NULL;
- ChildHandleBuffer = NULL;
- ChildCount = 0;
+ SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+ CHAR16 *FormatString;
+ CHAR16 *Name;
+ EFI_HANDLE *ChildHandleBuffer;
+ UINTN ChildCount;
+ UINTN LoopVar;
+
+ Status = EFI_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
+ Name = NULL;
+ ChildHandleBuffer = NULL;
+ ChildCount = 0;
ASSERT (TheHandle != NULL);
ASSERT (HiiString != NULL);
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
ShellStatus = SHELL_ABORTED;
return ShellStatus;
}
@@ -62,30 +62,30 @@ DoDevTreeForHandle( // We want controller handles. they will not have LoadedImage or DriverBinding (or others...)
//
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiDriverBindingProtocolGuid,
- NULL,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
+ TheHandle,
+ &gEfiDriverBindingProtocolGuid,
+ NULL,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
return SHELL_SUCCESS;
}
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiLoadedImageProtocolGuid,
- NULL,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
+ TheHandle,
+ &gEfiLoadedImageProtocolGuid,
+ NULL,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
return SHELL_SUCCESS;
}
- FormatString = AllocateZeroPool(StrSize(HiiString) + (10)*sizeof(FormatString[0]));
+ FormatString = AllocateZeroPool (StrSize (HiiString) + (10)*sizeof (FormatString[0]));
if (FormatString == NULL) {
return SHELL_OUT_OF_RESOURCES;
}
@@ -96,37 +96,38 @@ DoDevTreeForHandle( // handles the indenting.
//
- UnicodeSPrint(FormatString, StrSize(HiiString) + (10)*sizeof(FormatString[0]), L"%%%ds %s", IndentCharCount, HiiString);
- gEfiShellProtocol->GetDeviceName((EFI_HANDLE)TheHandle, !UseDevPaths?EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH:EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Lang, &Name);
+ UnicodeSPrint (FormatString, StrSize (HiiString) + (10)*sizeof (FormatString[0]), L"%%%ds %s", IndentCharCount, HiiString);
+ gEfiShellProtocol->GetDeviceName ((EFI_HANDLE)TheHandle, !UseDevPaths ? EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH : EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Lang, &Name);
//
// print out the information for ourselves
//
- ShellPrintEx(
+ ShellPrintEx (
-1,
-1,
FormatString,
L"",
- ConvertHandleToHandleIndex(TheHandle),
- Name==NULL?L"Unknown":Name);
+ ConvertHandleToHandleIndex (TheHandle),
+ Name == NULL ? L"Unknown" : Name
+ );
- FreePool(FormatString);
+ FreePool (FormatString);
if (Name != NULL) {
- FreePool(Name);
+ FreePool (Name);
}
//
// recurse on each child handle with IndentCharCount + 2
//
- ParseHandleDatabaseForChildControllers(TheHandle, &ChildCount, &ChildHandleBuffer);
- for (LoopVar = 0 ; LoopVar < ChildCount && ShellStatus == SHELL_SUCCESS; LoopVar++){
- ShellStatus = DoDevTreeForHandle(ChildHandleBuffer[LoopVar], Lang, UseDevPaths, IndentCharCount+2, HiiString);
+ ParseHandleDatabaseForChildControllers (TheHandle, &ChildCount, &ChildHandleBuffer);
+ for (LoopVar = 0; LoopVar < ChildCount && ShellStatus == SHELL_SUCCESS; LoopVar++) {
+ ShellStatus = DoDevTreeForHandle (ChildHandleBuffer[LoopVar], Lang, UseDevPaths, IndentCharCount+2, HiiString);
if (ShellStatus == SHELL_ABORTED) {
break;
}
}
if (ChildHandleBuffer != NULL) {
- FreePool(ChildHandleBuffer);
+ FreePool (ChildHandleBuffer);
}
return (ShellStatus);
@@ -145,74 +146,76 @@ ShellCommandRunDevTree ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CHAR8 *Language;
- CONST CHAR16 *Lang;
- CHAR16 *HiiString;
- UINTN LoopVar;
- EFI_HANDLE TheHandle;
- BOOLEAN FlagD;
- UINT64 Intermediate;
- UINTN ParentControllerHandleCount;
- EFI_HANDLE *ParentControllerHandleBuffer;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- Language = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CHAR8 *Language;
+ CONST CHAR16 *Lang;
+ CHAR16 *HiiString;
+ UINTN LoopVar;
+ EFI_HANDLE TheHandle;
+ BOOLEAN FlagD;
+ UINT64 Intermediate;
+ UINTN ParentControllerHandleCount;
+ EFI_HANDLE *ParentControllerHandleBuffer;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ Language = NULL;
//
// 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), gShellDriver1HiiHandle, L"devtree", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"devtree", 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), gShellDriver1HiiHandle, L"devtree");
+ if (ShellCommandLineGetCount (Package) > 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"devtree");
ShellCommandLineFreeVarList (Package);
return (SHELL_INVALID_PARAMETER);
}
- Lang = ShellCommandLineGetValue(Package, L"-l");
+
+ Lang = ShellCommandLineGetValue (Package, L"-l");
if (Lang != NULL) {
- Language = AllocateZeroPool(StrSize(Lang));
- AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
- } else if (!ShellCommandLineGetFlag(Package, L"-l")){
- ASSERT(Language == NULL);
-// Language = AllocateZeroPool(10);
-// AsciiSPrint(Language, 10, "en-us");
+ Language = AllocateZeroPool (StrSize (Lang));
+ AsciiSPrint (Language, StrSize (Lang), "%S", Lang);
+ } else if (!ShellCommandLineGetFlag (Package, L"-l")) {
+ ASSERT (Language == NULL);
+ // Language = AllocateZeroPool(10);
+ // AsciiSPrint(Language, 10, "en-us");
} else {
- ASSERT(Language == NULL);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devtree", L"-l");
+ ASSERT (Language == NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devtree", L"-l");
ShellCommandLineFreeVarList (Package);
return (SHELL_INVALID_PARAMETER);
}
- FlagD = ShellCommandLineGetFlag(Package, L"-d");
- Lang = ShellCommandLineGetRawValue(Package, 1);
- HiiString = HiiGetString(gShellDriver1HiiHandle, STRING_TOKEN (STR_DEV_TREE_OUTPUT), Language);
+ FlagD = ShellCommandLineGetFlag (Package, L"-d");
+
+ Lang = ShellCommandLineGetRawValue (Package, 1);
+ HiiString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DEV_TREE_OUTPUT), Language);
if (Lang == NULL) {
- for (LoopVar = 1 ; ; LoopVar++){
- TheHandle = ConvertHandleIndexToHandle(LoopVar);
- if (TheHandle == NULL){
+ for (LoopVar = 1; ; LoopVar++) {
+ TheHandle = ConvertHandleIndexToHandle (LoopVar);
+ if (TheHandle == NULL) {
break;
}
@@ -220,13 +223,13 @@ ShellCommandRunDevTree ( // Skip handles that do not have device path protocol
//
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiDevicePathProtocolGuid,
- NULL,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
+ TheHandle,
+ &gEfiDevicePathProtocolGuid,
+ NULL,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
continue;
}
@@ -235,11 +238,11 @@ ShellCommandRunDevTree ( // Skip handles that do have parents
//
ParentControllerHandleBuffer = NULL;
- Status = PARSE_HANDLE_DATABASE_PARENTS (
- TheHandle,
- &ParentControllerHandleCount,
- &ParentControllerHandleBuffer
- );
+ Status = PARSE_HANDLE_DATABASE_PARENTS (
+ TheHandle,
+ &ParentControllerHandleCount,
+ &ParentControllerHandleBuffer
+ );
SHELL_FREE_NON_NULL (ParentControllerHandleBuffer);
if (ParentControllerHandleCount > 0) {
continue;
@@ -248,22 +251,23 @@ ShellCommandRunDevTree ( //
// Start a devtree from TheHandle that has a device path and no parents
//
- ShellStatus = DoDevTreeForHandle(TheHandle, Language, FlagD, 0, HiiString);
+ ShellStatus = DoDevTreeForHandle (TheHandle, Language, FlagD, 0, HiiString);
}
} else {
- Status = ShellConvertStringToUint64(Lang, &Intermediate, TRUE, FALSE);
- if (EFI_ERROR(Status) || ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"devtree", Lang);
+ Status = ShellConvertStringToUint64 (Lang, &Intermediate, TRUE, FALSE);
+ if (EFI_ERROR (Status) || (ConvertHandleIndexToHandle ((UINTN)Intermediate) == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"devtree", Lang);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ShellStatus = DoDevTreeForHandle(ConvertHandleIndexToHandle((UINTN)Intermediate), Language, FlagD, 0, HiiString);
+ ShellStatus = DoDevTreeForHandle (ConvertHandleIndexToHandle ((UINTN)Intermediate), Language, FlagD, 0, HiiString);
}
}
if (HiiString != NULL) {
- FreePool(HiiString);
+ FreePool (HiiString);
}
- SHELL_FREE_NON_NULL(Language);
+
+ SHELL_FREE_NON_NULL (Language);
ShellCommandLineFreeVarList (Package);
}
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c index c49c44a8a8..e175cad192 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c @@ -48,70 +48,75 @@ GetDeviceHandleInfo ( IN CONST CHAR8 *Language
)
{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN Count;
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Count;
- if (TheHandle == NULL
- || Type == NULL
- || Cfg == NULL
- || Diag == NULL
- || Parents == NULL
- || Devices == NULL
- || Children == NULL
- || Name == NULL ) {
+ if ( (TheHandle == NULL)
+ || (Type == NULL)
+ || (Cfg == NULL)
+ || (Diag == NULL)
+ || (Parents == NULL)
+ || (Devices == NULL)
+ || (Children == NULL)
+ || (Name == NULL))
+ {
return (EFI_INVALID_PARAMETER);
}
- *Cfg = FALSE;
- *Diag = FALSE;
- *Children = 0;
- *Parents = 0;
- *Devices = 0;
- *Type = L' ';
- *Name = CHAR_NULL;
- HandleBuffer = NULL;
- Status = EFI_SUCCESS;
+ *Cfg = FALSE;
+ *Diag = FALSE;
+ *Children = 0;
+ *Parents = 0;
+ *Devices = 0;
+ *Type = L' ';
+ *Name = CHAR_NULL;
+ HandleBuffer = NULL;
+ Status = EFI_SUCCESS;
- gEfiShellProtocol->GetDeviceName(TheHandle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, Name);
+ gEfiShellProtocol->GetDeviceName (TheHandle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, Name);
- Status = ParseHandleDatabaseForChildControllers(TheHandle, Children, NULL);
-// if (!EFI_ERROR(Status)) {
- Status = PARSE_HANDLE_DATABASE_PARENTS(TheHandle, Parents, NULL);
- if (/*!EFI_ERROR(Status) && */Parents != NULL && Children != NULL) {
- if (*Parents == 0) {
- *Type = L'R';
- } else if (*Children > 0) {
- *Type = L'B';
- } else {
- *Type = L'D';
- }
+ Status = ParseHandleDatabaseForChildControllers (TheHandle, Children, NULL);
+ // if (!EFI_ERROR(Status)) {
+ Status = PARSE_HANDLE_DATABASE_PARENTS (TheHandle, Parents, NULL);
+ if (/*!EFI_ERROR(Status) && */ (Parents != NULL) && (Children != NULL)) {
+ if (*Parents == 0) {
+ *Type = L'R';
+ } else if (*Children > 0) {
+ *Type = L'B';
+ } else {
+ *Type = L'D';
}
-// }
- Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS(TheHandle, Devices, &HandleBuffer);
- if (!EFI_ERROR(Status) && Devices != NULL && HandleBuffer != NULL) {
- for (Count = 0 ; Count < *Devices ; Count++) {
- if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+ }
+
+ // }
+ Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (TheHandle, Devices, &HandleBuffer);
+ if (!EFI_ERROR (Status) && (Devices != NULL) && (HandleBuffer != NULL)) {
+ for (Count = 0; Count < *Devices; Count++) {
+ if (!EFI_ERROR (gBS->OpenProtocol (HandleBuffer[Count], &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
*Cfg = TRUE;
}
- if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+
+ if (!EFI_ERROR (gBS->OpenProtocol (HandleBuffer[Count], &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
*Diag = TRUE;
}
- if (!EFI_ERROR(gBS->OpenProtocol(HandleBuffer[Count], &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+
+ if (!EFI_ERROR (gBS->OpenProtocol (HandleBuffer[Count], &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
*Diag = TRUE;
}
}
- SHELL_FREE_NON_NULL(HandleBuffer);
+
+ SHELL_FREE_NON_NULL (HandleBuffer);
}
return (Status);
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-sfo", TypeFlag},
- {L"-l", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-sfo", TypeFlag },
+ { L"-l", TypeValue },
+ { NULL, TypeMax }
+};
/**
Function for 'devices' command.
@@ -126,78 +131,77 @@ ShellCommandRunDevices ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CHAR8 *Language;
- EFI_HANDLE *HandleList;
- EFI_HANDLE *HandleListWalker;
- CHAR16 Type;
- BOOLEAN Cfg;
- BOOLEAN Diag;
- UINTN Parents;
- UINTN Devices;
- UINTN Children;
- CHAR16 *Name;
- CONST CHAR16 *Lang;
- BOOLEAN SfoFlag;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CHAR8 *Language;
+ EFI_HANDLE *HandleList;
+ EFI_HANDLE *HandleListWalker;
+ CHAR16 Type;
+ BOOLEAN Cfg;
+ BOOLEAN Diag;
+ UINTN Parents;
+ UINTN Devices;
+ UINTN Children;
+ CHAR16 *Name;
+ CONST CHAR16 *Lang;
+ BOOLEAN SfoFlag;
- ShellStatus = SHELL_SUCCESS;
- Language = NULL;
- SfoFlag = FALSE;
+ ShellStatus = SHELL_SUCCESS;
+ Language = NULL;
+ SfoFlag = FALSE;
//
// 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), gShellDriver1HiiHandle, L"devices", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"devices", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// if more than 0 'value' parameters we have too many parameters
//
- if (ShellCommandLineGetRawValue(Package, 1) != NULL){
+ if (ShellCommandLineGetRawValue (Package, 1) != NULL) {
//
// error for too many parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"devices");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"devices");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// get the language if necessary
//
- Lang = ShellCommandLineGetValue(Package, L"-l");
+ Lang = ShellCommandLineGetValue (Package, L"-l");
if (Lang != NULL) {
- Language = AllocateZeroPool(StrSize(Lang));
- AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
- } else if (!ShellCommandLineGetFlag(Package, L"-l")){
- ASSERT(Language == NULL);
-// Language = AllocateZeroPool(10);
-// AsciiSPrint(Language, 10, "en-us");
+ Language = AllocateZeroPool (StrSize (Lang));
+ AsciiSPrint (Language, StrSize (Lang), "%S", Lang);
+ } else if (!ShellCommandLineGetFlag (Package, L"-l")) {
+ ASSERT (Language == NULL);
+ // Language = AllocateZeroPool(10);
+ // AsciiSPrint(Language, 10, "en-us");
} else {
- ASSERT(Language == NULL);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devices", L"-l");
+ ASSERT (Language == NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devices", L"-l");
ShellCommandLineFreeVarList (Package);
return (SHELL_INVALID_PARAMETER);
}
-
//
// Print Header
@@ -212,52 +216,54 @@ ShellCommandRunDevices ( //
// loop through each handle
//
- HandleList = GetHandleListByProtocol(NULL);
- ASSERT(HandleList != NULL);
+ HandleList = GetHandleListByProtocol (NULL);
+ ASSERT (HandleList != NULL);
for (HandleListWalker = HandleList
- ; HandleListWalker != NULL && *HandleListWalker != NULL /*&& !EFI_ERROR(Status)*/
- ; HandleListWalker++
- ){
-
+ ; HandleListWalker != NULL && *HandleListWalker != NULL /*&& !EFI_ERROR(Status)*/
+ ; HandleListWalker++
+ )
+ {
//
// get all the info on each handle
//
- Name = NULL;
- Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language);
- if (Name != NULL && (Parents != 0 || Devices != 0 || Children != 0)) {
+ Name = NULL;
+ Status = GetDeviceHandleInfo (*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language);
+ if ((Name != NULL) && ((Parents != 0) || (Devices != 0) || (Children != 0))) {
ShellPrintHiiEx (
-1,
-1,
Language,
- SfoFlag?STRING_TOKEN (STR_DEVICES_ITEM_LINE_SFO):STRING_TOKEN (STR_DEVICES_ITEM_LINE),
+ SfoFlag ? STRING_TOKEN (STR_DEVICES_ITEM_LINE_SFO) : STRING_TOKEN (STR_DEVICES_ITEM_LINE),
gShellDriver1HiiHandle,
ConvertHandleToHandleIndex (*HandleListWalker),
Type,
- Cfg?(SfoFlag?L'Y':L'X'):(SfoFlag?L'N':L'-'),
- Diag?(SfoFlag?L'Y':L'X'):(SfoFlag?L'N':L'-'),
+ Cfg ? (SfoFlag ? L'Y' : L'X') : (SfoFlag ? L'N' : L'-'),
+ Diag ? (SfoFlag ? L'Y' : L'X') : (SfoFlag ? L'N' : L'-'),
Parents,
Devices,
Children,
- Name!=NULL?Name:L"<UNKNOWN>");
+ Name != NULL ? Name : L"<UNKNOWN>"
+ );
}
+
if (Name != NULL) {
- FreePool(Name);
+ FreePool (Name);
}
+
if (ShellGetExecutionBreakFlag ()) {
ShellStatus = SHELL_ABORTED;
break;
}
-
}
if (HandleList != NULL) {
- FreePool(HandleList);
+ FreePool (HandleList);
}
-
}
- SHELL_FREE_NON_NULL(Language);
+
+ SHELL_FREE_NON_NULL (Language);
ShellCommandLineFreeVarList (Package);
}
+
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c index ab6d39c88b..dd9aba50d7 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c @@ -10,17 +10,17 @@ #include "UefiShellDriver1CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-p", TypeValue},
- {L"-d", TypeFlag},
- {L"-v", TypeFlag},
- {L"-verbose", TypeFlag},
- {L"-sfo", TypeFlag},
- {L"-l", TypeValue},
- {NULL, TypeMax}
- };
-
-STATIC CONST EFI_GUID *UefiDriverModelProtocolsGuidArray[] = {
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-p", TypeValue },
+ { L"-d", TypeFlag },
+ { L"-v", TypeFlag },
+ { L"-verbose", TypeFlag },
+ { L"-sfo", TypeFlag },
+ { L"-l", TypeValue },
+ { NULL, TypeMax }
+};
+
+STATIC CONST EFI_GUID *UefiDriverModelProtocolsGuidArray[] = {
&gEfiDriverBindingProtocolGuid,
&gEfiPlatformDriverOverrideProtocolGuid,
&gEfiBusSpecificDriverOverrideProtocolGuid,
@@ -36,7 +36,8 @@ STATIC CONST EFI_GUID *UefiDriverModelProtocolsGuidArray[] = { NULL
};
-UINTN mGuidDataLen[] = {8, 4, 4, 4, 12};
+UINTN mGuidDataLen[] = { 8, 4, 4, 4, 12 };
+
/**
Function to determine if the string can convert to a GUID.
The string must be restricted as "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" format.
@@ -47,8 +48,8 @@ UINTN mGuidDataLen[] = {8, 4, 4, 4, 12}; @retval FALSE The string can't convert to a GUID.
**/
BOOLEAN
-IsValidGuidString(
- IN CONST CHAR16 *String
+IsValidGuidString (
+ IN CONST CHAR16 *String
)
{
CONST CHAR16 *Walker;
@@ -59,18 +60,19 @@ IsValidGuidString( return FALSE;
}
- Walker = String;
- PrevWalker = String;
- Index = 0;
+ Walker = String;
+ PrevWalker = String;
+ Index = 0;
while (Walker != NULL && *Walker != CHAR_NULL) {
- if ( (*Walker >= '0' && *Walker <= '9') ||
- (*Walker >= 'a' && *Walker <= 'f') ||
- (*Walker >= 'A' && *Walker <= 'F')
- ) {
+ if (((*Walker >= '0') && (*Walker <= '9')) ||
+ ((*Walker >= 'a') && (*Walker <= 'f')) ||
+ ((*Walker >= 'A') && (*Walker <= 'F'))
+ )
+ {
Walker++;
} else {
- if (*Walker == L'-' && (((UINTN)Walker - (UINTN)PrevWalker) / sizeof (CHAR16)) == mGuidDataLen[Index]) {
+ if ((*Walker == L'-') && ((((UINTN)Walker - (UINTN)PrevWalker) / sizeof (CHAR16)) == mGuidDataLen[Index])) {
Walker++;
PrevWalker = Walker;
Index++;
@@ -100,13 +102,13 @@ IsValidGuidString( @retval The numerical value converted.
**/
UINTN
-HexCharToDecimal(
- IN CHAR16 Char
+HexCharToDecimal (
+ IN CHAR16 Char
)
{
- if (Char >= '0' && Char <= '9') {
+ if ((Char >= '0') && (Char <= '9')) {
return Char - L'0';
- } else if (Char >= 'a' && Char <= 'f') {
+ } else if ((Char >= 'a') && (Char <= 'f')) {
return Char - L'a' + 10;
} else {
return Char - L'A' + 10;
@@ -123,28 +125,28 @@ HexCharToDecimal( @retval EFI_UNSUPPORTED The input string is not in registry format.
**/
EFI_STATUS
-ConvertStrToGuid(
- IN CONST CHAR16 *String,
- OUT GUID *Guid
+ConvertStrToGuid (
+ IN CONST CHAR16 *String,
+ OUT GUID *Guid
)
{
CONST CHAR16 *Walker;
UINT8 TempValue;
UINTN Index;
- if (String == NULL || !IsValidGuidString (String)) {
+ if ((String == NULL) || !IsValidGuidString (String)) {
return EFI_UNSUPPORTED;
}
Index = 0;
- Walker = String;
+ Walker = String;
Guid->Data1 = (UINT32)StrHexToUint64 (Walker);
- Walker += 9;
+ Walker += 9;
Guid->Data2 = (UINT16)StrHexToUint64 (Walker);
- Walker += 5;
+ Walker += 5;
Guid->Data3 = (UINT16)StrHexToUint64 (Walker);
Walker += 5;
@@ -185,41 +187,46 @@ GetDriverName ( IN CHAR16 **NameFound
)
{
- CHAR8 *Lang;
- EFI_STATUS Status;
- EFI_COMPONENT_NAME2_PROTOCOL *CompName2;
- CHAR16 *NameToReturn;
+ CHAR8 *Lang;
+ EFI_STATUS Status;
+ EFI_COMPONENT_NAME2_PROTOCOL *CompName2;
+ CHAR16 *NameToReturn;
+
//
// Go through those handles until we get one that passes for GetComponentName
//
- Status = gBS->OpenProtocol(
- TheHandle,
- &gEfiComponentName2ProtocolGuid,
- (VOID**)&CompName2,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (EFI_ERROR(Status)) {
- Status = gBS->OpenProtocol(
- TheHandle,
- &gEfiComponentNameProtocolGuid,
- (VOID**)&CompName2,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiComponentName2ProtocolGuid,
+ (VOID **)&CompName2,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiComponentNameProtocolGuid,
+ (VOID **)&CompName2,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
}
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return (EFI_NOT_FOUND);
}
- Lang = GetBestLanguageForDriver (CompName2->SupportedLanguages, Language, FALSE);
- Status = CompName2->GetDriverName(CompName2, Lang, &NameToReturn);
- FreePool(Lang);
- if (!EFI_ERROR(Status) && NameToReturn != NULL) {
+ Lang = GetBestLanguageForDriver (CompName2->SupportedLanguages, Language, FALSE);
+ Status = CompName2->GetDriverName (CompName2, Lang, &NameToReturn);
+ FreePool (Lang);
+
+ if (!EFI_ERROR (Status) && (NameToReturn != NULL)) {
*NameFound = NULL;
- StrnCatGrow(NameFound, NULL, NameToReturn, 0);
+ StrnCatGrow (NameFound, NULL, NameToReturn, 0);
}
+
return (Status);
}
@@ -233,21 +240,24 @@ GetDriverName ( **/
BOOLEAN
IsDriverProt (
- IN CONST EFI_GUID *Guid
+ IN CONST EFI_GUID *Guid
)
{
- CONST EFI_GUID **GuidWalker;
- BOOLEAN GuidFound;
+ CONST EFI_GUID **GuidWalker;
+ BOOLEAN GuidFound;
+
GuidFound = FALSE;
for (GuidWalker = UefiDriverModelProtocolsGuidArray
- ; GuidWalker != NULL && *GuidWalker != NULL
- ; GuidWalker++
- ){
- if (CompareGuid(*GuidWalker, Guid)) {
+ ; GuidWalker != NULL && *GuidWalker != NULL
+ ; GuidWalker++
+ )
+ {
+ if (CompareGuid (*GuidWalker, Guid)) {
GuidFound = TRUE;
break;
}
}
+
return (GuidFound);
}
@@ -263,53 +273,55 @@ IsDriverProt ( @retval SHELL_SUCCESS The operation was successful.
@retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
**/
-CHAR16*
-GetProtocolInfoString(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST CHAR8 *Language,
- IN CONST CHAR16 *Separator,
- IN CONST BOOLEAN Verbose,
- IN CONST BOOLEAN ExtraInfo
+CHAR16 *
+GetProtocolInfoString (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST CHAR8 *Language,
+ IN CONST CHAR16 *Separator,
+ IN CONST BOOLEAN Verbose,
+ IN CONST BOOLEAN ExtraInfo
)
{
- EFI_GUID **ProtocolGuidArray;
- UINTN ArrayCount;
- UINTN ProtocolIndex;
- EFI_STATUS Status;
- CHAR16 *RetVal;
- UINTN Size;
- CHAR16 *Temp;
- CHAR16 GuidStr[40];
- VOID *Instance;
- CHAR16 InstanceStr[17];
+ EFI_GUID **ProtocolGuidArray;
+ UINTN ArrayCount;
+ UINTN ProtocolIndex;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
+ UINTN Size;
+ CHAR16 *Temp;
+ CHAR16 GuidStr[40];
+ VOID *Instance;
+ CHAR16 InstanceStr[17];
ProtocolGuidArray = NULL;
RetVal = NULL;
Size = 0;
Status = gBS->ProtocolsPerHandle (
- TheHandle,
- &ProtocolGuidArray,
- &ArrayCount
- );
+ TheHandle,
+ &ProtocolGuidArray,
+ &ArrayCount
+ );
if (!EFI_ERROR (Status)) {
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
- Temp = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], Language);
- ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
+ Temp = GetStringNameFromGuid (ProtocolGuidArray[ProtocolIndex], Language);
+ ASSERT ((RetVal == NULL && Size == 0) || (RetVal != NULL));
if (Size != 0) {
- StrnCatGrow(&RetVal, &Size, Separator, 0);
+ StrnCatGrow (&RetVal, &Size, Separator, 0);
}
- StrnCatGrow(&RetVal, &Size, L"%H", 0);
+
+ StrnCatGrow (&RetVal, &Size, L"%H", 0);
if (Temp == NULL) {
UnicodeSPrint (GuidStr, sizeof (GuidStr), L"%g", ProtocolGuidArray[ProtocolIndex]);
StrnCatGrow (&RetVal, &Size, GuidStr, 0);
} else {
- StrnCatGrow(&RetVal, &Size, Temp, 0);
- FreePool(Temp);
+ StrnCatGrow (&RetVal, &Size, Temp, 0);
+ FreePool (Temp);
}
- StrnCatGrow(&RetVal, &Size, L"%N", 0);
- if(Verbose) {
+ StrnCatGrow (&RetVal, &Size, L"%N", 0);
+
+ if (Verbose) {
Status = gBS->HandleProtocol (TheHandle, ProtocolGuidArray[ProtocolIndex], &Instance);
if (!EFI_ERROR (Status)) {
StrnCatGrow (&RetVal, &Size, L"(%H", 0);
@@ -320,31 +332,32 @@ GetProtocolInfoString( }
if (ExtraInfo) {
- Temp = GetProtocolInformationDump(TheHandle, ProtocolGuidArray[ProtocolIndex], Verbose);
+ Temp = GetProtocolInformationDump (TheHandle, ProtocolGuidArray[ProtocolIndex], Verbose);
if (Temp != NULL) {
- ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
+ ASSERT ((RetVal == NULL && Size == 0) || (RetVal != NULL));
if (!Verbose) {
- StrnCatGrow(&RetVal, &Size, L"(", 0);
- StrnCatGrow(&RetVal, &Size, Temp, 0);
- StrnCatGrow(&RetVal, &Size, L")", 0);
+ StrnCatGrow (&RetVal, &Size, L"(", 0);
+ StrnCatGrow (&RetVal, &Size, Temp, 0);
+ StrnCatGrow (&RetVal, &Size, L")", 0);
} else {
- StrnCatGrow(&RetVal, &Size, Separator, 0);
- StrnCatGrow(&RetVal, &Size, Temp, 0);
+ StrnCatGrow (&RetVal, &Size, Separator, 0);
+ StrnCatGrow (&RetVal, &Size, Temp, 0);
}
- FreePool(Temp);
+
+ FreePool (Temp);
}
}
}
}
- SHELL_FREE_NON_NULL(ProtocolGuidArray);
+ SHELL_FREE_NON_NULL (ProtocolGuidArray);
if (RetVal == NULL) {
return (NULL);
}
- ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));
- StrnCatGrow(&RetVal, &Size, Separator, 0);
+ ASSERT ((RetVal == NULL && Size == 0) || (RetVal != NULL));
+ StrnCatGrow (&RetVal, &Size, Separator, 0);
return (RetVal);
}
@@ -358,32 +371,33 @@ GetProtocolInfoString( **/
EFI_STATUS
GetDriverImageName (
- IN EFI_HANDLE TheHandle,
- OUT CHAR16 **Name
+ IN EFI_HANDLE TheHandle,
+ OUT CHAR16 **Name
)
{
// get loaded image and devicepathtotext on image->Filepath
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- if (TheHandle == NULL || Name == NULL) {
+ if ((TheHandle == NULL) || (Name == NULL)) {
return (EFI_INVALID_PARAMETER);
}
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **) &LoadedImage,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR(Status)) {
+ TheHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
return (Status);
}
+
DevicePath = LoadedImage->FilePath;
- *Name = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
+ *Name = ConvertDevicePathToText (DevicePath, TRUE, TRUE);
return (EFI_SUCCESS);
}
@@ -396,31 +410,31 @@ GetDriverImageName ( **/
EFI_STATUS
DisplayDriverModelHandle (
- IN EFI_HANDLE Handle,
- IN BOOLEAN BestName,
- IN CONST CHAR8 *Language OPTIONAL
+ IN EFI_HANDLE Handle,
+ IN BOOLEAN BestName,
+ IN CONST CHAR8 *Language OPTIONAL
)
{
- EFI_STATUS Status;
- BOOLEAN ConfigurationStatus;
- BOOLEAN DiagnosticsStatus;
- UINTN DriverBindingHandleCount;
- EFI_HANDLE *DriverBindingHandleBuffer;
- UINTN ParentControllerHandleCount;
- EFI_HANDLE *ParentControllerHandleBuffer;
- UINTN ChildControllerHandleCount;
- EFI_HANDLE *ChildControllerHandleBuffer;
- CHAR16 *TempStringPointer;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINTN Index;
- CHAR16 *DriverName;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- UINTN NumberOfChildren;
- UINTN HandleIndex;
- UINTN ControllerHandleCount;
- EFI_HANDLE *ControllerHandleBuffer;
- UINTN ChildIndex;
- BOOLEAN Image;
+ EFI_STATUS Status;
+ BOOLEAN ConfigurationStatus;
+ BOOLEAN DiagnosticsStatus;
+ UINTN DriverBindingHandleCount;
+ EFI_HANDLE *DriverBindingHandleBuffer;
+ UINTN ParentControllerHandleCount;
+ EFI_HANDLE *ParentControllerHandleBuffer;
+ UINTN ChildControllerHandleCount;
+ EFI_HANDLE *ChildControllerHandleBuffer;
+ CHAR16 *TempStringPointer;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UINTN Index;
+ CHAR16 *DriverName;
+ EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
+ UINTN NumberOfChildren;
+ UINTN HandleIndex;
+ UINTN ControllerHandleCount;
+ EFI_HANDLE *ControllerHandleBuffer;
+ UINTN ChildIndex;
+ BOOLEAN Image;
DriverName = NULL;
@@ -428,73 +442,73 @@ DisplayDriverModelHandle ( // See if Handle is a device handle and display its details.
//
DriverBindingHandleBuffer = NULL;
- Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
- Handle,
- &DriverBindingHandleCount,
- &DriverBindingHandleBuffer
- );
+ Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
+ Handle,
+ &DriverBindingHandleCount,
+ &DriverBindingHandleBuffer
+ );
ParentControllerHandleBuffer = NULL;
- Status = PARSE_HANDLE_DATABASE_PARENTS (
- Handle,
- &ParentControllerHandleCount,
- &ParentControllerHandleBuffer
- );
+ Status = PARSE_HANDLE_DATABASE_PARENTS (
+ Handle,
+ &ParentControllerHandleCount,
+ &ParentControllerHandleBuffer
+ );
ChildControllerHandleBuffer = NULL;
- Status = ParseHandleDatabaseForChildControllers (
- Handle,
- &ChildControllerHandleCount,
- &ChildControllerHandleBuffer
- );
+ Status = ParseHandleDatabaseForChildControllers (
+ Handle,
+ &ChildControllerHandleCount,
+ &ChildControllerHandleBuffer
+ );
- DiagnosticsStatus = FALSE;
+ DiagnosticsStatus = FALSE;
ConfigurationStatus = FALSE;
- if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+ if (!EFI_ERROR (gBS->OpenProtocol (Handle, &gEfiDriverConfigurationProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
ConfigurationStatus = TRUE;
}
- if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverConfiguration2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+
+ if (!EFI_ERROR (gBS->OpenProtocol (Handle, &gEfiDriverConfiguration2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
ConfigurationStatus = TRUE;
}
- if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+
+ if (!EFI_ERROR (gBS->OpenProtocol (Handle, &gEfiDriverDiagnosticsProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
DiagnosticsStatus = TRUE;
}
- if (!EFI_ERROR(gBS->OpenProtocol(Handle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+
+ if (!EFI_ERROR (gBS->OpenProtocol (Handle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, NULL, gImageHandle, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
DiagnosticsStatus = TRUE;
}
Status = EFI_SUCCESS;
- if (DriverBindingHandleCount > 0 || ParentControllerHandleCount > 0 || ChildControllerHandleCount > 0) {
-
-
-
- DevicePath = NULL;
- TempStringPointer = NULL;
- Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID**)&DevicePath);
+ if ((DriverBindingHandleCount > 0) || (ParentControllerHandleCount > 0) || (ChildControllerHandleCount > 0)) {
+ DevicePath = NULL;
+ TempStringPointer = NULL;
+ Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath);
- Status = gEfiShellProtocol->GetDeviceName(Handle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DRIVER1), gShellDriver1HiiHandle, TempStringPointer!=NULL?TempStringPointer:L"<Unknown>");
- SHELL_FREE_NON_NULL(TempStringPointer);
+ Status = gEfiShellProtocol->GetDeviceName (Handle, EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DRIVER1), gShellDriver1HiiHandle, TempStringPointer != NULL ? TempStringPointer : L"<Unknown>");
+ SHELL_FREE_NON_NULL (TempStringPointer);
- TempStringPointer = ConvertDevicePathToText(DevicePath, TRUE, FALSE);
- ShellPrintHiiEx(
+ TempStringPointer = ConvertDevicePathToText (DevicePath, TRUE, FALSE);
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER2),
gShellDriver1HiiHandle,
- TempStringPointer!=NULL?TempStringPointer:L"<None>",
- ParentControllerHandleCount == 0?L"ROOT":(ChildControllerHandleCount > 0)?L"BUS":L"DEVICE",
- ConfigurationStatus?L"YES":L"NO",
- DiagnosticsStatus?L"YES":L"NO"
+ TempStringPointer != NULL ? TempStringPointer : L"<None>",
+ ParentControllerHandleCount == 0 ? L"ROOT" : (ChildControllerHandleCount > 0) ? L"BUS" : L"DEVICE",
+ ConfigurationStatus ? L"YES" : L"NO",
+ DiagnosticsStatus ? L"YES" : L"NO"
);
- SHELL_FREE_NON_NULL(TempStringPointer);
+ SHELL_FREE_NON_NULL (TempStringPointer);
if (DriverBindingHandleCount == 0) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -503,7 +517,7 @@ DisplayDriverModelHandle ( L"<None>"
);
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -512,49 +526,50 @@ DisplayDriverModelHandle ( L""
);
for (Index = 0; Index < DriverBindingHandleCount; Index++) {
- Image = FALSE;
+ Image = FALSE;
Status = GetDriverName (
- DriverBindingHandleBuffer[Index],
- Language,
- &DriverName
- );
+ DriverBindingHandleBuffer[Index],
+ Language,
+ &DriverName
+ );
if (EFI_ERROR (Status)) {
Status = GetDriverImageName (
- DriverBindingHandleBuffer[Index],
- &DriverName
- );
+ DriverBindingHandleBuffer[Index],
+ &DriverName
+ );
if (EFI_ERROR (Status)) {
DriverName = NULL;
}
}
if (Image) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER4A),
gShellDriver1HiiHandle,
ConvertHandleToHandleIndex (DriverBindingHandleBuffer[Index]),
- DriverName!=NULL?DriverName:L"<Unknown>"
+ DriverName != NULL ? DriverName : L"<Unknown>"
);
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER4B),
gShellDriver1HiiHandle,
ConvertHandleToHandleIndex (DriverBindingHandleBuffer[Index]),
- DriverName!=NULL?DriverName:L"<Unknown>"
+ DriverName != NULL ? DriverName : L"<Unknown>"
);
}
- SHELL_FREE_NON_NULL(DriverName);
+
+ SHELL_FREE_NON_NULL (DriverName);
}
}
if (ParentControllerHandleCount == 0) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -563,7 +578,7 @@ DisplayDriverModelHandle ( L"<None>"
);
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -572,22 +587,22 @@ DisplayDriverModelHandle ( L""
);
for (Index = 0; Index < ParentControllerHandleCount; Index++) {
- Status = gEfiShellProtocol->GetDeviceName(ParentControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
- ShellPrintHiiEx(
+ Status = gEfiShellProtocol->GetDeviceName (ParentControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER5B),
gShellDriver1HiiHandle,
ConvertHandleToHandleIndex (ParentControllerHandleBuffer[Index]),
- TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
+ TempStringPointer != NULL ? TempStringPointer : L"<Unknown>"
);
- SHELL_FREE_NON_NULL(TempStringPointer);
+ SHELL_FREE_NON_NULL (TempStringPointer);
}
}
if (ChildControllerHandleCount == 0) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -596,7 +611,7 @@ DisplayDriverModelHandle ( L"<None>"
);
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -605,60 +620,61 @@ DisplayDriverModelHandle ( L""
);
for (Index = 0; Index < ChildControllerHandleCount; Index++) {
- Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
- ShellPrintHiiEx(
+ Status = gEfiShellProtocol->GetDeviceName (ChildControllerHandleBuffer[Index], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6B),
gShellDriver1HiiHandle,
ConvertHandleToHandleIndex (ChildControllerHandleBuffer[Index]),
- TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
+ TempStringPointer != NULL ? TempStringPointer : L"<Unknown>"
);
- SHELL_FREE_NON_NULL(TempStringPointer);
+ SHELL_FREE_NON_NULL (TempStringPointer);
}
}
}
- SHELL_FREE_NON_NULL(DriverBindingHandleBuffer);
+ SHELL_FREE_NON_NULL (DriverBindingHandleBuffer);
- SHELL_FREE_NON_NULL(ParentControllerHandleBuffer);
+ SHELL_FREE_NON_NULL (ParentControllerHandleBuffer);
- SHELL_FREE_NON_NULL(ChildControllerHandleBuffer);
+ SHELL_FREE_NON_NULL (ChildControllerHandleBuffer);
if (EFI_ERROR (Status)) {
return Status;
}
+
//
// See if Handle is a driver binding handle and display its details.
//
Status = gBS->OpenProtocol (
- Handle,
- &gEfiDriverBindingProtocolGuid,
- (VOID **) &DriverBinding,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ Handle,
+ &gEfiDriverBindingProtocolGuid,
+ (VOID **)&DriverBinding,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
return EFI_SUCCESS;
}
- NumberOfChildren = 0;
- ControllerHandleBuffer = NULL;
- Status = PARSE_HANDLE_DATABASE_DEVICES (
- Handle,
- &ControllerHandleCount,
- &ControllerHandleBuffer
- );
+ NumberOfChildren = 0;
+ ControllerHandleBuffer = NULL;
+ Status = PARSE_HANDLE_DATABASE_DEVICES (
+ Handle,
+ &ControllerHandleCount,
+ &ControllerHandleBuffer
+ );
if (ControllerHandleCount > 0) {
for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) {
Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
- Handle,
- ControllerHandleBuffer[HandleIndex],
- &ChildControllerHandleCount,
- NULL
- );
+ Handle,
+ ControllerHandleBuffer[HandleIndex],
+ &ChildControllerHandleCount,
+ NULL
+ );
NumberOfChildren += ChildControllerHandleCount;
}
}
@@ -668,56 +684,57 @@ DisplayDriverModelHandle ( DriverName = NULL;
}
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER7),
gShellDriver1HiiHandle,
- ConvertHandleToHandleIndex(Handle),
- DriverName!=NULL?DriverName:L"<Unknown>"
+ ConvertHandleToHandleIndex (Handle),
+ DriverName != NULL ? DriverName : L"<Unknown>"
);
- SHELL_FREE_NON_NULL(DriverName);
+ SHELL_FREE_NON_NULL (DriverName);
Status = GetDriverImageName (
- Handle,
- &DriverName
- );
+ Handle,
+ &DriverName
+ );
if (EFI_ERROR (Status)) {
DriverName = NULL;
}
- ShellPrintHiiEx(
+
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER7B),
gShellDriver1HiiHandle,
- DriverName!=NULL?DriverName:L"<Unknown>"
+ DriverName != NULL ? DriverName : L"<Unknown>"
);
- SHELL_FREE_NON_NULL(DriverName);
+ SHELL_FREE_NON_NULL (DriverName);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER8),
gShellDriver1HiiHandle,
DriverBinding->Version,
- NumberOfChildren > 0?L"Bus":ControllerHandleCount > 0?L"Device":L"<Unknown>",
- ConfigurationStatus?L"YES":L"NO",
- DiagnosticsStatus?L"YES":L"NO"
+ NumberOfChildren > 0 ? L"Bus" : ControllerHandleCount > 0 ? L"Device" : L"<Unknown>",
+ ConfigurationStatus ? L"YES" : L"NO",
+ DiagnosticsStatus ? L"YES" : L"NO"
);
if (ControllerHandleCount == 0) {
- ShellPrintHiiEx(
- -1,
- -1,
- NULL,
- STRING_TOKEN (STR_DH_OUTPUT_DRIVER9),
- gShellDriver1HiiHandle,
- L"None"
- );
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DH_OUTPUT_DRIVER9),
+ gShellDriver1HiiHandle,
+ L"None"
+ );
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -726,39 +743,39 @@ DisplayDriverModelHandle ( L""
);
for (HandleIndex = 0; HandleIndex < ControllerHandleCount; HandleIndex++) {
- Status = gEfiShellProtocol->GetDeviceName(ControllerHandleBuffer[HandleIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
+ Status = gEfiShellProtocol->GetDeviceName (ControllerHandleBuffer[HandleIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER9B),
gShellDriver1HiiHandle,
- ConvertHandleToHandleIndex(ControllerHandleBuffer[HandleIndex]),
- TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
+ ConvertHandleToHandleIndex (ControllerHandleBuffer[HandleIndex]),
+ TempStringPointer != NULL ? TempStringPointer : L"<Unknown>"
);
- SHELL_FREE_NON_NULL(TempStringPointer);
+ SHELL_FREE_NON_NULL (TempStringPointer);
Status = PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
- Handle,
- ControllerHandleBuffer[HandleIndex],
- &ChildControllerHandleCount,
- &ChildControllerHandleBuffer
- );
+ Handle,
+ ControllerHandleBuffer[HandleIndex],
+ &ChildControllerHandleCount,
+ &ChildControllerHandleBuffer
+ );
if (!EFI_ERROR (Status)) {
for (ChildIndex = 0; ChildIndex < ChildControllerHandleCount; ChildIndex++) {
- Status = gEfiShellProtocol->GetDeviceName(ChildControllerHandleBuffer[ChildIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8*)Language, &TempStringPointer);
+ Status = gEfiShellProtocol->GetDeviceName (ChildControllerHandleBuffer[ChildIndex], EFI_DEVICE_NAME_USE_COMPONENT_NAME|EFI_DEVICE_NAME_USE_DEVICE_PATH, (CHAR8 *)Language, &TempStringPointer);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_DRIVER6C),
gShellDriver1HiiHandle,
- ConvertHandleToHandleIndex(ChildControllerHandleBuffer[ChildIndex]),
- TempStringPointer!=NULL?TempStringPointer:L"<Unknown>"
+ ConvertHandleToHandleIndex (ChildControllerHandleBuffer[ChildIndex]),
+ TempStringPointer != NULL ? TempStringPointer : L"<Unknown>"
);
- SHELL_FREE_NON_NULL(TempStringPointer);
+ SHELL_FREE_NON_NULL (TempStringPointer);
}
SHELL_FREE_NON_NULL (ChildControllerHandleBuffer);
@@ -783,54 +800,54 @@ DisplayDriverModelHandle ( FALSE for a single one.
**/
VOID
-DoDhByHandle(
- IN CONST EFI_HANDLE TheHandle,
- IN CONST BOOLEAN Verbose,
- IN CONST BOOLEAN Sfo,
- IN CONST CHAR8 *Language,
- IN CONST BOOLEAN DriverInfo,
- IN CONST BOOLEAN Multiple
+DoDhByHandle (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose,
+ IN CONST BOOLEAN Sfo,
+ IN CONST CHAR8 *Language,
+ IN CONST BOOLEAN DriverInfo,
+ IN CONST BOOLEAN Multiple
)
{
- CHAR16 *ProtocolInfoString;
+ CHAR16 *ProtocolInfoString;
- ProtocolInfoString = NULL;
+ ProtocolInfoString = NULL;
if (!Sfo) {
if (Multiple) {
- ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L" ", Verbose, TRUE);
- ShellPrintHiiEx(
+ ProtocolInfoString = GetProtocolInfoString (TheHandle, Language, L" ", Verbose, TRUE);
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT),
gShellDriver1HiiHandle,
- ConvertHandleToHandleIndex(TheHandle),
- ProtocolInfoString==NULL?L"":ProtocolInfoString
- );
+ ConvertHandleToHandleIndex (TheHandle),
+ ProtocolInfoString == NULL ? L"" : ProtocolInfoString
+ );
} else {
- ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, Verbose ? L"\r\n" : L" ", Verbose, TRUE);
+ ProtocolInfoString = GetProtocolInfoString (TheHandle, Language, Verbose ? L"\r\n" : L" ", Verbose, TRUE);
if (Verbose) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_SINGLE),
gShellDriver1HiiHandle,
- ConvertHandleToHandleIndex(TheHandle),
+ ConvertHandleToHandleIndex (TheHandle),
TheHandle,
- ProtocolInfoString==NULL?L"":ProtocolInfoString
- );
+ ProtocolInfoString == NULL ? L"" : ProtocolInfoString
+ );
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DH_OUTPUT_SINGLE_D),
gShellDriver1HiiHandle,
- ConvertHandleToHandleIndex(TheHandle),
- ProtocolInfoString==NULL?L"":ProtocolInfoString
- );
+ ConvertHandleToHandleIndex (TheHandle),
+ ProtocolInfoString == NULL ? L"" : ProtocolInfoString
+ );
}
}
@@ -838,24 +855,24 @@ DoDhByHandle( DisplayDriverModelHandle ((EFI_HANDLE)TheHandle, TRUE, Language);
}
} else {
- ProtocolInfoString = GetProtocolInfoString(TheHandle, Language, L";", FALSE, FALSE);
- ShellPrintHiiEx(
- -1,
- -1,
- NULL,
- STRING_TOKEN (STR_DH_OUTPUT_SFO),
- gShellDriver1HiiHandle,
- Multiple ?L"HandlesInfo":L"HandleInfo",
- L"DriverName",
- L"ControllerName",
- ConvertHandleToHandleIndex(TheHandle),
- L"DevPath",
- ProtocolInfoString==NULL?L"":ProtocolInfoString
+ ProtocolInfoString = GetProtocolInfoString (TheHandle, Language, L";", FALSE, FALSE);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DH_OUTPUT_SFO),
+ gShellDriver1HiiHandle,
+ Multiple ? L"HandlesInfo" : L"HandleInfo",
+ L"DriverName",
+ L"ControllerName",
+ ConvertHandleToHandleIndex (TheHandle),
+ L"DevPath",
+ ProtocolInfoString == NULL ? L"" : ProtocolInfoString
);
}
if (ProtocolInfoString != NULL) {
- FreePool(ProtocolInfoString);
+ FreePool (ProtocolInfoString);
}
}
@@ -872,18 +889,18 @@ DoDhByHandle( @retval SHELL_ABORTED The operation was aborted.
**/
SHELL_STATUS
-DoDhForHandleList(
- IN CONST EFI_HANDLE *HandleList,
- IN CONST BOOLEAN Verbose,
- IN CONST BOOLEAN Sfo,
- IN CONST CHAR8 *Language,
- IN CONST BOOLEAN DriverInfo
+DoDhForHandleList (
+ IN CONST EFI_HANDLE *HandleList,
+ IN CONST BOOLEAN Verbose,
+ IN CONST BOOLEAN Sfo,
+ IN CONST CHAR8 *Language,
+ IN CONST BOOLEAN DriverInfo
)
{
CONST EFI_HANDLE *HandleWalker;
SHELL_STATUS ShellStatus;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
for (HandleWalker = HandleList; HandleWalker != NULL && *HandleWalker != NULL; HandleWalker++) {
DoDhByHandle (*HandleWalker, Verbose, Sfo, Language, DriverInfo, TRUE);
if (ShellGetExecutionBreakFlag ()) {
@@ -891,6 +908,7 @@ DoDhForHandleList( break;
}
}
+
return (ShellStatus);
}
@@ -908,7 +926,7 @@ DoDhForHandleList( @retval SHELL_INVALID_PARAMETER ProtocolName was NULL or invalid.
**/
SHELL_STATUS
-DoDhByProtocolGuid(
+DoDhByProtocolGuid (
IN CONST GUID *Guid,
IN CONST BOOLEAN Verbose,
IN CONST BOOLEAN Sfo,
@@ -932,9 +950,10 @@ DoDhByProtocolGuid( }
}
}
- HandleList = GetHandleListByProtocol(Guid);
- ShellStatus = DoDhForHandleList(HandleList, Verbose, Sfo, Language, DriverInfo);
- SHELL_FREE_NON_NULL(HandleList);
+
+ HandleList = GetHandleListByProtocol (Guid);
+ ShellStatus = DoDhForHandleList (HandleList, Verbose, Sfo, Language, DriverInfo);
+ SHELL_FREE_NON_NULL (HandleList);
return ShellStatus;
}
@@ -962,9 +981,9 @@ DoDhByProtocol ( IN CONST BOOLEAN DriverInfo
)
{
- EFI_GUID Guid;
- EFI_GUID *GuidPtr;
- EFI_STATUS Status;
+ EFI_GUID Guid;
+ EFI_GUID *GuidPtr;
+ EFI_STATUS Status;
if (Protocol == NULL) {
return DoDhByProtocolGuid (NULL, Verbose, Sfo, Language, DriverInfo);
@@ -977,7 +996,7 @@ DoDhByProtocol ( // Protocol is a Name, convert it to GUID
//
Status = GetGuidFromStringName (Protocol, Language, &GuidPtr);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_NAME_FOUND), gShellDriver1HiiHandle, Protocol);
return (SHELL_NOT_FOUND);
}
@@ -1000,23 +1019,23 @@ DoDhByProtocol ( @retval SHELL_OUT_OT_RESOURCES A memory allocation failed.
**/
SHELL_STATUS
-DoDecodeByProtocol(
- IN CONST CHAR16 *Protocol,
- IN CONST CHAR8 *Language
+DoDecodeByProtocol (
+ IN CONST CHAR16 *Protocol,
+ IN CONST CHAR8 *Language
)
{
- EFI_STATUS Status;
- EFI_GUID *Guids;
- EFI_GUID Guid;
- UINTN Counts;
- UINTN Index;
- CHAR16 *Name;
+ EFI_STATUS Status;
+ EFI_GUID *Guids;
+ EFI_GUID Guid;
+ UINTN Counts;
+ UINTN Index;
+ CHAR16 *Name;
if (Protocol == NULL) {
Counts = 0;
Status = GetAllMappingGuids (NULL, &Counts);
if (Status == EFI_BUFFER_TOO_SMALL) {
- Guids = AllocatePool (Counts * sizeof(EFI_GUID));
+ Guids = AllocatePool (Counts * sizeof (EFI_GUID));
if (Guids == NULL) {
return SHELL_OUT_OF_RESOURCES;
}
@@ -1030,9 +1049,11 @@ DoDecodeByProtocol( } else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_GUID_FOUND), gShellDriver1HiiHandle, &Guids[Index]);
}
+
SHELL_FREE_NON_NULL (Name);
}
}
+
FreePool (Guids);
}
} else {
@@ -1043,7 +1064,8 @@ DoDecodeByProtocol( } else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DH_NO_GUID_FOUND), gShellDriver1HiiHandle, &Guid);
}
- SHELL_FREE_NON_NULL(Name);
+
+ SHELL_FREE_NON_NULL (Name);
} else {
Status = GetGuidFromStringName (Protocol, Language, &Guids);
if (Status == EFI_SUCCESS) {
@@ -1070,66 +1092,66 @@ ShellCommandRunDh ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CHAR8 *Language;
- CONST CHAR16 *Lang;
- CONST CHAR16 *RawValue;
- CONST CHAR16 *ProtocolVal;
- BOOLEAN SfoFlag;
- BOOLEAN DriverFlag;
- BOOLEAN VerboseFlag;
- UINT64 Intermediate;
- EFI_HANDLE Handle;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- Language = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CHAR8 *Language;
+ CONST CHAR16 *Lang;
+ CONST CHAR16 *RawValue;
+ CONST CHAR16 *ProtocolVal;
+ BOOLEAN SfoFlag;
+ BOOLEAN DriverFlag;
+ BOOLEAN VerboseFlag;
+ UINT64 Intermediate;
+ EFI_HANDLE Handle;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ Language = NULL;
//
// 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), gShellDriver1HiiHandle, L"dh", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"dh", 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), gShellDriver1HiiHandle, L"dh");
+ if (ShellCommandLineGetCount (Package) > 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"dh");
ShellCommandLineFreeVarList (Package);
return (SHELL_INVALID_PARAMETER);
}
- if (ShellCommandLineGetFlag(Package, L"-l")) {
- Lang = ShellCommandLineGetValue(Package, L"-l");
+ if (ShellCommandLineGetFlag (Package, L"-l")) {
+ Lang = ShellCommandLineGetValue (Package, L"-l");
if (Lang != NULL) {
- Language = AllocateZeroPool(StrSize(Lang));
- AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
+ Language = AllocateZeroPool (StrSize (Lang));
+ AsciiSPrint (Language, StrSize (Lang), "%S", Lang);
} else {
- ASSERT(Language == NULL);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-l");
- ShellCommandLineFreeVarList(Package);
+ ASSERT (Language == NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-l");
+ ShellCommandLineFreeVarList (Package);
return (SHELL_INVALID_PARAMETER);
}
} else {
- Language = AllocateZeroPool(10);
- AsciiSPrint(Language, 10, "en-us");
+ Language = AllocateZeroPool (10);
+ AsciiSPrint (Language, 10, "en-us");
}
SfoFlag = ShellCommandLineGetFlag (Package, L"-sfo");
@@ -1149,7 +1171,8 @@ ShellCommandRunDh ( ShellStatus = DoDhByProtocol (ProtocolVal, VerboseFlag, SfoFlag, Language, DriverFlag);
}
} else if ((RawValue != NULL) &&
- (gUnicodeCollation->StriColl(gUnicodeCollation, L"decode", (CHAR16 *) RawValue) == 0)) {
+ (gUnicodeCollation->StriColl (gUnicodeCollation, L"decode", (CHAR16 *)RawValue) == 0))
+ {
if (ShellCommandLineGetFlag (Package, L"-p") && (ProtocolVal == NULL)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-p");
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -1165,11 +1188,11 @@ ShellCommandRunDh ( ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Status = ShellConvertStringToUint64 (RawValue, &Intermediate, TRUE, FALSE);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"dh", RawValue);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Handle = ConvertHandleIndexToHandle ((UINTN) Intermediate);
+ Handle = ConvertHandleIndexToHandle ((UINTN)Intermediate);
if (Handle == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"dh", RawValue);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -1184,7 +1207,7 @@ ShellCommandRunDh ( }
ShellCommandLineFreeVarList (Package);
- SHELL_FREE_NON_NULL(Language);
+ SHELL_FREE_NON_NULL (Language);
}
return (ShellStatus);
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c index 8c11280aeb..009ae5282b 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c @@ -10,11 +10,11 @@ #include "UefiShellDriver1CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-r", TypeFlag},
- {L"-nc", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-r", TypeFlag },
+ { L"-nc", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Disconnect everything.
@@ -22,7 +22,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { @retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
-DisconnectAll(
+DisconnectAll (
VOID
)
{
@@ -37,34 +37,37 @@ DisconnectAll( // The following example recusively disconnects all drivers from all
// controllers in a platform.
//
- EFI_STATUS Status;
-// EFI_BOOT_SERVICES *gBS;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleIndex;
+ EFI_STATUS Status;
+ // EFI_BOOT_SERVICES *gBS;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleIndex;
+
//
// Retrieve the list of all handles from the handle database
//
Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ AllHandles,
+ NULL,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (!EFI_ERROR (Status)) {
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
Status = gBS->DisconnectController (
- HandleBuffer[HandleIndex],
- NULL,
- NULL
- );
+ HandleBuffer[HandleIndex],
+ NULL,
+ NULL
+ );
}
- gBS->FreePool(HandleBuffer);
+
+ gBS->FreePool (HandleBuffer);
//
// end of stealing
//
}
+
return (EFI_SUCCESS);
}
@@ -81,118 +84,120 @@ ShellCommandRunDisconnect ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Param1;
- CONST CHAR16 *Param2;
- CONST CHAR16 *Param3;
- EFI_HANDLE Handle1;
- EFI_HANDLE Handle2;
- EFI_HANDLE Handle3;
- UINT64 Intermediate1;
- UINT64 Intermediate2;
- UINT64 Intermediate3;
-
- ShellStatus = SHELL_SUCCESS;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Param1;
+ CONST CHAR16 *Param2;
+ CONST CHAR16 *Param3;
+ EFI_HANDLE Handle1;
+ EFI_HANDLE Handle2;
+ EFI_HANDLE Handle3;
+ UINT64 Intermediate1;
+ UINT64 Intermediate2;
+ UINT64 Intermediate3;
+
+ ShellStatus = SHELL_SUCCESS;
//
// 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), gShellDriver1HiiHandle, L"disconnect", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"disconnect", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetFlag(Package, L"-r")){
- if (ShellCommandLineGetCount(Package) > 1){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"disconnect");
+ if (ShellCommandLineGetFlag (Package, L"-r")) {
+ if (ShellCommandLineGetCount (Package) > 1) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"disconnect");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) < 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect");
+ } else if (ShellCommandLineGetCount (Package) < 1) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = DisconnectAll ();
- //
- // Reconnect all consoles if -nc is not provided
- //
- if (!ShellCommandLineGetFlag (Package, L"-nc")){
- ShellConnectFromDevPaths (L"ConInDev");
- ShellConnectFromDevPaths (L"ConOutDev");
- ShellConnectFromDevPaths (L"ErrOutDev");
- ShellConnectFromDevPaths (L"ErrOut");
- ShellConnectFromDevPaths (L"ConIn");
- ShellConnectFromDevPaths (L"ConOut");
- }
+ Status = DisconnectAll ();
+ //
+ // Reconnect all consoles if -nc is not provided
+ //
+ if (!ShellCommandLineGetFlag (Package, L"-nc")) {
+ ShellConnectFromDevPaths (L"ConInDev");
+ ShellConnectFromDevPaths (L"ConOutDev");
+ ShellConnectFromDevPaths (L"ErrOutDev");
+ ShellConnectFromDevPaths (L"ErrOut");
+ ShellConnectFromDevPaths (L"ConIn");
+ ShellConnectFromDevPaths (L"ConOut");
+ }
}
} else if (ShellCommandLineGetFlag (Package, L"-nc")) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- if (ShellCommandLineGetCount(Package) > 4){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"disconnect");
+ if (ShellCommandLineGetCount (Package) > 4) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"disconnect");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) < 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect");
+ } else if (ShellCommandLineGetCount (Package) < 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"disconnect");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// must have between 1 and 3 handles passed in ...
//
- Param1 = ShellCommandLineGetRawValue(Package, 1);
- Param2 = ShellCommandLineGetRawValue(Package, 2);
- Param3 = ShellCommandLineGetRawValue(Package, 3);
- ShellConvertStringToUint64(Param1, &Intermediate1, TRUE, FALSE);
- Handle1 = Param1!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate1):NULL;
- ShellConvertStringToUint64(Param2, &Intermediate2, TRUE, FALSE);
- Handle2 = Param2!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate2):NULL;
- ShellConvertStringToUint64(Param3, &Intermediate3, TRUE, FALSE);
- Handle3 = Param3!=NULL?ConvertHandleIndexToHandle((UINTN)Intermediate3):NULL;
-
- if (Param1 != NULL && Handle1 == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param1);
+ Param1 = ShellCommandLineGetRawValue (Package, 1);
+ Param2 = ShellCommandLineGetRawValue (Package, 2);
+ Param3 = ShellCommandLineGetRawValue (Package, 3);
+ ShellConvertStringToUint64 (Param1, &Intermediate1, TRUE, FALSE);
+ Handle1 = Param1 != NULL ? ConvertHandleIndexToHandle ((UINTN)Intermediate1) : NULL;
+ ShellConvertStringToUint64 (Param2, &Intermediate2, TRUE, FALSE);
+ Handle2 = Param2 != NULL ? ConvertHandleIndexToHandle ((UINTN)Intermediate2) : NULL;
+ ShellConvertStringToUint64 (Param3, &Intermediate3, TRUE, FALSE);
+ Handle3 = Param3 != NULL ? ConvertHandleIndexToHandle ((UINTN)Intermediate3) : NULL;
+
+ if ((Param1 != NULL) && (Handle1 == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param1);
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (Param2 != NULL && Handle2 == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param2);
+ } else if ((Param2 != NULL) && (Handle2 == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param2);
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (Param3 != NULL && Handle3 == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param3);
+ } else if ((Param3 != NULL) && (Handle3 == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"disconnect", Param3);
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (Handle2 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
- ASSERT(Param2 != NULL);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, L"disconnect", ShellStrToUintn(Param2), L"driver handle");
+ } else if ((Handle2 != NULL) && EFI_ERROR (gBS->OpenProtocol (Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+ ASSERT (Param2 != NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, L"disconnect", ShellStrToUintn (Param2), L"driver handle");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(Param1 != NULL);
- Status = gBS->DisconnectController(Handle1, Handle2, Handle3);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_3P_RESULT), gShellDriver1HiiHandle, L"Disconnect", (UINTN)Intermediate1, (UINTN)Intermediate2, (UINTN)Intermediate3, Status);
+ ASSERT (Param1 != NULL);
+ Status = gBS->DisconnectController (Handle1, Handle2, Handle3);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_3P_RESULT), gShellDriver1HiiHandle, L"Disconnect", (UINTN)Intermediate1, (UINTN)Intermediate2, (UINTN)Intermediate3, Status);
}
}
}
}
+
if (ShellStatus == SHELL_SUCCESS) {
if (Status == EFI_SECURITY_VIOLATION) {
ShellStatus = SHELL_SECURITY_VIOLATION;
} else if (Status == EFI_INVALID_PARAMETER) {
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (EFI_ERROR(Status)) {
+ } else if (EFI_ERROR (Status)) {
ShellStatus = SHELL_NOT_FOUND;
}
}
+
return (ShellStatus);
}
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c index 99a7b0c8cd..2773039caa 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c @@ -9,13 +9,13 @@ #include "UefiShellDriver1CommandsLib.h"
-#define MAX_LEN_DRIVER_NAME 35
+#define MAX_LEN_DRIVER_NAME 35
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-sfo", TypeFlag},
- {L"-l", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-sfo", TypeFlag },
+ { L"-l", TypeValue },
+ { NULL, TypeMax }
+};
/**
Get a device path (in text format) for a given handle.
@@ -26,59 +26,64 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { @return A pointer to the driver path as a string. The callee must
free this memory.
**/
-CHAR16*
-GetDevicePathTextForHandle(
- IN EFI_HANDLE TheHandle
+CHAR16 *
+GetDevicePathTextForHandle (
+ IN EFI_HANDLE TheHandle
)
{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *FinalPath;
- CHAR16 *RetVal;
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *FinalPath;
+ CHAR16 *RetVal;
FinalPath = NULL;
Status = gBS->OpenProtocol (
- TheHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**)&LoadedImage,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->OpenProtocol (
- LoadedImage->DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&ImageDevicePath,
+ TheHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage,
gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ LoadedImage->DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&ImageDevicePath,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
FinalPath = AppendDevicePath (ImageDevicePath, LoadedImage->FilePath);
- gBS->CloseProtocol(
- LoadedImage->DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- gImageHandle,
- NULL);
+ gBS->CloseProtocol (
+ LoadedImage->DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ gImageHandle,
+ NULL
+ );
}
- gBS->CloseProtocol(
- TheHandle,
- &gEfiLoadedImageProtocolGuid,
- gImageHandle,
- NULL);
+
+ gBS->CloseProtocol (
+ TheHandle,
+ &gEfiLoadedImageProtocolGuid,
+ gImageHandle,
+ NULL
+ );
}
if (FinalPath == NULL) {
return (NULL);
}
- RetVal = gEfiShellProtocol->GetFilePathFromDevicePath(FinalPath);
+
+ RetVal = gEfiShellProtocol->GetFilePathFromDevicePath (FinalPath);
if (RetVal == NULL) {
- RetVal = ConvertDevicePathToText(FinalPath, TRUE, TRUE);
+ RetVal = ConvertDevicePathToText (FinalPath, TRUE, TRUE);
}
- FreePool(FinalPath);
+
+ FreePool (FinalPath);
return (RetVal);
}
@@ -91,15 +96,17 @@ GetDevicePathTextForHandle( @retval FALSE The driver does not have Driver Configuration.
**/
BOOLEAN
-ReturnDriverConfig(
- IN CONST EFI_HANDLE TheHandle
+ReturnDriverConfig (
+ IN CONST EFI_HANDLE TheHandle
)
{
- EFI_STATUS Status;
- Status = gBS->OpenProtocol((EFI_HANDLE)TheHandle, &gEfiDriverConfigurationProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
- if (EFI_ERROR(Status)) {
+ EFI_STATUS Status;
+
+ Status = gBS->OpenProtocol ((EFI_HANDLE)TheHandle, &gEfiDriverConfigurationProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
+ if (EFI_ERROR (Status)) {
return (FALSE);
}
+
return (TRUE);
}
@@ -112,18 +119,20 @@ ReturnDriverConfig( @retval FALSE The driver does not have Driver Diagnostics.
**/
BOOLEAN
-ReturnDriverDiag(
- IN CONST EFI_HANDLE TheHandle
+ReturnDriverDiag (
+ IN CONST EFI_HANDLE TheHandle
)
{
- EFI_STATUS Status;
- Status = gBS->OpenProtocol((EFI_HANDLE)TheHandle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
- if (EFI_ERROR(Status)) {
- Status = gBS->OpenProtocol((EFI_HANDLE)TheHandle, &gEfiDriverDiagnosticsProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
- if (EFI_ERROR(Status)) {
+ EFI_STATUS Status;
+
+ Status = gBS->OpenProtocol ((EFI_HANDLE)TheHandle, &gEfiDriverDiagnostics2ProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
+ if (EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol ((EFI_HANDLE)TheHandle, &gEfiDriverDiagnosticsProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
+ if (EFI_ERROR (Status)) {
return (FALSE);
}
}
+
return (TRUE);
}
@@ -136,21 +145,22 @@ ReturnDriverDiag( @retval 0xFFFFFFFF An error ocurred.
**/
UINT32
-ReturnDriverVersion(
- IN CONST EFI_HANDLE TheHandle
+ReturnDriverVersion (
+ IN CONST EFI_HANDLE TheHandle
)
{
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- EFI_STATUS Status;
- UINT32 RetVal;
+ EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
+ EFI_STATUS Status;
+ UINT32 RetVal;
RetVal = (UINT32)-1;
- Status = gBS->OpenProtocol((EFI_HANDLE)TheHandle, &gEfiDriverBindingProtocolGuid, (VOID**)&DriverBinding, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status)) {
+ Status = gBS->OpenProtocol ((EFI_HANDLE)TheHandle, &gEfiDriverBindingProtocolGuid, (VOID **)&DriverBinding, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ if (!EFI_ERROR (Status)) {
RetVal = DriverBinding->Version;
- gBS->CloseProtocol(TheHandle, &gEfiDriverBindingProtocolGuid, gImageHandle, NULL);
+ gBS->CloseProtocol (TheHandle, &gEfiDriverBindingProtocolGuid, gImageHandle, NULL);
}
+
return (RetVal);
}
@@ -163,18 +173,18 @@ ReturnDriverVersion( **/
CHAR16 *
GetImageNameFromHandle (
- IN CONST EFI_HANDLE Handle
+ IN CONST EFI_HANDLE Handle
)
{
- EFI_STATUS Status;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
- EFI_GUID *NameGuid;
- CHAR16 *ImageName;
- UINTN BufferSize;
- UINT32 AuthenticationStatus;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv2;
+ EFI_STATUS Status;
+ EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
+ EFI_GUID *NameGuid;
+ CHAR16 *ImageName;
+ UINTN BufferSize;
+ UINT32 AuthenticationStatus;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv2;
LoadedImage = NULL;
DriverBinding = NULL;
@@ -183,18 +193,19 @@ GetImageNameFromHandle ( Status = gBS->OpenProtocol (
Handle,
&gEfiDriverBindingProtocolGuid,
- (VOID **) &DriverBinding,
+ (VOID **)&DriverBinding,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
- return NULL;
+ return NULL;
}
+
Status = gBS->OpenProtocol (
DriverBinding->ImageHandle,
&gEfiLoadedImageProtocolGuid,
- (VOID**)&LoadedImage,
+ (VOID **)&LoadedImage,
gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -204,6 +215,7 @@ GetImageNameFromHandle ( if (DevPathNode == NULL) {
return NULL;
}
+
while (!IsDevicePathEnd (DevPathNode)) {
NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevPathNode);
if (NameGuid != NULL) {
@@ -225,18 +237,22 @@ GetImageNameFromHandle ( if (!EFI_ERROR (Status)) {
break;
}
+
ImageName = NULL;
}
}
+
//
// Next device path node
//
DevPathNode = NextDevicePathNode (DevPathNode);
}
+
if (ImageName == NULL) {
ImageName = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE);
}
}
+
return ImageName;
}
@@ -253,75 +269,75 @@ ShellCommandRunDrivers ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CHAR8 *Language;
- CONST CHAR16 *Lang;
- EFI_HANDLE *HandleList;
- EFI_HANDLE *HandleWalker;
- UINTN ChildCount;
- UINTN DeviceCount;
- CHAR16 ChildCountStr[21];
- CHAR16 DeviceCountStr[21];
- CHAR16 *Temp2;
- CONST CHAR16 *FullDriverName;
- CHAR16 *TruncatedDriverName;
- CHAR16 *ImageName;
- CHAR16 *FormatString;
- UINT32 DriverVersion;
- BOOLEAN DriverConfig;
- BOOLEAN DriverDiag;
- BOOLEAN SfoFlag;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- Language = NULL;
- FormatString = NULL;
- SfoFlag = FALSE;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CHAR8 *Language;
+ CONST CHAR16 *Lang;
+ EFI_HANDLE *HandleList;
+ EFI_HANDLE *HandleWalker;
+ UINTN ChildCount;
+ UINTN DeviceCount;
+ CHAR16 ChildCountStr[21];
+ CHAR16 DeviceCountStr[21];
+ CHAR16 *Temp2;
+ CONST CHAR16 *FullDriverName;
+ CHAR16 *TruncatedDriverName;
+ CHAR16 *ImageName;
+ CHAR16 *FormatString;
+ UINT32 DriverVersion;
+ BOOLEAN DriverConfig;
+ BOOLEAN DriverDiag;
+ BOOLEAN SfoFlag;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ Language = NULL;
+ FormatString = NULL;
+ SfoFlag = FALSE;
//
// 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), gShellDriver1HiiHandle, L"drivers", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drivers", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetCount(Package) > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drivers");
+ if (ShellCommandLineGetCount (Package) > 1) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drivers");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- if (ShellCommandLineGetFlag(Package, L"-l")){
- Lang = ShellCommandLineGetValue(Package, L"-l");
+ if (ShellCommandLineGetFlag (Package, L"-l")) {
+ Lang = ShellCommandLineGetValue (Package, L"-l");
if (Lang != NULL) {
- Language = AllocateZeroPool(StrSize(Lang));
- AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
+ Language = AllocateZeroPool (StrSize (Lang));
+ AsciiSPrint (Language, StrSize (Lang), "%S", Lang);
} else {
- ASSERT(Language == NULL);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drivers", L"-l");
+ ASSERT (Language == NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drivers", L"-l");
ShellCommandLineFreeVarList (Package);
return (SHELL_INVALID_PARAMETER);
}
}
if (ShellCommandLineGetFlag (Package, L"-sfo")) {
- SfoFlag = TRUE;
+ SfoFlag = TRUE;
FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE_SFO), Language);
//
// print the SFO header
@@ -332,34 +348,36 @@ ShellCommandRunDrivers ( Language,
STRING_TOKEN (STR_GEN_SFO_HEADER),
gShellDriver1HiiHandle,
- L"drivers");
+ L"drivers"
+ );
} else {
FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE), Language);
//
// print the header row
//
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
Language,
STRING_TOKEN (STR_DRIVERS_HEADER_LINES),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
}
- HandleList = GetHandleListByProtocol(&gEfiDriverBindingProtocolGuid);
- for (HandleWalker = HandleList ; HandleWalker != NULL && *HandleWalker != NULL ; HandleWalker++){
+ HandleList = GetHandleListByProtocol (&gEfiDriverBindingProtocolGuid);
+ for (HandleWalker = HandleList; HandleWalker != NULL && *HandleWalker != NULL; HandleWalker++) {
ChildCount = 0;
DeviceCount = 0;
- Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount , NULL);
- Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL);
- Temp2 = GetDevicePathTextForHandle(*HandleWalker);
- DriverVersion = ReturnDriverVersion(*HandleWalker);
- DriverConfig = ReturnDriverConfig(*HandleWalker);
- DriverDiag = ReturnDriverDiag (*HandleWalker);
- FullDriverName = GetStringNameFromHandle(*HandleWalker, Language);
+ Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount, NULL);
+ Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL);
+ Temp2 = GetDevicePathTextForHandle (*HandleWalker);
+ DriverVersion = ReturnDriverVersion (*HandleWalker);
+ DriverConfig = ReturnDriverConfig (*HandleWalker);
+ DriverDiag = ReturnDriverDiag (*HandleWalker);
+ FullDriverName = GetStringNameFromHandle (*HandleWalker, Language);
ImageName = GetImageNameFromHandle (*HandleWalker);
- UnicodeValueToStringS (ChildCountStr, sizeof (ChildCountStr), 0, ChildCount, 0);
+ UnicodeValueToStringS (ChildCountStr, sizeof (ChildCountStr), 0, ChildCount, 0);
UnicodeValueToStringS (DeviceCountStr, sizeof (DeviceCountStr), 0, DeviceCount, 0);
TruncatedDriverName = NULL;
if (!SfoFlag && (FullDriverName != NULL)) {
@@ -398,12 +416,15 @@ ShellCommandRunDrivers ( Temp2 == NULL ? L"" : Temp2
);
}
+
if (TruncatedDriverName != NULL) {
FreePool (TruncatedDriverName);
}
+
if (Temp2 != NULL) {
- FreePool(Temp2);
+ FreePool (Temp2);
}
+
if (ImageName != NULL) {
FreePool (ImageName);
}
@@ -414,9 +435,10 @@ ShellCommandRunDrivers ( }
}
}
- SHELL_FREE_NON_NULL(Language);
+
+ SHELL_FREE_NON_NULL (Language);
ShellCommandLineFreeVarList (Package);
- SHELL_FREE_NON_NULL(FormatString);
+ SHELL_FREE_NON_NULL (FormatString);
}
return (ShellStatus);
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c index f23f2fd7e8..9bbbb1444d 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c @@ -11,7 +11,7 @@ #include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiDatabase.h>
-STATIC CONST EFI_GUID *CfgGuidList[] = {&gEfiDriverConfigurationProtocolGuid, &gEfiDriverConfiguration2ProtocolGuid, NULL};
+STATIC CONST EFI_GUID *CfgGuidList[] = { &gEfiDriverConfigurationProtocolGuid, &gEfiDriverConfiguration2ProtocolGuid, NULL };
/**
Find the EFI_HII_HANDLE by device path.
@@ -24,40 +24,41 @@ STATIC CONST EFI_GUID *CfgGuidList[] = {&gEfiDriverConfigurationProtocolGuid, &g @retval EFI_NOT_FOUND There was no EFI_HII_HANDLE found for that deviec path.
**/
EFI_STATUS
-FindHiiHandleViaDevPath(
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath1,
- OUT EFI_HII_HANDLE *HiiHandle,
- IN EFI_HII_DATABASE_PROTOCOL *HiiDb
+FindHiiHandleViaDevPath (
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath1,
+ OUT EFI_HII_HANDLE *HiiHandle,
+ IN EFI_HII_DATABASE_PROTOCOL *HiiDb
)
{
- EFI_HII_HANDLE *HandleBuffer;
- UINTN HandleBufferSize;
- VOID *MainBuffer;
- UINTN MainBufferSize;
- EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
- EFI_HII_PACKAGE_HEADER *PackageHeader;
- UINTN LoopVariable;
- EFI_DEVICE_PATH_PROTOCOL *DevPath2;
- EFI_STATUS Status;
-
- ASSERT(DevPath1 != NULL);
- ASSERT(HiiHandle != NULL);
- ASSERT(*HiiHandle == NULL);
- ASSERT(HiiDb != NULL);
-
- HandleBufferSize = 0;
- HandleBuffer = NULL;
- Status = HiiDb->ListPackageLists(HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer);
+ EFI_HII_HANDLE *HandleBuffer;
+ UINTN HandleBufferSize;
+ VOID *MainBuffer;
+ UINTN MainBufferSize;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
+ EFI_HII_PACKAGE_HEADER *PackageHeader;
+ UINTN LoopVariable;
+ EFI_DEVICE_PATH_PROTOCOL *DevPath2;
+ EFI_STATUS Status;
+
+ ASSERT (DevPath1 != NULL);
+ ASSERT (HiiHandle != NULL);
+ ASSERT (*HiiHandle == NULL);
+ ASSERT (HiiDb != NULL);
+
+ HandleBufferSize = 0;
+ HandleBuffer = NULL;
+ Status = HiiDb->ListPackageLists (HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
- HandleBuffer = AllocateZeroPool(HandleBufferSize);
+ HandleBuffer = AllocateZeroPool (HandleBufferSize);
if (HandleBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
Status = HiiDb->ListPackageLists (HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer);
}
}
- if (EFI_ERROR(Status)) {
- SHELL_FREE_NON_NULL(HandleBuffer);
+
+ if (EFI_ERROR (Status)) {
+ SHELL_FREE_NON_NULL (HandleBuffer);
return (Status);
}
@@ -65,45 +66,52 @@ FindHiiHandleViaDevPath( return EFI_NOT_FOUND;
}
- for (LoopVariable = 0 ; LoopVariable < (HandleBufferSize/sizeof(HandleBuffer[0])) && *HiiHandle == NULL ; LoopVariable++) {
- MainBufferSize = 0;
- MainBuffer = NULL;
- Status = HiiDb->ExportPackageLists(HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer);
+ for (LoopVariable = 0; LoopVariable < (HandleBufferSize/sizeof (HandleBuffer[0])) && *HiiHandle == NULL; LoopVariable++) {
+ MainBufferSize = 0;
+ MainBuffer = NULL;
+ Status = HiiDb->ExportPackageLists (HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
- MainBuffer = AllocateZeroPool(MainBufferSize);
+ MainBuffer = AllocateZeroPool (MainBufferSize);
if (MainBuffer != NULL) {
Status = HiiDb->ExportPackageLists (HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer);
}
}
+
if (EFI_ERROR (Status)) {
continue;
}
+
//
// Enumerate through the block of returned memory.
// This should actually be a small block, but we need to be sure.
//
- for (PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)MainBuffer
- ; PackageListHeader != NULL && ((CHAR8*)PackageListHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && *HiiHandle == NULL
- ; PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)(((CHAR8*)(PackageListHeader)) + PackageListHeader->PackageLength )) {
- for (PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageListHeader))+sizeof(EFI_HII_PACKAGE_LIST_HEADER))
- ; PackageHeader != NULL && ((CHAR8*)PackageHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && PackageHeader->Type != EFI_HII_PACKAGE_END && *HiiHandle == NULL
- ; PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageHeader))+PackageHeader->Length)) {
- if (PackageHeader->Type == EFI_HII_PACKAGE_DEVICE_PATH) {
- DevPath2 = (EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER));
- if (DevicePathCompare(&DevPath1, &DevPath2) == 0) {
- *HiiHandle = HandleBuffer[LoopVariable];
- break;
- }
- }
+ for (PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER *)MainBuffer
+ ; PackageListHeader != NULL && ((CHAR8 *)PackageListHeader) < (((CHAR8 *)MainBuffer)+MainBufferSize) && *HiiHandle == NULL
+ ; PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER *)(((CHAR8 *)(PackageListHeader)) + PackageListHeader->PackageLength))
+ {
+ for (PackageHeader = (EFI_HII_PACKAGE_HEADER *)(((CHAR8 *)(PackageListHeader))+sizeof (EFI_HII_PACKAGE_LIST_HEADER))
+ ; PackageHeader != NULL && ((CHAR8 *)PackageHeader) < (((CHAR8 *)MainBuffer)+MainBufferSize) && PackageHeader->Type != EFI_HII_PACKAGE_END && *HiiHandle == NULL
+ ; PackageHeader = (EFI_HII_PACKAGE_HEADER *)(((CHAR8 *)(PackageHeader))+PackageHeader->Length))
+ {
+ if (PackageHeader->Type == EFI_HII_PACKAGE_DEVICE_PATH) {
+ DevPath2 = (EFI_DEVICE_PATH_PROTOCOL *)(((CHAR8 *)PackageHeader) + sizeof (EFI_HII_PACKAGE_HEADER));
+ if (DevicePathCompare (&DevPath1, &DevPath2) == 0) {
+ *HiiHandle = HandleBuffer[LoopVariable];
+ break;
+ }
}
+ }
}
- SHELL_FREE_NON_NULL(MainBuffer);
+
+ SHELL_FREE_NON_NULL (MainBuffer);
}
- SHELL_FREE_NON_NULL(HandleBuffer);
+
+ SHELL_FREE_NON_NULL (HandleBuffer);
if (*HiiHandle == NULL) {
return (EFI_NOT_FOUND);
}
+
return (EFI_SUCCESS);
}
@@ -117,18 +125,19 @@ FindHiiHandleViaDevPath( @retval EFI_SUCCESS The operation was successful.
**/
EFI_STATUS
-ConvertHandleToHiiHandle(
+ConvertHandleToHiiHandle (
IN CONST EFI_HANDLE Handle,
OUT EFI_HII_HANDLE *HiiHandle,
IN EFI_HII_DATABASE_PROTOCOL *HiiDb
)
{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevPath1;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevPath1;
- if (HiiHandle == NULL || HiiDb == NULL) {
+ if ((HiiHandle == NULL) || (HiiDb == NULL)) {
return (EFI_INVALID_PARAMETER);
}
+
*HiiHandle = NULL;
if (Handle == NULL) {
@@ -136,12 +145,12 @@ ConvertHandleToHiiHandle( }
DevPath1 = NULL;
- Status = gBS->OpenProtocol(Handle, &gEfiDevicePathProtocolGuid, (VOID**)&DevPath1, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (EFI_ERROR(Status) || DevPath1 == NULL) {
+ Status = gBS->OpenProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevPath1, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ if (EFI_ERROR (Status) || (DevPath1 == NULL)) {
return (EFI_NOT_FOUND);
}
- return (FindHiiHandleViaDevPath(DevPath1, HiiHandle, HiiDb));
+ return (FindHiiHandleViaDevPath (DevPath1, HiiHandle, HiiDb));
}
/**
@@ -151,34 +160,35 @@ ConvertHandleToHiiHandle( @param[in] FileName The filename to rwite the info to.
**/
SHELL_STATUS
-ConfigToFile(
- IN CONST EFI_HANDLE Handle,
- IN CONST CHAR16 *FileName
+ConfigToFile (
+ IN CONST EFI_HANDLE Handle,
+ IN CONST CHAR16 *FileName
)
{
- EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
- EFI_STATUS Status;
- VOID *MainBuffer;
- UINTN MainBufferSize;
- EFI_HII_HANDLE HiiHandle;
- SHELL_FILE_HANDLE FileHandle;
-
- HiiDatabase = NULL;
- MainBufferSize = 0;
- MainBuffer = NULL;
- FileHandle = NULL;
-
- Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
+ EFI_STATUS Status;
+ VOID *MainBuffer;
+ UINTN MainBufferSize;
+ EFI_HII_HANDLE HiiHandle;
+ SHELL_FILE_HANDLE FileHandle;
+
+ HiiDatabase = NULL;
+ MainBufferSize = 0;
+ MainBuffer = NULL;
+ FileHandle = NULL;
+
+ Status = ShellOpenFileByName (FileName, &FileHandle, 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),
+ STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL),
gShellDriver1HiiHandle,
L"drvcfg",
FileName,
- Status);
+ Status
+ );
return (SHELL_DEVICE_ERROR);
}
@@ -188,67 +198,72 @@ ConfigToFile( Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
- (VOID **) &HiiDatabase
+ (VOID **)&HiiDatabase
);
- if (EFI_ERROR(Status) || HiiDatabase == NULL) {
- ShellPrintHiiEx(
+ if (EFI_ERROR (Status) || (HiiDatabase == NULL)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_GEN_PROTOCOL_NF),
+ STRING_TOKEN (STR_GEN_PROTOCOL_NF),
gShellDriver1HiiHandle,
L"drvcfg",
L"EfiHiiDatabaseProtocol",
- &gEfiHiiDatabaseProtocolGuid);
- ShellCloseFile(&FileHandle);
+ &gEfiHiiDatabaseProtocolGuid
+ );
+ ShellCloseFile (&FileHandle);
return (SHELL_NOT_FOUND);
}
HiiHandle = NULL;
- Status = ConvertHandleToHiiHandle(Handle, &HiiHandle, HiiDatabase);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+ Status = ConvertHandleToHiiHandle (Handle, &HiiHandle, HiiDatabase);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_GEN_HANDLE_NOT),
+ STRING_TOKEN (STR_GEN_HANDLE_NOT),
gShellDriver1HiiHandle,
L"drvcfg",
- ConvertHandleToHandleIndex(Handle),
- L"Device");
- ShellCloseFile(&FileHandle);
+ ConvertHandleToHandleIndex (Handle),
+ L"Device"
+ );
+ ShellCloseFile (&FileHandle);
return (SHELL_DEVICE_ERROR);
}
- Status = HiiDatabase->ExportPackageLists(HiiDatabase, HiiHandle, &MainBufferSize, MainBuffer);
+ Status = HiiDatabase->ExportPackageLists (HiiDatabase, HiiHandle, &MainBufferSize, MainBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
- MainBuffer = AllocateZeroPool(MainBufferSize);
- Status = HiiDatabase->ExportPackageLists(HiiDatabase, HiiHandle, &MainBufferSize, MainBuffer);
+ MainBuffer = AllocateZeroPool (MainBufferSize);
+ Status = HiiDatabase->ExportPackageLists (HiiDatabase, HiiHandle, &MainBufferSize, MainBuffer);
}
- Status = ShellWriteFile(FileHandle, &MainBufferSize, MainBuffer);
+ Status = ShellWriteFile (FileHandle, &MainBufferSize, MainBuffer);
- ShellCloseFile(&FileHandle);
- SHELL_FREE_NON_NULL(MainBuffer);
+ ShellCloseFile (&FileHandle);
+ SHELL_FREE_NON_NULL (MainBuffer);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_FILE_WRITE_FAIL),
+ STRING_TOKEN (STR_FILE_WRITE_FAIL),
gShellDriver1HiiHandle,
L"drvcfg",
- FileName);
+ FileName
+ );
return (SHELL_DEVICE_ERROR);
}
- ShellPrintHiiEx(
+
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_DRVCFG_COMP),
- gShellDriver1HiiHandle);
+ STRING_TOKEN (STR_DRVCFG_COMP),
+ gShellDriver1HiiHandle
+ );
return (SHELL_SUCCESS);
}
@@ -260,40 +275,41 @@ ConfigToFile( @param[in] FileName The filename to read the info from.
**/
SHELL_STATUS
-ConfigFromFile(
- IN EFI_HANDLE Handle,
- IN CONST CHAR16 *FileName
+ConfigFromFile (
+ IN EFI_HANDLE Handle,
+ IN CONST CHAR16 *FileName
)
{
- EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
- EFI_STATUS Status;
- VOID *MainBuffer;
- UINT64 Temp;
- UINTN MainBufferSize;
- EFI_HII_HANDLE HiiHandle;
- SHELL_FILE_HANDLE FileHandle;
- CHAR16 *TempDevPathString;
- EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
- EFI_HII_PACKAGE_HEADER *PackageHeader;
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
- UINTN HandleIndex;
-
- HiiDatabase = NULL;
- MainBufferSize = 0;
- MainBuffer = NULL;
- FileHandle = NULL;
-
- Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
+ EFI_STATUS Status;
+ VOID *MainBuffer;
+ UINT64 Temp;
+ UINTN MainBufferSize;
+ EFI_HII_HANDLE HiiHandle;
+ SHELL_FILE_HANDLE FileHandle;
+ CHAR16 *TempDevPathString;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
+ EFI_HII_PACKAGE_HEADER *PackageHeader;
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;
+ UINTN HandleIndex;
+
+ HiiDatabase = NULL;
+ MainBufferSize = 0;
+ MainBuffer = NULL;
+ FileHandle = NULL;
+
+ Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_GEN_FILE_OPEN_FAIL),
+ STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL),
gShellDriver1HiiHandle,
L"drvcfg",
FileName,
- Status);
+ Status
+ );
return (SHELL_DEVICE_ERROR);
}
@@ -303,96 +319,107 @@ ConfigFromFile( Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
- (VOID **) &HiiDatabase
+ (VOID **)&HiiDatabase
);
- if (EFI_ERROR(Status) || HiiDatabase == NULL) {
- ShellPrintHiiEx(
+ if (EFI_ERROR (Status) || (HiiDatabase == NULL)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_GEN_PROTOCOL_NF),
+ STRING_TOKEN (STR_GEN_PROTOCOL_NF),
gShellDriver1HiiHandle,
L"drvcfg",
L"EfiHiiDatabaseProtocol",
- &gEfiHiiDatabaseProtocolGuid);
- ShellCloseFile(&FileHandle);
+ &gEfiHiiDatabaseProtocolGuid
+ );
+ ShellCloseFile (&FileHandle);
return (SHELL_NOT_FOUND);
}
- Status = ShellGetFileSize(FileHandle, &Temp);
+ Status = ShellGetFileSize (FileHandle, &Temp);
MainBufferSize = (UINTN)Temp;
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_FILE_READ_FAIL),
+ STRING_TOKEN (STR_FILE_READ_FAIL),
gShellDriver1HiiHandle,
L"drvcfg",
- FileName);
+ FileName
+ );
- ShellCloseFile(&FileHandle);
+ ShellCloseFile (&FileHandle);
return (SHELL_DEVICE_ERROR);
}
- MainBuffer = AllocateZeroPool((UINTN)MainBufferSize);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+
+ MainBuffer = AllocateZeroPool ((UINTN)MainBufferSize);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_GEN_OUT_MEM),
- gShellDriver1HiiHandle, L"drvcfg");
- ShellCloseFile(&FileHandle);
+ STRING_TOKEN (STR_GEN_OUT_MEM),
+ gShellDriver1HiiHandle,
+ L"drvcfg"
+ );
+ ShellCloseFile (&FileHandle);
return (SHELL_DEVICE_ERROR);
}
- Status = ShellReadFile(FileHandle, &MainBufferSize, MainBuffer);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+
+ Status = ShellReadFile (FileHandle, &MainBufferSize, MainBuffer);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_FILE_READ_FAIL),
+ STRING_TOKEN (STR_FILE_READ_FAIL),
gShellDriver1HiiHandle,
L"drvcfg",
- FileName);
+ FileName
+ );
- ShellCloseFile(&FileHandle);
- SHELL_FREE_NON_NULL(MainBuffer);
+ ShellCloseFile (&FileHandle);
+ SHELL_FREE_NON_NULL (MainBuffer);
return (SHELL_DEVICE_ERROR);
}
- ShellCloseFile(&FileHandle);
+ ShellCloseFile (&FileHandle);
if (Handle != NULL) {
//
// User override in place. Just do it.
//
- HiiHandle = NULL;
- Status = ConvertHandleToHiiHandle(Handle, &HiiHandle, HiiDatabase);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+ HiiHandle = NULL;
+ Status = ConvertHandleToHiiHandle (Handle, &HiiHandle, HiiDatabase);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_GEN_HANDLE_NOT),
- gShellDriver1HiiHandle, L"drvcfg",
- ConvertHandleToHandleIndex(Handle),
- L"Device");
- ShellCloseFile(&FileHandle);
+ STRING_TOKEN (STR_GEN_HANDLE_NOT),
+ gShellDriver1HiiHandle,
+ L"drvcfg",
+ ConvertHandleToHandleIndex (Handle),
+ L"Device"
+ );
+ ShellCloseFile (&FileHandle);
return (SHELL_DEVICE_ERROR);
}
- Status = HiiDatabase->UpdatePackageList(HiiDatabase, HiiHandle, MainBuffer);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
+
+ Status = HiiDatabase->UpdatePackageList (HiiDatabase, HiiHandle, MainBuffer);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_GEN_UEFI_FUNC_WARN),
+ STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN),
gShellDriver1HiiHandle,
L"drvcfg",
L"HiiDatabase->UpdatePackageList",
- Status);
+ Status
+ );
return (SHELL_DEVICE_ERROR);
}
} else {
@@ -400,68 +427,73 @@ ConfigFromFile( // we need to parse the buffer and try to match the device paths for each item to try to find it's device path.
//
- for (PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)MainBuffer
- ; PackageListHeader != NULL && ((CHAR8*)PackageListHeader) < (((CHAR8*)MainBuffer)+MainBufferSize)
- ; PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER*)(((CHAR8*)(PackageListHeader)) + PackageListHeader->PackageLength )) {
- for (PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageListHeader))+sizeof(EFI_HII_PACKAGE_LIST_HEADER))
- ; PackageHeader != NULL && ((CHAR8*)PackageHeader) < (((CHAR8*)MainBuffer)+MainBufferSize) && PackageHeader->Type != EFI_HII_PACKAGE_END
- ; PackageHeader = (EFI_HII_PACKAGE_HEADER*)(((CHAR8*)(PackageHeader))+PackageHeader->Length)) {
- if (PackageHeader->Type == EFI_HII_PACKAGE_DEVICE_PATH) {
- HiiHandle = NULL;
- Status = FindHiiHandleViaDevPath((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), &HiiHandle, HiiDatabase);
- if (EFI_ERROR(Status)) {
- //
- // print out an error.
- //
- TempDevPathString = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), TRUE, TRUE);
- ShellPrintHiiEx(
- -1,
- -1,
- NULL,
- STRING_TOKEN(STR_DRVCFG_IN_FILE_NF),
- gShellDriver1HiiHandle,
- TempDevPathString);
- SHELL_FREE_NON_NULL(TempDevPathString);
- } else {
- Status = HiiDatabase->UpdatePackageList(HiiDatabase, HiiHandle, PackageListHeader);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(
- -1,
- -1,
- NULL,
- STRING_TOKEN(STR_GEN_UEFI_FUNC_WARN),
- gShellDriver1HiiHandle,
- L"drvcfg",
- L"HiiDatabase->UpdatePackageList",
- Status);
- return (SHELL_DEVICE_ERROR);
- } else {
- DevPath = (EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER));
- gBS->LocateDevicePath(&gEfiHiiConfigAccessProtocolGuid, &DevPath, &Handle);
- HandleIndex = ConvertHandleToHandleIndex(Handle);
- ShellPrintHiiEx(
- -1,
- -1,
- NULL,
- STRING_TOKEN(STR_DRVCFG_DONE_HII),
- gShellDriver1HiiHandle,
- HandleIndex);
- }
- }
+ for (PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER *)MainBuffer
+ ; PackageListHeader != NULL && ((CHAR8 *)PackageListHeader) < (((CHAR8 *)MainBuffer)+MainBufferSize)
+ ; PackageListHeader = (EFI_HII_PACKAGE_LIST_HEADER *)(((CHAR8 *)(PackageListHeader)) + PackageListHeader->PackageLength))
+ {
+ for (PackageHeader = (EFI_HII_PACKAGE_HEADER *)(((CHAR8 *)(PackageListHeader))+sizeof (EFI_HII_PACKAGE_LIST_HEADER))
+ ; PackageHeader != NULL && ((CHAR8 *)PackageHeader) < (((CHAR8 *)MainBuffer)+MainBufferSize) && PackageHeader->Type != EFI_HII_PACKAGE_END
+ ; PackageHeader = (EFI_HII_PACKAGE_HEADER *)(((CHAR8 *)(PackageHeader))+PackageHeader->Length))
+ {
+ if (PackageHeader->Type == EFI_HII_PACKAGE_DEVICE_PATH) {
+ HiiHandle = NULL;
+ Status = FindHiiHandleViaDevPath ((EFI_DEVICE_PATH_PROTOCOL *)(((CHAR8 *)PackageHeader) + sizeof (EFI_HII_PACKAGE_HEADER)), &HiiHandle, HiiDatabase);
+ if (EFI_ERROR (Status)) {
+ //
+ // print out an error.
+ //
+ TempDevPathString = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL *)(((CHAR8 *)PackageHeader) + sizeof (EFI_HII_PACKAGE_HEADER)), TRUE, TRUE);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DRVCFG_IN_FILE_NF),
+ gShellDriver1HiiHandle,
+ TempDevPathString
+ );
+ SHELL_FREE_NON_NULL (TempDevPathString);
+ } else {
+ Status = HiiDatabase->UpdatePackageList (HiiDatabase, HiiHandle, PackageListHeader);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN),
+ gShellDriver1HiiHandle,
+ L"drvcfg",
+ L"HiiDatabase->UpdatePackageList",
+ Status
+ );
+ return (SHELL_DEVICE_ERROR);
+ } else {
+ DevPath = (EFI_DEVICE_PATH_PROTOCOL *)(((CHAR8 *)PackageHeader) + sizeof (EFI_HII_PACKAGE_HEADER));
+ gBS->LocateDevicePath (&gEfiHiiConfigAccessProtocolGuid, &DevPath, &Handle);
+ HandleIndex = ConvertHandleToHandleIndex (Handle);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DRVCFG_DONE_HII),
+ gShellDriver1HiiHandle,
+ HandleIndex
+ );
}
+ }
}
+ }
}
}
- SHELL_FREE_NON_NULL(MainBuffer);
-
+ SHELL_FREE_NON_NULL (MainBuffer);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_DRVCFG_COMP),
- gShellDriver1HiiHandle);
+ STRING_TOKEN (STR_DRVCFG_COMP),
+ gShellDriver1HiiHandle
+ );
return (SHELL_SUCCESS);
}
@@ -486,41 +518,41 @@ ShellCmdDriverConfigurationProcessActionRequired ( EFI_HANDLE ConnectControllerContextOverride[2];
switch (ActionRequired) {
- case EfiDriverConfigurationActionNone:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_NONE), gShellDriver1HiiHandle);
- break;
-
- case EfiDriverConfigurationActionStopController:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_STOP), gShellDriver1HiiHandle);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"stop controller");
- ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL);
-
- gBS->DisconnectController (ControllerHandle, DriverImageHandle, ChildHandle);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_CTLR_S), gShellDriver1HiiHandle, L"stopped");
- break;
-
- case EfiDriverConfigurationActionRestartController:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_RESTART_S), gShellDriver1HiiHandle, L"controller");
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"restart controller");
- ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL);
-
- gBS->DisconnectController (ControllerHandle, DriverImageHandle, ChildHandle);
- ConnectControllerContextOverride[0] = DriverImageHandle;
- ConnectControllerContextOverride[1] = NULL;
- gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_CTLR_S), gShellDriver1HiiHandle, L"restarted");
- break;
-
- case EfiDriverConfigurationActionRestartPlatform:
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_RESTART_S), gShellDriver1HiiHandle, L"platform");
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"restart platform");
- ShellPromptForResponse(ShellPromptResponseTypeEnterContinue, NULL, NULL);
-
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- break;
-
- default:
- return (EFI_INVALID_PARAMETER);
+ case EfiDriverConfigurationActionNone:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE), gShellDriver1HiiHandle);
+ break;
+
+ case EfiDriverConfigurationActionStopController:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_STOP), gShellDriver1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"stop controller");
+ ShellPromptForResponse (ShellPromptResponseTypeEnterContinue, NULL, NULL);
+
+ gBS->DisconnectController (ControllerHandle, DriverImageHandle, ChildHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_CTLR_S), gShellDriver1HiiHandle, L"stopped");
+ break;
+
+ case EfiDriverConfigurationActionRestartController:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_RESTART_S), gShellDriver1HiiHandle, L"controller");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"restart controller");
+ ShellPromptForResponse (ShellPromptResponseTypeEnterContinue, NULL, NULL);
+
+ gBS->DisconnectController (ControllerHandle, DriverImageHandle, ChildHandle);
+ ConnectControllerContextOverride[0] = DriverImageHandle;
+ ConnectControllerContextOverride[1] = NULL;
+ gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_CTLR_S), gShellDriver1HiiHandle, L"restarted");
+ break;
+
+ case EfiDriverConfigurationActionRestartPlatform:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_RESTART_S), gShellDriver1HiiHandle, L"platform");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_ENTER_S), gShellDriver1HiiHandle, L"restart platform");
+ ShellPromptForResponse (ShellPromptResponseTypeEnterContinue, NULL, NULL);
+
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ break;
+
+ default:
+ return (EFI_INVALID_PARAMETER);
}
return EFI_SUCCESS;
@@ -544,15 +576,15 @@ ShellCmdDriverConfigurationProcessActionRequired ( **/
SHELL_STATUS
PreHiiDrvCfg (
- IN CONST CHAR8 *Language,
- IN BOOLEAN ForceDefaults,
- IN UINT32 DefaultType,
- IN BOOLEAN AllChildren,
- IN BOOLEAN ValidateOptions,
- IN BOOLEAN SetOptions,
- IN EFI_HANDLE DriverImageHandle,
- IN EFI_HANDLE DeviceHandle,
- IN EFI_HANDLE ChildHandle
+ IN CONST CHAR8 *Language,
+ IN BOOLEAN ForceDefaults,
+ IN UINT32 DefaultType,
+ IN BOOLEAN AllChildren,
+ IN BOOLEAN ValidateOptions,
+ IN BOOLEAN SetOptions,
+ IN EFI_HANDLE DriverImageHandle,
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_HANDLE ChildHandle
)
{
EFI_STATUS Status;
@@ -578,44 +610,50 @@ PreHiiDrvCfg ( ShellStatus = SHELL_SUCCESS;
- if (ChildHandle == NULL && AllChildren) {
+ if ((ChildHandle == NULL) && AllChildren) {
SetOptions = FALSE;
}
if (ForceDefaults) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_FORCE_D),
gShellDriver1HiiHandle,
- DefaultType);
+ DefaultType
+ );
} else if (ValidateOptions) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_VALIDATE),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
} else if (SetOptions) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_SET),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
}
if (DriverImageHandle == 0) {
- DriverImageHandleBuffer = GetHandleListByProtocolList(CfgGuidList);
+ DriverImageHandleBuffer = GetHandleListByProtocolList (CfgGuidList);
if (DriverImageHandleBuffer == NULL) {
ShellStatus = SHELL_NOT_FOUND;
goto Done;
}
+
for (
- HandleBuffer = DriverImageHandleBuffer, DriverImageHandleCount = 0
- ; HandleBuffer != NULL && *HandleBuffer != NULL
- ; HandleBuffer++,DriverImageHandleCount++);
+ HandleBuffer = DriverImageHandleBuffer, DriverImageHandleCount = 0
+ ; HandleBuffer != NULL && *HandleBuffer != NULL
+ ; HandleBuffer++, DriverImageHandleCount++)
+ {
+ }
} else {
DriverImageHandleCount = 1;
//
@@ -629,47 +667,48 @@ PreHiiDrvCfg ( for (OuterLoopCounter = 0; OuterLoopCounter < DriverImageHandleCount; OuterLoopCounter++) {
Iso639Language = FALSE;
- Status = gBS->OpenProtocol (
- DriverImageHandleBuffer[OuterLoopCounter],
- &gEfiDriverConfiguration2ProtocolGuid,
- (VOID **) &DriverConfiguration,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ Status = gBS->OpenProtocol (
+ DriverImageHandleBuffer[OuterLoopCounter],
+ &gEfiDriverConfiguration2ProtocolGuid,
+ (VOID **)&DriverConfiguration,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
Iso639Language = TRUE;
- Status = gBS->OpenProtocol (
- DriverImageHandleBuffer[OuterLoopCounter],
- &gEfiDriverConfigurationProtocolGuid,
- (VOID **) &DriverConfiguration,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ Status = gBS->OpenProtocol (
+ DriverImageHandleBuffer[OuterLoopCounter],
+ &gEfiDriverConfigurationProtocolGuid,
+ (VOID **)&DriverConfiguration,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
}
+
if (EFI_ERROR (Status)) {
-// ShellPrintHiiEx(
-// -1,
-// -1,
-// NULL,
-// STRING_TOKEN (STR_DRVCFG_NOT_SUPPORT),
-// gShellDriver1HiiHandle,
-// ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter])
-// );
+ // ShellPrintHiiEx(
+ // -1,
+ // -1,
+ // NULL,
+ // STRING_TOKEN (STR_DRVCFG_NOT_SUPPORT),
+ // gShellDriver1HiiHandle,
+ // ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter])
+ // );
ShellStatus = SHELL_UNSUPPORTED;
continue;
}
BestLanguage = GetBestLanguage (
- DriverConfiguration->SupportedLanguages,
- Iso639Language,
- Language!=NULL?Language:"",
- DriverConfiguration->SupportedLanguages,
- NULL
- );
+ DriverConfiguration->SupportedLanguages,
+ Iso639Language,
+ Language != NULL ? Language : "",
+ DriverConfiguration->SupportedLanguages,
+ NULL
+ );
if (BestLanguage == NULL) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -683,18 +722,17 @@ PreHiiDrvCfg ( }
Status = ParseHandleDatabaseByRelationshipWithType (
- DriverImageHandleBuffer[OuterLoopCounter],
- NULL,
- &HandleCount,
- &HandleBuffer,
- &HandleType
- );
+ DriverImageHandleBuffer[OuterLoopCounter],
+ NULL,
+ &HandleCount,
+ &HandleBuffer,
+ &HandleType
+ );
if (EFI_ERROR (Status)) {
continue;
}
- if (SetOptions && DeviceHandle == NULL) {
-
+ if (SetOptions && (DeviceHandle == NULL)) {
gST->ConOut->ClearScreen (gST->ConOut);
Status = DriverConfiguration->SetOptions (
DriverConfiguration,
@@ -705,7 +743,7 @@ PreHiiDrvCfg ( );
gST->ConOut->ClearScreen (gST->ConOut);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -715,12 +753,13 @@ PreHiiDrvCfg ( DriverConfiguration->SupportedLanguages
);
if (!EFI_ERROR (Status)) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_OPTIONS_SET),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
for (LoopCounter = 0; LoopCounter < HandleCount; LoopCounter++) {
if ((HandleType[LoopCounter] & HR_CONTROLLER_HANDLE) == HR_CONTROLLER_HANDLE) {
ShellCmdDriverConfigurationProcessActionRequired (
@@ -732,14 +771,16 @@ PreHiiDrvCfg ( }
}
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_NOT_SET),
gShellDriver1HiiHandle,
- Status);
+ Status
+ );
}
+
continue;
}
@@ -747,13 +788,15 @@ PreHiiDrvCfg ( if ((HandleType[LoopCounter] & HR_CONTROLLER_HANDLE) != HR_CONTROLLER_HANDLE) {
continue;
}
- if (DeviceHandle != NULL && DeviceHandle != HandleBuffer[LoopCounter]) {
+
+ if ((DeviceHandle != NULL) && (DeviceHandle != HandleBuffer[LoopCounter])) {
continue;
}
+
if (ChildHandle == NULL) {
HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]);
HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -774,12 +817,13 @@ PreHiiDrvCfg ( );
if (!EFI_ERROR (Status)) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_DEF_FORCED),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
ShellCmdDriverConfigurationProcessActionRequired (
DriverImageHandleBuffer[OuterLoopCounter],
HandleBuffer[LoopCounter],
@@ -787,15 +831,16 @@ PreHiiDrvCfg ( ActionRequired
);
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_FORCE_FAILED),
gShellDriver1HiiHandle,
- Status);
- ShellStatus = SHELL_DEVICE_ERROR;
- }
+ Status
+ );
+ ShellStatus = SHELL_DEVICE_ERROR;
+ }
} else if (ValidateOptions) {
Status = DriverConfiguration->OptionsValid (
DriverConfiguration,
@@ -804,20 +849,22 @@ PreHiiDrvCfg ( );
if (!EFI_ERROR (Status)) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_OPTIONS_VALID),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_OPTIONS_INV),
gShellDriver1HiiHandle,
- Status);
+ Status
+ );
ShellStatus = SHELL_DEVICE_ERROR;
}
} else if (SetOptions) {
@@ -832,7 +879,7 @@ PreHiiDrvCfg ( gST->ConOut->ClearScreen (gST->ConOut);
HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]);
HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -843,12 +890,13 @@ PreHiiDrvCfg ( DriverConfiguration->SupportedLanguages
);
if (!EFI_ERROR (Status)) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_OPTIONS_SET),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
ShellCmdDriverConfigurationProcessActionRequired (
DriverImageHandleBuffer[OuterLoopCounter],
@@ -856,15 +904,15 @@ PreHiiDrvCfg ( NULL,
ActionRequired
);
-
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_NOT_SET),
gShellDriver1HiiHandle,
- Status);
+ Status
+ );
ShellStatus = SHELL_DEVICE_ERROR;
}
} else {
@@ -872,35 +920,34 @@ PreHiiDrvCfg ( }
}
- if (ChildHandle == NULL && !AllChildren) {
+ if ((ChildHandle == NULL) && !AllChildren) {
continue;
}
Status = ParseHandleDatabaseByRelationshipWithType (
- DriverImageHandleBuffer[OuterLoopCounter],
- HandleBuffer[LoopCounter],
- &ChildHandleCount,
- &ChildHandleBuffer,
- &ChildHandleType
- );
+ DriverImageHandleBuffer[OuterLoopCounter],
+ HandleBuffer[LoopCounter],
+ &ChildHandleCount,
+ &ChildHandleBuffer,
+ &ChildHandleType
+ );
if (EFI_ERROR (Status)) {
continue;
}
for (ChildIndex = 0; ChildIndex < ChildHandleCount; ChildIndex++) {
-
if ((ChildHandleType[ChildIndex] & HR_CHILD_HANDLE) != HR_CHILD_HANDLE) {
continue;
}
- if (ChildHandle != NULL && ChildHandle != ChildHandleBuffer[ChildIndex]) {
+ if ((ChildHandle != NULL) && (ChildHandle != ChildHandleBuffer[ChildIndex])) {
continue;
}
HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]);
HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]);
HandleIndex3 = ConvertHandleToHandleIndex (ChildHandleBuffer[ChildIndex]);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -909,7 +956,8 @@ PreHiiDrvCfg ( HandleIndex1,
HandleIndex2,
HandleIndex3,
- DriverConfiguration->SupportedLanguages);
+ DriverConfiguration->SupportedLanguages
+ );
if (ForceDefaults) {
Status = DriverConfiguration->ForceDefaults (
@@ -921,12 +969,13 @@ PreHiiDrvCfg ( );
if (!EFI_ERROR (Status)) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_DEF_FORCED),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
ShellCmdDriverConfigurationProcessActionRequired (
DriverImageHandleBuffer[OuterLoopCounter],
@@ -934,15 +983,15 @@ PreHiiDrvCfg ( ChildHandleBuffer[ChildIndex],
ActionRequired
);
-
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_FORCE_FAILED),
gShellDriver1HiiHandle,
- Status);
+ Status
+ );
ShellStatus = SHELL_DEVICE_ERROR;
}
} else if (ValidateOptions) {
@@ -953,20 +1002,22 @@ PreHiiDrvCfg ( );
if (!EFI_ERROR (Status)) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_OPTIONS_VALID),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_OPTIONS_INV),
gShellDriver1HiiHandle,
- Status);
+ Status
+ );
ShellStatus = SHELL_DEVICE_ERROR;
}
} else if (SetOptions) {
@@ -982,7 +1033,7 @@ PreHiiDrvCfg ( HandleIndex1 = ConvertHandleToHandleIndex (DriverImageHandleBuffer[OuterLoopCounter]);
HandleIndex2 = ConvertHandleToHandleIndex (HandleBuffer[LoopCounter]);
HandleIndex3 = ConvertHandleToHandleIndex (ChildHandleBuffer[ChildIndex]);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -994,12 +1045,13 @@ PreHiiDrvCfg ( DriverConfiguration->SupportedLanguages
);
if (!EFI_ERROR (Status)) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_OPTIONS_SET),
- gShellDriver1HiiHandle);
+ gShellDriver1HiiHandle
+ );
ShellCmdDriverConfigurationProcessActionRequired (
DriverImageHandleBuffer[OuterLoopCounter],
@@ -1007,15 +1059,15 @@ PreHiiDrvCfg ( ChildHandleBuffer[ChildIndex],
ActionRequired
);
-
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_NOT_SET),
gShellDriver1HiiHandle,
- Status);
+ Status
+ );
ShellStatus = SHELL_DEVICE_ERROR;
}
} else {
@@ -1032,7 +1084,7 @@ PreHiiDrvCfg ( FreePool (HandleType);
}
- if (DriverImageHandle != NULL && DriverImageHandleCount != 0) {
+ if ((DriverImageHandle != NULL) && (DriverImageHandleCount != 0)) {
FreePool (DriverImageHandleBuffer);
}
@@ -1050,31 +1102,30 @@ Done: @retval SHELL_SUCCESS The operation was successful.
**/
SHELL_STATUS
-PrintConfigInfoOnAll(
- IN CONST BOOLEAN ChildrenToo,
- IN CONST CHAR8 *Language,
- IN CONST BOOLEAN UseHii
+PrintConfigInfoOnAll (
+ IN CONST BOOLEAN ChildrenToo,
+ IN CONST CHAR8 *Language,
+ IN CONST BOOLEAN UseHii
)
{
- EFI_HANDLE *HandleList;
- EFI_HANDLE *CurrentHandle;
- BOOLEAN Found;
- UINTN Index2;
+ EFI_HANDLE *HandleList;
+ EFI_HANDLE *CurrentHandle;
+ BOOLEAN Found;
+ UINTN Index2;
-
- Found = FALSE;
- HandleList = NULL;
- CurrentHandle = NULL;
+ Found = FALSE;
+ HandleList = NULL;
+ CurrentHandle = NULL;
if (UseHii) {
//
// HII method
//
- HandleList = GetHandleListByProtocol(&gEfiHiiConfigAccessProtocolGuid);
- for (CurrentHandle = HandleList ; CurrentHandle != NULL && *CurrentHandle != NULL; CurrentHandle++){
- Found = TRUE;
- Index2 = *CurrentHandle == NULL ? 0 : ConvertHandleToHandleIndex(*CurrentHandle);
- ShellPrintHiiEx(
+ HandleList = GetHandleListByProtocol (&gEfiHiiConfigAccessProtocolGuid);
+ for (CurrentHandle = HandleList; CurrentHandle != NULL && *CurrentHandle != NULL; CurrentHandle++) {
+ Found = TRUE;
+ Index2 = *CurrentHandle == NULL ? 0 : ConvertHandleToHandleIndex (*CurrentHandle);
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -1083,46 +1134,49 @@ PrintConfigInfoOnAll( Index2
);
}
- SHELL_FREE_NON_NULL(HandleList);
+
+ SHELL_FREE_NON_NULL (HandleList);
}
if (PreHiiDrvCfg (
- Language,
- FALSE,
- 0,
- ChildrenToo,
- FALSE,
- FALSE,
- 0,
- 0,
- 0) == SHELL_SUCCESS) {
- Found = TRUE;
+ Language,
+ FALSE,
+ 0,
+ ChildrenToo,
+ FALSE,
+ FALSE,
+ 0,
+ 0,
+ 0
+ ) == SHELL_SUCCESS)
+ {
+ Found = TRUE;
}
if (!Found) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE_FOUND), gShellDriver1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE_FOUND), gShellDriver1HiiHandle);
return (SHELL_SUCCESS);
}
return (SHELL_SUCCESS);
}
-STATIC CONST SHELL_PARAM_ITEM ParamListHii[] = {
- {L"-s", TypeFlag},
- {L"-l", TypeValue},
- {L"-f", TypeValue},
- {L"-o", TypeValue},
- {L"-i", TypeValue},
- {NULL, TypeMax}
- };
-STATIC CONST SHELL_PARAM_ITEM ParamListPreHii[] = {
- {L"-c", TypeFlag},
- {L"-s", TypeFlag},
- {L"-v", TypeFlag},
- {L"-l", TypeValue},
- {L"-f", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamListHii[] = {
+ { L"-s", TypeFlag },
+ { L"-l", TypeValue },
+ { L"-f", TypeValue },
+ { L"-o", TypeValue },
+ { L"-i", TypeValue },
+ { NULL, TypeMax }
+};
+STATIC CONST SHELL_PARAM_ITEM ParamListPreHii[] = {
+ { L"-c", TypeFlag },
+ { L"-s", TypeFlag },
+ { L"-v", TypeFlag },
+ { L"-l", TypeValue },
+ { L"-f", TypeValue },
+ { NULL, TypeMax }
+};
/**
Function for 'drvcfg' command.
@@ -1137,150 +1191,161 @@ ShellCommandRunDrvCfg ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CHAR8 *Language;
- CONST CHAR16 *Lang;
- CONST CHAR16 *HandleIndex1;
- CONST CHAR16 *HandleIndex2;
- CONST CHAR16 *HandleIndex3;
- CONST CHAR16 *ForceTypeString;
- BOOLEAN Force;
- BOOLEAN Set;
- BOOLEAN Validate;
- BOOLEAN InFromFile;
- BOOLEAN OutToFile;
- BOOLEAN AllChildren;
- BOOLEAN UseHii;
- UINT32 ForceType;
- UINT64 Intermediate;
- EFI_HANDLE Handle1;
- EFI_HANDLE Handle2;
- EFI_HANDLE Handle3;
- CONST CHAR16 *FileName;
-
- ShellStatus = SHELL_SUCCESS;
- Status = EFI_SUCCESS;
- Language = NULL;
- UseHii = TRUE;
- ProblemParam = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CHAR8 *Language;
+ CONST CHAR16 *Lang;
+ CONST CHAR16 *HandleIndex1;
+ CONST CHAR16 *HandleIndex2;
+ CONST CHAR16 *HandleIndex3;
+ CONST CHAR16 *ForceTypeString;
+ BOOLEAN Force;
+ BOOLEAN Set;
+ BOOLEAN Validate;
+ BOOLEAN InFromFile;
+ BOOLEAN OutToFile;
+ BOOLEAN AllChildren;
+ BOOLEAN UseHii;
+ UINT32 ForceType;
+ UINT64 Intermediate;
+ EFI_HANDLE Handle1;
+ EFI_HANDLE Handle2;
+ EFI_HANDLE Handle3;
+ CONST CHAR16 *FileName;
+
+ ShellStatus = SHELL_SUCCESS;
+ Status = EFI_SUCCESS;
+ Language = NULL;
+ UseHii = TRUE;
+ ProblemParam = NULL;
//
// 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 (ParamListHii, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status) || ShellCommandLineGetCount(Package) > 2) {
+ if (EFI_ERROR (Status) || (ShellCommandLineGetCount (Package) > 2)) {
UseHii = FALSE;
if (Package != NULL) {
ShellCommandLineFreeVarList (Package);
}
- SHELL_FREE_NON_NULL(ProblemParam);
+
+ SHELL_FREE_NON_NULL (ProblemParam);
Status = ShellCommandLineParse (ParamListPreHii, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvcfg", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvcfg", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
}
}
+
if (ShellStatus == SHELL_SUCCESS) {
- if (ShellCommandLineGetCount(Package) > 4) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drvcfg");
+ if (ShellCommandLineGetCount (Package) > 4) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drvcfg");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- Lang = ShellCommandLineGetValue(Package, L"-l");
+
+ Lang = ShellCommandLineGetValue (Package, L"-l");
if (Lang != NULL) {
- Language = AllocateZeroPool(StrSize(Lang));
- AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
- } else if (ShellCommandLineGetFlag(Package, L"-l")){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-l");
+ Language = AllocateZeroPool (StrSize (Lang));
+ AsciiSPrint (Language, StrSize (Lang), "%S", Lang);
+ } else if (ShellCommandLineGetFlag (Package, L"-l")) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-l");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- Set = ShellCommandLineGetFlag (Package, L"-s");
- Validate = ShellCommandLineGetFlag (Package, L"-v");
- InFromFile = ShellCommandLineGetFlag (Package, L"-i");
- OutToFile = ShellCommandLineGetFlag (Package, L"-o");
- AllChildren = ShellCommandLineGetFlag (Package, L"-c");
- Force = ShellCommandLineGetFlag (Package, L"-f");
- ForceTypeString = ShellCommandLineGetValue(Package, L"-f");
+
+ Set = ShellCommandLineGetFlag (Package, L"-s");
+ Validate = ShellCommandLineGetFlag (Package, L"-v");
+ InFromFile = ShellCommandLineGetFlag (Package, L"-i");
+ OutToFile = ShellCommandLineGetFlag (Package, L"-o");
+ AllChildren = ShellCommandLineGetFlag (Package, L"-c");
+ Force = ShellCommandLineGetFlag (Package, L"-f");
+ ForceTypeString = ShellCommandLineGetValue (Package, L"-f");
if (OutToFile) {
- FileName = ShellCommandLineGetValue(Package, L"-o");
+ FileName = ShellCommandLineGetValue (Package, L"-o");
} else if (InFromFile) {
- FileName = ShellCommandLineGetValue(Package, L"-i");
+ FileName = ShellCommandLineGetValue (Package, L"-i");
} else {
FileName = NULL;
}
- if (InFromFile && EFI_ERROR(ShellFileExists(FileName))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FIND_FAIL), gShellDriver1HiiHandle, L"drvcfg", FileName);
+ if (InFromFile && EFI_ERROR (ShellFileExists (FileName))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FIND_FAIL), gShellDriver1HiiHandle, L"drvcfg", FileName);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- if (OutToFile && !EFI_ERROR(ShellFileExists(FileName))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_EXIST), gShellDriver1HiiHandle, L"drvcfg", FileName);
+
+ if (OutToFile && !EFI_ERROR (ShellFileExists (FileName))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_EXIST), gShellDriver1HiiHandle, L"drvcfg", FileName);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
- if (Force && ForceTypeString == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-f");
+
+ if (Force && (ForceTypeString == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-f");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+
if (Force) {
- Status = ShellConvertStringToUint64(ForceTypeString, &Intermediate, FALSE, FALSE);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDriver1HiiHandle, L"drvcfg", ForceTypeString, L"-f");
+ Status = ShellConvertStringToUint64 (ForceTypeString, &Intermediate, FALSE, FALSE);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDriver1HiiHandle, L"drvcfg", ForceTypeString, L"-f");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+
ForceType = (UINT32)Intermediate;
} else {
ForceType = 0;
}
- HandleIndex1 = ShellCommandLineGetRawValue(Package, 1);
- Handle1 = NULL;
- if (HandleIndex1 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex1, &Intermediate, TRUE, FALSE))) {
- Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate);
- if (Handle1 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex1);
+
+ HandleIndex1 = ShellCommandLineGetRawValue (Package, 1);
+ Handle1 = NULL;
+ if ((HandleIndex1 != NULL) && !EFI_ERROR (ShellConvertStringToUint64 (HandleIndex1, &Intermediate, TRUE, FALSE))) {
+ Handle1 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
+ if ((Handle1 == NULL) || ((UINT64)(UINTN)Intermediate != Intermediate)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex1);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
}
- HandleIndex2 = ShellCommandLineGetRawValue(Package, 2);
- Handle2 = NULL;
- if (HandleIndex2 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex2, &Intermediate, TRUE, FALSE))) {
- Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate);
- if (Handle2 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex2);
+
+ HandleIndex2 = ShellCommandLineGetRawValue (Package, 2);
+ Handle2 = NULL;
+ if ((HandleIndex2 != NULL) && !EFI_ERROR (ShellConvertStringToUint64 (HandleIndex2, &Intermediate, TRUE, FALSE))) {
+ Handle2 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
+ if ((Handle2 == NULL) || ((UINT64)(UINTN)Intermediate != Intermediate)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex2);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
}
- HandleIndex3 = ShellCommandLineGetRawValue(Package, 3);
- Handle3 = NULL;
- if (HandleIndex3 != NULL && !EFI_ERROR(ShellConvertStringToUint64(HandleIndex3, &Intermediate, TRUE, FALSE))) {
- Handle3 = ConvertHandleIndexToHandle((UINTN)Intermediate);
- if (Handle3 == NULL || (UINT64)(UINTN)Intermediate != Intermediate) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex3);
+
+ HandleIndex3 = ShellCommandLineGetRawValue (Package, 3);
+ Handle3 = NULL;
+ if ((HandleIndex3 != NULL) && !EFI_ERROR (ShellConvertStringToUint64 (HandleIndex3, &Intermediate, TRUE, FALSE))) {
+ Handle3 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
+ if ((Handle3 == NULL) || ((UINT64)(UINTN)Intermediate != Intermediate)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"drvcfg", HandleIndex3);
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
@@ -1288,42 +1353,49 @@ ShellCommandRunDrvCfg ( if ((InFromFile || OutToFile) && (FileName == NULL)) {
if (FileName == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", InFromFile?L"-i":L"-o");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", InFromFile ? L"-i" : L"-o");
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_REQ), gShellDriver1HiiHandle, L"drvcfg");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_REQ), gShellDriver1HiiHandle, L"drvcfg");
}
+
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+
if (!UseHii && (InFromFile || OutToFile)) {
if (InFromFile) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDriver1HiiHandle, L"drvcfg", L"-i");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDriver1HiiHandle, L"drvcfg", L"-i");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+
if (OutToFile) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDriver1HiiHandle, L"drvcfg", L"-o");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDriver1HiiHandle, L"drvcfg", L"-o");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
}
+
if (Validate && Force) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-v", L"-f");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-v", L"-f");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+
if (Validate && Set) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-v", L"-s");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-v", L"-s");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+
if (Set && Force) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-s", L"-f");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-s", L"-f");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+
if (OutToFile && InFromFile) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-i", L"-o");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDriver1HiiHandle, L"drvcfg", L"-i", L"-o");
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
@@ -1332,7 +1404,7 @@ ShellCommandRunDrvCfg ( // We do HII first.
//
if (UseHii) {
- if (Handle1 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiHiiConfigAccessProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+ if ((Handle1 != NULL) && EFI_ERROR (gBS->OpenProtocol (Handle1, &gEfiHiiConfigAccessProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
//
// no HII on this handle.
//
@@ -1341,30 +1413,30 @@ ShellCommandRunDrvCfg ( } else if (Force) {
} else if (Set) {
} else if (InFromFile) {
- ShellStatus = ConfigFromFile(Handle1, FileName);
- if (Handle1 != NULL && ShellStatus == SHELL_SUCCESS) {
+ ShellStatus = ConfigFromFile (Handle1, FileName);
+ if ((Handle1 != NULL) && (ShellStatus == SHELL_SUCCESS)) {
goto Done;
}
} else if (OutToFile) {
- ShellStatus = ConfigToFile(Handle1, FileName);
- if (Handle1 != NULL && ShellStatus == SHELL_SUCCESS) {
+ ShellStatus = ConfigToFile (Handle1, FileName);
+ if ((Handle1 != NULL) && (ShellStatus == SHELL_SUCCESS)) {
goto Done;
}
} else if (HandleIndex1 == NULL) {
//
// display all that are configurable
//
- ShellStatus = PrintConfigInfoOnAll(AllChildren, Language, UseHii);
+ ShellStatus = PrintConfigInfoOnAll (AllChildren, Language, UseHii);
goto Done;
} else {
- if (!EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiHiiConfigAccessProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
- ShellPrintHiiEx(
+ if (!EFI_ERROR (gBS->OpenProtocol (Handle1, &gEfiHiiConfigAccessProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_LINE_HII),
gShellDriver1HiiHandle,
- ConvertHandleToHandleIndex(Handle1)
+ ConvertHandleToHandleIndex (Handle1)
);
goto Done;
}
@@ -1376,31 +1448,32 @@ ShellCommandRunDrvCfg ( //
if (!InFromFile && !OutToFile) {
ShellStatus = PreHiiDrvCfg (
- Language,
- Force,
- ForceType,
- AllChildren,
- Validate,
- Set,
- Handle1,
- Handle2,
- Handle3);
+ Language,
+ Force,
+ ForceType,
+ AllChildren,
+ Validate,
+ Set,
+ Handle1,
+ Handle2,
+ Handle3
+ );
}
if (ShellStatus == SHELL_UNSUPPORTED) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_DRVCFG_NOT_SUPPORT),
gShellDriver1HiiHandle,
- ConvertHandleToHandleIndex(Handle1)
+ ConvertHandleToHandleIndex (Handle1)
);
}
}
Done:
ShellCommandLineFreeVarList (Package);
- SHELL_FREE_NON_NULL(Language);
+ SHELL_FREE_NON_NULL (Language);
return (ShellStatus);
}
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c index ec25e2bdee..c645c9fd68 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c @@ -9,7 +9,7 @@ #include "UefiShellDriver1CommandsLib.h"
-STATIC CONST EFI_GUID *DiagGuidList[] = {&gEfiDriverDiagnosticsProtocolGuid, &gEfiDriverDiagnostics2ProtocolGuid, NULL};
+STATIC CONST EFI_GUID *DiagGuidList[] = { &gEfiDriverDiagnosticsProtocolGuid, &gEfiDriverDiagnostics2ProtocolGuid, NULL };
//
// We need 1 more item on the list...
//
@@ -37,91 +37,96 @@ typedef enum { **/
EFI_STATUS
DoDiagnostics (
- IN CONST DRV_DIAG_TEST_MODE Mode,
- IN CONST CHAR8 *Lang,
- IN CONST BOOLEAN AllChilds,
- IN CONST EFI_HANDLE DriverHandle,
- IN CONST EFI_HANDLE ControllerHandle,
- IN CONST EFI_HANDLE ChildHandle
+ IN CONST DRV_DIAG_TEST_MODE Mode,
+ IN CONST CHAR8 *Lang,
+ IN CONST BOOLEAN AllChilds,
+ IN CONST EFI_HANDLE DriverHandle,
+ IN CONST EFI_HANDLE ControllerHandle,
+ IN CONST EFI_HANDLE ChildHandle
)
{
- EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics;
- EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2;
- EFI_HANDLE *DriverHandleList;
- EFI_HANDLE *ControllerHandleList;
- EFI_HANDLE *ChildHandleList;
- EFI_HANDLE *Walker;
- UINTN DriverHandleListCount;
- UINTN ControllerHandleListCount;
- UINTN ChildHandleListCount;
- UINTN DriverHandleListLoop;
- UINTN ControllerHandleListLoop;
- UINTN ChildHandleListLoop;
- EFI_STATUS Status;
- EFI_STATUS Status2;
- EFI_GUID *ErrorType;
- UINTN OutBufferSize;
- CHAR16 *OutBuffer;
- UINTN HandleIndex1;
- UINTN HandleIndex2;
- CHAR8 *Language;
- BOOLEAN Found;
-
- if ((ChildHandle != NULL && AllChilds) || (Mode >= TestModeMax)){
+ EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics;
+ EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2;
+ EFI_HANDLE *DriverHandleList;
+ EFI_HANDLE *ControllerHandleList;
+ EFI_HANDLE *ChildHandleList;
+ EFI_HANDLE *Walker;
+ UINTN DriverHandleListCount;
+ UINTN ControllerHandleListCount;
+ UINTN ChildHandleListCount;
+ UINTN DriverHandleListLoop;
+ UINTN ControllerHandleListLoop;
+ UINTN ChildHandleListLoop;
+ EFI_STATUS Status;
+ EFI_STATUS Status2;
+ EFI_GUID *ErrorType;
+ UINTN OutBufferSize;
+ CHAR16 *OutBuffer;
+ UINTN HandleIndex1;
+ UINTN HandleIndex2;
+ CHAR8 *Language;
+ BOOLEAN Found;
+
+ if (((ChildHandle != NULL) && AllChilds) || (Mode >= TestModeMax)) {
return (EFI_INVALID_PARAMETER);
}
- DriverDiagnostics = NULL;
- DriverDiagnostics2 = NULL;
- Status = EFI_SUCCESS;
- Status2 = EFI_SUCCESS;
- DriverHandleList = NULL;
- ControllerHandleList = NULL;
- ChildHandleList = NULL;
- Language = NULL;
- OutBuffer = NULL;
- ErrorType = NULL;
- DriverHandleListCount = 0;
- ControllerHandleListCount = 0;
- ChildHandleListCount = 0;
+ DriverDiagnostics = NULL;
+ DriverDiagnostics2 = NULL;
+ Status = EFI_SUCCESS;
+ Status2 = EFI_SUCCESS;
+ DriverHandleList = NULL;
+ ControllerHandleList = NULL;
+ ChildHandleList = NULL;
+ Language = NULL;
+ OutBuffer = NULL;
+ ErrorType = NULL;
+ DriverHandleListCount = 0;
+ ControllerHandleListCount = 0;
+ ChildHandleListCount = 0;
if (DriverHandle != NULL) {
- DriverHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE));
+ DriverHandleList = AllocateZeroPool (2*sizeof (EFI_HANDLE));
if (DriverHandleList == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- DriverHandleList[0] = DriverHandle;
+
+ DriverHandleList[0] = DriverHandle;
DriverHandleListCount = 1;
} else {
- DriverHandleList = GetHandleListByProtocolList(DiagGuidList);
+ DriverHandleList = GetHandleListByProtocolList (DiagGuidList);
if (DriverHandleList == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"drvdiag", L"gEfiDriverDiagnosticsProtocolGuid", &gEfiDriverDiagnosticsProtocolGuid);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"drvdiag", L"gEfiDriverDiagnostics2ProtocolGuid", &gEfiDriverDiagnostics2ProtocolGuid);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"drvdiag", L"gEfiDriverDiagnosticsProtocolGuid", &gEfiDriverDiagnosticsProtocolGuid);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellDriver1HiiHandle, L"drvdiag", L"gEfiDriverDiagnostics2ProtocolGuid", &gEfiDriverDiagnostics2ProtocolGuid);
return (EFI_NOT_FOUND);
}
- for (Walker = DriverHandleList ; Walker != NULL && *Walker != NULL ; DriverHandleListCount++, Walker++);
+
+ for (Walker = DriverHandleList; Walker != NULL && *Walker != NULL; DriverHandleListCount++, Walker++) {
+ }
}
if (ControllerHandle != NULL) {
- ControllerHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE));
+ ControllerHandleList = AllocateZeroPool (2*sizeof (EFI_HANDLE));
if (ControllerHandleList == NULL) {
SHELL_FREE_NON_NULL (DriverHandleList);
return EFI_OUT_OF_RESOURCES;
}
- ControllerHandleList[0] = ControllerHandle;
+
+ ControllerHandleList[0] = ControllerHandle;
ControllerHandleListCount = 1;
} else {
ControllerHandleList = NULL;
}
if (ChildHandle != NULL) {
- ChildHandleList = AllocateZeroPool(2*sizeof(EFI_HANDLE));
+ ChildHandleList = AllocateZeroPool (2*sizeof (EFI_HANDLE));
if (ChildHandleList == NULL) {
SHELL_FREE_NON_NULL (ControllerHandleList);
SHELL_FREE_NON_NULL (DriverHandleList);
return EFI_OUT_OF_RESOURCES;
}
- ChildHandleList[0] = ChildHandle;
+
+ ChildHandleList[0] = ChildHandle;
ChildHandleListCount = 1;
} else if (AllChilds) {
ChildHandleList = NULL;
@@ -133,98 +138,114 @@ DoDiagnostics ( }
if (Mode == TestModeList) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_HEADER), gShellDriver1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_HEADER), gShellDriver1HiiHandle);
}
+
for (DriverHandleListLoop = 0
- ; DriverHandleListLoop < DriverHandleListCount
- ; DriverHandleListLoop++
- ){
+ ; DriverHandleListLoop < DriverHandleListCount
+ ; DriverHandleListLoop++
+ )
+ {
if (Mode == TestModeList) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_HEADER), gShellDriver1HiiHandle, ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_HEADER), gShellDriver1HiiHandle, ConvertHandleToHandleIndex (DriverHandleList[DriverHandleListLoop]));
}
+
if (ControllerHandle == NULL) {
- PARSE_HANDLE_DATABASE_DEVICES(DriverHandleList[DriverHandleListLoop], &ControllerHandleListCount, &ControllerHandleList);
+ PARSE_HANDLE_DATABASE_DEVICES (DriverHandleList[DriverHandleListLoop], &ControllerHandleListCount, &ControllerHandleList);
}
+
if (ControllerHandleListCount == 0) {
if (Mode == TestModeList) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_NO_HANDLES), gShellDriver1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DRVDIAG_DRIVER_NO_HANDLES), gShellDriver1HiiHandle);
}
} else {
if (Mode == TestModeList) {
- ShellPrintEx(-1, -1, L"\r\n");
+ ShellPrintEx (-1, -1, L"\r\n");
}
+
for (ControllerHandleListLoop = 0
- ; ControllerHandleListLoop < ControllerHandleListCount
- ; ControllerHandleListLoop++
- ){
+ ; ControllerHandleListLoop < ControllerHandleListCount
+ ; ControllerHandleListLoop++
+ )
+ {
if (AllChilds) {
- ASSERT(ChildHandleList == NULL);
- PARSE_HANDLE_DATABASE_MANAGED_CHILDREN(
+ ASSERT (ChildHandleList == NULL);
+ PARSE_HANDLE_DATABASE_MANAGED_CHILDREN (
DriverHandleList[DriverHandleListLoop],
ControllerHandleList[ControllerHandleListLoop],
&ChildHandleListCount,
- &ChildHandleList);
+ &ChildHandleList
+ );
}
+
for (ChildHandleListLoop = 0
- ; (ChildHandleListLoop < ChildHandleListCount || ChildHandleList == NULL)
- ; ChildHandleListLoop++
- ){
+ ; (ChildHandleListLoop < ChildHandleListCount || ChildHandleList == NULL)
+ ; ChildHandleListLoop++
+ )
+ {
Found = FALSE;
if (Mode != TestModeList) {
- if (Lang == NULL || Lang[2] == '-') {
+ if ((Lang == NULL) || (Lang[2] == '-')) {
//
// Get the protocol pointer and call the function
//
- Status = gBS->OpenProtocol(
- DriverHandleList[DriverHandleListLoop],
- &gEfiDriverDiagnostics2ProtocolGuid,
- (VOID**)&DriverDiagnostics2,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status) && (DriverDiagnostics2 != NULL)) {
- Language = GetBestLanguageForDriver(DriverDiagnostics2->SupportedLanguages, Lang, FALSE);
- Found = TRUE;
- Status = DriverDiagnostics2->RunDiagnostics(
- DriverDiagnostics2,
- ControllerHandleList[ControllerHandleListLoop],
- ChildHandleList == NULL?NULL:ChildHandleList[ChildHandleListLoop],
- (EFI_DRIVER_DIAGNOSTIC_TYPE)Mode,
- Language,
- &ErrorType,
- &OutBufferSize,
- &OutBuffer);
- FreePool(Language);
+ Status = gBS->OpenProtocol (
+ DriverHandleList[DriverHandleListLoop],
+ &gEfiDriverDiagnostics2ProtocolGuid,
+ (VOID **)&DriverDiagnostics2,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status) && (DriverDiagnostics2 != NULL)) {
+ Language = GetBestLanguageForDriver (DriverDiagnostics2->SupportedLanguages, Lang, FALSE);
+ Found = TRUE;
+ Status = DriverDiagnostics2->RunDiagnostics (
+ DriverDiagnostics2,
+ ControllerHandleList[ControllerHandleListLoop],
+ ChildHandleList == NULL ? NULL : ChildHandleList[ChildHandleListLoop],
+ (EFI_DRIVER_DIAGNOSTIC_TYPE)Mode,
+ Language,
+ &ErrorType,
+ &OutBufferSize,
+ &OutBuffer
+ );
+ FreePool (Language);
}
}
- if (!Found && (Lang == NULL||(Lang!=NULL&&(Lang[2]!='-')))){
- Status = gBS->OpenProtocol(
- DriverHandleList[DriverHandleListLoop],
- &gEfiDriverDiagnosticsProtocolGuid,
- (VOID**)&DriverDiagnostics,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status)) {
- Language = GetBestLanguageForDriver(DriverDiagnostics->SupportedLanguages, Lang, FALSE);
- Status = DriverDiagnostics->RunDiagnostics(
- DriverDiagnostics,
- ControllerHandleList[ControllerHandleListLoop],
- ChildHandleList == NULL?NULL:ChildHandleList[ChildHandleListLoop],
- (EFI_DRIVER_DIAGNOSTIC_TYPE)Mode,
- Language,
- &ErrorType,
- &OutBufferSize,
- &OutBuffer);
- FreePool(Language);
+
+ if (!Found && ((Lang == NULL) || ((Lang != NULL) && (Lang[2] != '-')))) {
+ Status = gBS->OpenProtocol (
+ DriverHandleList[DriverHandleListLoop],
+ &gEfiDriverDiagnosticsProtocolGuid,
+ (VOID **)&DriverDiagnostics,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+ Language = GetBestLanguageForDriver (DriverDiagnostics->SupportedLanguages, Lang, FALSE);
+ Status = DriverDiagnostics->RunDiagnostics (
+ DriverDiagnostics,
+ ControllerHandleList[ControllerHandleListLoop],
+ ChildHandleList == NULL ? NULL : ChildHandleList[ChildHandleListLoop],
+ (EFI_DRIVER_DIAGNOSTIC_TYPE)Mode,
+ Language,
+ &ErrorType,
+ &OutBufferSize,
+ &OutBuffer
+ );
+ FreePool (Language);
}
}
- if (EFI_ERROR(Status)) {
+
+ if (EFI_ERROR (Status)) {
Status2 = Status;
}
- HandleIndex1 = ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]);
- HandleIndex2 = ConvertHandleToHandleIndex(ControllerHandleList[ControllerHandleListLoop]);
- ShellPrintHiiEx(
+
+ HandleIndex1 = ConvertHandleToHandleIndex (DriverHandleList[DriverHandleListLoop]);
+ HandleIndex2 = ConvertHandleToHandleIndex (ControllerHandleList[ControllerHandleListLoop]);
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -233,23 +254,25 @@ DoDiagnostics ( L"DrvDiag",
HandleIndex1,
HandleIndex2,
- ChildHandleList == NULL?0:ConvertHandleToHandleIndex(ChildHandleList[ChildHandleListLoop]),
- Status);
- if (OutBuffer!=NULL) {
- FreePool(OutBuffer);
+ ChildHandleList == NULL ? 0 : ConvertHandleToHandleIndex (ChildHandleList[ChildHandleListLoop]),
+ Status
+ );
+ if (OutBuffer != NULL) {
+ FreePool (OutBuffer);
OutBuffer = NULL;
}
- if (ErrorType!=NULL) {
- FreePool(ErrorType);
+
+ if (ErrorType != NULL) {
+ FreePool (ErrorType);
ErrorType = NULL;
}
} else {
- HandleIndex1 = ConvertHandleToHandleIndex(DriverHandleList[DriverHandleListLoop]);
- HandleIndex2 = ConvertHandleToHandleIndex(ControllerHandleList[ControllerHandleListLoop]);
+ HandleIndex1 = ConvertHandleToHandleIndex (DriverHandleList[DriverHandleListLoop]);
+ HandleIndex2 = ConvertHandleToHandleIndex (ControllerHandleList[ControllerHandleListLoop]);
//
// Print out the information that this set can be tested
//
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -257,8 +280,8 @@ DoDiagnostics ( gShellDriver1HiiHandle,
HandleIndex1,
HandleIndex2,
- ChildHandleList == NULL?0:ConvertHandleToHandleIndex(ChildHandleList[ChildHandleListLoop])
- );
+ ChildHandleList == NULL ? 0 : ConvertHandleToHandleIndex (ChildHandleList[ChildHandleListLoop])
+ );
}
//
@@ -268,41 +291,45 @@ DoDiagnostics ( break;
}
}
+
if (AllChilds) {
- SHELL_FREE_NON_NULL(ChildHandleList);
- ChildHandleList = NULL;
- ChildHandleListCount = 0;
+ SHELL_FREE_NON_NULL (ChildHandleList);
+ ChildHandleList = NULL;
+ ChildHandleListCount = 0;
}
}
+
if (ControllerHandle == NULL) {
- SHELL_FREE_NON_NULL(ControllerHandleList);
+ SHELL_FREE_NON_NULL (ControllerHandleList);
ControllerHandleList = NULL;
ControllerHandleListCount = 0;
}
- }
+ }
}
if (DriverHandleList != NULL) {
- FreePool(DriverHandleList);
+ FreePool (DriverHandleList);
}
+
if (ControllerHandleList != NULL) {
- FreePool(ControllerHandleList);
+ FreePool (ControllerHandleList);
}
+
if (ChildHandleList != NULL) {
- FreePool(ChildHandleList);
+ FreePool (ChildHandleList);
}
+
return (Status2);
}
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-c", TypeFlag},
- {L"-s", TypeFlag},
- {L"-e", TypeFlag},
- {L"-m", TypeFlag},
- {L"-l", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-c", TypeFlag },
+ { L"-s", TypeFlag },
+ { L"-e", TypeFlag },
+ { L"-m", TypeFlag },
+ { L"-l", TypeValue },
+ { NULL, TypeMax }
+};
/**
Function for 'drvdiag' command.
@@ -332,60 +359,62 @@ ShellCommandRunDrvDiag ( EFI_HANDLE Handle3;
UINT64 Intermediate;
- ShellStatus = SHELL_SUCCESS;
- Mode = TestModeMax;
- Language = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ Mode = TestModeMax;
+ Language = NULL;
//
// 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), gShellDriver1HiiHandle, L"drvdiag", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvdiag", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// if more than 3 'value' parameters (plus the name one) or we have any 2 mode flags
//
- if ((ShellCommandLineGetCount(Package) > 4)
- ||(ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-e"))
- ||(ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-m"))
- ||(ShellCommandLineGetFlag(Package, L"-e") && ShellCommandLineGetFlag(Package, L"-m"))
- ){
+ if ( (ShellCommandLineGetCount (Package) > 4)
+ || (ShellCommandLineGetFlag (Package, L"-s") && ShellCommandLineGetFlag (Package, L"-e"))
+ || (ShellCommandLineGetFlag (Package, L"-s") && ShellCommandLineGetFlag (Package, L"-m"))
+ || (ShellCommandLineGetFlag (Package, L"-e") && ShellCommandLineGetFlag (Package, L"-m"))
+ )
+ {
//
// error for too many parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drvdiag");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drvdiag");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if ((ShellCommandLineGetFlag(Package, L"-s"))
- || (ShellCommandLineGetFlag(Package, L"-e"))
- || (ShellCommandLineGetFlag(Package, L"-m"))
- ){
+ } else if ( (ShellCommandLineGetFlag (Package, L"-s"))
+ || (ShellCommandLineGetFlag (Package, L"-e"))
+ || (ShellCommandLineGetFlag (Package, L"-m"))
+ )
+ {
//
// Run the appropriate test
//
- if (ShellCommandLineGetFlag(Package, L"-s")) {
+ if (ShellCommandLineGetFlag (Package, L"-s")) {
Mode = TestModeStandard;
- } else if (ShellCommandLineGetFlag(Package, L"-e")) {
+ } else if (ShellCommandLineGetFlag (Package, L"-e")) {
Mode = TestModeExtended;
- } else if (ShellCommandLineGetFlag(Package, L"-m")) {
+ } else if (ShellCommandLineGetFlag (Package, L"-m")) {
Mode = TestModeManufacturing;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
@@ -394,53 +423,55 @@ ShellCommandRunDrvDiag ( Mode = TestModeList;
}
- Lang = ShellCommandLineGetValue(Package, L"-l");
- if (ShellCommandLineGetFlag(Package, L"-l") && Lang == NULL) {
- ASSERT(Language == NULL);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvdiag", L"-l");
+ Lang = ShellCommandLineGetValue (Package, L"-l");
+ if (ShellCommandLineGetFlag (Package, L"-l") && (Lang == NULL)) {
+ ASSERT (Language == NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvdiag", L"-l");
ShellCommandLineFreeVarList (Package);
return (SHELL_INVALID_PARAMETER);
} else if (Lang != NULL) {
- Language = AllocateZeroPool(StrSize(Lang));
- AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
+ Language = AllocateZeroPool (StrSize (Lang));
+ AsciiSPrint (Language, StrSize (Lang), "%S", Lang);
}
- DriverHandleStr = ShellCommandLineGetRawValue(Package, 1);
- ControllerHandleStr = ShellCommandLineGetRawValue(Package, 2);
- ChildHandleStr = ShellCommandLineGetRawValue(Package, 3);
+ DriverHandleStr = ShellCommandLineGetRawValue (Package, 1);
+ ControllerHandleStr = ShellCommandLineGetRawValue (Package, 2);
+ ChildHandleStr = ShellCommandLineGetRawValue (Package, 3);
if (DriverHandleStr == NULL) {
Handle1 = NULL;
} else {
- ShellConvertStringToUint64(DriverHandleStr, &Intermediate, TRUE, FALSE);
- Handle1 = ConvertHandleIndexToHandle((UINTN)Intermediate);
+ ShellConvertStringToUint64 (DriverHandleStr, &Intermediate, TRUE, FALSE);
+ Handle1 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
}
+
if (ControllerHandleStr == NULL) {
Handle2 = NULL;
} else {
- ShellConvertStringToUint64(ControllerHandleStr, &Intermediate, TRUE, FALSE);
- Handle2 = ConvertHandleIndexToHandle((UINTN)Intermediate);
+ ShellConvertStringToUint64 (ControllerHandleStr, &Intermediate, TRUE, FALSE);
+ Handle2 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
}
+
if (ChildHandleStr == NULL) {
Handle3 = NULL;
} else {
- ShellConvertStringToUint64(ChildHandleStr, &Intermediate, TRUE, FALSE);
- Handle3 = ConvertHandleIndexToHandle((UINTN)Intermediate);
+ ShellConvertStringToUint64 (ChildHandleStr, &Intermediate, TRUE, FALSE);
+ Handle3 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
}
Status = DoDiagnostics (
- Mode,
- Language,
- ShellCommandLineGetFlag(Package, L"-c"),
- Handle1,
- Handle2,
- Handle3
- );
-
- SHELL_FREE_NON_NULL(Language);
- ShellCommandLineFreeVarList (Package);
+ Mode,
+ Language,
+ ShellCommandLineGetFlag (Package, L"-c"),
+ Handle1,
+ Handle2,
+ Handle3
+ );
+ SHELL_FREE_NON_NULL (Language);
+ ShellCommandLineFreeVarList (Package);
}
+
if (ShellStatus == SHELL_SUCCESS) {
if (Status == EFI_SECURITY_VIOLATION) {
ShellStatus = SHELL_SECURITY_VIOLATION;
@@ -448,7 +479,7 @@ ShellCommandRunDrvDiag ( ShellStatus = SHELL_INVALID_PARAMETER;
} else if (Status == EFI_NOT_FOUND) {
ShellStatus = SHELL_NOT_FOUND;
- } else if (EFI_ERROR(Status)) {
+ } else if (EFI_ERROR (Status)) {
ShellStatus = SHELL_NOT_FOUND;
}
}
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c index 9c5541b982..a1a0904658 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c @@ -9,14 +9,14 @@ #include "UefiShellDriver1CommandsLib.h"
-STATIC CONST CHAR16 StringHandProt[] = L"HandProt ";
-STATIC CONST CHAR16 StringGetProt[] = L"GetProt ";
-STATIC CONST CHAR16 StringTestProt[] = L"TestProt ";
-STATIC CONST CHAR16 StringChild[] = L"Child ";
-STATIC CONST CHAR16 StringDriver[] = L"Driver ";
-STATIC CONST CHAR16 StringExclusive[] = L"Exclusive";
-STATIC CONST CHAR16 StringDriverEx[] = L"DriverEx ";
-STATIC CONST CHAR16 StringUnknown[] = L"Unknown ";
+STATIC CONST CHAR16 StringHandProt[] = L"HandProt ";
+STATIC CONST CHAR16 StringGetProt[] = L"GetProt ";
+STATIC CONST CHAR16 StringTestProt[] = L"TestProt ";
+STATIC CONST CHAR16 StringChild[] = L"Child ";
+STATIC CONST CHAR16 StringDriver[] = L"Driver ";
+STATIC CONST CHAR16 StringExclusive[] = L"Exclusive";
+STATIC CONST CHAR16 StringDriverEx[] = L"DriverEx ";
+STATIC CONST CHAR16 StringUnknown[] = L"Unknown ";
/**
Open the database and print out all the info about TheHandle.
@@ -28,21 +28,21 @@ STATIC CONST CHAR16 StringUnknown[] = L"Unknown "; **/
EFI_STATUS
TraverseHandleDatabase (
- IN CONST EFI_HANDLE TheHandle
+ IN CONST EFI_HANDLE TheHandle
)
{
- EFI_STATUS Status;
- EFI_GUID **ProtocolGuidArray;
- UINTN ArrayCount;
- UINTN ProtocolIndex;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
- UINTN OpenInfoCount;
- UINTN OpenInfoIndex;
- CONST CHAR16 *OpenTypeString;
- CHAR16 *TempString;
- UINTN HandleIndex;
- CONST CHAR16 *Name;
- UINTN ControllerIndex;
+ EFI_STATUS Status;
+ EFI_GUID **ProtocolGuidArray;
+ UINTN ArrayCount;
+ UINTN ProtocolIndex;
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
+ UINTN OpenInfoCount;
+ UINTN OpenInfoIndex;
+ CONST CHAR16 *OpenTypeString;
+ CHAR16 *TempString;
+ UINTN HandleIndex;
+ CONST CHAR16 *Name;
+ UINTN ControllerIndex;
if (TheHandle == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -52,80 +52,91 @@ TraverseHandleDatabase ( // Retrieve the list of all the protocols on the handle
//
Status = gBS->ProtocolsPerHandle (
- TheHandle,
- &ProtocolGuidArray,
- &ArrayCount
- );
- ASSERT_EFI_ERROR(Status);
+ TheHandle,
+ &ProtocolGuidArray,
+ &ArrayCount
+ );
+ ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) {
-
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
//
// print out the human readable name for this one.
//
- TempString = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], NULL);
+ TempString = GetStringNameFromGuid (ProtocolGuidArray[ProtocolIndex], NULL);
if (TempString == NULL) {
continue;
}
- ShellPrintEx(-1, -1, L"%H%s%N\r\n", TempString);
- FreePool(TempString);
+
+ ShellPrintEx (-1, -1, L"%H%s%N\r\n", TempString);
+ FreePool (TempString);
//
// Retrieve the list of agents that have opened each protocol
//
Status = gBS->OpenProtocolInformation (
- TheHandle,
- ProtocolGuidArray[ProtocolIndex],
- &OpenInfo,
- &OpenInfoCount
- );
- ASSERT_EFI_ERROR(Status);
+ TheHandle,
+ ProtocolGuidArray[ProtocolIndex],
+ &OpenInfo,
+ &OpenInfoCount
+ );
+ ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) {
for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
switch (OpenInfo[OpenInfoIndex].Attributes) {
- case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL: OpenTypeString = StringHandProt; break;
- case EFI_OPEN_PROTOCOL_GET_PROTOCOL: OpenTypeString = StringGetProt; break;
- case EFI_OPEN_PROTOCOL_TEST_PROTOCOL: OpenTypeString = StringTestProt; break;
- case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER: OpenTypeString = StringChild; break;
- case EFI_OPEN_PROTOCOL_BY_DRIVER: OpenTypeString = StringDriver; break;
- case EFI_OPEN_PROTOCOL_EXCLUSIVE: OpenTypeString = StringExclusive; break;
+ case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL: OpenTypeString = StringHandProt;
+ break;
+ case EFI_OPEN_PROTOCOL_GET_PROTOCOL: OpenTypeString = StringGetProt;
+ break;
+ case EFI_OPEN_PROTOCOL_TEST_PROTOCOL: OpenTypeString = StringTestProt;
+ break;
+ case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER: OpenTypeString = StringChild;
+ break;
+ case EFI_OPEN_PROTOCOL_BY_DRIVER: OpenTypeString = StringDriver;
+ break;
+ case EFI_OPEN_PROTOCOL_EXCLUSIVE: OpenTypeString = StringExclusive;
+ break;
case EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE:
- OpenTypeString = StringDriverEx; break;
- default: OpenTypeString = StringUnknown; break;
+ OpenTypeString = StringDriverEx;
+ break;
+ default: OpenTypeString = StringUnknown;
+ break;
}
- HandleIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].AgentHandle);
- Name = GetStringNameFromHandle(OpenInfo[OpenInfoIndex].AgentHandle, NULL);
- ControllerIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].ControllerHandle);
+
+ HandleIndex = ConvertHandleToHandleIndex (OpenInfo[OpenInfoIndex].AgentHandle);
+ Name = GetStringNameFromHandle (OpenInfo[OpenInfoIndex].AgentHandle, NULL);
+ ControllerIndex = ConvertHandleToHandleIndex (OpenInfo[OpenInfoIndex].ControllerHandle);
if (ControllerIndex != 0) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_OPENINFO_LINE),
+ STRING_TOKEN (STR_OPENINFO_LINE),
gShellDriver1HiiHandle,
HandleIndex,
ControllerIndex,
OpenInfo[OpenInfoIndex].OpenCount,
OpenTypeString,
Name
- );
+ );
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_OPENINFO_MIN_LINE),
+ STRING_TOKEN (STR_OPENINFO_MIN_LINE),
gShellDriver1HiiHandle,
HandleIndex,
OpenInfo[OpenInfoIndex].OpenCount,
OpenTypeString,
Name
- );
+ );
}
}
+
FreePool (OpenInfo);
}
}
+
FreePool (ProtocolGuidArray);
}
@@ -145,66 +156,67 @@ ShellCommandRunOpenInfo ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- EFI_HANDLE TheHandle;
- CONST CHAR16 *Param1;
- UINT64 Intermediate;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ EFI_HANDLE TheHandle;
+ CONST CHAR16 *Param1;
+ UINT64 Intermediate;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
//
// 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), gShellDriver1HiiHandle, L"openinfo", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"openinfo", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetCount(Package) > 2){
+ if (ShellCommandLineGetCount (Package) > 2) {
//
// error for too many parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"openinfo");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"openinfo");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) == 0) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"openinfo");
+ } else if (ShellCommandLineGetCount (Package) == 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"openinfo");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Param1 = ShellCommandLineGetRawValue(Package, 1);
- Status = ShellConvertStringToUint64(Param1, &Intermediate, TRUE, FALSE);
- if (EFI_ERROR(Status) || Param1 == NULL || ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"openinfo", Param1);
+ Param1 = ShellCommandLineGetRawValue (Package, 1);
+ Status = ShellConvertStringToUint64 (Param1, &Intermediate, TRUE, FALSE);
+ if (EFI_ERROR (Status) || (Param1 == NULL) || (ConvertHandleIndexToHandle ((UINTN)Intermediate) == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"openinfo", Param1);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- TheHandle = ConvertHandleIndexToHandle((UINTN)Intermediate);
- ASSERT(TheHandle != NULL);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_OPENINFO_HEADER_LINE), gShellDriver1HiiHandle, (UINTN)Intermediate, TheHandle);
+ TheHandle = ConvertHandleIndexToHandle ((UINTN)Intermediate);
+ ASSERT (TheHandle != NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_OPENINFO_HEADER_LINE), gShellDriver1HiiHandle, (UINTN)Intermediate, TheHandle);
Status = TraverseHandleDatabase (TheHandle);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"openinfo", Param1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"openinfo", Param1);
ShellStatus = SHELL_NOT_FOUND;
}
}
}
}
+
return (ShellStatus);
}
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c index 730122d361..ae5f5c7155 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c @@ -10,10 +10,10 @@ #include "UefiShellDriver1CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-r", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-r", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Connect all the possible console devices.
@@ -24,16 +24,15 @@ ConnectAllConsoles ( VOID
)
{
- ShellConnectFromDevPaths(L"ConInDev");
- ShellConnectFromDevPaths(L"ConOutDev");
- ShellConnectFromDevPaths(L"ErrOutDev");
+ ShellConnectFromDevPaths (L"ConInDev");
+ ShellConnectFromDevPaths (L"ConOutDev");
+ ShellConnectFromDevPaths (L"ErrOutDev");
- ShellConnectFromDevPaths(L"ErrOut");
- ShellConnectFromDevPaths(L"ConIn");
- ShellConnectFromDevPaths(L"ConOut");
+ ShellConnectFromDevPaths (L"ErrOut");
+ ShellConnectFromDevPaths (L"ConIn");
+ ShellConnectFromDevPaths (L"ConOut");
}
-
/**
Function for 'reconnect' command.
@@ -47,42 +46,43 @@ ShellCommandRunReconnect ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- SHELL_STATUS ShellStatus;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ EFI_STATUS Status;
gInReconnect = TRUE;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
//
// 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), gShellDriver1HiiHandle, L"reconnect", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"reconnect", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- ShellStatus = ShellCommandRunDisconnect(ImageHandle, SystemTable);
+ ShellStatus = ShellCommandRunDisconnect (ImageHandle, SystemTable);
if (ShellStatus == SHELL_SUCCESS) {
- if (ShellCommandLineGetFlag(Package, L"-r")) {
- ConnectAllConsoles();
+ if (ShellCommandLineGetFlag (Package, L"-r")) {
+ ConnectAllConsoles ();
}
- ShellStatus = ShellCommandRunConnect(ImageHandle, SystemTable);
+
+ ShellStatus = ShellCommandRunConnect (ImageHandle, SystemTable);
}
}
@@ -90,4 +90,3 @@ ShellCommandRunReconnect ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c index e2219c62ec..d441f66e09 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c @@ -8,16 +8,16 @@ #include "UefiShellDriver1CommandsLib.h"
-STATIC CONST CHAR16 mFileName[] = L"Driver1Commands";
-EFI_HII_HANDLE gShellDriver1HiiHandle = NULL;
-BOOLEAN gInReconnect = FALSE;
+STATIC CONST CHAR16 mFileName[] = L"Driver1Commands";
+EFI_HII_HANDLE gShellDriver1HiiHandle = NULL;
+BOOLEAN gInReconnect = FALSE;
/**
Function to return the name of the file containing help if HII will not be used.
@return The filename.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameDriver1 (
VOID
@@ -45,7 +45,7 @@ UefiShellDriver1CommandsLibConstructor ( //
// check our bit of the profiles mask
//
- if ((PcdGet8(PcdShellProfileMask) & BIT0) == 0) {
+ if ((PcdGet8 (PcdShellProfileMask) & BIT0) == 0) {
return (EFI_SUCCESS);
}
@@ -60,17 +60,17 @@ UefiShellDriver1CommandsLibConstructor ( //
// install our shell command handlers that are always installed
//
- ShellCommandRegisterCommandName(L"connect", ShellCommandRunConnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_CONNECT) );
- ShellCommandRegisterCommandName(L"devices", ShellCommandRunDevices , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DEVICES) );
- ShellCommandRegisterCommandName(L"openinfo", ShellCommandRunOpenInfo , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_OPENINFO) );
- ShellCommandRegisterCommandName(L"disconnect", ShellCommandRunDisconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DISCONNECT));
- ShellCommandRegisterCommandName(L"reconnect", ShellCommandRunReconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_RECONNECT) );
- ShellCommandRegisterCommandName(L"unload", ShellCommandRunUnload , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_UNLOAD) );
- ShellCommandRegisterCommandName(L"drvdiag", ShellCommandRunDrvDiag , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRVDIAG) );
- ShellCommandRegisterCommandName(L"dh", ShellCommandRunDh , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DH) );
- ShellCommandRegisterCommandName(L"drivers", ShellCommandRunDrivers , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRIVERS) );
- ShellCommandRegisterCommandName(L"devtree", ShellCommandRunDevTree , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DEVTREE) );
- ShellCommandRegisterCommandName(L"drvcfg", ShellCommandRunDrvCfg , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRVCFG) );
+ ShellCommandRegisterCommandName (L"connect", ShellCommandRunConnect, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_CONNECT));
+ ShellCommandRegisterCommandName (L"devices", ShellCommandRunDevices, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DEVICES));
+ ShellCommandRegisterCommandName (L"openinfo", ShellCommandRunOpenInfo, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_OPENINFO));
+ ShellCommandRegisterCommandName (L"disconnect", ShellCommandRunDisconnect, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DISCONNECT));
+ ShellCommandRegisterCommandName (L"reconnect", ShellCommandRunReconnect, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_RECONNECT));
+ ShellCommandRegisterCommandName (L"unload", ShellCommandRunUnload, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_UNLOAD));
+ ShellCommandRegisterCommandName (L"drvdiag", ShellCommandRunDrvDiag, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DRVDIAG));
+ ShellCommandRegisterCommandName (L"dh", ShellCommandRunDh, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DH));
+ ShellCommandRegisterCommandName (L"drivers", ShellCommandRunDrivers, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DRIVERS));
+ ShellCommandRegisterCommandName (L"devtree", ShellCommandRunDevTree, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DEVTREE));
+ ShellCommandRegisterCommandName (L"drvcfg", ShellCommandRunDrvCfg, ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN (STR_GET_HELP_DRVCFG));
return (EFI_SUCCESS);
}
@@ -89,10 +89,8 @@ UefiShellDriver1CommandsLibDestructor ( )
{
if (gShellDriver1HiiHandle != NULL) {
- HiiRemovePackages(gShellDriver1HiiHandle);
+ HiiRemovePackages (gShellDriver1HiiHandle);
}
+
return (EFI_SUCCESS);
}
-
-
-
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h index ee795c4ce0..1c002361de 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h @@ -57,9 +57,8 @@ #include <Library/PeCoffGetEntryPointLib.h>
#include <Library/HandleParsingLib.h>
-
-extern EFI_HII_HANDLE gShellDriver1HiiHandle;
-extern BOOLEAN gInReconnect;
+extern EFI_HII_HANDLE gShellDriver1HiiHandle;
+extern BOOLEAN gInReconnect;
/**
Function for 'connect' command.
@@ -213,10 +212,7 @@ ShellCommandRunUnload ( **/
EFI_STATUS
ShellConnectFromDevPaths (
- IN CONST CHAR16 *Key
+ IN CONST CHAR16 *Key
);
-
-
#endif
-
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c index a051723d75..1dd947c177 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c @@ -19,26 +19,26 @@ **/
EFI_STATUS
DumpLoadedImageProtocolInfo (
- IN EFI_HANDLE TheHandle
+ IN EFI_HANDLE TheHandle
)
{
- CHAR16 *TheString;
+ CHAR16 *TheString;
- TheString = GetProtocolInformationDump(TheHandle, &gEfiLoadedImageProtocolGuid, TRUE);
+ TheString = GetProtocolInformationDump (TheHandle, &gEfiLoadedImageProtocolGuid, TRUE);
- ShellPrintEx(-1, -1, L"%s", TheString);
+ ShellPrintEx (-1, -1, L"%s", TheString);
- SHELL_FREE_NON_NULL(TheString);
+ SHELL_FREE_NON_NULL (TheString);
return (EFI_SUCCESS);
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-n", TypeFlag},
- {L"-v", TypeFlag},
- {L"-verbose", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-n", TypeFlag },
+ { L"-v", TypeFlag },
+ { L"-verbose", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'unload' command.
@@ -53,89 +53,92 @@ ShellCommandRunUnload ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- EFI_HANDLE TheHandle;
- CONST CHAR16 *Param1;
- SHELL_PROMPT_RESPONSE *Resp;
- UINT64 Value;
-
- ShellStatus = SHELL_SUCCESS;
- Package = NULL;
- Resp = NULL;
- Value = 0;
- TheHandle = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ EFI_HANDLE TheHandle;
+ CONST CHAR16 *Param1;
+ SHELL_PROMPT_RESPONSE *Resp;
+ UINT64 Value;
+
+ ShellStatus = SHELL_SUCCESS;
+ Package = NULL;
+ Resp = NULL;
+ Value = 0;
+ TheHandle = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ 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), gShellDriver1HiiHandle,L"unload", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"unload", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetCount(Package) > 2){
+ if (ShellCommandLineGetCount (Package) > 2) {
//
// error for too many parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"unload");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"unload");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) < 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"unload");
+ } else if (ShellCommandLineGetCount (Package) < 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle, L"unload");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Param1 = ShellCommandLineGetRawValue(Package, 1);
+ Param1 = ShellCommandLineGetRawValue (Package, 1);
if (Param1 != NULL) {
- Status = ShellConvertStringToUint64(Param1, &Value, TRUE, FALSE);
- TheHandle = ConvertHandleIndexToHandle((UINTN)Value);
+ Status = ShellConvertStringToUint64 (Param1, &Value, TRUE, FALSE);
+ TheHandle = ConvertHandleIndexToHandle ((UINTN)Value);
}
- if (EFI_ERROR(Status) || Param1 == NULL || TheHandle == NULL){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"unload", Param1);
+ if (EFI_ERROR (Status) || (Param1 == NULL) || (TheHandle == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"unload", Param1);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(TheHandle != NULL);
- if (ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose")) {
- DumpLoadedImageProtocolInfo(TheHandle);
+ ASSERT (TheHandle != NULL);
+ if (ShellCommandLineGetFlag (Package, L"-v") || ShellCommandLineGetFlag (Package, L"-verbose")) {
+ DumpLoadedImageProtocolInfo (TheHandle);
}
- if (!ShellCommandLineGetFlag(Package, L"-n")) {
- Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_UNLOAD_CONF), gShellDriver1HiiHandle, (UINTN)TheHandle);
- Status = ShellPromptForResponse(ShellPromptResponseTypeYesNo, NULL, (VOID**)&Resp);
+ if (!ShellCommandLineGetFlag (Package, L"-n")) {
+ Status = ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_UNLOAD_CONF), gShellDriver1HiiHandle, (UINTN)TheHandle);
+ Status = ShellPromptForResponse (ShellPromptResponseTypeYesNo, NULL, (VOID **)&Resp);
}
- if (ShellCommandLineGetFlag(Package, L"-n") || (Resp != NULL && *Resp == ShellPromptResponseYes)) {
- Status = gBS->UnloadImage(TheHandle);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Unload", (UINTN)TheHandle, Status);
+
+ if (ShellCommandLineGetFlag (Package, L"-n") || ((Resp != NULL) && (*Resp == ShellPromptResponseYes))) {
+ Status = gBS->UnloadImage (TheHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Unload", (UINTN)TheHandle, Status);
}
- SHELL_FREE_NON_NULL(Resp);
+
+ SHELL_FREE_NON_NULL (Resp);
}
}
}
+
if (ShellStatus == SHELL_SUCCESS) {
if (Status == EFI_SECURITY_VIOLATION) {
ShellStatus = SHELL_SECURITY_VIOLATION;
} else if (Status == EFI_INVALID_PARAMETER) {
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (EFI_ERROR(Status)) {
+ } else if (EFI_ERROR (Status)) {
ShellStatus = SHELL_NOT_FOUND;
}
}
if (Package != NULL) {
- ShellCommandLineFreeVarList(Package);
+ ShellCommandLineFreeVarList (Package);
}
return (ShellStatus);
diff --git a/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c b/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c index 7c08717cd1..16c2df3382 100644 --- a/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c +++ b/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c @@ -29,11 +29,11 @@ ShellInstall1CommandsLibConstructor ( //
// check our bit of the profiles mask
//
- if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {
+ if ((PcdGet8 (PcdShellProfileMask) & BIT2) == 0) {
return (EFI_SUCCESS);
}
- return (BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Install1"));
+ return (BcfgLibraryRegisterBcfgCommand (ImageHandle, SystemTable, L"Install1"));
}
/**
@@ -49,5 +49,5 @@ ShellInstall1CommandsLibDestructor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- return (BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable));
+ return (BcfgLibraryUnregisterBcfgCommand (ImageHandle, SystemTable));
}
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c index 706297cd99..3a49dbfaa3 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/Exit.c @@ -9,10 +9,10 @@ #include "UefiShellLevel1CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"/b", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"/b", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'exit' command.
@@ -27,65 +27,64 @@ ShellCommandRunExit ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINT64 RetVal;
- CONST CHAR16 *Return;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINT64 RetVal;
+ CONST CHAR16 *Return;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
//
// 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), gShellLevel1HiiHandle, L"exit", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, L"exit", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
-
//
// return the specified error code
//
- Return = ShellCommandLineGetRawValue(Package, 1);
+ Return = ShellCommandLineGetRawValue (Package, 1);
if (Return != NULL) {
- Status = ShellConvertStringToUint64(Return, &RetVal, FALSE, FALSE);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel1HiiHandle, L"exit", Return);
+ Status = ShellConvertStringToUint64 (Return, &RetVal, FALSE, FALSE);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel1HiiHandle, L"exit", Return);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// If we are in a batch file and /b then pass TRUE otherwise false...
//
- ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")), RetVal);
+ ShellCommandRegisterExit ((BOOLEAN)(gEfiShellProtocol->BatchIsActive () && ShellCommandLineGetFlag (Package, L"/b")), RetVal);
ShellStatus = SHELL_SUCCESS;
}
} else {
// If we are in a batch file and /b then pass TRUE otherwise false...
//
- ShellCommandRegisterExit((BOOLEAN)(gEfiShellProtocol->BatchIsActive() && ShellCommandLineGetFlag(Package, L"/b")), 0);
+ ShellCommandRegisterExit ((BOOLEAN)(gEfiShellProtocol->BatchIsActive () && ShellCommandLineGetFlag (Package, L"/b")), 0);
ShellStatus = SHELL_SUCCESS;
}
ShellCommandLineFreeVarList (Package);
}
+
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c index 97ade33289..8a6a940f28 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c @@ -20,10 +20,10 @@ **/
BOOLEAN
ShellIsValidForNumber (
- IN CONST CHAR16 *Number
+ IN CONST CHAR16 *Number
)
{
- if (Number == NULL || *Number == CHAR_NULL) {
+ if ((Number == NULL) || (*Number == CHAR_NULL)) {
return (FALSE);
}
@@ -31,17 +31,17 @@ ShellIsValidForNumber ( Number++;
}
- if (StrLen(Number) == 0) {
+ if (StrLen (Number) == 0) {
return (FALSE);
}
- if (StrLen(Number) >= 7) {
- if ((StrStr(Number, L" ") == NULL) || (((StrStr(Number, L" ") != NULL) && (StrStr(Number, L" ") - Number) >= 7))) {
+ if (StrLen (Number) >= 7) {
+ if ((StrStr (Number, L" ") == NULL) || (((StrStr (Number, L" ") != NULL) && ((StrStr (Number, L" ") - Number) >= 7)))) {
return (FALSE);
}
}
- if (!ShellIsDecimalDigitCharacter(*Number)) {
+ if (!ShellIsDecimalDigitCharacter (*Number)) {
return (FALSE);
}
@@ -61,28 +61,28 @@ ShellCommandRunEndFor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- BOOLEAN Found;
- SCRIPT_FILE *CurrentScriptFile;
+ EFI_STATUS Status;
+ BOOLEAN Found;
+ SCRIPT_FILE *CurrentScriptFile;
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"endfor");
+ if (!gEfiShellProtocol->BatchIsActive ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"endfor");
return (SHELL_UNSUPPORTED);
}
if (gEfiShellParametersProtocol->Argc > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"endfor");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"endfor");
return (SHELL_INVALID_PARAMETER);
}
- Found = MoveToTag(GetPreviousNode, L"for", L"endfor", NULL, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, FALSE);
+ Found = MoveToTag (GetPreviousNode, L"for", L"endfor", NULL, ShellCommandGetCurrentScriptFile (), FALSE, FALSE, FALSE);
if (!Found) {
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
- ShellPrintHiiEx(
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -90,26 +90,28 @@ ShellCommandRunEndFor ( gShellLevel1HiiHandle,
L"For",
L"EndFor",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
return (SHELL_NOT_FOUND);
}
+
return (SHELL_SUCCESS);
}
typedef struct {
- UINT32 Signature;
- INTN Current;
- INTN End;
- INTN Step;
- CHAR16 *ReplacementName;
- CHAR16 *CurrentValue;
- BOOLEAN RemoveSubstAlias;
- CHAR16 Set[1];
- } SHELL_FOR_INFO;
-#define SIZE_OF_SHELL_FOR_INFO OFFSET_OF (SHELL_FOR_INFO, Set)
-#define SHELL_FOR_INFO_SIGNATURE SIGNATURE_32 ('S', 'F', 'I', 's')
+ UINT32 Signature;
+ INTN Current;
+ INTN End;
+ INTN Step;
+ CHAR16 *ReplacementName;
+ CHAR16 *CurrentValue;
+ BOOLEAN RemoveSubstAlias;
+ CHAR16 Set[1];
+} SHELL_FOR_INFO;
+#define SIZE_OF_SHELL_FOR_INFO OFFSET_OF (SHELL_FOR_INFO, Set)
+#define SHELL_FOR_INFO_SIGNATURE SIGNATURE_32 ('S', 'F', 'I', 's')
/**
Update the value of a given alias on the list. If the alias is not there then add it.
@@ -122,48 +124,52 @@ typedef struct { @retval EFI_OUT_OF_RESOURCES There was not enough free memory.
**/
EFI_STATUS
-InternalUpdateAliasOnList(
- IN CONST CHAR16 *Alias,
- IN CONST CHAR16 *CommandString,
- IN OUT LIST_ENTRY *List
+InternalUpdateAliasOnList (
+ IN CONST CHAR16 *Alias,
+ IN CONST CHAR16 *CommandString,
+ IN OUT LIST_ENTRY *List
)
{
- ALIAS_LIST *Node;
- BOOLEAN Found;
+ ALIAS_LIST *Node;
+ BOOLEAN Found;
//
// assert for NULL parameter
//
- ASSERT(Alias != NULL);
+ ASSERT (Alias != NULL);
//
// check for the Alias
//
- for ( Node = (ALIAS_LIST *)GetFirstNode(List), Found = FALSE
- ; !IsNull(List, &Node->Link)
- ; Node = (ALIAS_LIST *)GetNextNode(List, &Node->Link)
- ){
- ASSERT(Node->CommandString != NULL);
- ASSERT(Node->Alias != NULL);
- if (StrCmp(Node->Alias, Alias)==0) {
- FreePool(Node->CommandString);
+ for ( Node = (ALIAS_LIST *)GetFirstNode (List), Found = FALSE
+ ; !IsNull (List, &Node->Link)
+ ; Node = (ALIAS_LIST *)GetNextNode (List, &Node->Link)
+ )
+ {
+ ASSERT (Node->CommandString != NULL);
+ ASSERT (Node->Alias != NULL);
+ if (StrCmp (Node->Alias, Alias) == 0) {
+ FreePool (Node->CommandString);
Node->CommandString = NULL;
- Node->CommandString = StrnCatGrow(&Node->CommandString, NULL, CommandString, 0);
- Found = TRUE;
+ Node->CommandString = StrnCatGrow (&Node->CommandString, NULL, CommandString, 0);
+ Found = TRUE;
break;
}
}
+
if (!Found) {
- Node = AllocateZeroPool(sizeof(ALIAS_LIST));
+ Node = AllocateZeroPool (sizeof (ALIAS_LIST));
if (Node == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- ASSERT(Node->Alias == NULL);
- Node->Alias = StrnCatGrow(&Node->Alias, NULL, Alias, 0);
- ASSERT(Node->CommandString == NULL);
- Node->CommandString = StrnCatGrow(&Node->CommandString, NULL, CommandString, 0);
- InsertTailList(List, &Node->Link);
+
+ ASSERT (Node->Alias == NULL);
+ Node->Alias = StrnCatGrow (&Node->Alias, NULL, Alias, 0);
+ ASSERT (Node->CommandString == NULL);
+ Node->CommandString = StrnCatGrow (&Node->CommandString, NULL, CommandString, 0);
+ InsertTailList (List, &Node->Link);
}
+
return (EFI_SUCCESS);
}
@@ -177,31 +183,33 @@ InternalUpdateAliasOnList( @retval FALSE The alias is not on the list.
**/
BOOLEAN
-InternalIsAliasOnList(
- IN CONST CHAR16 *Alias,
- IN CONST LIST_ENTRY *List
+InternalIsAliasOnList (
+ IN CONST CHAR16 *Alias,
+ IN CONST LIST_ENTRY *List
)
{
- ALIAS_LIST *Node;
+ ALIAS_LIST *Node;
//
// assert for NULL parameter
//
- ASSERT(Alias != NULL);
+ ASSERT (Alias != NULL);
//
// check for the Alias
//
- for ( Node = (ALIAS_LIST *)GetFirstNode(List)
- ; !IsNull(List, &Node->Link)
- ; Node = (ALIAS_LIST *)GetNextNode(List, &Node->Link)
- ){
- ASSERT(Node->CommandString != NULL);
- ASSERT(Node->Alias != NULL);
- if (StrCmp(Node->Alias, Alias)==0) {
+ for ( Node = (ALIAS_LIST *)GetFirstNode (List)
+ ; !IsNull (List, &Node->Link)
+ ; Node = (ALIAS_LIST *)GetNextNode (List, &Node->Link)
+ )
+ {
+ ASSERT (Node->CommandString != NULL);
+ ASSERT (Node->Alias != NULL);
+ if (StrCmp (Node->Alias, Alias) == 0) {
return (TRUE);
}
}
+
return (FALSE);
}
@@ -212,35 +220,37 @@ InternalIsAliasOnList( @param[in, out] List The list to search.
**/
BOOLEAN
-InternalRemoveAliasFromList(
- IN CONST CHAR16 *Alias,
- IN OUT LIST_ENTRY *List
+InternalRemoveAliasFromList (
+ IN CONST CHAR16 *Alias,
+ IN OUT LIST_ENTRY *List
)
{
- ALIAS_LIST *Node;
+ ALIAS_LIST *Node;
//
// assert for NULL parameter
//
- ASSERT(Alias != NULL);
+ ASSERT (Alias != NULL);
//
// check for the Alias
//
- for ( Node = (ALIAS_LIST *)GetFirstNode(List)
- ; !IsNull(List, &Node->Link)
- ; Node = (ALIAS_LIST *)GetNextNode(List, &Node->Link)
- ){
- ASSERT(Node->CommandString != NULL);
- ASSERT(Node->Alias != NULL);
- if (StrCmp(Node->Alias, Alias)==0) {
- RemoveEntryList(&Node->Link);
- FreePool(Node->Alias);
- FreePool(Node->CommandString);
- FreePool(Node);
+ for ( Node = (ALIAS_LIST *)GetFirstNode (List)
+ ; !IsNull (List, &Node->Link)
+ ; Node = (ALIAS_LIST *)GetNextNode (List, &Node->Link)
+ )
+ {
+ ASSERT (Node->CommandString != NULL);
+ ASSERT (Node->Alias != NULL);
+ if (StrCmp (Node->Alias, Alias) == 0) {
+ RemoveEntryList (&Node->Link);
+ FreePool (Node->Alias);
+ FreePool (Node->CommandString);
+ FreePool (Node);
return (TRUE);
}
}
+
return (FALSE);
}
@@ -254,15 +264,16 @@ InternalRemoveAliasFromList( @retval (UINTN)(-1) An error ocurred.
**/
UINTN
-ReturnUintn(
- IN CONST CHAR16 *String
+ReturnUintn (
+ IN CONST CHAR16 *String
)
{
- UINT64 RetVal;
+ UINT64 RetVal;
- if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, FALSE, TRUE))) {
+ if (!EFI_ERROR (ShellConvertStringToUint64 (String, &RetVal, FALSE, TRUE))) {
return ((UINTN)RetVal);
}
+
return ((UINTN)(-1));
}
@@ -279,51 +290,51 @@ ShellCommandRunFor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- SCRIPT_FILE *CurrentScriptFile;
- CHAR16 *ArgSet;
- CHAR16 *ArgSetWalker;
- CHAR16 *Parameter;
- UINTN ArgSize;
- UINTN LoopVar;
- SHELL_FOR_INFO *Info;
- CHAR16 *TempString;
- CHAR16 *TempSpot;
- BOOLEAN FirstPass;
- EFI_SHELL_FILE_INFO *Node;
- EFI_SHELL_FILE_INFO *FileList;
- UINTN NewSize;
-
- ArgSet = NULL;
- ArgSize = 0;
- ShellStatus = SHELL_SUCCESS;
- ArgSetWalker = NULL;
- TempString = NULL;
- Parameter = NULL;
- FirstPass = FALSE;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ SCRIPT_FILE *CurrentScriptFile;
+ CHAR16 *ArgSet;
+ CHAR16 *ArgSetWalker;
+ CHAR16 *Parameter;
+ UINTN ArgSize;
+ UINTN LoopVar;
+ SHELL_FOR_INFO *Info;
+ CHAR16 *TempString;
+ CHAR16 *TempSpot;
+ BOOLEAN FirstPass;
+ EFI_SHELL_FILE_INFO *Node;
+ EFI_SHELL_FILE_INFO *FileList;
+ UINTN NewSize;
+
+ ArgSet = NULL;
+ ArgSize = 0;
+ ShellStatus = SHELL_SUCCESS;
+ ArgSetWalker = NULL;
+ TempString = NULL;
+ Parameter = NULL;
+ FirstPass = FALSE;
//
// 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);
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"for");
+ if (!gEfiShellProtocol->BatchIsActive ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"for");
return (SHELL_UNSUPPORTED);
}
if (gEfiShellParametersProtocol->Argc < 4) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"for");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"for");
return (SHELL_INVALID_PARAMETER);
}
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
- ASSERT(CurrentScriptFile != NULL);
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ ASSERT (CurrentScriptFile != NULL);
if ((CurrentScriptFile->CurrentCommand != NULL) && (CurrentScriptFile->CurrentCommand->Data == NULL)) {
FirstPass = TRUE;
@@ -331,8 +342,8 @@ ShellCommandRunFor ( //
// Make sure that an End exists.
//
- if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {
- ShellPrintHiiEx(
+ if (!MoveToTag (GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -340,156 +351,177 @@ ShellCommandRunFor ( gShellLevel1HiiHandle,
L"EndFor",
L"For",
- CurrentScriptFile->CurrentCommand->Line);
+ CurrentScriptFile->CurrentCommand->Line
+ );
return (SHELL_DEVICE_ERROR);
}
//
// Process the line.
//
- if (gEfiShellParametersProtocol->Argv[1][0] != L'%' || gEfiShellParametersProtocol->Argv[1][2] != CHAR_NULL
- ||!((gEfiShellParametersProtocol->Argv[1][1] >= L'a' && gEfiShellParametersProtocol->Argv[1][1] <= L'z')
- ||(gEfiShellParametersProtocol->Argv[1][1] >= L'A' && gEfiShellParametersProtocol->Argv[1][1] <= L'Z'))
- ) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_VAR), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[1]);
+ if ( (gEfiShellParametersProtocol->Argv[1][0] != L'%') || (gEfiShellParametersProtocol->Argv[1][2] != CHAR_NULL)
+ || !( ((gEfiShellParametersProtocol->Argv[1][1] >= L'a') && (gEfiShellParametersProtocol->Argv[1][1] <= L'z'))
+ || ((gEfiShellParametersProtocol->Argv[1][1] >= L'A') && (gEfiShellParametersProtocol->Argv[1][1] <= L'Z')))
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_VAR), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[1]);
return (SHELL_INVALID_PARAMETER);
}
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- L"in",
- gEfiShellParametersProtocol->Argv[2]) == 0) {
- for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
- ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL));
- if (StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"*") != NULL
- ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"?") != NULL
- ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"[") != NULL
- ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"]") != NULL) {
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ L"in",
+ gEfiShellParametersProtocol->Argv[2]
+ ) == 0)
+ {
+ for (LoopVar = 0x3; LoopVar < gEfiShellParametersProtocol->Argc; LoopVar++) {
+ ASSERT ((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL));
+ if ( (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L"*") != NULL)
+ || (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L"?") != NULL)
+ || (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L"[") != NULL)
+ || (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L"]") != NULL))
+ {
FileList = NULL;
- Status = ShellOpenFileMetaArg ((CHAR16*)gEfiShellParametersProtocol->Argv[LoopVar], EFI_FILE_MODE_READ, &FileList);
- if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) {
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
+ Status = ShellOpenFileMetaArg ((CHAR16 *)gEfiShellParametersProtocol->Argv[LoopVar], EFI_FILE_MODE_READ, &FileList);
+ if (EFI_ERROR (Status) || (FileList == NULL) || IsListEmpty (&FileList->Link)) {
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, L" \"", 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, L"\"", 0);
} else {
- for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link)
- ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link)
- ){
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Node->FullName, 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
+ for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; !IsNull (&FileList->Link, &Node->Link)
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
+ )
+ {
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, L" \"", 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, Node->FullName, 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, L"\"", 0);
}
- ShellCloseFileMetaArg(&FileList);
+
+ ShellCloseFileMetaArg (&FileList);
}
} else {
Parameter = gEfiShellParametersProtocol->Argv[LoopVar];
- if (Parameter[0] == L'\"' && Parameter[StrLen(Parameter)-1] == L'\"') {
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Parameter, 0);
+ if ((Parameter[0] == L'\"') && (Parameter[StrLen (Parameter)-1] == L'\"')) {
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, L" ", 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, Parameter, 0);
} else {
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Parameter, 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, L" \"", 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, Parameter, 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, L"\"", 0);
}
}
}
+
if (ArgSet == NULL) {
ShellStatus = SHELL_OUT_OF_RESOURCES;
} else {
//
// set up for an 'in' for loop
//
- NewSize = StrSize(ArgSet);
- NewSize += sizeof(SHELL_FOR_INFO)+StrSize(gEfiShellParametersProtocol->Argv[1]);
- Info = AllocateZeroPool(NewSize);
+ NewSize = StrSize (ArgSet);
+ NewSize += sizeof (SHELL_FOR_INFO)+StrSize (gEfiShellParametersProtocol->Argv[1]);
+ Info = AllocateZeroPool (NewSize);
if (Info == NULL) {
FreePool (ArgSet);
return SHELL_OUT_OF_RESOURCES;
}
+
Info->Signature = SHELL_FOR_INFO_SIGNATURE;
- CopyMem(Info->Set, ArgSet, StrSize(ArgSet));
- NewSize = StrSize(gEfiShellParametersProtocol->Argv[1]);
- CopyMem(Info->Set+(StrSize(ArgSet)/sizeof(Info->Set[0])), gEfiShellParametersProtocol->Argv[1], NewSize);
- Info->ReplacementName = Info->Set+StrSize(ArgSet)/sizeof(Info->Set[0]);
- Info->CurrentValue = (CHAR16*)Info->Set;
- Info->Step = 0;
- Info->Current = 0;
- Info->End = 0;
-
- if (InternalIsAliasOnList(Info->ReplacementName, &CurrentScriptFile->SubstList)) {
- Info->RemoveSubstAlias = FALSE;
+ CopyMem (Info->Set, ArgSet, StrSize (ArgSet));
+ NewSize = StrSize (gEfiShellParametersProtocol->Argv[1]);
+ CopyMem (Info->Set+(StrSize (ArgSet)/sizeof (Info->Set[0])), gEfiShellParametersProtocol->Argv[1], NewSize);
+ Info->ReplacementName = Info->Set+StrSize (ArgSet)/sizeof (Info->Set[0]);
+ Info->CurrentValue = (CHAR16 *)Info->Set;
+ Info->Step = 0;
+ Info->Current = 0;
+ Info->End = 0;
+
+ if (InternalIsAliasOnList (Info->ReplacementName, &CurrentScriptFile->SubstList)) {
+ Info->RemoveSubstAlias = FALSE;
} else {
- Info->RemoveSubstAlias = TRUE;
+ Info->RemoveSubstAlias = TRUE;
}
+
CurrentScriptFile->CurrentCommand->Data = Info;
}
- } else if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- L"run",
- gEfiShellParametersProtocol->Argv[2]) == 0) {
- for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
- ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL));
- if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L")") != NULL &&
- (LoopVar + 1) < gEfiShellParametersProtocol->Argc
- ) {
+ } else if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ L"run",
+ gEfiShellParametersProtocol->Argv[2]
+ ) == 0)
+ {
+ for (LoopVar = 0x3; LoopVar < gEfiShellParametersProtocol->Argc; LoopVar++) {
+ ASSERT ((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL));
+ if ((StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L")") != NULL) &&
+ ((LoopVar + 1) < gEfiShellParametersProtocol->Argc)
+ )
+ {
return (SHELL_INVALID_PARAMETER);
}
+
if (ArgSet == NULL) {
-// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
+ // ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
} else {
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0);
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, L" ", 0);
}
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
-// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0);
+
+ ArgSet = StrnCatGrow (&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
+ // ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0);
}
+
if (ArgSet == NULL) {
ShellStatus = SHELL_OUT_OF_RESOURCES;
} else {
//
// set up for a 'run' for loop
//
- Info = AllocateZeroPool(sizeof(SHELL_FOR_INFO)+StrSize(gEfiShellParametersProtocol->Argv[1]));
+ Info = AllocateZeroPool (sizeof (SHELL_FOR_INFO)+StrSize (gEfiShellParametersProtocol->Argv[1]));
if (Info == NULL) {
FreePool (ArgSet);
return SHELL_OUT_OF_RESOURCES;
}
+
Info->Signature = SHELL_FOR_INFO_SIGNATURE;
- CopyMem(Info->Set, gEfiShellParametersProtocol->Argv[1], StrSize(gEfiShellParametersProtocol->Argv[1]));
+ CopyMem (Info->Set, gEfiShellParametersProtocol->Argv[1], StrSize (gEfiShellParametersProtocol->Argv[1]));
Info->ReplacementName = Info->Set;
Info->CurrentValue = NULL;
- ArgSetWalker = ArgSet;
+ ArgSetWalker = ArgSet;
if (ArgSetWalker[0] != L'(') {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
gShellLevel1HiiHandle,
ArgSet,
- CurrentScriptFile->CurrentCommand->Line);
+ CurrentScriptFile->CurrentCommand->Line
+ );
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- TempSpot = StrStr(ArgSetWalker, L")");
+ TempSpot = StrStr (ArgSetWalker, L")");
if (TempSpot != NULL) {
TempString = TempSpot+1;
if (*(TempString) != CHAR_NULL) {
- while(TempString != NULL && *TempString == L' ') {
+ while (TempString != NULL && *TempString == L' ') {
TempString++;
}
- if (StrLen(TempString) > 0) {
+
+ if (StrLen (TempString) > 0) {
TempSpot = NULL;
}
}
}
+
if (TempSpot == NULL) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
gShellLevel1HiiHandle,
- CurrentScriptFile->CurrentCommand->Line);
+ CurrentScriptFile->CurrentCommand->Line
+ );
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
*TempSpot = CHAR_NULL;
@@ -497,139 +529,152 @@ ShellCommandRunFor ( while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
ArgSetWalker++;
}
- if (!ShellIsValidForNumber(ArgSetWalker)) {
- ShellPrintHiiEx(
+
+ if (!ShellIsValidForNumber (ArgSetWalker)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
gShellLevel1HiiHandle,
ArgSet,
- CurrentScriptFile->CurrentCommand->Line);
+ CurrentScriptFile->CurrentCommand->Line
+ );
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (ArgSetWalker[0] == L'-') {
- Info->Current = 0 - (INTN)ReturnUintn(ArgSetWalker+1);
+ Info->Current = 0 - (INTN)ReturnUintn (ArgSetWalker+1);
} else {
- Info->Current = (INTN)ReturnUintn(ArgSetWalker);
+ Info->Current = (INTN)ReturnUintn (ArgSetWalker);
}
- ArgSetWalker = StrStr(ArgSetWalker, L" ");
+
+ ArgSetWalker = StrStr (ArgSetWalker, L" ");
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
ArgSetWalker++;
}
- if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
- ShellPrintHiiEx(
+
+ if ((ArgSetWalker == NULL) || (*ArgSetWalker == CHAR_NULL) || !ShellIsValidForNumber (ArgSetWalker)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
gShellLevel1HiiHandle,
ArgSet,
- CurrentScriptFile->CurrentCommand->Line);
+ CurrentScriptFile->CurrentCommand->Line
+ );
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (ArgSetWalker[0] == L'-') {
- Info->End = 0 - (INTN)ReturnUintn(ArgSetWalker+1);
+ Info->End = 0 - (INTN)ReturnUintn (ArgSetWalker+1);
} else {
- Info->End = (INTN)ReturnUintn(ArgSetWalker);
+ Info->End = (INTN)ReturnUintn (ArgSetWalker);
}
+
if (Info->Current < Info->End) {
- Info->Step = 1;
+ Info->Step = 1;
} else {
- Info->Step = -1;
+ Info->Step = -1;
}
- ArgSetWalker = StrStr(ArgSetWalker, L" ");
+ ArgSetWalker = StrStr (ArgSetWalker, L" ");
while (ArgSetWalker != NULL && ArgSetWalker[0] == L' ') {
ArgSetWalker++;
}
- if (ArgSetWalker != NULL && *ArgSetWalker != CHAR_NULL) {
- if (ArgSetWalker == NULL || *ArgSetWalker == CHAR_NULL || !ShellIsValidForNumber(ArgSetWalker)){
- ShellPrintHiiEx(
+
+ if ((ArgSetWalker != NULL) && (*ArgSetWalker != CHAR_NULL)) {
+ if ((ArgSetWalker == NULL) || (*ArgSetWalker == CHAR_NULL) || !ShellIsValidForNumber (ArgSetWalker)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
gShellLevel1HiiHandle,
ArgSet,
- CurrentScriptFile->CurrentCommand->Line);
+ CurrentScriptFile->CurrentCommand->Line
+ );
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (*ArgSetWalker == L')') {
- ASSERT(Info->Step == 1 || Info->Step == -1);
+ ASSERT (Info->Step == 1 || Info->Step == -1);
} else {
if (ArgSetWalker[0] == L'-') {
- Info->Step = 0 - (INTN)ReturnUintn(ArgSetWalker+1);
+ Info->Step = 0 - (INTN)ReturnUintn (ArgSetWalker+1);
} else {
- Info->Step = (INTN)ReturnUintn(ArgSetWalker);
+ Info->Step = (INTN)ReturnUintn (ArgSetWalker);
}
- if (StrStr(ArgSetWalker, L" ") != NULL) {
- ShellPrintHiiEx(
+ if (StrStr (ArgSetWalker, L" ") != NULL) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
gShellLevel1HiiHandle,
ArgSet,
- CurrentScriptFile->CurrentCommand->Line);
+ CurrentScriptFile->CurrentCommand->Line
+ );
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
}
-
}
}
}
}
}
+
if (ShellStatus == SHELL_SUCCESS) {
- if (InternalIsAliasOnList(Info->ReplacementName, &CurrentScriptFile->SubstList)) {
- Info->RemoveSubstAlias = FALSE;
+ if (InternalIsAliasOnList (Info->ReplacementName, &CurrentScriptFile->SubstList)) {
+ Info->RemoveSubstAlias = FALSE;
} else {
- Info->RemoveSubstAlias = TRUE;
+ Info->RemoveSubstAlias = TRUE;
}
}
+
if (CurrentScriptFile->CurrentCommand != NULL) {
CurrentScriptFile->CurrentCommand->Data = Info;
}
}
} else {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT),
gShellLevel1HiiHandle,
ArgSet,
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else {
//
// These need to be NULL since they are used to determine if this is the first pass later on...
//
- ASSERT(ArgSetWalker == NULL);
- ASSERT(ArgSet == NULL);
+ ASSERT (ArgSetWalker == NULL);
+ ASSERT (ArgSet == NULL);
}
- if (CurrentScriptFile != NULL && CurrentScriptFile->CurrentCommand != NULL) {
- Info = (SHELL_FOR_INFO*)CurrentScriptFile->CurrentCommand->Data;
+ if ((CurrentScriptFile != NULL) && (CurrentScriptFile->CurrentCommand != NULL)) {
+ Info = (SHELL_FOR_INFO *)CurrentScriptFile->CurrentCommand->Data;
if (CurrentScriptFile->CurrentCommand->Reset) {
if (Info != NULL) {
- Info->CurrentValue = (CHAR16*)Info->Set;
+ Info->CurrentValue = (CHAR16 *)Info->Set;
}
- FirstPass = TRUE;
+
+ FirstPass = TRUE;
CurrentScriptFile->CurrentCommand->Reset = FALSE;
}
} else {
ShellStatus = SHELL_UNSUPPORTED;
- Info = NULL;
+ Info = NULL;
}
+
if (ShellStatus == SHELL_SUCCESS) {
- ASSERT(Info != NULL);
+ ASSERT (Info != NULL);
if (Info->Step != 0) {
//
// only advance if not the first pass
@@ -641,18 +686,18 @@ ShellCommandRunFor ( Info->Current += Info->Step;
}
- TempString = AllocateZeroPool(50*sizeof(CHAR16));
- UnicodeSPrint(TempString, 50*sizeof(CHAR16), L"%d", Info->Current);
- InternalUpdateAliasOnList(Info->ReplacementName, TempString, &CurrentScriptFile->SubstList);
- FreePool(TempString);
+ TempString = AllocateZeroPool (50*sizeof (CHAR16));
+ UnicodeSPrint (TempString, 50*sizeof (CHAR16), L"%d", Info->Current);
+ InternalUpdateAliasOnList (Info->ReplacementName, TempString, &CurrentScriptFile->SubstList);
+ FreePool (TempString);
- if ((Info->Step > 0 && Info->Current > Info->End) || (Info->Step < 0 && Info->Current < Info->End)) {
+ if (((Info->Step > 0) && (Info->Current > Info->End)) || ((Info->Step < 0) && (Info->Current < Info->End))) {
CurrentScriptFile->CurrentCommand->Data = NULL;
//
// find the matching endfor (we're done with the loop)
//
- if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) {
- ShellPrintHiiEx(
+ if (!MoveToTag (GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -660,61 +705,69 @@ ShellCommandRunFor ( gShellLevel1HiiHandle,
L"EndFor",
L"For",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
ShellStatus = SHELL_DEVICE_ERROR;
}
+
if (Info->RemoveSubstAlias) {
//
// remove item from list
//
- InternalRemoveAliasFromList(Info->ReplacementName, &CurrentScriptFile->SubstList);
+ InternalRemoveAliasFromList (Info->ReplacementName, &CurrentScriptFile->SubstList);
}
- FreePool(Info);
+
+ FreePool (Info);
}
} else {
//
// Must be in 'in' version of for loop...
//
- ASSERT(Info->Set != NULL);
- if (Info->CurrentValue != NULL && *Info->CurrentValue != CHAR_NULL) {
+ ASSERT (Info->Set != NULL);
+ if ((Info->CurrentValue != NULL) && (*Info->CurrentValue != CHAR_NULL)) {
if (Info->CurrentValue[0] == L' ') {
Info->CurrentValue++;
}
+
if (Info->CurrentValue[0] == L'\"') {
Info->CurrentValue++;
}
+
//
// do the next one of the set
//
- ASSERT(TempString == NULL);
- TempString = StrnCatGrow(&TempString, NULL, Info->CurrentValue, 0);
+ ASSERT (TempString == NULL);
+ TempString = StrnCatGrow (&TempString, NULL, Info->CurrentValue, 0);
if (TempString == NULL) {
ShellStatus = SHELL_OUT_OF_RESOURCES;
} else {
- TempSpot = StrStr(TempString, L"\" \"");
+ TempSpot = StrStr (TempString, L"\" \"");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
- while (TempString[StrLen(TempString)-1] == L'\"') {
- TempString[StrLen(TempString)-1] = CHAR_NULL;
+
+ while (TempString[StrLen (TempString)-1] == L'\"') {
+ TempString[StrLen (TempString)-1] = CHAR_NULL;
}
- InternalUpdateAliasOnList(Info->ReplacementName, TempString, &CurrentScriptFile->SubstList);
- Info->CurrentValue += StrLen(TempString);
+
+ InternalUpdateAliasOnList (Info->ReplacementName, TempString, &CurrentScriptFile->SubstList);
+ Info->CurrentValue += StrLen (TempString);
if (Info->CurrentValue[0] == L'\"') {
Info->CurrentValue++;
}
- FreePool(TempString);
+
+ FreePool (TempString);
}
} else {
CurrentScriptFile->CurrentCommand->Data = NULL;
//
// find the matching endfor (we're done with the loop)
//
- if (!MoveToTag(GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) {
- ShellPrintHiiEx(
+ if (!MoveToTag (GetNextNode, L"endfor", L"for", NULL, CurrentScriptFile, TRUE, FALSE, FALSE)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -722,24 +775,28 @@ ShellCommandRunFor ( gShellLevel1HiiHandle,
L"EndFor",
L"For",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
ShellStatus = SHELL_DEVICE_ERROR;
}
+
if (Info->RemoveSubstAlias) {
//
// remove item from list
//
- InternalRemoveAliasFromList(Info->ReplacementName, &CurrentScriptFile->SubstList);
+ InternalRemoveAliasFromList (Info->ReplacementName, &CurrentScriptFile->SubstList);
}
- FreePool(Info);
+
+ FreePool (Info);
}
}
}
+
if (ArgSet != NULL) {
- FreePool(ArgSet);
+ FreePool (ArgSet);
}
+
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c index ac27592676..c0b9a010a7 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c @@ -22,28 +22,28 @@ ShellCommandRunGoto ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CHAR16 *CompareString;
- UINTN Size;
- SCRIPT_FILE *CurrentScriptFile;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CHAR16 *CompareString;
+ UINTN Size;
+ SCRIPT_FILE *CurrentScriptFile;
- ShellStatus = SHELL_SUCCESS;
- CompareString = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ CompareString = NULL;
//
// 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);
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Goto");
+ if (!gEfiShellProtocol->BatchIsActive ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Goto");
return (SHELL_UNSUPPORTED);
}
@@ -51,32 +51,32 @@ ShellCommandRunGoto ( // 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), gShellLevel1HiiHandle, L"goto", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, L"goto", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"goto");
+ if (ShellCommandLineGetRawValue (Package, 2) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"goto");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"goto");
+ } else if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"goto");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Size = 0;
- ASSERT((CompareString == NULL && Size == 0) || (CompareString != NULL));
- CompareString = StrnCatGrow(&CompareString, &Size, L":", 0);
- CompareString = StrnCatGrow(&CompareString, &Size, ShellCommandLineGetRawValue(Package, 1), 0);
+ ASSERT ((CompareString == NULL && Size == 0) || (CompareString != NULL));
+ CompareString = StrnCatGrow (&CompareString, &Size, L":", 0);
+ CompareString = StrnCatGrow (&CompareString, &Size, ShellCommandLineGetRawValue (Package, 1), 0);
//
// Check forwards and then backwards for a label...
//
- if (!MoveToTag(GetNextNode, L"endfor", L"for", CompareString, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, TRUE)) {
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
- ShellPrintHiiEx(
+ if (!MoveToTag (GetNextNode, L"endfor", L"for", CompareString, ShellCommandGetCurrentScriptFile (), FALSE, FALSE, TRUE)) {
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -84,16 +84,18 @@ ShellCommandRunGoto ( gShellLevel1HiiHandle,
CompareString,
L"Goto",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
ShellStatus = SHELL_NOT_FOUND;
}
- FreePool(CompareString);
+
+ FreePool (CompareString);
}
+
ShellCommandLineFreeVarList (Package);
}
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c index a1abb5feaa..b4a6966edb 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c @@ -44,36 +44,41 @@ typedef enum { **/
EFI_STATUS
IsNextFragment (
- IN OUT CONST CHAR16 **Statement,
- IN CONST CHAR16 *Fragment,
- OUT BOOLEAN *Match
+ IN OUT CONST CHAR16 **Statement,
+ IN CONST CHAR16 *Fragment,
+ OUT BOOLEAN *Match
)
{
- CHAR16 *Tester;
+ CHAR16 *Tester;
Tester = NULL;
- Tester = StrnCatGrow(&Tester, NULL, *Statement, StrLen(Fragment));
+ Tester = StrnCatGrow (&Tester, NULL, *Statement, StrLen (Fragment));
if (Tester == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Tester[StrLen(Fragment)] = CHAR_NULL;
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)Fragment,
- Tester) == 0) {
+
+ Tester[StrLen (Fragment)] = CHAR_NULL;
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)Fragment,
+ Tester
+ ) == 0)
+ {
//
// increment the string pointer to the end of what we found and then chop off spaces...
//
- *Statement+=StrLen(Fragment);
+ *Statement += StrLen (Fragment);
while (*Statement[0] == L' ') {
(*Statement)++;
}
+
*Match = TRUE;
} else {
*Match = FALSE;
}
- FreePool(Tester);
+
+ FreePool (Tester);
return EFI_SUCCESS;
}
@@ -87,18 +92,19 @@ IsNextFragment ( **/
BOOLEAN
IsValidProfile (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
CONST CHAR16 *ProfilesString;
CONST CHAR16 *TempLocation;
- ProfilesString = ShellGetEnvironmentVariable(L"profiles");
- ASSERT(ProfilesString != NULL);
- TempLocation = StrStr(ProfilesString, String);
- if ((TempLocation != NULL) && (*(TempLocation-1) == L';') && (*(TempLocation+StrLen(String)) == L';')) {
+ ProfilesString = ShellGetEnvironmentVariable (L"profiles");
+ ASSERT (ProfilesString != NULL);
+ TempLocation = StrStr (ProfilesString, String);
+ if ((TempLocation != NULL) && (*(TempLocation-1) == L';') && (*(TempLocation+StrLen (String)) == L';')) {
return (TRUE);
}
+
return (FALSE);
}
@@ -122,207 +128,224 @@ TestOperation ( IN CONST BOOLEAN ForceStringCompare
)
{
- INTN Cmp1;
- INTN Cmp2;
+ INTN Cmp1;
+ INTN Cmp2;
//
// "Compare1 BinOp Compare2"
//
switch (BinOp) {
- case OperatorUnisgnedGreaterThan:
- case OperatorGreaterThan:
- if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
- //
- // string compare
- //
- if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) > 0) || (StringCompare(&Compare1, &Compare2) > 0)) {
- return (TRUE);
- }
- } else {
- //
- // numeric compare
- //
- if (Compare1[0] == L'-') {
- Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
- } else {
- Cmp1 = (INTN)ShellStrToUintn(Compare1);
- }
- if (Compare2[0] == L'-') {
- Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
- } else {
- Cmp2 = (INTN)ShellStrToUintn(Compare2);
- }
- if (BinOp == OperatorGreaterThan) {
- if (Cmp1 > Cmp2) {
+ case OperatorUnisgnedGreaterThan:
+ case OperatorGreaterThan:
+ if (ForceStringCompare || !ShellIsHexOrDecimalNumber (Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber (Compare2, FALSE, FALSE)) {
+ //
+ // string compare
+ //
+ if ((CaseInsensitive && (StringNoCaseCompare (&Compare1, &Compare2) > 0)) || (StringCompare (&Compare1, &Compare2) > 0)) {
return (TRUE);
}
} else {
- if ((UINTN)Cmp1 > (UINTN)Cmp2) {
- return (TRUE);
+ //
+ // numeric compare
+ //
+ if (Compare1[0] == L'-') {
+ Cmp1 = 0 - (INTN)ShellStrToUintn (Compare1+1);
+ } else {
+ Cmp1 = (INTN)ShellStrToUintn (Compare1);
+ }
+
+ if (Compare2[0] == L'-') {
+ Cmp2 = 0 - (INTN)ShellStrToUintn (Compare2+1);
+ } else {
+ Cmp2 = (INTN)ShellStrToUintn (Compare2);
+ }
+
+ if (BinOp == OperatorGreaterThan) {
+ if (Cmp1 > Cmp2) {
+ return (TRUE);
+ }
+ } else {
+ if ((UINTN)Cmp1 > (UINTN)Cmp2) {
+ return (TRUE);
+ }
}
}
- }
- return (FALSE);
- case OperatorUnsignedLessThan:
- case OperatorLessThan:
- if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
- //
- // string compare
- //
- if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) < 0) || (StringCompare(&Compare1, &Compare2) < 0)) {
- return (TRUE);
- }
- } else {
- //
- // numeric compare
- //
- if (Compare1[0] == L'-') {
- Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
- } else {
- Cmp1 = (INTN)ShellStrToUintn(Compare1);
- }
- if (Compare2[0] == L'-') {
- Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
+
+ return (FALSE);
+ case OperatorUnsignedLessThan:
+ case OperatorLessThan:
+ if (ForceStringCompare || !ShellIsHexOrDecimalNumber (Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber (Compare2, FALSE, FALSE)) {
+ //
+ // string compare
+ //
+ if ((CaseInsensitive && (StringNoCaseCompare (&Compare1, &Compare2) < 0)) || (StringCompare (&Compare1, &Compare2) < 0)) {
+ return (TRUE);
+ }
} else {
- Cmp2 = (INTN)ShellStrToUintn(Compare2);
+ //
+ // numeric compare
+ //
+ if (Compare1[0] == L'-') {
+ Cmp1 = 0 - (INTN)ShellStrToUintn (Compare1+1);
+ } else {
+ Cmp1 = (INTN)ShellStrToUintn (Compare1);
+ }
+
+ if (Compare2[0] == L'-') {
+ Cmp2 = 0 - (INTN)ShellStrToUintn (Compare2+1);
+ } else {
+ Cmp2 = (INTN)ShellStrToUintn (Compare2);
+ }
+
+ if (BinOp == OperatorLessThan) {
+ if (Cmp1 < Cmp2) {
+ return (TRUE);
+ }
+ } else {
+ if ((UINTN)Cmp1 < (UINTN)Cmp2) {
+ return (TRUE);
+ }
+ }
}
- if (BinOp == OperatorLessThan) {
- if (Cmp1 < Cmp2) {
+
+ return (FALSE);
+ case OperatorEqual:
+ if (ForceStringCompare || !ShellIsHexOrDecimalNumber (Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber (Compare2, FALSE, FALSE)) {
+ //
+ // string compare
+ //
+ if ((CaseInsensitive && (StringNoCaseCompare (&Compare1, &Compare2) == 0)) || (StringCompare (&Compare1, &Compare2) == 0)) {
return (TRUE);
}
} else {
- if ((UINTN)Cmp1 < (UINTN)Cmp2) {
+ //
+ // numeric compare
+ //
+ if (Compare1[0] == L'-') {
+ Cmp1 = 0 - (INTN)ShellStrToUintn (Compare1+1);
+ } else {
+ Cmp1 = (INTN)ShellStrToUintn (Compare1);
+ }
+
+ if (Compare2[0] == L'-') {
+ Cmp2 = 0 - (INTN)ShellStrToUintn (Compare2+1);
+ } else {
+ Cmp2 = (INTN)ShellStrToUintn (Compare2);
+ }
+
+ if (Cmp1 == Cmp2) {
return (TRUE);
}
}
- }
- return (FALSE);
- case OperatorEqual:
- if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
- //
- // string compare
- //
- if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) == 0) || (StringCompare(&Compare1, &Compare2) == 0)) {
- return (TRUE);
- }
- } else {
- //
- // numeric compare
- //
- if (Compare1[0] == L'-') {
- Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
- } else {
- Cmp1 = (INTN)ShellStrToUintn(Compare1);
- }
- if (Compare2[0] == L'-') {
- Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
- } else {
- Cmp2 = (INTN)ShellStrToUintn(Compare2);
- }
- if (Cmp1 == Cmp2) {
- return (TRUE);
- }
- }
- return (FALSE);
- case OperatorNotEqual:
- if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
- //
- // string compare
- //
- if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) != 0) || (StringCompare(&Compare1, &Compare2) != 0)) {
- return (TRUE);
- }
- } else {
- //
- // numeric compare
- //
- if (Compare1[0] == L'-') {
- Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
- } else {
- Cmp1 = (INTN)ShellStrToUintn(Compare1);
- }
- if (Compare2[0] == L'-') {
- Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
- } else {
- Cmp2 = (INTN)ShellStrToUintn(Compare2);
- }
- if (Cmp1 != Cmp2) {
- return (TRUE);
- }
- }
- return (FALSE);
- case OperatorUnsignedGreaterOrEqual:
- case OperatorGreatorOrEqual:
- if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
- //
- // string compare
- //
- if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) >= 0) || (StringCompare(&Compare1, &Compare2) >= 0)) {
- return (TRUE);
- }
- } else {
- //
- // numeric compare
- //
- if (Compare1[0] == L'-') {
- Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
- } else {
- Cmp1 = (INTN)ShellStrToUintn(Compare1);
- }
- if (Compare2[0] == L'-') {
- Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
- } else {
- Cmp2 = (INTN)ShellStrToUintn(Compare2);
- }
- if (BinOp == OperatorGreatorOrEqual) {
- if (Cmp1 >= Cmp2) {
+ return (FALSE);
+ case OperatorNotEqual:
+ if (ForceStringCompare || !ShellIsHexOrDecimalNumber (Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber (Compare2, FALSE, FALSE)) {
+ //
+ // string compare
+ //
+ if ((CaseInsensitive && (StringNoCaseCompare (&Compare1, &Compare2) != 0)) || (StringCompare (&Compare1, &Compare2) != 0)) {
return (TRUE);
}
} else {
- if ((UINTN)Cmp1 >= (UINTN)Cmp2) {
+ //
+ // numeric compare
+ //
+ if (Compare1[0] == L'-') {
+ Cmp1 = 0 - (INTN)ShellStrToUintn (Compare1+1);
+ } else {
+ Cmp1 = (INTN)ShellStrToUintn (Compare1);
+ }
+
+ if (Compare2[0] == L'-') {
+ Cmp2 = 0 - (INTN)ShellStrToUintn (Compare2+1);
+ } else {
+ Cmp2 = (INTN)ShellStrToUintn (Compare2);
+ }
+
+ if (Cmp1 != Cmp2) {
return (TRUE);
}
}
- }
- return (FALSE);
- case OperatorLessOrEqual:
- case OperatorUnsignedLessOrEqual:
- if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) {
- //
- // string compare
- //
- if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) <= 0) || (StringCompare(&Compare1, &Compare2) <= 0)) {
- return (TRUE);
- }
- } else {
- //
- // numeric compare
- //
- if (Compare1[0] == L'-') {
- Cmp1 = 0 - (INTN)ShellStrToUintn(Compare1+1);
- } else {
- Cmp1 = (INTN)ShellStrToUintn(Compare1);
- }
- if (Compare2[0] == L'-') {
- Cmp2 = 0 - (INTN)ShellStrToUintn(Compare2+1);
+
+ return (FALSE);
+ case OperatorUnsignedGreaterOrEqual:
+ case OperatorGreatorOrEqual:
+ if (ForceStringCompare || !ShellIsHexOrDecimalNumber (Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber (Compare2, FALSE, FALSE)) {
+ //
+ // string compare
+ //
+ if ((CaseInsensitive && (StringNoCaseCompare (&Compare1, &Compare2) >= 0)) || (StringCompare (&Compare1, &Compare2) >= 0)) {
+ return (TRUE);
+ }
} else {
- Cmp2 = (INTN)ShellStrToUintn(Compare2);
+ //
+ // numeric compare
+ //
+ if (Compare1[0] == L'-') {
+ Cmp1 = 0 - (INTN)ShellStrToUintn (Compare1+1);
+ } else {
+ Cmp1 = (INTN)ShellStrToUintn (Compare1);
+ }
+
+ if (Compare2[0] == L'-') {
+ Cmp2 = 0 - (INTN)ShellStrToUintn (Compare2+1);
+ } else {
+ Cmp2 = (INTN)ShellStrToUintn (Compare2);
+ }
+
+ if (BinOp == OperatorGreatorOrEqual) {
+ if (Cmp1 >= Cmp2) {
+ return (TRUE);
+ }
+ } else {
+ if ((UINTN)Cmp1 >= (UINTN)Cmp2) {
+ return (TRUE);
+ }
+ }
}
- if (BinOp == OperatorLessOrEqual) {
- if (Cmp1 <= Cmp2) {
+
+ return (FALSE);
+ case OperatorLessOrEqual:
+ case OperatorUnsignedLessOrEqual:
+ if (ForceStringCompare || !ShellIsHexOrDecimalNumber (Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber (Compare2, FALSE, FALSE)) {
+ //
+ // string compare
+ //
+ if ((CaseInsensitive && (StringNoCaseCompare (&Compare1, &Compare2) <= 0)) || (StringCompare (&Compare1, &Compare2) <= 0)) {
return (TRUE);
}
} else {
- if ((UINTN)Cmp1 <= (UINTN)Cmp2) {
- return (TRUE);
+ //
+ // numeric compare
+ //
+ if (Compare1[0] == L'-') {
+ Cmp1 = 0 - (INTN)ShellStrToUintn (Compare1+1);
+ } else {
+ Cmp1 = (INTN)ShellStrToUintn (Compare1);
+ }
+
+ if (Compare2[0] == L'-') {
+ Cmp2 = 0 - (INTN)ShellStrToUintn (Compare2+1);
+ } else {
+ Cmp2 = (INTN)ShellStrToUintn (Compare2);
+ }
+
+ if (BinOp == OperatorLessOrEqual) {
+ if (Cmp1 <= Cmp2) {
+ return (TRUE);
+ }
+ } else {
+ if ((UINTN)Cmp1 <= (UINTN)Cmp2) {
+ return (TRUE);
+ }
}
}
- }
- return (FALSE);
- default:
- ASSERT(FALSE);
- return (FALSE);
+
+ return (FALSE);
+ default:
+ ASSERT (FALSE);
+ return (FALSE);
}
}
@@ -344,33 +367,33 @@ TestOperation ( **/
EFI_STATUS
ProcessStatement (
- IN OUT BOOLEAN *PassingState,
- IN UINTN StartParameterNumber,
- IN UINTN EndParameterNumber,
- IN CONST END_TAG_TYPE OperatorToUse,
- IN CONST BOOLEAN CaseInsensitive,
- IN CONST BOOLEAN ForceStringCompare
+ IN OUT BOOLEAN *PassingState,
+ IN UINTN StartParameterNumber,
+ IN UINTN EndParameterNumber,
+ IN CONST END_TAG_TYPE OperatorToUse,
+ IN CONST BOOLEAN CaseInsensitive,
+ IN CONST BOOLEAN ForceStringCompare
)
{
- EFI_STATUS Status;
- BOOLEAN OperationResult;
- BOOLEAN NotPresent;
- CHAR16 *StatementWalker;
- BIN_OPERATOR_TYPE BinOp;
- CHAR16 *Compare1;
- CHAR16 *Compare2;
- CHAR16 HexString[20];
- CHAR16 *TempSpot;
- BOOLEAN Match;
-
- ASSERT((END_TAG_TYPE)OperatorToUse != EndTagThen);
+ EFI_STATUS Status;
+ BOOLEAN OperationResult;
+ BOOLEAN NotPresent;
+ CHAR16 *StatementWalker;
+ BIN_OPERATOR_TYPE BinOp;
+ CHAR16 *Compare1;
+ CHAR16 *Compare2;
+ CHAR16 HexString[20];
+ CHAR16 *TempSpot;
+ BOOLEAN Match;
+
+ ASSERT ((END_TAG_TYPE)OperatorToUse != EndTagThen);
Status = EFI_SUCCESS;
BinOp = OperatorMax;
OperationResult = FALSE;
Match = FALSE;
StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber];
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"not", &Match)) && Match) {
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"not", &Match)) && Match) {
NotPresent = TRUE;
StatementWalker = gEfiShellParametersProtocol->Argv[++StartParameterNumber];
} else {
@@ -380,57 +403,62 @@ ProcessStatement ( //
// now check for 'boolfunc' operators
//
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"isint", &Match)) && Match) {
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match
- && StatementWalker[StrLen(StatementWalker)-1] == L')') {
- StatementWalker[StrLen(StatementWalker)-1] = CHAR_NULL;
- OperationResult = ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE);
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"isint", &Match)) && Match) {
+ if ( !EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match
+ && (StatementWalker[StrLen (StatementWalker)-1] == L')'))
+ {
+ StatementWalker[StrLen (StatementWalker)-1] = CHAR_NULL;
+ OperationResult = ShellIsHexOrDecimalNumber (StatementWalker, FALSE, FALSE);
} else {
Status = EFI_INVALID_PARAMETER;
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"isint");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"isint");
}
- } else if ((!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"exists", &Match)) && Match) ||
- (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"exist", &Match)) && Match)) {
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match &&
- StatementWalker[StrLen(StatementWalker)-1] == L')') {
- StatementWalker[StrLen(StatementWalker)-1] = CHAR_NULL;
+ } else if ((!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"exists", &Match)) && Match) ||
+ (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"exist", &Match)) && Match))
+ {
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match &&
+ (StatementWalker[StrLen (StatementWalker)-1] == L')'))
+ {
+ StatementWalker[StrLen (StatementWalker)-1] = CHAR_NULL;
//
// is what remains a file in CWD???
//
- OperationResult = (BOOLEAN)(ShellFileExists(StatementWalker)==EFI_SUCCESS);
- } else if (StatementWalker[0] == CHAR_NULL && StartParameterNumber+1 == EndParameterNumber) {
- OperationResult = (BOOLEAN)(ShellFileExists(gEfiShellParametersProtocol->Argv[++StartParameterNumber])==EFI_SUCCESS);
+ OperationResult = (BOOLEAN)(ShellFileExists (StatementWalker) == EFI_SUCCESS);
+ } else if ((StatementWalker[0] == CHAR_NULL) && (StartParameterNumber+1 == EndParameterNumber)) {
+ OperationResult = (BOOLEAN)(ShellFileExists (gEfiShellParametersProtocol->Argv[++StartParameterNumber]) == EFI_SUCCESS);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"exist(s)");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"exist(s)");
Status = EFI_INVALID_PARAMETER;
}
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"available", &Match)) && Match) {
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match &&
- StatementWalker[StrLen(StatementWalker)-1] == L')') {
- StatementWalker[StrLen(StatementWalker)-1] = CHAR_NULL;
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"available", &Match)) && Match) {
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match &&
+ (StatementWalker[StrLen (StatementWalker)-1] == L')'))
+ {
+ StatementWalker[StrLen (StatementWalker)-1] = CHAR_NULL;
//
// is what remains a file in the CWD or path???
//
- OperationResult = (BOOLEAN)(ShellIsFileInPath(StatementWalker)==EFI_SUCCESS);
+ OperationResult = (BOOLEAN)(ShellIsFileInPath (StatementWalker) == EFI_SUCCESS);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"available");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"available");
Status = EFI_INVALID_PARAMETER;
}
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"profile", &Match)) && Match) {
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match &&
- StatementWalker[StrLen(StatementWalker)-1] == L')') {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"profile", &Match)) && Match) {
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match &&
+ (StatementWalker[StrLen (StatementWalker)-1] == L')'))
+ {
//
// Chop off that ')'
//
- StatementWalker[StrLen(StatementWalker)-1] = CHAR_NULL;
- OperationResult = IsValidProfile(StatementWalker);
+ StatementWalker[StrLen (StatementWalker)-1] = CHAR_NULL;
+ OperationResult = IsValidProfile (StatementWalker);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"profile");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"profile");
Status = EFI_INVALID_PARAMETER;
}
} else if (StartParameterNumber+1 >= EndParameterNumber) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[StartParameterNumber]);
- Status = EFI_INVALID_PARAMETER;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[StartParameterNumber]);
+ Status = EFI_INVALID_PARAMETER;
} else {
//
// must be 'item binop item' style
@@ -443,186 +471,188 @@ ProcessStatement ( // get the first item
//
StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber];
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"efierror", &Match)) && Match) {
- TempSpot = StrStr(StatementWalker, L")");
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) {
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"efierror", &Match)) && Match) {
+ TempSpot = StrStr (StatementWalker, L")");
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match && (TempSpot != NULL)) {
*TempSpot = CHAR_NULL;
- if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) {
- UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT);
- ASSERT(Compare1 == NULL);
- Compare1 = StrnCatGrow(&Compare1, NULL, HexString, 0);
- StatementWalker += StrLen(StatementWalker) + 1;
+ if (ShellIsHexOrDecimalNumber (StatementWalker, FALSE, FALSE)) {
+ UnicodeSPrint (HexString, sizeof (HexString), L"0x%x", ShellStrToUintn (StatementWalker)|MAX_BIT);
+ ASSERT (Compare1 == NULL);
+ Compare1 = StrnCatGrow (&Compare1, NULL, HexString, 0);
+ StatementWalker += StrLen (StatementWalker) + 1;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror");
Status = EFI_INVALID_PARAMETER;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror");
Status = EFI_INVALID_PARAMETER;
}
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"pierror", &Match)) && Match) {
- TempSpot = StrStr(StatementWalker, L")");
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"pierror", &Match)) && Match) {
+ TempSpot = StrStr (StatementWalker, L")");
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match && (TempSpot != NULL)) {
*TempSpot = CHAR_NULL;
- if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) {
- UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT|(MAX_BIT>>2));
- ASSERT(Compare1 == NULL);
- Compare1 = StrnCatGrow(&Compare1, NULL, HexString, 0);
- StatementWalker += StrLen(StatementWalker) + 1;
+ if (ShellIsHexOrDecimalNumber (StatementWalker, FALSE, FALSE)) {
+ UnicodeSPrint (HexString, sizeof (HexString), L"0x%x", ShellStrToUintn (StatementWalker)|MAX_BIT|(MAX_BIT>>2));
+ ASSERT (Compare1 == NULL);
+ Compare1 = StrnCatGrow (&Compare1, NULL, HexString, 0);
+ StatementWalker += StrLen (StatementWalker) + 1;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror");
Status = EFI_INVALID_PARAMETER;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror");
Status = EFI_INVALID_PARAMETER;
}
- } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16**)(&StatementWalker), L"oemerror", &Match)) && Match) {
- TempSpot = StrStr(StatementWalker, L")");
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"oemerror", &Match)) && Match) {
+ TempSpot = StrStr (StatementWalker, L")");
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match && (TempSpot != NULL)) {
TempSpot = CHAR_NULL;
- if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) {
- UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT|(MAX_BIT>>1));
- ASSERT(Compare1 == NULL);
- Compare1 = StrnCatGrow(&Compare1, NULL, HexString, 0);
- StatementWalker += StrLen(StatementWalker) + 1;
+ if (ShellIsHexOrDecimalNumber (StatementWalker, FALSE, FALSE)) {
+ UnicodeSPrint (HexString, sizeof (HexString), L"0x%x", ShellStrToUintn (StatementWalker)|MAX_BIT|(MAX_BIT>>1));
+ ASSERT (Compare1 == NULL);
+ Compare1 = StrnCatGrow (&Compare1, NULL, HexString, 0);
+ StatementWalker += StrLen (StatementWalker) + 1;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror");
Status = EFI_INVALID_PARAMETER;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror");
Status = EFI_INVALID_PARAMETER;
}
} else {
- ASSERT(Compare1 == NULL);
+ ASSERT (Compare1 == NULL);
if (EndParameterNumber - StartParameterNumber > 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_STARTING), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[StartParameterNumber+2]);
- Status = EFI_INVALID_PARAMETER;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_STARTING), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[StartParameterNumber+2]);
+ Status = EFI_INVALID_PARAMETER;
} else {
//
// must be a raw string
//
- Compare1 = StrnCatGrow(&Compare1, NULL, StatementWalker, 0);
+ Compare1 = StrnCatGrow (&Compare1, NULL, StatementWalker, 0);
}
}
//
// get the operator
//
- ASSERT(StartParameterNumber+1<EndParameterNumber);
+ ASSERT (StartParameterNumber+1 < EndParameterNumber);
StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber+1];
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"gt", &Match)) && Match) {
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"gt", &Match)) && Match) {
BinOp = OperatorGreaterThan;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"lt", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"lt", &Match)) && Match) {
BinOp = OperatorLessThan;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"eq", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"eq", &Match)) && Match) {
BinOp = OperatorEqual;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ne", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"ne", &Match)) && Match) {
BinOp = OperatorNotEqual;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ge", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"ge", &Match)) && Match) {
BinOp = OperatorGreatorOrEqual;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"le", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"le", &Match)) && Match) {
BinOp = OperatorLessOrEqual;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"==", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"==", &Match)) && Match) {
BinOp = OperatorEqual;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ugt", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"ugt", &Match)) && Match) {
BinOp = OperatorUnisgnedGreaterThan;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ult", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"ult", &Match)) && Match) {
BinOp = OperatorUnsignedLessThan;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"uge", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"uge", &Match)) && Match) {
BinOp = OperatorUnsignedGreaterOrEqual;
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"ule", &Match)) && Match) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"ule", &Match)) && Match) {
BinOp = OperatorUnsignedLessOrEqual;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_INVALID_BINOP), gShellLevel1HiiHandle, StatementWalker);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_INVALID_BINOP), gShellLevel1HiiHandle, StatementWalker);
Status = EFI_INVALID_PARAMETER;
}
//
// get the second item
//
- ASSERT(StartParameterNumber+2<=EndParameterNumber);
+ ASSERT (StartParameterNumber+2 <= EndParameterNumber);
StatementWalker = gEfiShellParametersProtocol->Argv[StartParameterNumber+2];
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"efierror", &Match)) && Match) {
- TempSpot = StrStr(StatementWalker, L")");
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) {
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"efierror", &Match)) && Match) {
+ TempSpot = StrStr (StatementWalker, L")");
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match && (TempSpot != NULL)) {
TempSpot = CHAR_NULL;
- if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) {
- UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT);
- ASSERT(Compare2 == NULL);
- Compare2 = StrnCatGrow(&Compare2, NULL, HexString, 0);
- StatementWalker += StrLen(StatementWalker) + 1;
+ if (ShellIsHexOrDecimalNumber (StatementWalker, FALSE, FALSE)) {
+ UnicodeSPrint (HexString, sizeof (HexString), L"0x%x", ShellStrToUintn (StatementWalker)|MAX_BIT);
+ ASSERT (Compare2 == NULL);
+ Compare2 = StrnCatGrow (&Compare2, NULL, HexString, 0);
+ StatementWalker += StrLen (StatementWalker) + 1;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror");
Status = EFI_INVALID_PARAMETER;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"efierror");
Status = EFI_INVALID_PARAMETER;
}
- //
- // can this be collapsed into the above?
- //
- } else if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"pierror", &Match)) && Match) {
- TempSpot = StrStr(StatementWalker, L")");
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) {
+
+ //
+ // can this be collapsed into the above?
+ //
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"pierror", &Match)) && Match) {
+ TempSpot = StrStr (StatementWalker, L")");
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match && (TempSpot != NULL)) {
TempSpot = CHAR_NULL;
- if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) {
- UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT|(MAX_BIT>>2));
- ASSERT(Compare2 == NULL);
- Compare2 = StrnCatGrow(&Compare2, NULL, HexString, 0);
- StatementWalker += StrLen(StatementWalker) + 1;
+ if (ShellIsHexOrDecimalNumber (StatementWalker, FALSE, FALSE)) {
+ UnicodeSPrint (HexString, sizeof (HexString), L"0x%x", ShellStrToUintn (StatementWalker)|MAX_BIT|(MAX_BIT>>2));
+ ASSERT (Compare2 == NULL);
+ Compare2 = StrnCatGrow (&Compare2, NULL, HexString, 0);
+ StatementWalker += StrLen (StatementWalker) + 1;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror");
Status = EFI_INVALID_PARAMETER;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"pierror");
Status = EFI_INVALID_PARAMETER;
}
- } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16**)(&StatementWalker), L"oemerror", &Match)) && Match) {
- TempSpot = StrStr(StatementWalker, L")");
- if (!EFI_ERROR (IsNextFragment((CONST CHAR16**)(&StatementWalker), L"(", &Match)) && Match && TempSpot != NULL) {
+ } else if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"oemerror", &Match)) && Match) {
+ TempSpot = StrStr (StatementWalker, L")");
+ if (!EFI_ERROR (IsNextFragment ((CONST CHAR16 **)(&StatementWalker), L"(", &Match)) && Match && (TempSpot != NULL)) {
TempSpot = CHAR_NULL;
- if (ShellIsHexOrDecimalNumber(StatementWalker, FALSE, FALSE)) {
- UnicodeSPrint(HexString, sizeof(HexString), L"0x%x", ShellStrToUintn(StatementWalker)|MAX_BIT|(MAX_BIT>>1));
- ASSERT(Compare2 == NULL);
- Compare2 = StrnCatGrow(&Compare2, NULL, HexString, 0);
- StatementWalker += StrLen(StatementWalker) + 1;
+ if (ShellIsHexOrDecimalNumber (StatementWalker, FALSE, FALSE)) {
+ UnicodeSPrint (HexString, sizeof (HexString), L"0x%x", ShellStrToUintn (StatementWalker)|MAX_BIT|(MAX_BIT>>1));
+ ASSERT (Compare2 == NULL);
+ Compare2 = StrnCatGrow (&Compare2, NULL, HexString, 0);
+ StatementWalker += StrLen (StatementWalker) + 1;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror");
Status = EFI_INVALID_PARAMETER;
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_IN), gShellLevel1HiiHandle, L"oemerror");
Status = EFI_INVALID_PARAMETER;
}
} else {
//
// must be a raw string
//
- ASSERT(Compare2 == NULL);
- Compare2 = StrnCatGrow(&Compare2, NULL, StatementWalker, 0);
+ ASSERT (Compare2 == NULL);
+ Compare2 = StrnCatGrow (&Compare2, NULL, StatementWalker, 0);
}
- if (Compare1 != NULL && Compare2 != NULL && BinOp != OperatorMax) {
- OperationResult = TestOperation(Compare1, Compare2, BinOp, CaseInsensitive, ForceStringCompare);
+ if ((Compare1 != NULL) && (Compare2 != NULL) && (BinOp != OperatorMax)) {
+ OperationResult = TestOperation (Compare1, Compare2, BinOp, CaseInsensitive, ForceStringCompare);
}
- SHELL_FREE_NON_NULL(Compare1);
- SHELL_FREE_NON_NULL(Compare2);
+ SHELL_FREE_NON_NULL (Compare1);
+ SHELL_FREE_NON_NULL (Compare2);
}
//
// done processing do result...
//
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
if (NotPresent) {
OperationResult = (BOOLEAN)(!OperationResult);
}
- switch(OperatorToUse) {
+
+ switch (OperatorToUse) {
case EndTagOr:
*PassingState = (BOOLEAN)(*PassingState || OperationResult);
break;
@@ -633,9 +663,10 @@ ProcessStatement ( *PassingState = (BOOLEAN)(OperationResult);
break;
default:
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
}
+
return (Status);
}
@@ -660,36 +691,45 @@ BuildNextStatement ( {
*EndTag = EndTagMax;
- for(
- ; ParameterNumber < gEfiShellParametersProtocol->Argc
- ; ParameterNumber++
- ) {
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[ParameterNumber],
- L"or") == 0) {
+ for (
+ ; ParameterNumber < gEfiShellParametersProtocol->Argc
+ ; ParameterNumber++
+ )
+ {
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[ParameterNumber],
+ L"or"
+ ) == 0)
+ {
*EndParameter = ParameterNumber - 1;
- *EndTag = EndTagOr;
+ *EndTag = EndTagOr;
break;
- } else if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[ParameterNumber],
- L"and") == 0) {
+ } else if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[ParameterNumber],
+ L"and"
+ ) == 0)
+ {
*EndParameter = ParameterNumber - 1;
- *EndTag = EndTagAnd;
+ *EndTag = EndTagAnd;
break;
- } else if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[ParameterNumber],
- L"then") == 0) {
+ } else if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[ParameterNumber],
+ L"then"
+ ) == 0)
+ {
*EndParameter = ParameterNumber - 1;
- *EndTag = EndTagThen;
+ *EndTag = EndTagThen;
break;
}
}
+
if (*EndTag == EndTagMax) {
return (FALSE);
}
+
return (TRUE);
}
@@ -704,36 +744,37 @@ BuildNextStatement ( **/
BOOLEAN
MoveToTagSpecial (
- IN SCRIPT_FILE *ScriptFile
+ IN SCRIPT_FILE *ScriptFile
)
{
- SCRIPT_COMMAND_LIST *CommandNode;
- BOOLEAN Found;
- UINTN TargetCount;
- CHAR16 *CommandName;
- CHAR16 *CommandWalker;
- CHAR16 *TempLocation;
+ SCRIPT_COMMAND_LIST *CommandNode;
+ BOOLEAN Found;
+ UINTN TargetCount;
+ CHAR16 *CommandName;
+ CHAR16 *CommandWalker;
+ CHAR16 *TempLocation;
- TargetCount = 1;
- Found = FALSE;
+ TargetCount = 1;
+ Found = FALSE;
if (ScriptFile == NULL) {
return FALSE;
}
- for (CommandNode = (SCRIPT_COMMAND_LIST *)GetNextNode(&ScriptFile->CommandList, &ScriptFile->CurrentCommand->Link), Found = FALSE
- ; !IsNull(&ScriptFile->CommandList, &CommandNode->Link) && !Found
- ; CommandNode = (SCRIPT_COMMAND_LIST *)GetNextNode(&ScriptFile->CommandList, &CommandNode->Link)
- ){
-
+ for (CommandNode = (SCRIPT_COMMAND_LIST *)GetNextNode (&ScriptFile->CommandList, &ScriptFile->CurrentCommand->Link), Found = FALSE
+ ; !IsNull (&ScriptFile->CommandList, &CommandNode->Link) && !Found
+ ; CommandNode = (SCRIPT_COMMAND_LIST *)GetNextNode (&ScriptFile->CommandList, &CommandNode->Link)
+ )
+ {
//
// get just the first part of the command line...
//
- CommandName = NULL;
- CommandName = StrnCatGrow(&CommandName, NULL, CommandNode->Cl, 0);
+ CommandName = NULL;
+ CommandName = StrnCatGrow (&CommandName, NULL, CommandNode->Cl, 0);
if (CommandName == NULL) {
continue;
}
+
CommandWalker = CommandName;
//
@@ -742,7 +783,8 @@ MoveToTagSpecial ( while ((CommandWalker[0] == L' ') || (CommandWalker[0] == L'\t')) {
CommandWalker++;
}
- TempLocation = StrStr(CommandWalker, L" ");
+
+ TempLocation = StrStr (CommandWalker, L" ");
if (TempLocation != NULL) {
*TempLocation = CHAR_NULL;
@@ -751,36 +793,44 @@ MoveToTagSpecial ( //
// did we find a nested item ?
//
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandWalker,
- L"If") == 0) {
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandWalker,
+ L"If"
+ ) == 0)
+ {
TargetCount++;
- } else if (TargetCount == 1 && gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandWalker,
- (CHAR16*)L"else") == 0) {
+ } else if ((TargetCount == 1) && (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandWalker,
+ (CHAR16 *)L"else"
+ ) == 0))
+ {
//
// else can only decrement the last part... not an nested if
// hence the TargetCount compare added
//
TargetCount--;
- } else if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandWalker,
- (CHAR16*)L"endif") == 0) {
+ } else if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandWalker,
+ (CHAR16 *)L"endif"
+ ) == 0)
+ {
TargetCount--;
}
+
if (TargetCount == 0) {
- ScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode(&ScriptFile->CommandList, &CommandNode->Link);
- Found = TRUE;
+ ScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode (&ScriptFile->CommandList, &CommandNode->Link);
+ Found = TRUE;
}
//
// Free the memory for this loop...
//
- SHELL_FREE_NON_NULL(CommandName);
+ SHELL_FREE_NON_NULL (CommandName);
}
+
return (Found);
}
@@ -794,12 +844,13 @@ MoveToTagSpecial ( **/
EFI_STATUS
PerformResultOperation (
- IN CONST BOOLEAN Result
+ IN CONST BOOLEAN Result
)
{
- if (Result || MoveToTagSpecial(ShellCommandGetCurrentScriptFile())) {
+ if (Result || MoveToTagSpecial (ShellCommandGetCurrentScriptFile ())) {
return (EFI_SUCCESS);
}
+
return (EFI_NOT_FOUND);
}
@@ -816,36 +867,36 @@ ShellCommandRunIf ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- BOOLEAN CaseInsensitive;
- BOOLEAN ForceString;
- UINTN CurrentParameter;
- UINTN EndParameter;
- BOOLEAN CurrentValue;
- END_TAG_TYPE Ending;
- END_TAG_TYPE PreviousEnding;
- SCRIPT_FILE *CurrentScriptFile;
-
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
-
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"if");
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ BOOLEAN CaseInsensitive;
+ BOOLEAN ForceString;
+ UINTN CurrentParameter;
+ UINTN EndParameter;
+ BOOLEAN CurrentValue;
+ END_TAG_TYPE Ending;
+ END_TAG_TYPE PreviousEnding;
+ SCRIPT_FILE *CurrentScriptFile;
+
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
+
+ if (!gEfiShellProtocol->BatchIsActive ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"if");
return (SHELL_UNSUPPORTED);
}
if (gEfiShellParametersProtocol->Argc < 3) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"if");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"if");
return (SHELL_INVALID_PARAMETER);
}
//
// Make sure that an End exists.
//
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
- if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {
- ShellPrintHiiEx(
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ if (!MoveToTag (GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -853,73 +904,86 @@ ShellCommandRunIf ( gShellLevel1HiiHandle,
L"EndIf",
L"If",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
return (SHELL_DEVICE_ERROR);
}
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- CurrentParameter = 1;
- EndParameter = 0;
-
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[1],
- L"/i") == 0 ||
- gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[2],
- L"/i") == 0 ||
- (gEfiShellParametersProtocol->Argc > 3 && gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[3],
- L"/i") == 0)) {
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
+
+ CurrentParameter = 1;
+ EndParameter = 0;
+
+ if ((gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[1],
+ L"/i"
+ ) == 0) ||
+ (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[2],
+ L"/i"
+ ) == 0) ||
+ ((gEfiShellParametersProtocol->Argc > 3) && (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[3],
+ L"/i"
+ ) == 0)))
+ {
CaseInsensitive = TRUE;
CurrentParameter++;
} else {
CaseInsensitive = FALSE;
}
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[1],
- L"/s") == 0 ||
- gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[2],
- L"/s") == 0 ||
- (gEfiShellParametersProtocol->Argc > 3 && gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[3],
- L"/s") == 0)) {
- ForceString = TRUE;
+
+ if ((gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[1],
+ L"/s"
+ ) == 0) ||
+ (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[2],
+ L"/s"
+ ) == 0) ||
+ ((gEfiShellParametersProtocol->Argc > 3) && (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[3],
+ L"/s"
+ ) == 0)))
+ {
+ ForceString = TRUE;
CurrentParameter++;
} else {
- ForceString = FALSE;
+ ForceString = FALSE;
}
for ( ShellStatus = SHELL_SUCCESS, CurrentValue = FALSE, Ending = EndTagMax
- ; CurrentParameter < gEfiShellParametersProtocol->Argc && ShellStatus == SHELL_SUCCESS
- ; CurrentParameter++) {
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- gEfiShellParametersProtocol->Argv[CurrentParameter],
- L"then") == 0) {
+ ; CurrentParameter < gEfiShellParametersProtocol->Argc && ShellStatus == SHELL_SUCCESS
+ ; CurrentParameter++)
+ {
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ gEfiShellParametersProtocol->Argv[CurrentParameter],
+ L"then"
+ ) == 0)
+ {
//
// we are at the then
//
if (CurrentParameter+1 != gEfiShellParametersProtocol->Argc) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TEXT_AFTER_THEN), gShellLevel1HiiHandle, L"if");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TEXT_AFTER_THEN), gShellLevel1HiiHandle, L"if");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = PerformResultOperation(CurrentValue);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, L"if", gEfiShellParametersProtocol->Argv[CurrentParameter]);
+ Status = PerformResultOperation (CurrentValue);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, L"if", gEfiShellParametersProtocol->Argv[CurrentParameter]);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
@@ -928,9 +992,9 @@ ShellCommandRunIf ( //
// build up the next statement for analysis
//
- if (!BuildNextStatement(CurrentParameter, &EndParameter, &Ending)) {
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
- ShellPrintHiiEx(
+ if (!BuildNextStatement (CurrentParameter, &EndParameter, &Ending)) {
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -938,43 +1002,47 @@ ShellCommandRunIf ( gShellLevel1HiiHandle,
L"Then",
L"If",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// Analyze the statement
//
- Status = ProcessStatement(&CurrentValue, CurrentParameter, EndParameter, PreviousEnding, CaseInsensitive, ForceString);
- if (EFI_ERROR(Status)) {
-// ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_STARTING), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[CurrentParameter]);
+ Status = ProcessStatement (&CurrentValue, CurrentParameter, EndParameter, PreviousEnding, CaseInsensitive, ForceString);
+ if (EFI_ERROR (Status)) {
+ // ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_STARTING), gShellLevel1HiiHandle, gEfiShellParametersProtocol->Argv[CurrentParameter]);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// Optomize to get out of the loop early...
//
- if ((Ending == EndTagOr && CurrentValue) || (Ending == EndTagAnd && !CurrentValue)) {
- Status = PerformResultOperation(CurrentValue);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, L"if", gEfiShellParametersProtocol->Argv[CurrentParameter]);
+ if (((Ending == EndTagOr) && CurrentValue) || ((Ending == EndTagAnd) && !CurrentValue)) {
+ Status = PerformResultOperation (CurrentValue);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_AFTER_BAD), gShellLevel1HiiHandle, L"if", gEfiShellParametersProtocol->Argv[CurrentParameter]);
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
break;
}
}
}
- if (ShellStatus == SHELL_SUCCESS){
+
+ if (ShellStatus == SHELL_SUCCESS) {
CurrentParameter = EndParameter;
//
// Skip over the or or and parameter.
//
- if (Ending == EndTagOr || Ending == EndTagAnd) {
+ if ((Ending == EndTagOr) || (Ending == EndTagAnd)) {
CurrentParameter++;
}
}
}
}
+
return (ShellStatus);
}
@@ -991,26 +1059,26 @@ ShellCommandRunElse ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SCRIPT_FILE *CurrentScriptFile;
+ EFI_STATUS Status;
+ SCRIPT_FILE *CurrentScriptFile;
Status = CommandInit ();
ASSERT_EFI_ERROR (Status);
if (gEfiShellParametersProtocol->Argc > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if");
return (SHELL_INVALID_PARAMETER);
}
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Else");
+ if (!gEfiShellProtocol->BatchIsActive ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Else");
return (SHELL_UNSUPPORTED);
}
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
- if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
- ShellPrintHiiEx(
+ if (!MoveToTag (GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -1018,13 +1086,15 @@ ShellCommandRunElse ( gShellLevel1HiiHandle,
L"If",
L"Else",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
return (SHELL_DEVICE_ERROR);
}
- if (!MoveToTag(GetPreviousNode, L"if", L"else", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
- ShellPrintHiiEx(
+
+ if (!MoveToTag (GetPreviousNode, L"if", L"else", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -1032,14 +1102,15 @@ ShellCommandRunElse ( gShellLevel1HiiHandle,
L"If",
L"Else",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
return (SHELL_DEVICE_ERROR);
}
- if (!MoveToTag(GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, FALSE, FALSE, FALSE)) {
- ShellPrintHiiEx(
+ if (!MoveToTag (GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, FALSE, FALSE, FALSE)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -1047,9 +1118,10 @@ ShellCommandRunElse ( gShellLevel1HiiHandle,
L"EndIf",
"Else",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
return (SHELL_DEVICE_ERROR);
}
@@ -1069,25 +1141,25 @@ ShellCommandRunEndIf ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SCRIPT_FILE *CurrentScriptFile;
+ EFI_STATUS Status;
+ SCRIPT_FILE *CurrentScriptFile;
Status = CommandInit ();
ASSERT_EFI_ERROR (Status);
if (gEfiShellParametersProtocol->Argc > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if");
return (SHELL_INVALID_PARAMETER);
}
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Endif");
+ if (!gEfiShellProtocol->BatchIsActive ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"Endif");
return (SHELL_UNSUPPORTED);
}
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
- if (!MoveToTag(GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
- ShellPrintHiiEx(
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ if (!MoveToTag (GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -1095,9 +1167,10 @@ ShellCommandRunEndIf ( gShellLevel1HiiHandle,
L"If",
L"EndIf",
- CurrentScriptFile!=NULL
- && CurrentScriptFile->CurrentCommand!=NULL
- ? CurrentScriptFile->CurrentCommand->Line:0);
+ CurrentScriptFile != NULL
+ && CurrentScriptFile->CurrentCommand != NULL
+ ? CurrentScriptFile->CurrentCommand->Line : 0
+ );
return (SHELL_DEVICE_ERROR);
}
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c index 05d65dda4f..4c0debea3f 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c @@ -22,37 +22,38 @@ ShellCommandRunShift ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SCRIPT_FILE *CurrentScriptFile;
- UINTN LoopVar;
+ EFI_STATUS Status;
+ SCRIPT_FILE *CurrentScriptFile;
+ UINTN LoopVar;
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"shift");
+ if (!gEfiShellProtocol->BatchIsActive ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"shift");
return (SHELL_UNSUPPORTED);
}
- CurrentScriptFile = ShellCommandGetCurrentScriptFile();
- ASSERT(CurrentScriptFile != NULL);
+ CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ ASSERT (CurrentScriptFile != NULL);
if (CurrentScriptFile->Argc < 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"shift");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"shift");
return (SHELL_UNSUPPORTED);
}
- for (LoopVar = 0 ; LoopVar < CurrentScriptFile->Argc ; LoopVar++) {
+ for (LoopVar = 0; LoopVar < CurrentScriptFile->Argc; LoopVar++) {
if (LoopVar == 0) {
- SHELL_FREE_NON_NULL(CurrentScriptFile->Argv[LoopVar]);
+ SHELL_FREE_NON_NULL (CurrentScriptFile->Argv[LoopVar]);
}
+
if (LoopVar < CurrentScriptFile->Argc -1) {
CurrentScriptFile->Argv[LoopVar] = CurrentScriptFile->Argv[LoopVar+1];
} else {
CurrentScriptFile->Argv[LoopVar] = NULL;
}
}
+
CurrentScriptFile->Argc--;
return (SHELL_SUCCESS);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/Stall.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/Stall.c index 1036a0648e..fb210ee80d 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/Stall.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/Stall.c @@ -22,57 +22,58 @@ ShellCommandRunStall ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINT64 Intermediate;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINT64 Intermediate;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
//
// 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), gShellLevel1HiiHandle, L"stall", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel1HiiHandle, L"stall", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"stall");
+ if (ShellCommandLineGetRawValue (Package, 2) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"stall");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"stall");
+ } else if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"stall");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellConvertStringToUint64(ShellCommandLineGetRawValue(Package, 1), &Intermediate, FALSE, FALSE);
- if (EFI_ERROR(Status) || ((UINT64)(UINTN)(Intermediate)) != Intermediate) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel1HiiHandle, L"stall", ShellCommandLineGetRawValue(Package, 1));
+ Status = ShellConvertStringToUint64 (ShellCommandLineGetRawValue (Package, 1), &Intermediate, FALSE, FALSE);
+ if (EFI_ERROR (Status) || (((UINT64)(UINTN)(Intermediate)) != Intermediate)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel1HiiHandle, L"stall", ShellCommandLineGetRawValue (Package, 1));
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = gBS->Stall((UINTN)Intermediate);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_STALL_FAILED), gShellLevel1HiiHandle, L"stall");
+ Status = gBS->Stall ((UINTN)Intermediate);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_STALL_FAILED), gShellLevel1HiiHandle, L"stall");
ShellStatus = SHELL_DEVICE_ERROR;
}
}
}
+
ShellCommandLineFreeVarList (Package);
}
+
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c index 88cddd88dd..92e438437f 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c @@ -9,15 +9,15 @@ #include "UefiShellLevel1CommandsLib.h"
-STATIC CONST CHAR16 mFileName[] = L"ShellCommands";
-EFI_HII_HANDLE gShellLevel1HiiHandle = NULL;
+STATIC CONST CHAR16 mFileName[] = L"ShellCommands";
+EFI_HII_HANDLE gShellLevel1HiiHandle = NULL;
/**
Return the help text filename. Only used if no HII information found.
@retval the filename.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameLevel1 (
VOID
@@ -47,7 +47,7 @@ ShellLevel1CommandsLibConstructor ( //
// if shell level is less than 2 do nothing
//
- if (PcdGet8(PcdShellSupportLevel) < 1) {
+ if (PcdGet8 (PcdShellSupportLevel) < 1) {
return (EFI_SUCCESS);
}
@@ -59,15 +59,15 @@ ShellLevel1CommandsLibConstructor ( //
// install our shell command handlers that are always installed
//
- ShellCommandRegisterCommandName(L"stall", ShellCommandRunStall , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_STALL) ));
- ShellCommandRegisterCommandName(L"for", ShellCommandRunFor , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_FOR) ));
- ShellCommandRegisterCommandName(L"goto", ShellCommandRunGoto , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_GOTO) ));
- ShellCommandRegisterCommandName(L"if", ShellCommandRunIf , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_IF) ));
- ShellCommandRegisterCommandName(L"shift", ShellCommandRunShift , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_SHIFT) ));
- ShellCommandRegisterCommandName(L"exit", ShellCommandRunExit , ShellCommandGetManFileNameLevel1, 1, L"", TRUE , gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_EXIT) ));
- ShellCommandRegisterCommandName(L"else", ShellCommandRunElse , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ELSE) ));
- ShellCommandRegisterCommandName(L"endif", ShellCommandRunEndIf , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ENDIF) ));
- ShellCommandRegisterCommandName(L"endfor", ShellCommandRunEndFor , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ENDFOR)));
+ ShellCommandRegisterCommandName (L"stall", ShellCommandRunStall, ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_STALL)));
+ ShellCommandRegisterCommandName (L"for", ShellCommandRunFor, ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_FOR)));
+ ShellCommandRegisterCommandName (L"goto", ShellCommandRunGoto, ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_GOTO)));
+ ShellCommandRegisterCommandName (L"if", ShellCommandRunIf, ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_IF)));
+ ShellCommandRegisterCommandName (L"shift", ShellCommandRunShift, ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_SHIFT)));
+ ShellCommandRegisterCommandName (L"exit", ShellCommandRunExit, ShellCommandGetManFileNameLevel1, 1, L"", TRUE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_EXIT)));
+ ShellCommandRegisterCommandName (L"else", ShellCommandRunElse, ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_ELSE)));
+ ShellCommandRegisterCommandName (L"endif", ShellCommandRunEndIf, ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_ENDIF)));
+ ShellCommandRegisterCommandName (L"endfor", ShellCommandRunEndFor, ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8 (PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN (STR_GET_HELP_ENDFOR)));
return (EFI_SUCCESS);
}
@@ -86,8 +86,9 @@ ShellLevel1CommandsLibDestructor ( )
{
if (gShellLevel1HiiHandle != NULL) {
- HiiRemovePackages(gShellLevel1HiiHandle);
+ HiiRemovePackages (gShellLevel1HiiHandle);
}
+
return (EFI_SUCCESS);
}
@@ -127,18 +128,18 @@ TestNodeForMove ( IN OUT UINTN *TargetCount
)
{
- BOOLEAN Found;
- CHAR16 *CommandName;
- CHAR16 *CommandNameWalker;
- CHAR16 *TempLocation;
+ BOOLEAN Found;
+ CHAR16 *CommandName;
+ CHAR16 *CommandNameWalker;
+ CHAR16 *TempLocation;
Found = FALSE;
//
// get just the first part of the command line...
//
- CommandName = NULL;
- CommandName = StrnCatGrow(&CommandName, NULL, CommandNode->Cl, 0);
+ CommandName = NULL;
+ CommandName = StrnCatGrow (&CommandName, NULL, CommandNode->Cl, 0);
if (CommandName == NULL) {
return (FALSE);
}
@@ -151,7 +152,8 @@ TestNodeForMove ( while ((CommandNameWalker[0] == L' ') || (CommandNameWalker[0] == L'\t')) {
CommandNameWalker++;
}
- TempLocation = StrStr(CommandNameWalker, L" ");
+
+ TempLocation = StrStr (CommandNameWalker, L" ");
if (TempLocation != NULL) {
*TempLocation = CHAR_NULL;
@@ -160,15 +162,19 @@ TestNodeForMove ( //
// did we find a nested item ?
//
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandNameWalker,
- (CHAR16*)IncrementerTag) == 0) {
+ if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandNameWalker,
+ (CHAR16 *)IncrementerTag
+ ) == 0)
+ {
(*TargetCount)++;
- } else if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandNameWalker,
- (CHAR16*)DecrementerTag) == 0) {
+ } else if (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandNameWalker,
+ (CHAR16 *)DecrementerTag
+ ) == 0)
+ {
if (*TargetCount > 0) {
(*TargetCount)--;
}
@@ -189,11 +195,13 @@ TestNodeForMove ( }
}
} else {
- if (gUnicodeCollation->StriColl(
- gUnicodeCollation,
- (CHAR16*)CommandNameWalker,
- (CHAR16*)Label) == 0
- && (*TargetCount) == 0) {
+ if ( (gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ (CHAR16 *)CommandNameWalker,
+ (CHAR16 *)Label
+ ) == 0)
+ && ((*TargetCount) == 0))
+ {
Found = TRUE;
if (!FindOnly) {
//
@@ -211,7 +219,7 @@ TestNodeForMove ( //
// Free the memory for this loop...
//
- FreePool(CommandName);
+ FreePool (CommandName);
return (Found);
}
@@ -240,24 +248,24 @@ TestNodeForMove ( **/
BOOLEAN
MoveToTag (
- IN CONST LIST_MANIP_FUNC Function,
- IN CONST CHAR16 *DecrementerTag,
- IN CONST CHAR16 *IncrementerTag,
- IN CONST CHAR16 *Label OPTIONAL,
- IN OUT SCRIPT_FILE *ScriptFile,
- IN CONST BOOLEAN MovePast,
- IN CONST BOOLEAN FindOnly,
- IN CONST BOOLEAN WrapAroundScript
+ IN CONST LIST_MANIP_FUNC Function,
+ IN CONST CHAR16 *DecrementerTag,
+ IN CONST CHAR16 *IncrementerTag,
+ IN CONST CHAR16 *Label OPTIONAL,
+ IN OUT SCRIPT_FILE *ScriptFile,
+ IN CONST BOOLEAN MovePast,
+ IN CONST BOOLEAN FindOnly,
+ IN CONST BOOLEAN WrapAroundScript
)
{
- SCRIPT_COMMAND_LIST *CommandNode;
- BOOLEAN Found;
- UINTN TargetCount;
+ SCRIPT_COMMAND_LIST *CommandNode;
+ BOOLEAN Found;
+ UINTN TargetCount;
if (Label == NULL) {
- TargetCount = 1;
+ TargetCount = 1;
} else {
- TargetCount = 0;
+ TargetCount = 0;
}
if (ScriptFile == NULL) {
@@ -265,38 +273,42 @@ MoveToTag ( }
for (CommandNode = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &ScriptFile->CurrentCommand->Link), Found = FALSE
- ; !IsNull(&ScriptFile->CommandList, &CommandNode->Link)&& !Found
- ; CommandNode = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &CommandNode->Link)
- ){
- Found = TestNodeForMove(
- Function,
- DecrementerTag,
- IncrementerTag,
- Label,
- ScriptFile,
- MovePast,
- FindOnly,
- CommandNode,
- &TargetCount);
+ ; !IsNull (&ScriptFile->CommandList, &CommandNode->Link) && !Found
+ ; CommandNode = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &CommandNode->Link)
+ )
+ {
+ Found = TestNodeForMove (
+ Function,
+ DecrementerTag,
+ IncrementerTag,
+ Label,
+ ScriptFile,
+ MovePast,
+ FindOnly,
+ CommandNode,
+ &TargetCount
+ );
}
if (WrapAroundScript && !Found) {
- for (CommandNode = (SCRIPT_COMMAND_LIST *)GetFirstNode(&ScriptFile->CommandList), Found = FALSE
- ; CommandNode != ScriptFile->CurrentCommand && !Found
- ; CommandNode = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &CommandNode->Link)
- ){
- Found = TestNodeForMove(
- Function,
- DecrementerTag,
- IncrementerTag,
- Label,
- ScriptFile,
- MovePast,
- FindOnly,
- CommandNode,
- &TargetCount);
+ for (CommandNode = (SCRIPT_COMMAND_LIST *)GetFirstNode (&ScriptFile->CommandList), Found = FALSE
+ ; CommandNode != ScriptFile->CurrentCommand && !Found
+ ; CommandNode = (SCRIPT_COMMAND_LIST *)(*Function)(&ScriptFile->CommandList, &CommandNode->Link)
+ )
+ {
+ Found = TestNodeForMove (
+ Function,
+ DecrementerTag,
+ IncrementerTag,
+ Label,
+ ScriptFile,
+ MovePast,
+ FindOnly,
+ CommandNode,
+ &TargetCount
+ );
}
}
+
return (Found);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h b/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h index f2f9cc5dcf..45584cdb96 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h @@ -33,7 +33,7 @@ #include <Library/HiiLib.h>
#include <Library/FileHandleLib.h>
-extern EFI_HII_HANDLE gShellLevel1HiiHandle;
+extern EFI_HII_HANDLE gShellLevel1HiiHandle;
/**
Function for 'stall' command.
@@ -139,7 +139,6 @@ ShellCommandRunShift ( IN EFI_SYSTEM_TABLE *SystemTable
);
-
/**
Function for 'else' command.
@@ -189,15 +188,14 @@ LIST_ENTRY * **/
BOOLEAN
MoveToTag (
- IN CONST LIST_MANIP_FUNC Function,
- IN CONST CHAR16 *DecrementerTag,
- IN CONST CHAR16 *IncrementerTag,
- IN CONST CHAR16 *Label OPTIONAL,
- IN OUT SCRIPT_FILE *ScriptFile,
- IN CONST BOOLEAN MovePast,
- IN CONST BOOLEAN FindOnly,
- IN CONST BOOLEAN WrapAroundScript
+ IN CONST LIST_MANIP_FUNC Function,
+ IN CONST CHAR16 *DecrementerTag,
+ IN CONST CHAR16 *IncrementerTag,
+ IN CONST CHAR16 *Label OPTIONAL,
+ IN OUT SCRIPT_FILE *ScriptFile,
+ IN CONST BOOLEAN MovePast,
+ IN CONST BOOLEAN FindOnly,
+ IN CONST BOOLEAN WrapAroundScript
);
#endif
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c index a5950b4e4b..724dc808ae 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c @@ -9,19 +9,19 @@ #include "UefiShellLevel2CommandsLib.h"
-STATIC CONST CHAR16 AllFiles[] = L"*";
-
-STATIC CONST SHELL_PARAM_ITEM AttribParamList[] = {
- {L"-a", TypeFlag},
- {L"+a", TypeFlag},
- {L"-s", TypeFlag},
- {L"+s", TypeFlag},
- {L"-h", TypeFlag},
- {L"+h", TypeFlag},
- {L"-r", TypeFlag},
- {L"+r", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST CHAR16 AllFiles[] = L"*";
+
+STATIC CONST SHELL_PARAM_ITEM AttribParamList[] = {
+ { L"-a", TypeFlag },
+ { L"+a", TypeFlag },
+ { L"-s", TypeFlag },
+ { L"+s", TypeFlag },
+ { L"-h", TypeFlag },
+ { L"+h", TypeFlag },
+ { L"-r", TypeFlag },
+ { L"+r", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'attrib' command.
@@ -36,127 +36,137 @@ ShellCommandRunAttrib ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- UINT64 FileAttributesToAdd;
- UINT64 FileAttributesToRemove;
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINTN ParamNumberCount;
- CONST CHAR16 *FileName;
- EFI_SHELL_FILE_INFO *ListOfFiles;
- EFI_SHELL_FILE_INFO *FileNode;
- EFI_FILE_INFO *FileInfo;
-
- ListOfFiles = NULL;
- ShellStatus = SHELL_SUCCESS;
- ProblemParam = NULL;
+ UINT64 FileAttributesToAdd;
+ UINT64 FileAttributesToRemove;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamNumberCount;
+ CONST CHAR16 *FileName;
+ EFI_SHELL_FILE_INFO *ListOfFiles;
+ EFI_SHELL_FILE_INFO *FileNode;
+ EFI_FILE_INFO *FileInfo;
+
+ ListOfFiles = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ ProblemParam = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParse (AttribParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"attrib", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"attrib", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
-
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
} else {
- FileAttributesToAdd = 0;
+ FileAttributesToAdd = 0;
FileAttributesToRemove = 0;
//
// apply or remove each flag
//
- if (ShellCommandLineGetFlag(Package, L"+a")) {
+ if (ShellCommandLineGetFlag (Package, L"+a")) {
FileAttributesToAdd |= EFI_FILE_ARCHIVE;
}
- if (ShellCommandLineGetFlag(Package, L"-a")) {
+
+ if (ShellCommandLineGetFlag (Package, L"-a")) {
FileAttributesToRemove |= EFI_FILE_ARCHIVE;
}
- if (ShellCommandLineGetFlag(Package, L"+s")) {
+
+ if (ShellCommandLineGetFlag (Package, L"+s")) {
FileAttributesToAdd |= EFI_FILE_SYSTEM;
}
- if (ShellCommandLineGetFlag(Package, L"-s")) {
+
+ if (ShellCommandLineGetFlag (Package, L"-s")) {
FileAttributesToRemove |= EFI_FILE_SYSTEM;
}
- if (ShellCommandLineGetFlag(Package, L"+h")) {
+
+ if (ShellCommandLineGetFlag (Package, L"+h")) {
FileAttributesToAdd |= EFI_FILE_HIDDEN;
}
- if (ShellCommandLineGetFlag(Package, L"-h")) {
+
+ if (ShellCommandLineGetFlag (Package, L"-h")) {
FileAttributesToRemove |= EFI_FILE_HIDDEN;
}
- if (ShellCommandLineGetFlag(Package, L"+r")) {
+
+ if (ShellCommandLineGetFlag (Package, L"+r")) {
FileAttributesToAdd |= EFI_FILE_READ_ONLY;
}
- if (ShellCommandLineGetFlag(Package, L"-r")) {
+
+ if (ShellCommandLineGetFlag (Package, L"-r")) {
FileAttributesToRemove |= EFI_FILE_READ_ONLY;
}
- if (FileAttributesToRemove == 0 && FileAttributesToAdd == 0) {
+ if ((FileAttributesToRemove == 0) && (FileAttributesToAdd == 0)) {
//
// Do display as we have no attributes to change
//
for ( ParamNumberCount = 1
- ;
- ; ParamNumberCount++
- ){
- FileName = ShellCommandLineGetRawValue(Package, ParamNumberCount);
+ ;
+ ; ParamNumberCount++
+ )
+ {
+ FileName = ShellCommandLineGetRawValue (Package, ParamNumberCount);
// if we dont have anything left, move on...
- if (FileName == NULL && ParamNumberCount == 1) {
- FileName = (CHAR16*)AllFiles;
+ if ((FileName == NULL) && (ParamNumberCount == 1)) {
+ FileName = (CHAR16 *)AllFiles;
} else if (FileName == NULL) {
break;
}
- ASSERT(ListOfFiles == NULL);
- Status = ShellOpenFileMetaArg((CHAR16*)FileName, EFI_FILE_MODE_READ, &ListOfFiles);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount));
+
+ ASSERT (ListOfFiles == NULL);
+ Status = ShellOpenFileMetaArg ((CHAR16 *)FileName, EFI_FILE_MODE_READ, &ListOfFiles);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue (Package, ParamNumberCount));
ShellStatus = SHELL_NOT_FOUND;
} else {
- for (FileNode = (EFI_SHELL_FILE_INFO*)GetFirstNode(&ListOfFiles->Link)
- ; !IsNull(&ListOfFiles->Link, &FileNode->Link)
- ; FileNode = (EFI_SHELL_FILE_INFO*)GetNextNode(&ListOfFiles->Link, &FileNode->Link)
- ){
- ShellPrintHiiEx(
+ for (FileNode = (EFI_SHELL_FILE_INFO *)GetFirstNode (&ListOfFiles->Link)
+ ; !IsNull (&ListOfFiles->Link, &FileNode->Link)
+ ; FileNode = (EFI_SHELL_FILE_INFO *)GetNextNode (&ListOfFiles->Link, &FileNode->Link)
+ )
+ {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_ATTRIB_OUTPUT_LINE),
gShellLevel2HiiHandle,
- FileNode->Info->Attribute&EFI_FILE_DIRECTORY? L'D':L' ',
- FileNode->Info->Attribute&EFI_FILE_ARCHIVE? L'A':L' ',
- FileNode->Info->Attribute&EFI_FILE_SYSTEM? L'S':L' ',
- FileNode->Info->Attribute&EFI_FILE_HIDDEN? L'H':L' ',
- FileNode->Info->Attribute&EFI_FILE_READ_ONLY? L'R':L' ',
+ FileNode->Info->Attribute&EFI_FILE_DIRECTORY ? L'D' : L' ',
+ FileNode->Info->Attribute&EFI_FILE_ARCHIVE ? L'A' : L' ',
+ FileNode->Info->Attribute&EFI_FILE_SYSTEM ? L'S' : L' ',
+ FileNode->Info->Attribute&EFI_FILE_HIDDEN ? L'H' : L' ',
+ FileNode->Info->Attribute&EFI_FILE_READ_ONLY ? L'R' : L' ',
FileNode->FileName
- );
+ );
- if (ShellGetExecutionBreakFlag()) {
- ShellStatus = SHELL_ABORTED;
- break;
+ if (ShellGetExecutionBreakFlag ()) {
+ ShellStatus = SHELL_ABORTED;
+ break;
}
}
- Status = ShellCloseFileMetaArg(&ListOfFiles);
+
+ Status = ShellCloseFileMetaArg (&ListOfFiles);
ListOfFiles = NULL;
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_CLOSE_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount));
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_CLOSE_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue (Package, ParamNumberCount));
ShellStatus = SHELL_NOT_FOUND;
}
} // for loop for handling wildcard filenames
@@ -165,26 +175,28 @@ ShellCommandRunAttrib ( //
// fail as we have conflcting params.
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel2HiiHandle, L"attrib");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel2HiiHandle, L"attrib");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// enumerate through all the files/directories and apply the attributes
//
for ( ParamNumberCount = 1
- ;
- ; ParamNumberCount++
- ){
- FileName = ShellCommandLineGetRawValue(Package, ParamNumberCount);
+ ;
+ ; ParamNumberCount++
+ )
+ {
+ FileName = ShellCommandLineGetRawValue (Package, ParamNumberCount);
// if we dont have anything left, move on...
if (FileName == NULL) {
//
// make sure we are not failing on the first one we do... if yes that's an error...
//
if (ParamNumberCount == 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"attrib");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"attrib");
ShellStatus = SHELL_INVALID_PARAMETER;
}
+
break;
}
@@ -196,24 +208,25 @@ ShellCommandRunAttrib ( //
// Open the file(s)
//
- ASSERT(ListOfFiles == NULL);
- Status = ShellOpenFileMetaArg((CHAR16*)FileName, EFI_FILE_MODE_READ, &ListOfFiles);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount));
+ ASSERT (ListOfFiles == NULL);
+ Status = ShellOpenFileMetaArg ((CHAR16 *)FileName, EFI_FILE_MODE_READ, &ListOfFiles);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue (Package, ParamNumberCount));
ShellStatus = SHELL_NOT_FOUND;
} else {
- for (FileNode = (EFI_SHELL_FILE_INFO*)GetFirstNode(&ListOfFiles->Link)
- ; !IsNull(&ListOfFiles->Link, &FileNode->Link)
- ; FileNode = (EFI_SHELL_FILE_INFO*)GetNextNode(&ListOfFiles->Link, &FileNode->Link)
- ){
+ for (FileNode = (EFI_SHELL_FILE_INFO *)GetFirstNode (&ListOfFiles->Link)
+ ; !IsNull (&ListOfFiles->Link, &FileNode->Link)
+ ; FileNode = (EFI_SHELL_FILE_INFO *)GetNextNode (&ListOfFiles->Link, &FileNode->Link)
+ )
+ {
//
// skip the directory traversing stuff...
//
- if (StrCmp(FileNode->FileName, L".") == 0 || StrCmp(FileNode->FileName, L"..") == 0) {
+ if ((StrCmp (FileNode->FileName, L".") == 0) || (StrCmp (FileNode->FileName, L"..") == 0)) {
continue;
}
- FileInfo = gEfiShellProtocol->GetFileInfo(FileNode->Handle);
+ FileInfo = gEfiShellProtocol->GetFileInfo (FileNode->Handle);
//
// if we are removing Read-Only we need to do that alone
@@ -223,9 +236,9 @@ ShellCommandRunAttrib ( //
// SetFileInfo
//
- Status = ShellSetFileInfo(FileNode->Handle, FileInfo);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount));
+ Status = ShellSetFileInfo (FileNode->Handle, FileInfo);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue (Package, ParamNumberCount));
ShellStatus = SHELL_ACCESS_DENIED;
}
}
@@ -239,18 +252,19 @@ ShellCommandRunAttrib ( //
// SetFileInfo
//
- Status = ShellSetFileInfo(FileNode->Handle, FileInfo);
- if (EFI_ERROR(Status)) {;
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount));
+ Status = ShellSetFileInfo (FileNode->Handle, FileInfo);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue (Package, ParamNumberCount));
ShellStatus = SHELL_ACCESS_DENIED;
}
- SHELL_FREE_NON_NULL(FileInfo);
+ SHELL_FREE_NON_NULL (FileInfo);
}
- Status = ShellCloseFileMetaArg(&ListOfFiles);
+
+ Status = ShellCloseFileMetaArg (&ListOfFiles);
ListOfFiles = NULL;
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_CLOSE_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue(Package, ParamNumberCount));
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_CLOSE_FAIL), gShellLevel2HiiHandle, L"attrib", ShellCommandLineGetRawValue (Package, ParamNumberCount));
ShellStatus = SHELL_NOT_FOUND;
}
} // for loop for handling wildcard filenames
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c index 30243da222..48ef988fb7 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c @@ -31,33 +31,33 @@ ReplaceDriveWithCwd ( IN CONST CHAR16 *Cwd
)
{
- CHAR16 *Splitter;
- CHAR16 *TempBuffer;
- UINTN TotalSize;
+ CHAR16 *Splitter;
+ CHAR16 *TempBuffer;
+ UINTN TotalSize;
Splitter = NULL;
TempBuffer = NULL;
TotalSize = 0;
- if (FullPath == NULL || *FullPath == NULL) {
+ if ((FullPath == NULL) || (*FullPath == NULL)) {
return EFI_SUCCESS;
}
Splitter = StrStr (*FullPath, L":");
- ASSERT(Splitter != *FullPath);
+ ASSERT (Splitter != *FullPath);
- if (Splitter != NULL && *(Splitter + 1) != L'\\' && *(Splitter + 1) != L'/') {
- TotalSize = StrSize (Cwd) + StrSize (Splitter + 1);
+ if ((Splitter != NULL) && (*(Splitter + 1) != L'\\') && (*(Splitter + 1) != L'/')) {
+ TotalSize = StrSize (Cwd) + StrSize (Splitter + 1);
TempBuffer = AllocateZeroPool (TotalSize);
if (TempBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- StrCpyS (TempBuffer, TotalSize / sizeof(CHAR16), Cwd);
- StrCatS (TempBuffer, TotalSize / sizeof(CHAR16), L"\\");
- StrCatS (TempBuffer, TotalSize / sizeof(CHAR16), Splitter + 1);
+ StrCpyS (TempBuffer, TotalSize / sizeof (CHAR16), Cwd);
+ StrCatS (TempBuffer, TotalSize / sizeof (CHAR16), L"\\");
+ StrCatS (TempBuffer, TotalSize / sizeof (CHAR16), Splitter + 1);
- FreePool(*FullPath);
+ FreePool (*FullPath);
*FullPath = TempBuffer;
}
@@ -75,17 +75,17 @@ ReplaceDriveWithCwd ( **/
BOOLEAN
IsCurrentFileSystem (
- IN CONST CHAR16 *FullPath,
- IN CONST CHAR16 *Cwd
+ IN CONST CHAR16 *FullPath,
+ IN CONST CHAR16 *Cwd
)
{
- CHAR16 *Splitter1;
- CHAR16 *Splitter2;
+ CHAR16 *Splitter1;
+ CHAR16 *Splitter2;
Splitter1 = NULL;
Splitter2 = NULL;
- ASSERT(FullPath != NULL);
+ ASSERT (FullPath != NULL);
Splitter1 = StrStr (FullPath, L":");
if (Splitter1 == NULL) {
@@ -94,10 +94,10 @@ IsCurrentFileSystem ( Splitter2 = StrStr (Cwd, L":");
- if (((UINTN) Splitter1 - (UINTN) FullPath) != ((UINTN) Splitter2 - (UINTN) Cwd)) {
+ if (((UINTN)Splitter1 - (UINTN)FullPath) != ((UINTN)Splitter2 - (UINTN)Cwd)) {
return FALSE;
} else {
- if (StrniCmp (FullPath, Cwd, ((UINTN) Splitter1 - (UINTN) FullPath) / sizeof (CHAR16)) == 0) {
+ if (StrniCmp (FullPath, Cwd, ((UINTN)Splitter1 - (UINTN)FullPath) / sizeof (CHAR16)) == 0) {
return TRUE;
} else {
return FALSE;
@@ -119,12 +119,12 @@ IsCurrentFileSystem ( **/
EFI_STATUS
ExtractDriveAndPath (
- IN CONST CHAR16 *FullPath,
- OUT CHAR16 **Drive,
- OUT CHAR16 **Path
+ IN CONST CHAR16 *FullPath,
+ OUT CHAR16 **Drive,
+ OUT CHAR16 **Path
)
{
- CHAR16 *Splitter;
+ CHAR16 *Splitter;
ASSERT (FullPath != NULL);
@@ -132,22 +132,23 @@ ExtractDriveAndPath ( if (Splitter == NULL) {
*Drive = NULL;
- *Path = AllocateCopyPool (StrSize (FullPath), FullPath);
+ *Path = AllocateCopyPool (StrSize (FullPath), FullPath);
if (*Path == NULL) {
return EFI_OUT_OF_RESOURCES;
}
} else {
if (*(Splitter + 1) == CHAR_NULL) {
*Drive = AllocateCopyPool (StrSize (FullPath), FullPath);
- *Path = NULL;
+ *Path = NULL;
if (*Drive == NULL) {
return EFI_OUT_OF_RESOURCES;
}
} else {
- *Drive = AllocateCopyPool ((Splitter - FullPath + 2) * sizeof(CHAR16), FullPath);
+ *Drive = AllocateCopyPool ((Splitter - FullPath + 2) * sizeof (CHAR16), FullPath);
if (*Drive == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
(*Drive)[Splitter - FullPath + 1] = CHAR_NULL;
*Path = AllocateCopyPool (StrSize (Splitter + 1), Splitter + 1);
@@ -174,59 +175,59 @@ ShellCommandRunCd ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CONST CHAR16 *Cwd;
- CHAR16 *Path;
- CHAR16 *Drive;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Param1;
- CHAR16 *Param1Copy;
- CHAR16 *Walker;
- CHAR16 *Splitter;
- CHAR16 *TempBuffer;
- UINTN TotalSize;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- Cwd = NULL;
- Path = NULL;
- Drive = NULL;
- Splitter = NULL;
- TempBuffer = NULL;
- TotalSize = 0;
-
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CONST CHAR16 *Cwd;
+ CHAR16 *Path;
+ CHAR16 *Drive;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Param1;
+ CHAR16 *Param1Copy;
+ CHAR16 *Walker;
+ CHAR16 *Splitter;
+ CHAR16 *TempBuffer;
+ UINTN TotalSize;
+
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ Cwd = NULL;
+ Path = NULL;
+ Drive = NULL;
+ Splitter = NULL;
+ TempBuffer = NULL;
+ TotalSize = 0;
+
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ 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), gShellLevel2HiiHandle, L"cd", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"cd", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
}
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"cd");
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 2) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"cd");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
@@ -237,7 +238,7 @@ ShellCommandRunCd ( //
Cwd = ShellGetCurrentDir (NULL);
if (Cwd == NULL) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"cd");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"cd");
ShellStatus = SHELL_NOT_FOUND;
} else {
Param1 = ShellCommandLineGetRawValue (Package, 1);
@@ -245,17 +246,17 @@ ShellCommandRunCd ( //
// display the current directory
//
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_CD_PRINT), gShellLevel2HiiHandle, Cwd);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CD_PRINT), gShellLevel2HiiHandle, Cwd);
} else {
Param1Copy = CatSPrint (NULL, L"%s", Param1, NULL);
for (Walker = Param1Copy; Walker != NULL && *Walker != CHAR_NULL; Walker++) {
if (*Walker == L'\"') {
- CopyMem (Walker, Walker + 1, StrSize(Walker) - sizeof(Walker[0]));
+ CopyMem (Walker, Walker + 1, StrSize (Walker) - sizeof (Walker[0]));
}
}
- if (Param1Copy != NULL && IsCurrentFileSystem (Param1Copy, Cwd)) {
- Status = ReplaceDriveWithCwd (&Param1Copy,Cwd);
+ if ((Param1Copy != NULL) && IsCurrentFileSystem (Param1Copy, Cwd)) {
+ Status = ReplaceDriveWithCwd (&Param1Copy, Cwd);
} else {
//
// Can't use cd command to change filesystem.
@@ -264,27 +265,27 @@ ShellCommandRunCd ( Status = EFI_NOT_FOUND;
}
- if (!EFI_ERROR(Status) && Param1Copy != NULL) {
+ if (!EFI_ERROR (Status) && (Param1Copy != NULL)) {
Splitter = StrStr (Cwd, L":");
if (Param1Copy[0] == L'\\') {
//
// Absolute Path on current drive letter.
//
- TotalSize = ((Splitter - Cwd + 1) * sizeof(CHAR16)) + StrSize(Param1Copy);
+ TotalSize = ((Splitter - Cwd + 1) * sizeof (CHAR16)) + StrSize (Param1Copy);
TempBuffer = AllocateZeroPool (TotalSize);
if (TempBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
- StrnCpyS (TempBuffer, TotalSize / sizeof(CHAR16), Cwd, (Splitter - Cwd + 1));
- StrCatS (TempBuffer, TotalSize / sizeof(CHAR16), Param1Copy);
+ StrnCpyS (TempBuffer, TotalSize / sizeof (CHAR16), Cwd, (Splitter - Cwd + 1));
+ StrCatS (TempBuffer, TotalSize / sizeof (CHAR16), Param1Copy);
FreePool (Param1Copy);
Param1Copy = TempBuffer;
TempBuffer = NULL;
}
} else {
- if (StrStr (Param1Copy,L":") == NULL) {
- TotalSize = StrSize (Cwd) + StrSize (Param1Copy);
+ if (StrStr (Param1Copy, L":") == NULL) {
+ TotalSize = StrSize (Cwd) + StrSize (Param1Copy);
TempBuffer = AllocateZeroPool (TotalSize);
if (TempBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -301,19 +302,19 @@ ShellCommandRunCd ( }
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Param1Copy = PathCleanUpDirectories (Param1Copy);
- Status = ExtractDriveAndPath (Param1Copy, &Drive, &Path);
+ Status = ExtractDriveAndPath (Param1Copy, &Drive, &Path);
}
- if (!EFI_ERROR (Status) && Drive != NULL && Path != NULL) {
- if (EFI_ERROR(ShellIsDirectory (Param1Copy))) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cd", Param1Copy);
+ if (!EFI_ERROR (Status) && (Drive != NULL) && (Path != NULL)) {
+ if (EFI_ERROR (ShellIsDirectory (Param1Copy))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cd", Param1Copy);
ShellStatus = SHELL_NOT_FOUND;
} else {
Status = gEfiShellProtocol->SetCurDir (Drive, Path + 1);
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cd", Param1Copy);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cd", Param1Copy);
ShellStatus = SHELL_NOT_FOUND;
}
}
@@ -342,4 +343,3 @@ ShellCommandRunCd ( //
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c index 4a2c2cfe64..c3927ca35b 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c @@ -29,7 +29,7 @@ @retval SHELL_OUT_OF_RESOURCES a memory allocation failed
**/
SHELL_STATUS
-ValidateAndCopyFiles(
+ValidateAndCopyFiles (
IN CONST EFI_SHELL_FILE_INFO *FileList,
IN CONST CHAR16 *DestDir,
IN BOOLEAN SilentMode,
@@ -51,12 +51,12 @@ ValidateAndCopyFiles( @retval SHELL_SUCCESS The source file was copied to the destination
**/
SHELL_STATUS
-CopySingleFile(
- IN CONST CHAR16 *Source,
- IN CONST CHAR16 *Dest,
- OUT VOID **Resp,
- IN BOOLEAN SilentMode,
- IN CONST CHAR16 *CmdName
+CopySingleFile (
+ IN CONST CHAR16 *Source,
+ IN CONST CHAR16 *Dest,
+ OUT VOID **Resp,
+ IN BOOLEAN SilentMode,
+ IN CONST CHAR16 *CmdName
)
{
VOID *Response;
@@ -75,28 +75,29 @@ CopySingleFile( EFI_FILE_SYSTEM_INFO *DestVolumeInfo;
UINTN DestVolumeInfoSize;
- ASSERT(Resp != NULL);
+ ASSERT (Resp != NULL);
- SourceHandle = NULL;
- DestHandle = NULL;
- Response = *Resp;
- List = NULL;
- DestVolumeInfo = NULL;
- ShellStatus = SHELL_SUCCESS;
+ SourceHandle = NULL;
+ DestHandle = NULL;
+ Response = *Resp;
+ List = NULL;
+ DestVolumeInfo = NULL;
+ ShellStatus = SHELL_SUCCESS;
- ReadSize = PcdGet32(PcdShellFileOperationSize);
+ ReadSize = PcdGet32 (PcdShellFileOperationSize);
// Why bother copying a file to itself
- if (StrCmp(Source, Dest) == 0) {
+ if (StrCmp (Source, Dest) == 0) {
return (SHELL_SUCCESS);
}
//
// if the destination file existed check response and possibly prompt user
//
- if (ShellFileExists(Dest) == EFI_SUCCESS) {
- if (Response == NULL && !SilentMode) {
- Status = ShellPromptForResponseHii(ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response);
+ if (ShellFileExists (Dest) == EFI_SUCCESS) {
+ if ((Response == NULL) && !SilentMode) {
+ Status = ShellPromptForResponseHii (ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response);
}
+
//
// possibly return based on response
//
@@ -104,7 +105,8 @@ CopySingleFile( if (Response == NULL) {
return SHELL_ABORTED;
}
- switch (*(SHELL_PROMPT_RESPONSE*)Response) {
+
+ switch (*(SHELL_PROMPT_RESPONSE *)Response) {
case ShellPromptResponseNo:
//
// return success here so we dont stop the process
@@ -126,39 +128,39 @@ CopySingleFile( }
}
- if (ShellIsDirectory(Source) == EFI_SUCCESS) {
- Status = ShellCreateDirectory(Dest, &DestHandle);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_DIR_FAIL), gShellLevel2HiiHandle, CmdName, Dest);
+ if (ShellIsDirectory (Source) == EFI_SUCCESS) {
+ Status = ShellCreateDirectory (Dest, &DestHandle);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_DIR_FAIL), gShellLevel2HiiHandle, CmdName, Dest);
return (SHELL_ACCESS_DENIED);
}
//
// Now copy all the files under the directory...
//
- TempName = NULL;
- Size = 0;
- StrnCatGrow(&TempName, &Size, Source, 0);
- StrnCatGrow(&TempName, &Size, L"\\*", 0);
+ TempName = NULL;
+ Size = 0;
+ StrnCatGrow (&TempName, &Size, Source, 0);
+ StrnCatGrow (&TempName, &Size, L"\\*", 0);
if (TempName != NULL) {
- ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List);
+ ShellOpenFileMetaArg ((CHAR16 *)TempName, EFI_FILE_MODE_READ, &List);
*TempName = CHAR_NULL;
- StrnCatGrow(&TempName, &Size, Dest, 0);
- StrnCatGrow(&TempName, &Size, L"\\", 0);
- ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp);
- ShellCloseFileMetaArg(&List);
- SHELL_FREE_NON_NULL(TempName);
+ StrnCatGrow (&TempName, &Size, Dest, 0);
+ StrnCatGrow (&TempName, &Size, L"\\", 0);
+ ShellStatus = ValidateAndCopyFiles (List, TempName, SilentMode, TRUE, Resp);
+ ShellCloseFileMetaArg (&List);
+ SHELL_FREE_NON_NULL (TempName);
Size = 0;
}
} else {
- Status = ShellDeleteFileByName(Dest);
+ Status = ShellDeleteFileByName (Dest);
//
// open file with create enabled
//
- Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_OPEN_FAIL), gShellLevel2HiiHandle, CmdName, Dest);
+ Status = ShellOpenFileByName (Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_OPEN_FAIL), gShellLevel2HiiHandle, CmdName, Dest);
return (SHELL_ACCESS_DENIED);
}
@@ -172,90 +174,93 @@ CopySingleFile( }
//
- //get file size of source file and freespace available on destination volume
+ // get file size of source file and freespace available on destination volume
//
- ShellGetFileSize(SourceHandle, &SourceFileSize);
- ShellGetFileSize(DestHandle, &DestFileSize);
+ ShellGetFileSize (SourceHandle, &SourceFileSize);
+ ShellGetFileSize (DestHandle, &DestFileSize);
//
- //if the destination file already exists then it will be replaced, meaning the sourcefile effectively needs less storage space
+ // if the destination file already exists then it will be replaced, meaning the sourcefile effectively needs less storage space
//
- if(DestFileSize < SourceFileSize){
+ if (DestFileSize < SourceFileSize) {
SourceFileSize -= DestFileSize;
} else {
SourceFileSize = 0;
}
//
- //get the system volume info to check the free space
+ // get the system volume info to check the free space
//
- DestVolumeFP = ConvertShellHandleToEfiFileProtocol(DestHandle);
- DestVolumeInfo = NULL;
+ DestVolumeFP = ConvertShellHandleToEfiFileProtocol (DestHandle);
+ DestVolumeInfo = NULL;
DestVolumeInfoSize = 0;
- Status = DestVolumeFP->GetInfo(
- DestVolumeFP,
- &gEfiFileSystemInfoGuid,
- &DestVolumeInfoSize,
- DestVolumeInfo
- );
+ Status = DestVolumeFP->GetInfo (
+ DestVolumeFP,
+ &gEfiFileSystemInfoGuid,
+ &DestVolumeInfoSize,
+ DestVolumeInfo
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- DestVolumeInfo = AllocateZeroPool(DestVolumeInfoSize);
- Status = DestVolumeFP->GetInfo(
- DestVolumeFP,
- &gEfiFileSystemInfoGuid,
- &DestVolumeInfoSize,
- DestVolumeInfo
- );
+ DestVolumeInfo = AllocateZeroPool (DestVolumeInfoSize);
+ Status = DestVolumeFP->GetInfo (
+ DestVolumeFP,
+ &gEfiFileSystemInfoGuid,
+ &DestVolumeInfoSize,
+ DestVolumeInfo
+ );
}
//
- //check if enough space available on destination drive to complete copy
+ // check if enough space available on destination drive to complete copy
//
- if (DestVolumeInfo!= NULL && (DestVolumeInfo->FreeSpace < SourceFileSize)) {
+ if ((DestVolumeInfo != NULL) && (DestVolumeInfo->FreeSpace < SourceFileSize)) {
//
- //not enough space on destination directory to copy file
+ // not enough space on destination directory to copy file
//
- SHELL_FREE_NON_NULL(DestVolumeInfo);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_FAIL), gShellLevel2HiiHandle, CmdName);
- return(SHELL_VOLUME_FULL);
+ SHELL_FREE_NON_NULL (DestVolumeInfo);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_FAIL), gShellLevel2HiiHandle, CmdName);
+ return (SHELL_VOLUME_FULL);
} else {
//
// copy data between files
//
- Buffer = AllocateZeroPool(ReadSize);
+ Buffer = AllocateZeroPool (ReadSize);
if (Buffer == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, CmdName);
return SHELL_OUT_OF_RESOURCES;
}
- while (ReadSize == PcdGet32(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {
- Status = ShellReadFile(SourceHandle, &ReadSize, Buffer);
- if (!EFI_ERROR(Status)) {
- Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);
- if (EFI_ERROR(Status)) {
- ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_WRITE_ERROR), gShellLevel2HiiHandle, CmdName, Dest);
+
+ while (ReadSize == PcdGet32 (PcdShellFileOperationSize) && !EFI_ERROR (Status)) {
+ Status = ShellReadFile (SourceHandle, &ReadSize, Buffer);
+ if (!EFI_ERROR (Status)) {
+ Status = ShellWriteFile (DestHandle, &ReadSize, Buffer);
+ if (EFI_ERROR (Status)) {
+ ShellStatus = (SHELL_STATUS)(Status & (~MAX_BIT));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_WRITE_ERROR), gShellLevel2HiiHandle, CmdName, Dest);
break;
}
} else {
- ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_READ_ERROR), gShellLevel2HiiHandle, CmdName, Source);
+ ShellStatus = (SHELL_STATUS)(Status & (~MAX_BIT));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_READ_ERROR), gShellLevel2HiiHandle, CmdName, Source);
break;
}
}
}
- SHELL_FREE_NON_NULL(DestVolumeInfo);
+
+ SHELL_FREE_NON_NULL (DestVolumeInfo);
}
//
// close files
//
if (DestHandle != NULL) {
- ShellCloseFile(&DestHandle);
- DestHandle = NULL;
+ ShellCloseFile (&DestHandle);
+ DestHandle = NULL;
}
+
if (SourceHandle != NULL) {
- ShellCloseFile(&SourceHandle);
+ ShellCloseFile (&SourceHandle);
SourceHandle = NULL;
}
@@ -286,7 +291,7 @@ CopySingleFile( @retval SHELL_OUT_OF_RESOURCES a memory allocation failed
**/
SHELL_STATUS
-ValidateAndCopyFiles(
+ValidateAndCopyFiles (
IN CONST EFI_SHELL_FILE_INFO *FileList,
IN CONST CHAR16 *DestDir,
IN BOOLEAN SilentMode,
@@ -294,17 +299,17 @@ ValidateAndCopyFiles( IN VOID **Resp
)
{
- CHAR16 *HiiOutput;
- CHAR16 *HiiResultOk;
- CONST EFI_SHELL_FILE_INFO *Node;
- SHELL_STATUS ShellStatus;
- EFI_STATUS Status;
- CHAR16 *DestPath;
- VOID *Response;
- UINTN PathSize;
- CONST CHAR16 *Cwd;
- UINTN NewSize;
- CHAR16 *CleanFilePathStr;
+ CHAR16 *HiiOutput;
+ CHAR16 *HiiResultOk;
+ CONST EFI_SHELL_FILE_INFO *Node;
+ SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+ CHAR16 *DestPath;
+ VOID *Response;
+ UINTN PathSize;
+ CONST CHAR16 *Cwd;
+ UINTN NewSize;
+ CHAR16 *CleanFilePathStr;
if (Resp == NULL) {
Response = NULL;
@@ -315,12 +320,11 @@ ValidateAndCopyFiles( DestPath = NULL;
ShellStatus = SHELL_SUCCESS;
PathSize = 0;
- Cwd = ShellGetCurrentDir(NULL);
+ Cwd = ShellGetCurrentDir (NULL);
CleanFilePathStr = NULL;
- ASSERT(FileList != NULL);
- ASSERT(DestDir != NULL);
-
+ ASSERT (FileList != NULL);
+ ASSERT (DestDir != NULL);
Status = ShellLevel2StripQuotes (DestDir, &CleanFilePathStr);
if (EFI_ERROR (Status)) {
@@ -336,28 +340,30 @@ ValidateAndCopyFiles( //
// If we are trying to copy multiple files... make sure we got a directory for the target...
//
- if (EFI_ERROR(ShellIsDirectory(CleanFilePathStr)) && FileList->Link.ForwardLink != FileList->Link.BackLink) {
+ if (EFI_ERROR (ShellIsDirectory (CleanFilePathStr)) && (FileList->Link.ForwardLink != FileList->Link.BackLink)) {
//
// Error for destination not a directory
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
FreePool (CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
- for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link)
- ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link)
- ){
+
+ for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; !IsNull (&FileList->Link, &Node->Link)
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
+ )
+ {
//
// skip the directory traversing stuff...
//
- if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) {
+ if ((StrCmp (Node->FileName, L".") == 0) || (StrCmp (Node->FileName, L"..") == 0)) {
continue;
}
- NewSize = StrSize(CleanFilePathStr);
- NewSize += StrSize(Node->FullName);
- NewSize += (Cwd == NULL)? 0 : (StrSize(Cwd) + sizeof(CHAR16));
+ NewSize = StrSize (CleanFilePathStr);
+ NewSize += StrSize (Node->FullName);
+ NewSize += (Cwd == NULL) ? 0 : (StrSize (Cwd) + sizeof (CHAR16));
if (NewSize > PathSize) {
PathSize = NewSize;
}
@@ -365,8 +371,8 @@ ValidateAndCopyFiles( //
// Make sure got -r if required
//
- if (!RecursiveMode && !EFI_ERROR(ShellIsDirectory(Node->FullName))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_REQ), gShellLevel2HiiHandle, L"cp");
+ if (!RecursiveMode && !EFI_ERROR (ShellIsDirectory (Node->FullName))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_REQ), gShellLevel2HiiHandle, L"cp");
FreePool (CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
@@ -374,11 +380,11 @@ ValidateAndCopyFiles( //
// make sure got dest as dir if needed
//
- if (!EFI_ERROR(ShellIsDirectory(Node->FullName)) && EFI_ERROR(ShellIsDirectory(CleanFilePathStr))) {
+ if (!EFI_ERROR (ShellIsDirectory (Node->FullName)) && EFI_ERROR (ShellIsDirectory (CleanFilePathStr))) {
//
// Error for destination not a directory
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
FreePool (CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
@@ -386,12 +392,12 @@ ValidateAndCopyFiles( HiiOutput = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_CP_OUTPUT), NULL);
HiiResultOk = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_GEN_RES_OK), NULL);
- DestPath = AllocateZeroPool(PathSize);
+ DestPath = AllocateZeroPool (PathSize);
- if (DestPath == NULL || HiiOutput == NULL || HiiResultOk == NULL) {
- SHELL_FREE_NON_NULL(DestPath);
- SHELL_FREE_NON_NULL(HiiOutput);
- SHELL_FREE_NON_NULL(HiiResultOk);
+ if ((DestPath == NULL) || (HiiOutput == NULL) || (HiiResultOk == NULL)) {
+ SHELL_FREE_NON_NULL (DestPath);
+ SHELL_FREE_NON_NULL (HiiOutput);
+ SHELL_FREE_NON_NULL (HiiResultOk);
FreePool (CleanFilePathStr);
return (SHELL_OUT_OF_RESOURCES);
}
@@ -399,46 +405,51 @@ ValidateAndCopyFiles( //
// Go through the list of files to copy...
//
- for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link)
- ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link)
- ){
- if (ShellGetExecutionBreakFlag()) {
+ for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; !IsNull (&FileList->Link, &Node->Link)
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
+ )
+ {
+ if (ShellGetExecutionBreakFlag ()) {
break;
}
- ASSERT(Node->FileName != NULL);
- ASSERT(Node->FullName != NULL);
+
+ ASSERT (Node->FileName != NULL);
+ ASSERT (Node->FullName != NULL);
//
// skip the directory traversing stuff...
//
- if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) {
+ if ((StrCmp (Node->FileName, L".") == 0) || (StrCmp (Node->FileName, L"..") == 0)) {
continue;
}
- if (FileList->Link.ForwardLink == FileList->Link.BackLink // 1 item
- && EFI_ERROR(ShellIsDirectory(CleanFilePathStr)) // not an existing directory
- ) {
- if (StrStr(CleanFilePathStr, L":") == NULL) {
+ if ( (FileList->Link.ForwardLink == FileList->Link.BackLink) // 1 item
+ && EFI_ERROR (ShellIsDirectory (CleanFilePathStr)) // not an existing directory
+ )
+ {
+ if (StrStr (CleanFilePathStr, L":") == NULL) {
//
// simple copy of a single file
//
if (Cwd != NULL) {
- StrCpyS(DestPath, PathSize / sizeof(CHAR16), Cwd);
- StrCatS(DestPath, PathSize / sizeof(CHAR16), L"\\");
+ StrCpyS (DestPath, PathSize / sizeof (CHAR16), Cwd);
+ StrCatS (DestPath, PathSize / sizeof (CHAR16), L"\\");
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
FreePool (CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
- if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') {
- StrCatS(DestPath, PathSize / sizeof(CHAR16), L"\\");
- } else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') {
- ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
+
+ if ((DestPath[StrLen (DestPath)-1] != L'\\') && (CleanFilePathStr[0] != L'\\')) {
+ StrCatS (DestPath, PathSize / sizeof (CHAR16), L"\\");
+ } else if ((DestPath[StrLen (DestPath)-1] == L'\\') && (CleanFilePathStr[0] == L'\\')) {
+ ((CHAR16 *)DestPath)[StrLen (DestPath)-1] = CHAR_NULL;
}
- StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);
+
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), CleanFilePathStr);
} else {
- StrCpyS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);
+ StrCpyS (DestPath, PathSize/sizeof (CHAR16), CleanFilePathStr);
}
} else {
//
@@ -449,112 +460,121 @@ ValidateAndCopyFiles( // Check for leading slash
//
if (CleanFilePathStr[0] == L'\\') {
- //
- // Copy to the root of CWD
- //
+ //
+ // Copy to the root of CWD
+ //
if (Cwd != NULL) {
- StrCpyS(DestPath, PathSize/sizeof(CHAR16), Cwd);
- StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");
+ StrCpyS (DestPath, PathSize/sizeof (CHAR16), Cwd);
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), L"\\");
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
- FreePool(CleanFilePathStr);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
+ FreePool (CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
- while (PathRemoveLastItem(DestPath));
- StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr+1);
- StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);
- } else if (StrStr(CleanFilePathStr, L":") == NULL) {
+
+ while (PathRemoveLastItem (DestPath)) {
+ }
+
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), CleanFilePathStr+1);
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), Node->FileName);
+ } else if (StrStr (CleanFilePathStr, L":") == NULL) {
if (Cwd != NULL) {
- StrCpyS(DestPath, PathSize/sizeof(CHAR16), Cwd);
- StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");
+ StrCpyS (DestPath, PathSize/sizeof (CHAR16), Cwd);
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), L"\\");
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
- FreePool(CleanFilePathStr);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr);
+ FreePool (CleanFilePathStr);
return (SHELL_INVALID_PARAMETER);
}
- if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') {
- StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");
- } else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') {
- ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
+
+ if ((DestPath[StrLen (DestPath)-1] != L'\\') && (CleanFilePathStr[0] != L'\\')) {
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), L"\\");
+ } else if ((DestPath[StrLen (DestPath)-1] == L'\\') && (CleanFilePathStr[0] == L'\\')) {
+ ((CHAR16 *)DestPath)[StrLen (DestPath)-1] = CHAR_NULL;
}
- StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);
- if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') {
- StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");
- } else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') {
- ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
+
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), CleanFilePathStr);
+ if ((CleanFilePathStr[StrLen (CleanFilePathStr)-1] != L'\\') && (Node->FileName[0] != L'\\')) {
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), L"\\");
+ } else if ((CleanFilePathStr[StrLen (CleanFilePathStr)-1] == L'\\') && (Node->FileName[0] == L'\\')) {
+ ((CHAR16 *)DestPath)[StrLen (DestPath)-1] = CHAR_NULL;
}
- StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), Node->FileName);
} else {
- StrCpyS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);
- if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') {
- StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");
- } else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') {
- ((CHAR16*)CleanFilePathStr)[StrLen(CleanFilePathStr)-1] = CHAR_NULL;
+ StrCpyS (DestPath, PathSize/sizeof (CHAR16), CleanFilePathStr);
+ if ((CleanFilePathStr[StrLen (CleanFilePathStr)-1] != L'\\') && (Node->FileName[0] != L'\\')) {
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), L"\\");
+ } else if ((CleanFilePathStr[StrLen (CleanFilePathStr)-1] == L'\\') && (Node->FileName[0] == L'\\')) {
+ ((CHAR16 *)CleanFilePathStr)[StrLen (CleanFilePathStr)-1] = CHAR_NULL;
}
- StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);
+
+ StrCatS (DestPath, PathSize/sizeof (CHAR16), Node->FileName);
}
}
//
// Make sure the path exists
//
- if (EFI_ERROR(VerifyIntermediateDirectories(DestPath))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_WNF), gShellLevel2HiiHandle, L"cp", DestPath);
+ if (EFI_ERROR (VerifyIntermediateDirectories (DestPath))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_WNF), gShellLevel2HiiHandle, L"cp", DestPath);
ShellStatus = SHELL_DEVICE_ERROR;
break;
}
- if ( !EFI_ERROR(ShellIsDirectory(Node->FullName))
- && !EFI_ERROR(ShellIsDirectory(DestPath))
- && StrniCmp(Node->FullName, DestPath, StrLen(DestPath)) == 0
- ){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_PARENT), gShellLevel2HiiHandle, L"cp");
+ if ( !EFI_ERROR (ShellIsDirectory (Node->FullName))
+ && !EFI_ERROR (ShellIsDirectory (DestPath))
+ && (StrniCmp (Node->FullName, DestPath, StrLen (DestPath)) == 0)
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_SD_PARENT), gShellLevel2HiiHandle, L"cp");
ShellStatus = SHELL_INVALID_PARAMETER;
break;
}
- if (StringNoCaseCompare(&Node->FullName, &DestPath) == 0) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle, L"cp");
+
+ if (StringNoCaseCompare (&Node->FullName, &DestPath) == 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle, L"cp");
ShellStatus = SHELL_INVALID_PARAMETER;
break;
}
- if ((StrniCmp(Node->FullName, DestPath, StrLen(Node->FullName)) == 0)
- && (DestPath[StrLen(Node->FullName)] == CHAR_NULL || DestPath[StrLen(Node->FullName)] == L'\\')
- ) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle, L"cp");
+ if ( (StrniCmp (Node->FullName, DestPath, StrLen (Node->FullName)) == 0)
+ && ((DestPath[StrLen (Node->FullName)] == CHAR_NULL) || (DestPath[StrLen (Node->FullName)] == L'\\'))
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle, L"cp");
ShellStatus = SHELL_INVALID_PARAMETER;
break;
}
- PathCleanUpDirectories(DestPath);
+ PathCleanUpDirectories (DestPath);
if (!SilentMode) {
- ShellPrintEx(-1, -1, HiiOutput, Node->FullName, DestPath);
+ ShellPrintEx (-1, -1, HiiOutput, Node->FullName, DestPath);
}
//
// copy single file...
//
- ShellStatus = CopySingleFile(Node->FullName, DestPath, &Response, SilentMode, L"cp");
+ ShellStatus = CopySingleFile (Node->FullName, DestPath, &Response, SilentMode, L"cp");
if (ShellStatus != SHELL_SUCCESS) {
break;
}
}
- if (ShellStatus == SHELL_SUCCESS && Resp == NULL) {
- ShellPrintEx(-1, -1, L"%s", HiiResultOk);
+
+ if ((ShellStatus == SHELL_SUCCESS) && (Resp == NULL)) {
+ ShellPrintEx (-1, -1, L"%s", HiiResultOk);
}
- SHELL_FREE_NON_NULL(DestPath);
- SHELL_FREE_NON_NULL(HiiOutput);
- SHELL_FREE_NON_NULL(HiiResultOk);
- SHELL_FREE_NON_NULL(CleanFilePathStr);
+ SHELL_FREE_NON_NULL (DestPath);
+ SHELL_FREE_NON_NULL (HiiOutput);
+ SHELL_FREE_NON_NULL (HiiResultOk);
+ SHELL_FREE_NON_NULL (CleanFilePathStr);
if (Resp == NULL) {
- SHELL_FREE_NON_NULL(Response);
+ SHELL_FREE_NON_NULL (Response);
}
return (ShellStatus);
-
}
/**
@@ -570,55 +590,55 @@ ValidateAndCopyFiles( @retval SHELL_SUCCESS The operation was successful.
**/
SHELL_STATUS
-ProcessValidateAndCopyFiles(
+ProcessValidateAndCopyFiles (
IN EFI_SHELL_FILE_INFO *FileList,
IN CONST CHAR16 *DestDir,
IN BOOLEAN SilentMode,
IN BOOLEAN RecursiveMode
)
{
- SHELL_STATUS ShellStatus;
- EFI_SHELL_FILE_INFO *List;
- EFI_FILE_INFO *FileInfo;
- CHAR16 *FullName;
-
- List = NULL;
- FullName = NULL;
- FileInfo = NULL;
-
- ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_READ, &List);
- if (List != NULL && List->Link.ForwardLink != List->Link.BackLink) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, L"cp", DestDir);
+ SHELL_STATUS ShellStatus;
+ EFI_SHELL_FILE_INFO *List;
+ EFI_FILE_INFO *FileInfo;
+ CHAR16 *FullName;
+
+ List = NULL;
+ FullName = NULL;
+ FileInfo = NULL;
+
+ ShellOpenFileMetaArg ((CHAR16 *)DestDir, EFI_FILE_MODE_READ, &List);
+ if ((List != NULL) && (List->Link.ForwardLink != List->Link.BackLink)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, L"cp", DestDir);
ShellStatus = SHELL_INVALID_PARAMETER;
- ShellCloseFileMetaArg(&List);
+ ShellCloseFileMetaArg (&List);
} else if (List != NULL) {
- ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink) != NULL);
- ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName != NULL);
- FileInfo = gEfiShellProtocol->GetFileInfo(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->Handle);
- ASSERT(FileInfo != NULL);
- StrnCatGrow(&FullName, NULL, ((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName, 0);
- ShellCloseFileMetaArg(&List);
+ ASSERT (((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink) != NULL);
+ ASSERT (((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName != NULL);
+ FileInfo = gEfiShellProtocol->GetFileInfo (((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->Handle);
+ ASSERT (FileInfo != NULL);
+ StrnCatGrow (&FullName, NULL, ((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName, 0);
+ ShellCloseFileMetaArg (&List);
if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) == 0) {
- ShellStatus = ValidateAndCopyFiles(FileList, FullName, SilentMode, RecursiveMode, NULL);
+ ShellStatus = ValidateAndCopyFiles (FileList, FullName, SilentMode, RecursiveMode, NULL);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_ERROR), gShellLevel2HiiHandle, L"cp");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_ERROR), gShellLevel2HiiHandle, L"cp");
ShellStatus = SHELL_ACCESS_DENIED;
}
} else {
- ShellCloseFileMetaArg(&List);
- ShellStatus = ValidateAndCopyFiles(FileList, DestDir, SilentMode, RecursiveMode, NULL);
+ ShellCloseFileMetaArg (&List);
+ ShellStatus = ValidateAndCopyFiles (FileList, DestDir, SilentMode, RecursiveMode, NULL);
}
- SHELL_FREE_NON_NULL(FileInfo);
- SHELL_FREE_NON_NULL(FullName);
+ SHELL_FREE_NON_NULL (FileInfo);
+ SHELL_FREE_NON_NULL (FullName);
return (ShellStatus);
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-r", TypeFlag},
- {L"-q", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-r", TypeFlag },
+ { L"-q", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'cp' command.
@@ -633,86 +653,87 @@ ShellCommandRunCp ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- UINTN LoopCounter;
- EFI_SHELL_FILE_INFO *FileList;
- BOOLEAN SilentMode;
- BOOLEAN RecursiveMode;
- CONST CHAR16 *Cwd;
- CHAR16 *FullCwd;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- ParamCount = 0;
- FileList = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamCount;
+ UINTN LoopCounter;
+ EFI_SHELL_FILE_INFO *FileList;
+ BOOLEAN SilentMode;
+ BOOLEAN RecursiveMode;
+ CONST CHAR16 *Cwd;
+ CHAR16 *FullCwd;
+
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ ParamCount = 0;
+ FileList = NULL;
//
// 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), gShellLevel2HiiHandle, L"cp", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"cp", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
//
// Initialize SilentMode and RecursiveMode
//
- if (gEfiShellProtocol->BatchIsActive()) {
+ if (gEfiShellProtocol->BatchIsActive ()) {
SilentMode = TRUE;
} else {
- SilentMode = ShellCommandLineGetFlag(Package, L"-q");
+ SilentMode = ShellCommandLineGetFlag (Package, L"-q");
}
- RecursiveMode = ShellCommandLineGetFlag(Package, L"-r");
- switch (ParamCount = ShellCommandLineGetCount(Package)) {
+ RecursiveMode = ShellCommandLineGetFlag (Package, L"-r");
+
+ switch (ParamCount = ShellCommandLineGetCount (Package)) {
case 0:
case 1:
//
// we have insufficient parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"cp");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"cp");
ShellStatus = SHELL_INVALID_PARAMETER;
break;
case 2:
//
// must have valid CWD for single parameter...
//
- Cwd = ShellGetCurrentDir(NULL);
- if (Cwd == NULL){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"cp");
+ Cwd = ShellGetCurrentDir (NULL);
+ if (Cwd == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"cp");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, 1), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
- if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue(Package, 1));
+ Status = ShellOpenFileMetaArg ((CHAR16 *)ShellCommandLineGetRawValue (Package, 1), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
+ if ((FileList == NULL) || IsListEmpty (&FileList->Link) || EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue (Package, 1));
ShellStatus = SHELL_NOT_FOUND;
- } else {
- FullCwd = AllocateZeroPool(StrSize(Cwd) + sizeof(CHAR16));
+ } else {
+ FullCwd = AllocateZeroPool (StrSize (Cwd) + sizeof (CHAR16));
if (FullCwd == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"cp");
ShellStatus = SHELL_OUT_OF_RESOURCES;
@@ -729,36 +750,39 @@ ShellCommandRunCp ( //
// Make a big list of all the files...
//
- for (ParamCount--, LoopCounter = 1 ; LoopCounter < ParamCount && ShellStatus == SHELL_SUCCESS ; LoopCounter++) {
- if (ShellGetExecutionBreakFlag()) {
+ for (ParamCount--, LoopCounter = 1; LoopCounter < ParamCount && ShellStatus == SHELL_SUCCESS; LoopCounter++) {
+ if (ShellGetExecutionBreakFlag ()) {
break;
}
- Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, LoopCounter), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
- if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue(Package, LoopCounter));
+
+ Status = ShellOpenFileMetaArg ((CHAR16 *)ShellCommandLineGetRawValue (Package, LoopCounter), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
+ if (EFI_ERROR (Status) || (FileList == NULL) || IsListEmpty (&FileList->Link)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue (Package, LoopCounter));
ShellStatus = SHELL_NOT_FOUND;
}
}
+
if (ShellStatus != SHELL_SUCCESS) {
- Status = ShellCloseFileMetaArg(&FileList);
+ Status = ShellCloseFileMetaArg (&FileList);
} else {
//
// now copy them all...
//
- if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
- ShellStatus = ProcessValidateAndCopyFiles(FileList, PathCleanUpDirectories((CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount)), SilentMode, RecursiveMode);
- Status = ShellCloseFileMetaArg(&FileList);
- if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_FILE), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue(Package, ParamCount), ShellStatus|MAX_BIT);
+ if ((FileList != NULL) && !IsListEmpty (&FileList->Link)) {
+ ShellStatus = ProcessValidateAndCopyFiles (FileList, PathCleanUpDirectories ((CHAR16 *)ShellCommandLineGetRawValue (Package, ParamCount)), SilentMode, RecursiveMode);
+ Status = ShellCloseFileMetaArg (&FileList);
+ if (EFI_ERROR (Status) && (ShellStatus == SHELL_SUCCESS)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_FILE), gShellLevel2HiiHandle, L"cp", ShellCommandLineGetRawValue (Package, ParamCount), ShellStatus|MAX_BIT);
ShellStatus = SHELL_ACCESS_DENIED;
}
}
}
+
break;
} // switch on parameter count
if (FileList != NULL) {
- ShellCloseFileMetaArg(&FileList);
+ ShellCloseFileMetaArg (&FileList);
}
//
@@ -767,10 +791,9 @@ ShellCommandRunCp ( ShellCommandLineFreeVarList (Package);
}
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
return (SHELL_ABORTED);
}
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c index b6e7c952fa..f92cfa502d 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c @@ -12,6 +12,7 @@ // This function was from from the BdsLib implementation in
// IntelFrameworkModulePkg\Library\GenericBdsLib\BdsConnect.c
// function name: BdsLibConnectAllEfi
+
/**
This function will connect all current system handles recursively. The
connection will finish until every handle's child handle created if it have.
@@ -37,7 +38,7 @@ ConnectAllEfi ( NULL,
&HandleCount,
&HandleBuffer
- );
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -67,51 +68,52 @@ ConnectAllEfi ( @retval EFI_OUT_OF_RESOURCES there was insufficient memory
**/
EFI_STATUS
-LoadDriver(
+LoadDriver (
IN CONST CHAR16 *FileName,
IN CONST BOOLEAN Connect
)
{
- EFI_HANDLE LoadedDriverHandle;
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *FilePath;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedDriverImage;
+ EFI_HANDLE LoadedDriverHandle;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *FilePath;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedDriverImage;
- LoadedDriverImage = NULL;
- FilePath = NULL;
- LoadedDriverHandle = NULL;
- Status = EFI_SUCCESS;
+ LoadedDriverImage = NULL;
+ FilePath = NULL;
+ LoadedDriverHandle = NULL;
+ Status = EFI_SUCCESS;
ASSERT (FileName != NULL);
//
// Fix local copies of the protocol pointers
//
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
//
// Convert to DEVICE_PATH
//
- FilePath = gEfiShellProtocol->GetDevicePathFromFilePath(FileName);
+ FilePath = gEfiShellProtocol->GetDevicePathFromFilePath (FileName);
if (FilePath == NULL) {
- ASSERT(FALSE);
+ ASSERT (FALSE);
return (EFI_INVALID_PARAMETER);
}
//
// Use LoadImage to get it into memory
//
- Status = gBS->LoadImage(
- FALSE,
- gImageHandle,
- FilePath,
- NULL,
- 0,
- &LoadedDriverHandle);
-
- if (EFI_ERROR(Status)) {
+ Status = gBS->LoadImage (
+ FALSE,
+ gImageHandle,
+ FilePath,
+ NULL,
+ 0,
+ &LoadedDriverHandle
+ );
+
+ 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.
@@ -121,62 +123,64 @@ LoadDriver( if (Status == EFI_SECURITY_VIOLATION) {
gBS->UnloadImage (LoadedDriverHandle);
}
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_NOT_IMAGE), gShellLevel2HiiHandle, FileName, Status);
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOAD_NOT_IMAGE), gShellLevel2HiiHandle, FileName, Status);
} else {
//
// Make sure it is a driver image
//
- Status = gBS->HandleProtocol (LoadedDriverHandle, &gEfiLoadedImageProtocolGuid, (VOID *) &LoadedDriverImage);
+ Status = gBS->HandleProtocol (LoadedDriverHandle, &gEfiLoadedImageProtocolGuid, (VOID *)&LoadedDriverImage);
ASSERT (LoadedDriverImage != NULL);
- if ( EFI_ERROR(Status)
- || ( LoadedDriverImage->ImageCodeType != EfiBootServicesCode
- && LoadedDriverImage->ImageCodeType != EfiRuntimeServicesCode)
- ){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_NOT_DRIVER), gShellLevel2HiiHandle, FileName);
+ if ( EFI_ERROR (Status)
+ || ( (LoadedDriverImage->ImageCodeType != EfiBootServicesCode)
+ && (LoadedDriverImage->ImageCodeType != EfiRuntimeServicesCode))
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOAD_NOT_DRIVER), gShellLevel2HiiHandle, FileName);
//
// Exit and unload the non-driver image
//
- gBS->Exit(LoadedDriverHandle, EFI_INVALID_PARAMETER, 0, NULL);
+ gBS->Exit (LoadedDriverHandle, EFI_INVALID_PARAMETER, 0, NULL);
Status = EFI_INVALID_PARAMETER;
}
}
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
//
// Start the image
//
- Status = gBS->StartImage(LoadedDriverHandle, NULL, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_ERROR), gShellLevel2HiiHandle, FileName, Status);
+ Status = gBS->StartImage (LoadedDriverHandle, NULL, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOAD_ERROR), gShellLevel2HiiHandle, FileName, Status);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_LOADED), gShellLevel2HiiHandle, FileName, LoadedDriverImage->ImageBase, Status);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOAD_LOADED), gShellLevel2HiiHandle, FileName, LoadedDriverImage->ImageBase, Status);
}
}
- if (!EFI_ERROR(Status) && Connect) {
+ if (!EFI_ERROR (Status) && Connect) {
//
// Connect it...
//
- Status = ConnectAllEfi();
+ Status = ConnectAllEfi ();
}
//
// clean up memory...
//
if (FilePath != NULL) {
- FreePool(FilePath);
+ FreePool (FilePath);
}
return (Status);
}
-STATIC CONST SHELL_PARAM_ITEM LoadParamList[] = {
- {L"-nc", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM LoadParamList[] = {
+ { L"-nc", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'load' command.
@@ -191,78 +195,81 @@ ShellCommandRunLoad ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- EFI_SHELL_FILE_INFO *ListHead;
- EFI_SHELL_FILE_INFO *Node;
-
- ListHead = NULL;
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamCount;
+ EFI_SHELL_FILE_INFO *ListHead;
+ EFI_SHELL_FILE_INFO *Node;
+
+ ListHead = NULL;
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParse (LoadParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"load", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"load", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
//
// we didnt get a single file to load parameter
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"load");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"load");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
for ( ParamCount = 1
- ; ShellCommandLineGetRawValue(Package, ParamCount) != NULL
- ; ParamCount++
- ){
- Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount), EFI_FILE_MODE_READ, &ListHead);
- if (!EFI_ERROR(Status)) {
- for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link)
- ; !IsNull(&ListHead->Link, &Node->Link)
- ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link)
- ){
+ ; ShellCommandLineGetRawValue (Package, ParamCount) != NULL
+ ; ParamCount++
+ )
+ {
+ Status = ShellOpenFileMetaArg ((CHAR16 *)ShellCommandLineGetRawValue (Package, ParamCount), EFI_FILE_MODE_READ, &ListHead);
+ if (!EFI_ERROR (Status)) {
+ for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&ListHead->Link)
+ ; !IsNull (&ListHead->Link, &Node->Link)
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&ListHead->Link, &Node->Link)
+ )
+ {
//
// once we have an error preserve that value, but finish the loop.
//
- if (EFI_ERROR(Status)) {
- LoadDriver(Node->FullName, (BOOLEAN)(ShellCommandLineGetFlag(Package, L"-nc")==FALSE));
+ if (EFI_ERROR (Status)) {
+ LoadDriver (Node->FullName, (BOOLEAN)(ShellCommandLineGetFlag (Package, L"-nc") == FALSE));
} else {
- Status = LoadDriver(Node->FullName, (BOOLEAN)(ShellCommandLineGetFlag(Package, L"-nc")==FALSE));
+ Status = LoadDriver (Node->FullName, (BOOLEAN)(ShellCommandLineGetFlag (Package, L"-nc") == FALSE));
}
} // for loop for multi-open
- if (EFI_ERROR(Status)) {
- ShellCloseFileMetaArg(&ListHead);
+
+ if (EFI_ERROR (Status)) {
+ ShellCloseFileMetaArg (&ListHead);
} else {
- Status = ShellCloseFileMetaArg(&ListHead);;
+ Status = ShellCloseFileMetaArg (&ListHead);
}
} else {
//
// no files found.
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"load", (CHAR16*)ShellCommandLineGetRawValue(Package, ParamCount));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"load", (CHAR16 *)ShellCommandLineGetRawValue (Package, ParamCount));
ShellStatus = SHELL_NOT_FOUND;
}
} // for loop for params
@@ -274,7 +281,7 @@ ShellCommandRunLoad ( ShellCommandLineFreeVarList (Package);
}
- if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) {
+ if (EFI_ERROR (Status) && (ShellStatus == SHELL_SUCCESS)) {
ShellStatus = SHELL_DEVICE_ERROR;
}
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c index 8b97926d7f..6f9d035a1a 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c @@ -10,7 +10,7 @@ #include "UefiShellLevel2CommandsLib.h"
#include <Guid/FileSystemInfo.h>
-UINTN mDayOfMonth[] = {31, 28, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30};
+UINTN mDayOfMonth[] = { 31, 28, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30 };
/**
print out the standard format output volume entry.
@@ -18,8 +18,8 @@ UINTN mDayOfMonth[] = {31, 28, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30}; @param[in] TheList a list of files from the volume.
**/
EFI_STATUS
-PrintSfoVolumeInfoTableEntry(
- IN CONST EFI_SHELL_FILE_INFO *TheList
+PrintSfoVolumeInfoTableEntry (
+ IN CONST EFI_SHELL_FILE_INFO *TheList
)
{
EFI_STATUS Status;
@@ -33,77 +33,79 @@ PrintSfoVolumeInfoTableEntry( //
// Get the first valid handle (directories)
//
- for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&TheList->Link)
- ; !IsNull(&TheList->Link, &Node->Link) && Node->Handle == NULL
- ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&TheList->Link, &Node->Link)
- );
+ for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&TheList->Link)
+ ; !IsNull (&TheList->Link, &Node->Link) && Node->Handle == NULL
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&TheList->Link, &Node->Link)
+ )
+ {
+ }
if (Node->Handle == NULL) {
- DirectoryName = GetFullyQualifiedPath(((EFI_SHELL_FILE_INFO *)GetFirstNode(&TheList->Link))->FullName);
+ DirectoryName = GetFullyQualifiedPath (((EFI_SHELL_FILE_INFO *)GetFirstNode (&TheList->Link))->FullName);
//
// We need to open something up to get system information
//
- Status = gEfiShellProtocol->OpenFileByName(
- DirectoryName,
- &ShellFileHandle,
- EFI_FILE_MODE_READ
- );
+ Status = gEfiShellProtocol->OpenFileByName (
+ DirectoryName,
+ &ShellFileHandle,
+ EFI_FILE_MODE_READ
+ );
- ASSERT_EFI_ERROR(Status);
- FreePool(DirectoryName);
+ ASSERT_EFI_ERROR (Status);
+ FreePool (DirectoryName);
//
// Get the Volume Info from ShellFileHandle
//
SysInfo = NULL;
SysInfoSize = 0;
- EfiFpHandle = ConvertShellHandleToEfiFileProtocol(ShellFileHandle);
- Status = EfiFpHandle->GetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo
- );
+ EfiFpHandle = ConvertShellHandleToEfiFileProtocol (ShellFileHandle);
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- SysInfo = AllocateZeroPool(SysInfoSize);
- Status = EfiFpHandle->GetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo
- );
+ SysInfo = AllocateZeroPool (SysInfoSize);
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
}
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
- gEfiShellProtocol->CloseFile(ShellFileHandle);
+ gEfiShellProtocol->CloseFile (ShellFileHandle);
} else {
//
// Get the Volume Info from Node->Handle
//
- SysInfo = NULL;
+ SysInfo = NULL;
SysInfoSize = 0;
- EfiFpHandle = ConvertShellHandleToEfiFileProtocol(Node->Handle);
- Status = EfiFpHandle->GetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo
- );
+ EfiFpHandle = ConvertShellHandleToEfiFileProtocol (Node->Handle);
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- SysInfo = AllocateZeroPool(SysInfoSize);
- Status = EfiFpHandle->GetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo
- );
+ SysInfo = AllocateZeroPool (SysInfoSize);
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
}
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
}
ShellPrintHiiEx (
@@ -117,7 +119,7 @@ PrintSfoVolumeInfoTableEntry( //
// print VolumeInfo table
//
- ASSERT(SysInfo != NULL);
+ ASSERT (SysInfo != NULL);
ShellPrintHiiEx (
0,
gST->ConOut->Mode->CursorRow,
@@ -126,12 +128,12 @@ PrintSfoVolumeInfoTableEntry( gShellLevel2HiiHandle,
SysInfo->VolumeLabel,
SysInfo->VolumeSize,
- SysInfo->ReadOnly?L"TRUE":L"FALSE",
+ SysInfo->ReadOnly ? L"TRUE" : L"FALSE",
SysInfo->FreeSpace,
SysInfo->BlockSize
);
- SHELL_FREE_NON_NULL(SysInfo);
+ SHELL_FREE_NON_NULL (SysInfo);
return (Status);
}
@@ -147,7 +149,7 @@ PrintSfoVolumeInfoTableEntry( **/
VOID
-PrintFileInformation(
+PrintFileInformation (
IN CONST BOOLEAN Sfo,
IN CONST EFI_SHELL_FILE_INFO *TheNode,
IN UINT64 *Files,
@@ -155,10 +157,10 @@ PrintFileInformation( IN UINT64 *Dirs
)
{
- ASSERT(Files != NULL);
- ASSERT(Size != NULL);
- ASSERT(Dirs != NULL);
- ASSERT(TheNode != NULL);
+ ASSERT (Files != NULL);
+ ASSERT (Size != NULL);
+ ASSERT (Dirs != NULL);
+ ASSERT (TheNode != NULL);
if (Sfo) {
//
@@ -173,11 +175,11 @@ PrintFileInformation( TheNode->FullName,
TheNode->Info->FileSize,
TheNode->Info->PhysicalSize,
- (TheNode->Info->Attribute & EFI_FILE_ARCHIVE) != 0?L"a":L"",
- (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) != 0?L"d":L"",
- (TheNode->Info->Attribute & EFI_FILE_HIDDEN) != 0?L"h":L"",
- (TheNode->Info->Attribute & EFI_FILE_READ_ONLY) != 0?L"r":L"",
- (TheNode->Info->Attribute & EFI_FILE_SYSTEM) != 0?L"s":L"",
+ (TheNode->Info->Attribute & EFI_FILE_ARCHIVE) != 0 ? L"a" : L"",
+ (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) != 0 ? L"d" : L"",
+ (TheNode->Info->Attribute & EFI_FILE_HIDDEN) != 0 ? L"h" : L"",
+ (TheNode->Info->Attribute & EFI_FILE_READ_ONLY) != 0 ? L"r" : L"",
+ (TheNode->Info->Attribute & EFI_FILE_SYSTEM) != 0 ? L"s" : L"",
TheNode->Info->CreateTime.Hour,
TheNode->Info->CreateTime.Minute,
TheNode->Info->CreateTime.Second,
@@ -209,8 +211,8 @@ PrintFileInformation( STRING_TOKEN (STR_LS_LINE_START_ALL),
gShellLevel2HiiHandle,
&TheNode->Info->ModificationTime,
- (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) != 0?L"<DIR>":L"",
- (TheNode->Info->Attribute & EFI_FILE_READ_ONLY) != 0?L'r':L' ',
+ (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) != 0 ? L"<DIR>" : L"",
+ (TheNode->Info->Attribute & EFI_FILE_READ_ONLY) != 0 ? L'r' : L' ',
TheNode->Info->FileSize
);
if (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) {
@@ -226,9 +228,10 @@ PrintFileInformation( } else {
(*Files)++;
(*Size) += TheNode->Info->FileSize;
- if ( (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)L".nsh", (CHAR16*)&(TheNode->FileName[StrLen (TheNode->FileName) - 4])) == 0)
- || (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)L".efi", (CHAR16*)&(TheNode->FileName[StrLen (TheNode->FileName) - 4])) == 0)
- ){
+ if ( (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)L".nsh", (CHAR16 *)&(TheNode->FileName[StrLen (TheNode->FileName) - 4])) == 0)
+ || (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)L".efi", (CHAR16 *)&(TheNode->FileName[StrLen (TheNode->FileName) - 4])) == 0)
+ )
+ {
ShellPrintHiiEx (
-1,
-1,
@@ -257,16 +260,16 @@ PrintFileInformation( @param[in] Path String with starting path.
**/
VOID
-PrintNonSfoHeader(
- IN CONST CHAR16 *Path
+PrintNonSfoHeader (
+ IN CONST CHAR16 *Path
)
{
- CHAR16 *DirectoryName;
+ CHAR16 *DirectoryName;
//
// get directory name from path...
//
- DirectoryName = GetFullyQualifiedPath(Path);
+ DirectoryName = GetFullyQualifiedPath (Path);
if (DirectoryName != NULL) {
//
@@ -281,7 +284,7 @@ PrintNonSfoHeader( DirectoryName
);
- SHELL_FREE_NON_NULL(DirectoryName);
+ SHELL_FREE_NON_NULL (DirectoryName);
}
}
@@ -293,10 +296,10 @@ PrintNonSfoHeader( @param[in] Dirs The number of directories.
**/
VOID
-PrintNonSfoFooter(
- IN UINT64 Files,
- IN UINT64 Size,
- IN UINT64 Dirs
+PrintNonSfoFooter (
+ IN UINT64 Files,
+ IN UINT64 Size,
+ IN UINT64 Dirs
)
{
//
@@ -311,7 +314,7 @@ PrintNonSfoFooter( Files,
Size,
Dirs
- );
+ );
}
/**
@@ -322,33 +325,33 @@ PrintNonSfoFooter( **/
VOID
FileTimeToLocalTime (
- IN EFI_TIME *Time,
- IN INT16 LocalTimeZone
+ IN EFI_TIME *Time,
+ IN INT16 LocalTimeZone
)
{
- INTN MinuteDiff;
- INTN TempMinute;
- INTN HourNumberOfTempMinute;
- INTN TempHour;
- INTN DayNumberOfTempHour;
- INTN TempDay;
- INTN MonthNumberOfTempDay;
- INTN TempMonth;
- INTN YearNumberOfTempMonth;
- INTN MonthRecord;
-
- ASSERT ((Time->TimeZone >= -1440) && (Time->TimeZone <=1440));
- ASSERT ((LocalTimeZone >= -1440) && (LocalTimeZone <=1440));
+ INTN MinuteDiff;
+ INTN TempMinute;
+ INTN HourNumberOfTempMinute;
+ INTN TempHour;
+ INTN DayNumberOfTempHour;
+ INTN TempDay;
+ INTN MonthNumberOfTempDay;
+ INTN TempMonth;
+ INTN YearNumberOfTempMonth;
+ INTN MonthRecord;
+
+ ASSERT ((Time->TimeZone >= -1440) && (Time->TimeZone <= 1440));
+ ASSERT ((LocalTimeZone >= -1440) && (LocalTimeZone <= 1440));
ASSERT ((Time->Month >= 1) && (Time->Month <= 12));
- if(Time->TimeZone == LocalTimeZone) {
+ if (Time->TimeZone == LocalTimeZone) {
//
- //if the file timezone is equal to the local timezone, there is no need to adjust the file time.
+ // if the file timezone is equal to the local timezone, there is no need to adjust the file time.
//
return;
}
- if((Time->Year % 4 == 0 && Time->Year / 100 != 0)||(Time->Year % 400 == 0)) {
+ if (((Time->Year % 4 == 0) && (Time->Year / 100 != 0)) || (Time->Year % 400 == 0)) {
//
// Day in February of leap year is 29.
//
@@ -363,21 +366,23 @@ FileTimeToLocalTime ( // TempHour will be used to calculate Time->Hour
//
HourNumberOfTempMinute = TempMinute / 60;
- if(TempMinute < 0) {
- HourNumberOfTempMinute --;
+ if (TempMinute < 0) {
+ HourNumberOfTempMinute--;
}
- TempHour = Time->Hour + HourNumberOfTempMinute;
+
+ TempHour = Time->Hour + HourNumberOfTempMinute;
Time->Minute = (UINT8)(TempMinute - 60 * HourNumberOfTempMinute);
//
// Calculate Time->Hour
// TempDay will be used to calculate Time->Day
//
- DayNumberOfTempHour = TempHour / 24 ;
- if(TempHour < 0){
+ DayNumberOfTempHour = TempHour / 24;
+ if (TempHour < 0) {
DayNumberOfTempHour--;
}
- TempDay = Time->Day + DayNumberOfTempHour;
+
+ TempDay = Time->Day + DayNumberOfTempHour;
Time->Hour = (UINT8)(TempHour - 24 * DayNumberOfTempHour);
//
@@ -385,11 +390,12 @@ FileTimeToLocalTime ( // TempMonth will be used to calculate Time->Month
//
MonthNumberOfTempDay = (TempDay - 1) / (INTN)mDayOfMonth[Time->Month - 1];
- MonthRecord = (INTN)(Time->Month) ;
- if(TempDay - 1 < 0){
- MonthNumberOfTempDay -- ;
- MonthRecord -- ;
+ MonthRecord = (INTN)(Time->Month);
+ if (TempDay - 1 < 0) {
+ MonthNumberOfTempDay--;
+ MonthRecord--;
}
+
TempMonth = Time->Month + MonthNumberOfTempDay;
Time->Day = (UINT8)(TempDay - (INTN)mDayOfMonth[(MonthRecord - 1 + 12) % 12] * MonthNumberOfTempDay);
@@ -397,11 +403,12 @@ FileTimeToLocalTime ( // Calculate Time->Month, Time->Year
//
YearNumberOfTempMonth = (TempMonth - 1) / 12;
- if(TempMonth - 1 < 0){
- YearNumberOfTempMonth --;
+ if (TempMonth - 1 < 0) {
+ YearNumberOfTempMonth--;
}
+
Time->Month = (UINT8)(TempMonth - 12 * (YearNumberOfTempMonth));
- Time->Year = (UINT16)(Time->Year + YearNumberOfTempMonth);
+ Time->Year = (UINT16)(Time->Year + YearNumberOfTempMonth);
}
/**
@@ -423,30 +430,30 @@ FileTimeToLocalTime ( @retval SHELL_SUCCESS the printing was sucessful.
**/
SHELL_STATUS
-PrintLsOutput(
- IN CONST BOOLEAN Rec,
- IN CONST UINT64 Attribs,
- IN CONST BOOLEAN Sfo,
- IN CONST CHAR16 *RootPath,
- IN CONST CHAR16 *SearchString,
- IN BOOLEAN *Found,
- IN CONST UINTN Count,
- IN CONST INT16 TimeZone,
- IN CONST BOOLEAN ListUnfiltered
+PrintLsOutput (
+ IN CONST BOOLEAN Rec,
+ IN CONST UINT64 Attribs,
+ IN CONST BOOLEAN Sfo,
+ IN CONST CHAR16 *RootPath,
+ IN CONST CHAR16 *SearchString,
+ IN BOOLEAN *Found,
+ IN CONST UINTN Count,
+ IN CONST INT16 TimeZone,
+ IN CONST BOOLEAN ListUnfiltered
)
{
- EFI_STATUS Status;
- EFI_SHELL_FILE_INFO *ListHead;
- EFI_SHELL_FILE_INFO *Node;
- SHELL_STATUS ShellStatus;
- UINT64 FileCount;
- UINT64 DirCount;
- UINT64 FileSize;
- UINTN LongestPath;
- CHAR16 *CorrectedPath;
- BOOLEAN FoundOne;
- BOOLEAN HeaderPrinted;
- EFI_TIME LocalTime;
+ EFI_STATUS Status;
+ EFI_SHELL_FILE_INFO *ListHead;
+ EFI_SHELL_FILE_INFO *Node;
+ SHELL_STATUS ShellStatus;
+ UINT64 FileCount;
+ UINT64 DirCount;
+ UINT64 FileSize;
+ UINTN LongestPath;
+ CHAR16 *CorrectedPath;
+ BOOLEAN FoundOne;
+ BOOLEAN HeaderPrinted;
+ EFI_TIME LocalTime;
HeaderPrinted = FALSE;
FileCount = 0;
@@ -463,30 +470,33 @@ PrintLsOutput( FoundOne = FALSE;
}
- CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, RootPath, 0);
+ CorrectedPath = StrnCatGrow (&CorrectedPath, &LongestPath, RootPath, 0);
if (CorrectedPath == NULL) {
return SHELL_OUT_OF_RESOURCES;
}
- if (CorrectedPath[StrLen(CorrectedPath)-1] != L'\\'
- &&CorrectedPath[StrLen(CorrectedPath)-1] != L'/') {
- CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"\\", 0);
+
+ if ( (CorrectedPath[StrLen (CorrectedPath)-1] != L'\\')
+ && (CorrectedPath[StrLen (CorrectedPath)-1] != L'/'))
+ {
+ CorrectedPath = StrnCatGrow (&CorrectedPath, &LongestPath, L"\\", 0);
}
- CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, SearchString, 0);
+
+ CorrectedPath = StrnCatGrow (&CorrectedPath, &LongestPath, SearchString, 0);
if (CorrectedPath == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- PathCleanUpDirectories(CorrectedPath);
+ PathCleanUpDirectories (CorrectedPath);
- Status = ShellOpenFileMetaArg((CHAR16*)CorrectedPath, EFI_FILE_MODE_READ, &ListHead);
- if (!EFI_ERROR(Status)) {
- if (ListHead == NULL || IsListEmpty(&ListHead->Link)) {
- SHELL_FREE_NON_NULL(CorrectedPath);
+ Status = ShellOpenFileMetaArg ((CHAR16 *)CorrectedPath, EFI_FILE_MODE_READ, &ListHead);
+ if (!EFI_ERROR (Status)) {
+ if ((ListHead == NULL) || IsListEmpty (&ListHead->Link)) {
+ SHELL_FREE_NON_NULL (CorrectedPath);
return (SHELL_SUCCESS);
}
- if (Sfo && Found == NULL) {
- PrintSfoVolumeInfoTableEntry(ListHead);
+ if (Sfo && (Found == NULL)) {
+ PrintSfoVolumeInfoTableEntry (ListHead);
}
if (!Sfo) {
@@ -503,54 +513,64 @@ PrintLsOutput( );
}
- for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link), LongestPath = 0
- ; !IsNull(&ListHead->Link, &Node->Link)
- ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link)
- ){
+ for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&ListHead->Link), LongestPath = 0
+ ; !IsNull (&ListHead->Link, &Node->Link)
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&ListHead->Link, &Node->Link)
+ )
+ {
if (ShellGetExecutionBreakFlag ()) {
ShellStatus = SHELL_ABORTED;
break;
}
- ASSERT(Node != NULL);
+
+ ASSERT (Node != NULL);
//
// Change the file time to local time.
//
- Status = gRT->GetTime(&LocalTime, NULL);
+ Status = gRT->GetTime (&LocalTime, NULL);
if (!EFI_ERROR (Status) && (LocalTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE)) {
if ((Node->Info->CreateTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) &&
- (Node->Info->CreateTime.Month >= 1 && Node->Info->CreateTime.Month <= 12)) {
+ ((Node->Info->CreateTime.Month >= 1) && (Node->Info->CreateTime.Month <= 12)))
+ {
//
// FileTimeToLocalTime () requires Month is in a valid range, other buffer out-of-band access happens.
//
FileTimeToLocalTime (&Node->Info->CreateTime, LocalTime.TimeZone);
}
+
if ((Node->Info->LastAccessTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) &&
- (Node->Info->LastAccessTime.Month >= 1 && Node->Info->LastAccessTime.Month <= 12)) {
+ ((Node->Info->LastAccessTime.Month >= 1) && (Node->Info->LastAccessTime.Month <= 12)))
+ {
FileTimeToLocalTime (&Node->Info->LastAccessTime, LocalTime.TimeZone);
}
+
if ((Node->Info->ModificationTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) &&
- (Node->Info->ModificationTime.Month >= 1 && Node->Info->ModificationTime.Month <= 12)) {
+ ((Node->Info->ModificationTime.Month >= 1) && (Node->Info->ModificationTime.Month <= 12)))
+ {
FileTimeToLocalTime (&Node->Info->ModificationTime, LocalTime.TimeZone);
}
}
- if (LongestPath < StrSize(Node->FullName)) {
- LongestPath = StrSize(Node->FullName);
+ if (LongestPath < StrSize (Node->FullName)) {
+ LongestPath = StrSize (Node->FullName);
}
- ASSERT(Node->Info != NULL);
- ASSERT((Node->Info->Attribute & EFI_FILE_VALID_ATTR) == Node->Info->Attribute);
+
+ ASSERT (Node->Info != NULL);
+ ASSERT ((Node->Info->Attribute & EFI_FILE_VALID_ATTR) == Node->Info->Attribute);
if (Attribs == 0) {
//
// NOT system & NOT hidden
//
- if ( (Node->Info->Attribute & EFI_FILE_SYSTEM)
- || (Node->Info->Attribute & EFI_FILE_HIDDEN)
- ){
+ if ( (Node->Info->Attribute & EFI_FILE_SYSTEM)
+ || (Node->Info->Attribute & EFI_FILE_HIDDEN)
+ )
+ {
continue;
}
} else if ((Attribs != EFI_FILE_VALID_ATTR) ||
- (Count == 5)) {
+ (Count == 5))
+ {
//
// Only matches the bits which "Attribs" contains, not
// all files/directories with any of the bits.
@@ -558,47 +578,52 @@ PrintLsOutput( // specifying all bits (EX: -arhsda) and just specifying
// -a (means display all files with any attribute).
//
- if ( (Node->Info->Attribute & Attribs) != Attribs) {
+ if ((Node->Info->Attribute & Attribs) != Attribs) {
continue;
}
}
if (!Sfo && !HeaderPrinted) {
PathRemoveLastItem (CorrectedPath);
- PrintNonSfoHeader(CorrectedPath);
+ PrintNonSfoHeader (CorrectedPath);
}
- PrintFileInformation(Sfo, Node, &FileCount, &FileSize, &DirCount);
- FoundOne = TRUE;
+
+ PrintFileInformation (Sfo, Node, &FileCount, &FileSize, &DirCount);
+ FoundOne = TRUE;
HeaderPrinted = TRUE;
}
- if (!Sfo && ShellStatus != SHELL_ABORTED && HeaderPrinted) {
- PrintNonSfoFooter(FileCount, FileSize, DirCount);
+ if (!Sfo && (ShellStatus != SHELL_ABORTED) && HeaderPrinted) {
+ PrintNonSfoFooter (FileCount, FileSize, DirCount);
}
}
- if (Rec && ShellStatus != SHELL_ABORTED) {
+ if (Rec && (ShellStatus != SHELL_ABORTED)) {
//
// Re-Open all the files under the starting path for directories that didnt necessarily match our file filter
//
- ShellCloseFileMetaArg(&ListHead);
+ ShellCloseFileMetaArg (&ListHead);
CorrectedPath[0] = CHAR_NULL;
- CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, RootPath, 0);
+ CorrectedPath = StrnCatGrow (&CorrectedPath, &LongestPath, RootPath, 0);
if (CorrectedPath == NULL) {
return SHELL_OUT_OF_RESOURCES;
}
- if (CorrectedPath[StrLen(CorrectedPath)-1] != L'\\'
- &&CorrectedPath[StrLen(CorrectedPath)-1] != L'/') {
- CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"\\", 0);
+
+ if ( (CorrectedPath[StrLen (CorrectedPath)-1] != L'\\')
+ && (CorrectedPath[StrLen (CorrectedPath)-1] != L'/'))
+ {
+ CorrectedPath = StrnCatGrow (&CorrectedPath, &LongestPath, L"\\", 0);
}
- CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"*", 0);
- Status = ShellOpenFileMetaArg((CHAR16*)CorrectedPath, EFI_FILE_MODE_READ, &ListHead);
-
- if (!EFI_ERROR(Status)) {
- for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link)
- ; !IsNull(&ListHead->Link, &Node->Link) && ShellStatus == SHELL_SUCCESS
- ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link)
- ){
+
+ CorrectedPath = StrnCatGrow (&CorrectedPath, &LongestPath, L"*", 0);
+ Status = ShellOpenFileMetaArg ((CHAR16 *)CorrectedPath, EFI_FILE_MODE_READ, &ListHead);
+
+ if (!EFI_ERROR (Status)) {
+ for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&ListHead->Link)
+ ; !IsNull (&ListHead->Link, &Node->Link) && ShellStatus == SHELL_SUCCESS
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&ListHead->Link, &Node->Link)
+ )
+ {
if (ShellGetExecutionBreakFlag ()) {
ShellStatus = SHELL_ABORTED;
break;
@@ -607,20 +632,22 @@ PrintLsOutput( //
// recurse on any directory except the traversing ones...
//
- if (((Node->Info->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY)
- && StrCmp(Node->FileName, L".") != 0
- && StrCmp(Node->FileName, L"..") != 0
- ){
- ShellStatus = PrintLsOutput(
- Rec,
- Attribs,
- Sfo,
- Node->FullName,
- SearchString,
- &FoundOne,
- Count,
- TimeZone,
- FALSE);
+ if ( ((Node->Info->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY)
+ && (StrCmp (Node->FileName, L".") != 0)
+ && (StrCmp (Node->FileName, L"..") != 0)
+ )
+ {
+ ShellStatus = PrintLsOutput (
+ Rec,
+ Attribs,
+ Sfo,
+ Node->FullName,
+ SearchString,
+ &FoundOne,
+ Count,
+ TimeZone,
+ FALSE
+ );
//
// Since it's running recursively, we have to break immediately when returned SHELL_ABORTED
@@ -633,10 +660,10 @@ PrintLsOutput( }
}
- SHELL_FREE_NON_NULL(CorrectedPath);
- ShellCloseFileMetaArg(&ListHead);
+ SHELL_FREE_NON_NULL (CorrectedPath);
+ ShellCloseFileMetaArg (&ListHead);
- if (Found == NULL && !FoundOne) {
+ if ((Found == NULL) && !FoundOne) {
if (ListUnfiltered) {
//
// When running "ls" without any filtering request, avoid outputing
@@ -661,12 +688,12 @@ PrintLsOutput( return (ShellStatus);
}
-STATIC CONST SHELL_PARAM_ITEM LsParamList[] = {
- {L"-r", TypeFlag},
- {L"-a", TypeStart},
- {L"-sfo", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM LsParamList[] = {
+ { L"-r", TypeFlag },
+ { L"-a", TypeStart },
+ { L"-sfo", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'ls' command.
@@ -696,62 +723,63 @@ ShellCommandRunLs ( CHAR16 *SearchString;
BOOLEAN ListUnfiltered;
- Size = 0;
- FullPath = NULL;
- ProblemParam = NULL;
- Attribs = NULL;
- ShellStatus = SHELL_SUCCESS;
- RequiredAttributes = 0;
- PathName = NULL;
- SearchString = NULL;
- CurDir = NULL;
- Count = 0;
- ListUnfiltered = FALSE;
+ Size = 0;
+ FullPath = NULL;
+ ProblemParam = NULL;
+ Attribs = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ RequiredAttributes = 0;
+ PathName = NULL;
+ SearchString = NULL;
+ CurDir = NULL;
+ Count = 0;
+ ListUnfiltered = FALSE;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// Fix local copies of the protocol pointers
//
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParse (LsParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"ls", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"ls", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
- if (ShellCommandLineGetCount(Package) > 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"ls");
+ if (ShellCommandLineGetCount (Package) > 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"ls");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// check for -a
//
- if (ShellCommandLineGetFlag(Package, L"-a")) {
- for ( Attribs = ShellCommandLineGetValue(Package, L"-a")
- ; Attribs != NULL && *Attribs != CHAR_NULL && ShellStatus == SHELL_SUCCESS
- ; Attribs++
- ){
+ if (ShellCommandLineGetFlag (Package, L"-a")) {
+ for ( Attribs = ShellCommandLineGetValue (Package, L"-a")
+ ; Attribs != NULL && *Attribs != CHAR_NULL && ShellStatus == SHELL_SUCCESS
+ ; Attribs++
+ )
+ {
switch (*Attribs) {
case L'a':
case L'A':
@@ -779,11 +807,12 @@ ShellCommandRunLs ( Count++;
continue;
default:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ATTRIBUTE), gShellLevel2HiiHandle, L"ls", ShellCommandLineGetValue(Package, L"-a"));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ATTRIBUTE), gShellLevel2HiiHandle, L"ls", ShellCommandLineGetValue (Package, L"-a"));
ShellStatus = SHELL_INVALID_PARAMETER;
break;
} // switch
} // for loop
+
//
// if nothing is specified all are specified
//
@@ -791,103 +820,109 @@ ShellCommandRunLs ( RequiredAttributes = EFI_FILE_VALID_ATTR;
}
} // if -a present
+
if (ShellStatus == SHELL_SUCCESS) {
- PathName = ShellCommandLineGetRawValue(Package, 1);
+ PathName = ShellCommandLineGetRawValue (Package, 1);
if (PathName == NULL) {
//
// Nothing specified... must start from current directory
//
- CurDir = gEfiShellProtocol->GetCurDir(NULL);
+ CurDir = gEfiShellProtocol->GetCurDir (NULL);
if (CurDir == NULL) {
ShellStatus = SHELL_NOT_FOUND;
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"ls");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"ls");
}
+
ListUnfiltered = TRUE;
//
// Copy to the 2 strings for starting path and file search string
//
- ASSERT(SearchString == NULL);
- ASSERT(FullPath == NULL);
- StrnCatGrow(&SearchString, NULL, L"*", 0);
- StrnCatGrow(&FullPath, NULL, CurDir, 0);
- Size = FullPath != NULL? StrSize(FullPath) : 0;
- StrnCatGrow(&FullPath, &Size, L"\\", 0);
+ ASSERT (SearchString == NULL);
+ ASSERT (FullPath == NULL);
+ StrnCatGrow (&SearchString, NULL, L"*", 0);
+ StrnCatGrow (&FullPath, NULL, CurDir, 0);
+ Size = FullPath != NULL ? StrSize (FullPath) : 0;
+ StrnCatGrow (&FullPath, &Size, L"\\", 0);
} else {
- if (StrStr(PathName, L":") == NULL && gEfiShellProtocol->GetCurDir(NULL) == NULL) {
+ if ((StrStr (PathName, L":") == NULL) && (gEfiShellProtocol->GetCurDir (NULL) == NULL)) {
//
// If we got something and it doesnt have a fully qualified path, then we needed to have a CWD.
//
ShellStatus = SHELL_NOT_FOUND;
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"ls");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"ls");
} else {
//
// We got a valid fully qualified path or we have a CWD
//
- ASSERT((FullPath == NULL && Size == 0) || (FullPath != NULL));
- if (StrStr(PathName, L":") == NULL) {
- StrnCatGrow(&FullPath, &Size, gEfiShellProtocol->GetCurDir(NULL), 0);
+ ASSERT ((FullPath == NULL && Size == 0) || (FullPath != NULL));
+ if (StrStr (PathName, L":") == NULL) {
+ StrnCatGrow (&FullPath, &Size, gEfiShellProtocol->GetCurDir (NULL), 0);
if (FullPath == NULL) {
ShellCommandLineFreeVarList (Package);
return SHELL_OUT_OF_RESOURCES;
}
- Size = FullPath != NULL? StrSize(FullPath) : 0;
- StrnCatGrow(&FullPath, &Size, L"\\", 0);
+
+ Size = FullPath != NULL ? StrSize (FullPath) : 0;
+ StrnCatGrow (&FullPath, &Size, L"\\", 0);
}
- StrnCatGrow(&FullPath, &Size, PathName, 0);
+
+ StrnCatGrow (&FullPath, &Size, PathName, 0);
if (FullPath == NULL) {
- ShellCommandLineFreeVarList (Package);
- return SHELL_OUT_OF_RESOURCES;
+ ShellCommandLineFreeVarList (Package);
+ return SHELL_OUT_OF_RESOURCES;
}
- if (ShellIsDirectory(PathName) == EFI_SUCCESS) {
+ if (ShellIsDirectory (PathName) == EFI_SUCCESS) {
//
// is listing ends with a directory, then we list all files in that directory
//
ListUnfiltered = TRUE;
- StrnCatGrow(&SearchString, NULL, L"*", 0);
+ StrnCatGrow (&SearchString, NULL, L"*", 0);
} else {
//
// must split off the search part that applies to files from the end of the directory part
//
- StrnCatGrow(&SearchString, NULL, FullPath, 0);
+ StrnCatGrow (&SearchString, NULL, FullPath, 0);
if (SearchString == NULL) {
FreePool (FullPath);
ShellCommandLineFreeVarList (Package);
return SHELL_OUT_OF_RESOURCES;
}
+
PathRemoveLastItem (FullPath);
CopyMem (SearchString, SearchString + StrLen (FullPath), StrSize (SearchString + StrLen (FullPath)));
}
}
}
- Status = gRT->GetTime(&TheTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"ls", L"gRT->GetTime", Status);
+
+ Status = gRT->GetTime (&TheTime, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"ls", L"gRT->GetTime", Status);
TheTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
}
if (ShellStatus == SHELL_SUCCESS) {
- ShellStatus = PrintLsOutput(
- ShellCommandLineGetFlag(Package, L"-r"),
- RequiredAttributes,
- ShellCommandLineGetFlag(Package, L"-sfo"),
- FullPath,
- SearchString,
- NULL,
- Count,
- TheTime.TimeZone,
- ListUnfiltered
- );
+ ShellStatus = PrintLsOutput (
+ ShellCommandLineGetFlag (Package, L"-r"),
+ RequiredAttributes,
+ ShellCommandLineGetFlag (Package, L"-sfo"),
+ FullPath,
+ SearchString,
+ NULL,
+ Count,
+ TheTime.TimeZone,
+ ListUnfiltered
+ );
if (ShellStatus == SHELL_NOT_FOUND) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LS_FILE_NOT_FOUND), gShellLevel2HiiHandle, L"ls", FullPath);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LS_FILE_NOT_FOUND), gShellLevel2HiiHandle, L"ls", FullPath);
} else if (ShellStatus == SHELL_INVALID_PARAMETER) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"ls", FullPath);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"ls", FullPath);
} else if (ShellStatus == SHELL_ABORTED) {
//
// Ignore aborting.
//
} else if (ShellStatus != SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"ls", FullPath);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"ls", FullPath);
}
}
}
@@ -897,8 +932,8 @@ ShellCommandRunLs ( //
// Free memory allocated
//
- SHELL_FREE_NON_NULL(SearchString);
- SHELL_FREE_NON_NULL(FullPath);
+ SHELL_FREE_NON_NULL (SearchString);
+ SHELL_FREE_NON_NULL (FullPath);
ShellCommandLineFreeVarList (Package);
return (ShellStatus);
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c index c5968226be..f3c888edd4 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c @@ -28,20 +28,23 @@ @retval FALSE String has at least one other character.
**/
BOOLEAN
-IsNumberLetterOnly(
- IN CONST CHAR16 *String,
- IN CONST UINTN Len
+IsNumberLetterOnly (
+ IN CONST CHAR16 *String,
+ IN CONST UINTN Len
)
{
- UINTN Count;
- for (Count = 0 ; Count < Len && String != NULL && *String != CHAR_NULL ; String++,Count++) {
- if (! ((*String >= L'a' && *String <= L'z') ||
- (*String >= L'A' && *String <= L'Z') ||
- (*String >= L'0' && *String <= L'9'))
- ){
+ UINTN Count;
+
+ for (Count = 0; Count < Len && String != NULL && *String != CHAR_NULL; String++, Count++) {
+ if (!(((*String >= L'a') && (*String <= L'z')) ||
+ ((*String >= L'A') && (*String <= L'Z')) ||
+ ((*String >= L'0') && (*String <= L'9')))
+ )
+ {
return (FALSE);
}
}
+
return (TRUE);
}
@@ -58,7 +61,7 @@ IsNumberLetterOnly( items (";" normally).
**/
BOOLEAN
-SearchList(
+SearchList (
IN CONST CHAR16 *List,
IN CONST CHAR16 *MetaTarget,
OUT CHAR16 **FullName OPTIONAL,
@@ -73,39 +76,44 @@ SearchList( BOOLEAN Result;
CHAR16 *TempSpot;
- for (ListWalker = List , TempList = NULL
- ; ListWalker != NULL && *ListWalker != CHAR_NULL
- ;
- ) {
- TempList = StrnCatGrow(&TempList, NULL, ListWalker, 0);
- ASSERT(TempList != NULL);
- TempSpot = StrStr(TempList, Target);
+ for (ListWalker = List, TempList = NULL
+ ; ListWalker != NULL && *ListWalker != CHAR_NULL
+ ;
+ )
+ {
+ TempList = StrnCatGrow (&TempList, NULL, ListWalker, 0);
+ ASSERT (TempList != NULL);
+ TempSpot = StrStr (TempList, Target);
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
- while (SkipTrailingNumbers && (ShellIsDecimalDigitCharacter(TempList[StrLen(TempList)-1]) || TempList[StrLen(TempList)-1] == L':')) {
- TempList[StrLen(TempList)-1] = CHAR_NULL;
+ while (SkipTrailingNumbers && (ShellIsDecimalDigitCharacter (TempList[StrLen (TempList)-1]) || TempList[StrLen (TempList)-1] == L':')) {
+ TempList[StrLen (TempList)-1] = CHAR_NULL;
}
- ListWalker = StrStr(ListWalker, Target);
- while(ListWalker != NULL && *ListWalker == *Target) {
+ ListWalker = StrStr (ListWalker, Target);
+ while (ListWalker != NULL && *ListWalker == *Target) {
ListWalker++;
}
+
if (Meta) {
- Result = gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)TempList, (CHAR16*)MetaTarget);
+ Result = gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)TempList, (CHAR16 *)MetaTarget);
} else {
- Result = (BOOLEAN)(StrCmp(TempList, MetaTarget)==0);
+ Result = (BOOLEAN)(StrCmp (TempList, MetaTarget) == 0);
}
+
if (Result) {
if (FullName != NULL) {
*FullName = TempList;
} else {
- FreePool(TempList);
+ FreePool (TempList);
}
+
return (TRUE);
}
- FreePool(TempList);
+
+ FreePool (TempList);
TempList = NULL;
}
@@ -124,9 +132,9 @@ SearchList( @retval STR_MAP_MEDIA_CDROM The media is a CD ROM.
@retval STR_MAP_MEDIA_FLOPPY The media is a floppy drive.
**/
-CHAR16*
+CHAR16 *
GetDeviceMediaType (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
ACPI_HID_DEVICE_PATH *Acpi;
@@ -139,26 +147,26 @@ GetDeviceMediaType ( // Acpi.HID = 0X0604 -> Floppy
//
if (NULL == DevicePath) {
- return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_UNKNOWN), NULL);
+ return HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_MAP_MEDIA_UNKNOWN), NULL);
}
- for (;!IsDevicePathEndType (DevicePath) ;DevicePath = NextDevicePathNode (DevicePath)) {
+ for ( ; !IsDevicePathEndType (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) {
switch (DevicePathSubType (DevicePath)) {
- case MEDIA_HARDDRIVE_DP:
- return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_HARDDISK), NULL);
- case MEDIA_CDROM_DP:
- return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_CDROM), NULL);
+ case MEDIA_HARDDRIVE_DP:
+ return HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_MAP_MEDIA_HARDDISK), NULL);
+ case MEDIA_CDROM_DP:
+ return HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_MAP_MEDIA_CDROM), NULL);
}
} else if (DevicePathType (DevicePath) == ACPI_DEVICE_PATH) {
- Acpi = (ACPI_HID_DEVICE_PATH *) DevicePath;
+ Acpi = (ACPI_HID_DEVICE_PATH *)DevicePath;
if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) {
- return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_FLOPPY), NULL);
+ return HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_MAP_MEDIA_FLOPPY), NULL);
}
}
}
- return HiiGetString(gShellLevel2HiiHandle, STRING_TOKEN(STR_MAP_MEDIA_UNKNOWN), NULL);
+ return HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_MAP_MEDIA_UNKNOWN), NULL);
}
/**
@@ -171,7 +179,7 @@ GetDeviceMediaType ( **/
BOOLEAN
IsRemoveableDevice (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
if (NULL == DevicePath) {
@@ -181,15 +189,17 @@ IsRemoveableDevice ( while (!IsDevicePathEndType (DevicePath)) {
if (DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) {
switch (DevicePathSubType (DevicePath)) {
- case MSG_USB_DP:
- case MSG_SCSI_DP:
- return TRUE;
- default:
- return FALSE;
+ case MSG_USB_DP:
+ case MSG_SCSI_DP:
+ return TRUE;
+ default:
+ return FALSE;
}
}
+
DevicePath = NextDevicePathNode (DevicePath);
}
+
return FALSE;
}
@@ -206,68 +216,73 @@ IsRemoveableDevice ( @retval FALSE The map should not be displayed.
**/
BOOLEAN
-MappingListHasType(
- IN CONST CHAR16 *MapList,
- IN CONST CHAR16 *Specific,
- IN CONST CHAR16 *TypeString,
- IN CONST BOOLEAN Normal,
- IN CONST BOOLEAN Consist
+MappingListHasType (
+ IN CONST CHAR16 *MapList,
+ IN CONST CHAR16 *Specific,
+ IN CONST CHAR16 *TypeString,
+ IN CONST BOOLEAN Normal,
+ IN CONST BOOLEAN Consist
)
{
- CHAR16 *NewSpecific;
- RETURN_STATUS Status;
- UINTN Length;
+ CHAR16 *NewSpecific;
+ RETURN_STATUS Status;
+ UINTN Length;
//
// specific has priority
//
if (Specific != NULL) {
- Length = StrLen (Specific);
+ Length = StrLen (Specific);
//
// Allocate enough buffer for Specific and potential ":"
//
- NewSpecific = AllocatePool ((Length + 2) * sizeof(CHAR16));
- if (NewSpecific == NULL){
+ NewSpecific = AllocatePool ((Length + 2) * sizeof (CHAR16));
+ if (NewSpecific == NULL) {
return FALSE;
}
+
StrCpyS (NewSpecific, Length + 2, Specific);
if (Specific[Length - 1] != L':') {
- Status = StrnCatS(NewSpecific, Length + 2, L":", StrLen(L":"));
+ Status = StrnCatS (NewSpecific, Length + 2, L":", StrLen (L":"));
if (EFI_ERROR (Status)) {
- FreePool(NewSpecific);
+ FreePool (NewSpecific);
return FALSE;
}
}
- if (SearchList(MapList, NewSpecific, NULL, TRUE, FALSE, L";")) {
- FreePool(NewSpecific);
+ if (SearchList (MapList, NewSpecific, NULL, TRUE, FALSE, L";")) {
+ FreePool (NewSpecific);
return (TRUE);
}
- FreePool(NewSpecific);
+
+ FreePool (NewSpecific);
}
+
if ( Consist
- && Specific == NULL
- && (SearchList(MapList, L"HD*", NULL, TRUE, TRUE, L";")
- ||SearchList(MapList, L"CD*", NULL, TRUE, TRUE, L";")
- ||SearchList(MapList, L"F*", NULL, TRUE, TRUE, L";")
- ||SearchList(MapList, L"FP*", NULL, TRUE, TRUE, L";"))){
+ && (Specific == NULL)
+ && ( SearchList (MapList, L"HD*", NULL, TRUE, TRUE, L";")
+ || SearchList (MapList, L"CD*", NULL, TRUE, TRUE, L";")
+ || SearchList (MapList, L"F*", NULL, TRUE, TRUE, L";")
+ || SearchList (MapList, L"FP*", NULL, TRUE, TRUE, L";")))
+ {
return (TRUE);
}
if ( Normal
- && Specific == NULL
- && (SearchList(MapList, L"FS", NULL, FALSE, TRUE, L";")
- ||SearchList(MapList, L"BLK", NULL, FALSE, TRUE, L";"))){
+ && (Specific == NULL)
+ && ( SearchList (MapList, L"FS", NULL, FALSE, TRUE, L";")
+ || SearchList (MapList, L"BLK", NULL, FALSE, TRUE, L";")))
+ {
return (TRUE);
}
- if (TypeString != NULL && SearchList(MapList, TypeString, NULL, TRUE, TRUE, L";")) {
+ if ((TypeString != NULL) && SearchList (MapList, TypeString, NULL, TRUE, TRUE, L";")) {
return (TRUE);
}
+
return (FALSE);
}
-
/**
Display a single map line for device Handle if conditions are met.
@@ -282,14 +297,14 @@ MappingListHasType( @retval EFI_SUCCESS The mapping was displayed.
**/
EFI_STATUS
-PerformSingleMappingDisplay(
- IN CONST BOOLEAN Verbose,
- IN CONST BOOLEAN Consist,
- IN CONST BOOLEAN Normal,
- IN CONST CHAR16 *TypeString,
- IN CONST BOOLEAN SFO,
- IN CONST CHAR16 *Specific OPTIONAL,
- IN CONST EFI_HANDLE Handle
+PerformSingleMappingDisplay (
+ IN CONST BOOLEAN Verbose,
+ IN CONST BOOLEAN Consist,
+ IN CONST BOOLEAN Normal,
+ IN CONST CHAR16 *TypeString,
+ IN CONST BOOLEAN SFO,
+ IN CONST CHAR16 *Specific OPTIONAL,
+ IN CONST EFI_HANDLE Handle
)
{
EFI_DEVICE_PATH_PROTOCOL *DevPath;
@@ -307,14 +322,14 @@ PerformSingleMappingDisplay( Alias = NULL;
TempSpot2 = NULL;
CurrentName = NULL;
- DevPath = DevicePathFromHandle(Handle);
+ DevPath = DevicePathFromHandle (Handle);
DevPathCopy = DevPath;
- MapList = gEfiShellProtocol->GetMapFromDevicePath(&DevPathCopy);
+ MapList = gEfiShellProtocol->GetMapFromDevicePath (&DevPathCopy);
if (MapList == NULL) {
return EFI_NOT_FOUND;
}
- if (!MappingListHasType(MapList, Specific, TypeString, Normal, Consist)){
+ if (!MappingListHasType (MapList, Specific, TypeString, Normal, Consist)) {
return EFI_NOT_FOUND;
}
@@ -327,7 +342,7 @@ PerformSingleMappingDisplay( // Allocate a name
//
CurrentName = NULL;
- CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0);
+ CurrentName = StrnCatGrow (&CurrentName, 0, MapList, 0);
if (CurrentName == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
@@ -336,7 +351,7 @@ PerformSingleMappingDisplay( // Chop off the other names that become "Alias(s)"
// leaving just the normal name
//
- TempSpot = StrStr(CurrentName, L";");
+ TempSpot = StrStr (CurrentName, L";");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
@@ -346,54 +361,62 @@ PerformSingleMappingDisplay( //
// Skip the first name. This is the standard name.
//
- TempSpot = StrStr(MapList, L";");
+ TempSpot = StrStr (MapList, L";");
if (TempSpot != NULL) {
TempSpot++;
}
- SearchList(TempSpot, L"HD*", &CurrentName, TRUE, FALSE, L";");
+
+ SearchList (TempSpot, L"HD*", &CurrentName, TRUE, FALSE, L";");
if (CurrentName == NULL) {
- SearchList(TempSpot, L"CD*", &CurrentName, TRUE, FALSE, L";");
+ SearchList (TempSpot, L"CD*", &CurrentName, TRUE, FALSE, L";");
}
+
if (CurrentName == NULL) {
- SearchList(TempSpot, L"FP*", &CurrentName, TRUE, FALSE, L";");
+ SearchList (TempSpot, L"FP*", &CurrentName, TRUE, FALSE, L";");
}
+
if (CurrentName == NULL) {
- SearchList(TempSpot, L"F*", &CurrentName, TRUE, FALSE, L";");
+ SearchList (TempSpot, L"F*", &CurrentName, TRUE, FALSE, L";");
}
+
if (CurrentName == NULL) {
//
// We didnt find anything, so just the first one in the list...
//
- CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0);
+ CurrentName = StrnCatGrow (&CurrentName, 0, MapList, 0);
if (CurrentName == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- TempSpot = StrStr(CurrentName, L";");
+
+ TempSpot = StrStr (CurrentName, L";");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
} else {
- Alias = StrnCatGrow(&Alias, 0, MapList, 0);
+ Alias = StrnCatGrow (&Alias, 0, MapList, 0);
if (Alias == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- TempSpot = StrStr(Alias, CurrentName);
+
+ TempSpot = StrStr (Alias, CurrentName);
if (TempSpot != NULL) {
- TempSpot2 = StrStr(TempSpot, L";");
+ TempSpot2 = StrStr (TempSpot, L";");
if (TempSpot2 != NULL) {
TempSpot2++; // Move past ";" from CurrentName
- CopyMem(TempSpot, TempSpot2, StrSize(TempSpot2));
+ CopyMem (TempSpot, TempSpot2, StrSize (TempSpot2));
} else {
*TempSpot = CHAR_NULL;
}
}
- if (Alias[StrLen(Alias)-1] == L';') {
- Alias[StrLen(Alias)-1] = CHAR_NULL;
+
+ if (Alias[StrLen (Alias)-1] == L';') {
+ Alias[StrLen (Alias)-1] = CHAR_NULL;
}
}
}
- DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
- TempLen = StrLen(CurrentName);
+
+ DevPathString = ConvertDevicePathToText (DevPath, TRUE, FALSE);
+ TempLen = StrLen (CurrentName);
if (!SFO) {
ShellPrintHiiEx (
-1,
@@ -402,30 +425,31 @@ PerformSingleMappingDisplay( STRING_TOKEN (STR_MAP_ENTRY),
gShellLevel2HiiHandle,
CurrentName,
- Alias!=NULL?Alias:(TempLen < StrLen(MapList)?MapList + TempLen+1:L""),
+ Alias != NULL ? Alias : (TempLen < StrLen (MapList) ? MapList + TempLen+1 : L""),
DevPathString
- );
+ );
if (Verbose) {
//
// also print handle, media type, removable (y/n), and current directory
//
- MediaType = GetDeviceMediaType(DevPath);
- if ((TypeString != NULL &&MediaType != NULL && StrStr(TypeString, MediaType) != NULL) || TypeString == NULL) {
- Removable = IsRemoveableDevice(DevPath);
- TempSpot2 = ShellGetCurrentDir(CurrentName);
+ MediaType = GetDeviceMediaType (DevPath);
+ if (((TypeString != NULL) && (MediaType != NULL) && (StrStr (TypeString, MediaType) != NULL)) || (TypeString == NULL)) {
+ Removable = IsRemoveableDevice (DevPath);
+ TempSpot2 = ShellGetCurrentDir (CurrentName);
ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_MAP_ENTRY_VERBOSE),
gShellLevel2HiiHandle,
- ConvertHandleToHandleIndex(Handle),
+ ConvertHandleToHandleIndex (Handle),
MediaType,
- Removable?L"Yes":L"No",
+ Removable ? L"Yes" : L"No",
TempSpot2
- );
+ );
}
- SHELL_FREE_NON_NULL(MediaType);
+
+ SHELL_FREE_NON_NULL (MediaType);
}
} else {
ShellPrintHiiEx (
@@ -436,12 +460,13 @@ PerformSingleMappingDisplay( gShellLevel2HiiHandle,
CurrentName,
DevPathString,
- Consist?L"":(TempLen < StrLen(MapList)?MapList + TempLen+1:L"")
- );
+ Consist ? L"" : (TempLen < StrLen (MapList) ? MapList + TempLen+1 : L"")
+ );
}
- SHELL_FREE_NON_NULL(DevPathString);
- SHELL_FREE_NON_NULL(CurrentName);
- SHELL_FREE_NON_NULL(Alias);
+
+ SHELL_FREE_NON_NULL (DevPathString);
+ SHELL_FREE_NON_NULL (CurrentName);
+ SHELL_FREE_NON_NULL (Alias);
return EFI_SUCCESS;
}
@@ -455,9 +480,9 @@ PerformSingleMappingDisplay( @retval EFI_NOT_FOUND Name was not a map on Handle.
**/
EFI_STATUS
-PerformSingleMappingDelete(
- IN CONST CHAR16 *Specific,
- IN CONST EFI_HANDLE Handle
+PerformSingleMappingDelete (
+ IN CONST CHAR16 *Specific,
+ IN CONST EFI_HANDLE Handle
)
{
EFI_DEVICE_PATH_PROTOCOL *DevPath;
@@ -465,27 +490,30 @@ PerformSingleMappingDelete( CONST CHAR16 *MapList;
CHAR16 *CurrentName;
- DevPath = DevicePathFromHandle(Handle);
+ DevPath = DevicePathFromHandle (Handle);
DevPathCopy = DevPath;
- MapList = gEfiShellProtocol->GetMapFromDevicePath(&DevPathCopy);
+ MapList = gEfiShellProtocol->GetMapFromDevicePath (&DevPathCopy);
CurrentName = NULL;
if (MapList == NULL) {
return (EFI_NOT_FOUND);
}
+
//
// if there is a specific and its not on the list...
//
- if (!SearchList(MapList, Specific, &CurrentName, TRUE, FALSE, L";")) {
+ if (!SearchList (MapList, Specific, &CurrentName, TRUE, FALSE, L";")) {
return (EFI_NOT_FOUND);
}
- return (gEfiShellProtocol->SetMap(NULL, CurrentName));
+
+ return (gEfiShellProtocol->SetMap (NULL, CurrentName));
}
-CONST CHAR16 Cd[] = L"cd*";
-CONST CHAR16 Hd[] = L"hd*";
-CONST CHAR16 Fp[] = L"fp*";
-CONST CHAR16 AnyF[] = L"F*";
+CONST CHAR16 Cd[] = L"cd*";
+CONST CHAR16 Hd[] = L"hd*";
+CONST CHAR16 Fp[] = L"fp*";
+CONST CHAR16 AnyF[] = L"F*";
+
/**
Function to display mapping information to the user.
@@ -505,40 +533,40 @@ CONST CHAR16 AnyF[] = L"F*"; **/
SHELL_STATUS
-PerformMappingDisplay(
- IN CONST BOOLEAN Verbose,
- IN CONST BOOLEAN Consist,
- IN CONST BOOLEAN Normal,
- IN CONST CHAR16 *TypeString,
- IN CONST BOOLEAN SFO,
- IN CONST CHAR16 *Specific OPTIONAL,
- IN CONST BOOLEAN Header
+PerformMappingDisplay (
+ IN CONST BOOLEAN Verbose,
+ IN CONST BOOLEAN Consist,
+ IN CONST BOOLEAN Normal,
+ IN CONST CHAR16 *TypeString,
+ IN CONST BOOLEAN SFO,
+ IN CONST CHAR16 *Specific OPTIONAL,
+ IN CONST BOOLEAN Header
)
{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN BufferSize;
- UINTN LoopVar;
- CHAR16 *Test;
- BOOLEAN Found;
-
- if (!Consist && !Normal && Specific == NULL && TypeString == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"map");
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN BufferSize;
+ UINTN LoopVar;
+ CHAR16 *Test;
+ BOOLEAN Found;
+
+ if (!Consist && !Normal && (Specific == NULL) && (TypeString == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"map");
return (SHELL_INVALID_PARAMETER);
}
if (TypeString != NULL) {
- Test = (CHAR16*)Cd;
- if (StrnCmp(TypeString, Test, StrLen(Test)-1) != 0) {
- Test = (CHAR16*)Hd;
- if (StrnCmp(TypeString, Test, StrLen(Test)-1) != 0) {
- Test = (CHAR16*)Fp;
- if (StrnCmp(TypeString, Test, StrLen(Test)-1) != 0) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", TypeString);
+ Test = (CHAR16 *)Cd;
+ if (StrnCmp (TypeString, Test, StrLen (Test)-1) != 0) {
+ Test = (CHAR16 *)Hd;
+ if (StrnCmp (TypeString, Test, StrLen (Test)-1) != 0) {
+ Test = (CHAR16 *)Fp;
+ if (StrnCmp (TypeString, Test, StrLen (Test)-1) != 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", TypeString);
return (SHELL_INVALID_PARAMETER);
}
} else if (Test == NULL) {
- Test = (CHAR16*)AnyF;
+ Test = (CHAR16 *)AnyF;
}
}
} else {
@@ -550,53 +578,58 @@ PerformMappingDisplay( // Print the header
//
if (!SFO) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_HEADER), gShellLevel2HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MAP_HEADER), gShellLevel2HiiHandle);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellLevel2HiiHandle, L"map");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellLevel2HiiHandle, L"map");
}
}
- BufferSize = 0;
- HandleBuffer = NULL;
+ BufferSize = 0;
+ HandleBuffer = NULL;
//
// Look up all SimpleFileSystems in the platform
//
- Status = gBS->LocateHandle(
- ByProtocol,
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- &BufferSize,
- HandleBuffer);
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ &BufferSize,
+ HandleBuffer
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- HandleBuffer = AllocateZeroPool(BufferSize);
+ HandleBuffer = AllocateZeroPool (BufferSize);
if (HandleBuffer == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- Status = gBS->LocateHandle(
- ByProtocol,
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- &BufferSize,
- HandleBuffer);
+
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ &BufferSize,
+ HandleBuffer
+ );
}
//
// Get the map name(s) for each one.
//
for ( LoopVar = 0, Found = FALSE
- ; LoopVar < (BufferSize / sizeof(EFI_HANDLE)) && HandleBuffer != NULL
- ; LoopVar ++
- ){
- Status = PerformSingleMappingDisplay(
- Verbose,
- Consist,
- Normal,
- Test,
- SFO,
- Specific,
- HandleBuffer[LoopVar]);
- if (!EFI_ERROR(Status)) {
+ ; LoopVar < (BufferSize / sizeof (EFI_HANDLE)) && HandleBuffer != NULL
+ ; LoopVar++
+ )
+ {
+ Status = PerformSingleMappingDisplay (
+ Verbose,
+ Consist,
+ Normal,
+ Test,
+ SFO,
+ Specific,
+ HandleBuffer[LoopVar]
+ );
+ if (!EFI_ERROR (Status)) {
Found = TRUE;
}
}
@@ -604,66 +637,78 @@ PerformMappingDisplay( //
// Look up all BlockIo in the platform
//
- Status = gBS->LocateHandle(
- ByProtocol,
- &gEfiBlockIoProtocolGuid,
- NULL,
- &BufferSize,
- HandleBuffer);
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &BufferSize,
+ HandleBuffer
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- SHELL_FREE_NON_NULL(HandleBuffer);
- HandleBuffer = AllocateZeroPool(BufferSize);
+ SHELL_FREE_NON_NULL (HandleBuffer);
+ HandleBuffer = AllocateZeroPool (BufferSize);
if (HandleBuffer == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- Status = gBS->LocateHandle(
- ByProtocol,
- &gEfiBlockIoProtocolGuid,
- NULL,
- &BufferSize,
- HandleBuffer);
+
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &BufferSize,
+ HandleBuffer
+ );
}
- if (!EFI_ERROR(Status) && HandleBuffer != NULL) {
+
+ if (!EFI_ERROR (Status) && (HandleBuffer != NULL)) {
//
// Get the map name(s) for each one.
//
for ( LoopVar = 0
- ; LoopVar < BufferSize / sizeof(EFI_HANDLE)
- ; LoopVar ++
- ){
+ ; LoopVar < BufferSize / sizeof (EFI_HANDLE)
+ ; LoopVar++
+ )
+ {
//
// Skip any that were already done...
//
- if (gBS->OpenProtocol(
- HandleBuffer[LoopVar],
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL) == EFI_SUCCESS) {
- continue;
+ if (gBS->OpenProtocol (
+ HandleBuffer[LoopVar],
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ ) == EFI_SUCCESS)
+ {
+ continue;
}
- Status = PerformSingleMappingDisplay(
- Verbose,
- Consist,
- Normal,
- Test,
- SFO,
- Specific,
- HandleBuffer[LoopVar]);
- if (!EFI_ERROR(Status)) {
+
+ Status = PerformSingleMappingDisplay (
+ Verbose,
+ Consist,
+ Normal,
+ Test,
+ SFO,
+ Specific,
+ HandleBuffer[LoopVar]
+ );
+ if (!EFI_ERROR (Status)) {
Found = TRUE;
}
}
- FreePool(HandleBuffer);
+
+ FreePool (HandleBuffer);
}
+
if (!Found) {
if (Specific != NULL) {
- ShellPrintHiiEx(gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, L"map", Specific);
+ ShellPrintHiiEx (gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, L"map", Specific);
} else {
- ShellPrintHiiEx(gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_CD_NF), gShellLevel2HiiHandle, L"map");
+ ShellPrintHiiEx (gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_CD_NF), gShellLevel2HiiHandle, L"map");
}
}
+
return (SHELL_SUCCESS);
}
@@ -682,41 +727,43 @@ PerformMappingDisplay( @sa PerformMappingDisplay
**/
SHELL_STATUS
-PerformMappingDisplay2(
- IN CONST BOOLEAN Verbose,
- IN CONST BOOLEAN Consist,
- IN CONST BOOLEAN Normal,
- IN CONST CHAR16 *TypeString,
- IN CONST BOOLEAN SFO,
- IN CONST CHAR16 *Specific OPTIONAL
+PerformMappingDisplay2 (
+ IN CONST BOOLEAN Verbose,
+ IN CONST BOOLEAN Consist,
+ IN CONST BOOLEAN Normal,
+ IN CONST CHAR16 *TypeString,
+ IN CONST BOOLEAN SFO,
+ IN CONST CHAR16 *Specific OPTIONAL
)
{
CONST CHAR16 *TypeWalker;
SHELL_STATUS ShellStatus;
CHAR16 *Comma;
-
if (TypeString == NULL) {
- return (PerformMappingDisplay(Verbose, Consist, Normal, NULL, SFO, Specific, TRUE));
+ return (PerformMappingDisplay (Verbose, Consist, Normal, NULL, SFO, Specific, TRUE));
}
+
ShellStatus = SHELL_SUCCESS;
- for (TypeWalker = TypeString ; TypeWalker != NULL && *TypeWalker != CHAR_NULL ;) {
- Comma = StrStr(TypeWalker, L",");
+ for (TypeWalker = TypeString; TypeWalker != NULL && *TypeWalker != CHAR_NULL;) {
+ Comma = StrStr (TypeWalker, L",");
if (Comma == NULL) {
if (ShellStatus == SHELL_SUCCESS) {
- ShellStatus = PerformMappingDisplay(Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
+ ShellStatus = PerformMappingDisplay (Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
} else {
- PerformMappingDisplay(Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
+ PerformMappingDisplay (Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
}
+
break;
} else {
*Comma = CHAR_NULL;
if (ShellStatus == SHELL_SUCCESS) {
- ShellStatus = PerformMappingDisplay(Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
+ ShellStatus = PerformMappingDisplay (Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
} else {
- PerformMappingDisplay(Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
+ PerformMappingDisplay (Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
}
- *Comma = L',';
+
+ *Comma = L',';
TypeWalker = Comma + 1;
}
}
@@ -734,47 +781,51 @@ PerformMappingDisplay2( @retval EFI_NOT_FOUND Specific could not be found.
**/
EFI_STATUS
-PerformMappingDelete(
+PerformMappingDelete (
IN CONST CHAR16 *Specific
)
{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN BufferSize;
- UINTN LoopVar;
- BOOLEAN Deleted;
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN BufferSize;
+ UINTN LoopVar;
+ BOOLEAN Deleted;
if (Specific == NULL) {
return (EFI_INVALID_PARAMETER);
}
- BufferSize = 0;
- HandleBuffer = NULL;
- Deleted = FALSE;
+ BufferSize = 0;
+ HandleBuffer = NULL;
+ Deleted = FALSE;
//
// Look up all SimpleFileSystems in the platform
//
- Status = gBS->LocateHandle(
- ByProtocol,
- &gEfiDevicePathProtocolGuid,
- NULL,
- &BufferSize,
- HandleBuffer);
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiDevicePathProtocolGuid,
+ NULL,
+ &BufferSize,
+ HandleBuffer
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- HandleBuffer = AllocateZeroPool(BufferSize);
+ HandleBuffer = AllocateZeroPool (BufferSize);
if (HandleBuffer == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- Status = gBS->LocateHandle(
- ByProtocol,
- &gEfiDevicePathProtocolGuid,
- NULL,
- &BufferSize,
- HandleBuffer);
+
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiDevicePathProtocolGuid,
+ NULL,
+ &BufferSize,
+ HandleBuffer
+ );
}
- if (EFI_ERROR(Status)) {
- SHELL_FREE_NON_NULL(HandleBuffer);
+
+ if (EFI_ERROR (Status)) {
+ SHELL_FREE_NON_NULL (HandleBuffer);
return (Status);
}
@@ -783,38 +834,44 @@ PerformMappingDelete( // Get the map name(s) for each one.
//
for ( LoopVar = 0
- ; LoopVar < BufferSize / sizeof(EFI_HANDLE)
- ; LoopVar ++
- ){
- if (PerformSingleMappingDelete(Specific,HandleBuffer[LoopVar]) == SHELL_SUCCESS) {
- Deleted = TRUE;
+ ; LoopVar < BufferSize / sizeof (EFI_HANDLE)
+ ; LoopVar++
+ )
+ {
+ if (PerformSingleMappingDelete (Specific, HandleBuffer[LoopVar]) == SHELL_SUCCESS) {
+ Deleted = TRUE;
}
}
}
+
//
// Look up all BlockIo in the platform
//
- Status = gBS->LocateHandle(
- ByProtocol,
- &gEfiBlockIoProtocolGuid,
- NULL,
- &BufferSize,
- HandleBuffer);
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &BufferSize,
+ HandleBuffer
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- FreePool(HandleBuffer);
- HandleBuffer = AllocateZeroPool(BufferSize);
+ FreePool (HandleBuffer);
+ HandleBuffer = AllocateZeroPool (BufferSize);
if (HandleBuffer == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- Status = gBS->LocateHandle(
- ByProtocol,
- &gEfiBlockIoProtocolGuid,
- NULL,
- &BufferSize,
- HandleBuffer);
+
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &BufferSize,
+ HandleBuffer
+ );
}
- if (EFI_ERROR(Status)) {
- SHELL_FREE_NON_NULL(HandleBuffer);
+
+ if (EFI_ERROR (Status)) {
+ SHELL_FREE_NON_NULL (HandleBuffer);
return (Status);
}
@@ -823,30 +880,36 @@ PerformMappingDelete( // Get the map name(s) for each one.
//
for ( LoopVar = 0
- ; LoopVar < BufferSize / sizeof(EFI_HANDLE)
- ; LoopVar ++
- ){
+ ; LoopVar < BufferSize / sizeof (EFI_HANDLE)
+ ; LoopVar++
+ )
+ {
//
// Skip any that were already done...
//
- if (gBS->OpenProtocol(
- HandleBuffer[LoopVar],
- &gEfiDevicePathProtocolGuid,
- NULL,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL) == EFI_SUCCESS) {
- continue;
+ if (gBS->OpenProtocol (
+ HandleBuffer[LoopVar],
+ &gEfiDevicePathProtocolGuid,
+ NULL,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ ) == EFI_SUCCESS)
+ {
+ continue;
}
- if (PerformSingleMappingDelete(Specific,HandleBuffer[LoopVar]) == SHELL_SUCCESS) {
- Deleted = TRUE;
+
+ if (PerformSingleMappingDelete (Specific, HandleBuffer[LoopVar]) == SHELL_SUCCESS) {
+ Deleted = TRUE;
}
}
}
- SHELL_FREE_NON_NULL(HandleBuffer);
+
+ SHELL_FREE_NON_NULL (HandleBuffer);
if (!Deleted) {
return (EFI_NOT_FOUND);
}
+
return (EFI_SUCCESS);
}
@@ -864,9 +927,9 @@ PerformMappingDelete( **/
SHELL_STATUS
-AddMappingFromMapping(
- IN CONST CHAR16 *Map,
- IN CONST CHAR16 *SName
+AddMappingFromMapping (
+ IN CONST CHAR16 *Map,
+ IN CONST CHAR16 *SName
)
{
CONST EFI_DEVICE_PATH_PROTOCOL *DevPath;
@@ -874,34 +937,36 @@ AddMappingFromMapping( CHAR16 *NewSName;
RETURN_STATUS StrRetStatus;
- NewSName = AllocateCopyPool(StrSize(SName) + sizeof(CHAR16), SName);
+ NewSName = AllocateCopyPool (StrSize (SName) + sizeof (CHAR16), SName);
if (NewSName == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- if (NewSName[StrLen(NewSName)-1] != L':') {
- StrRetStatus = StrnCatS(NewSName, (StrSize(SName) + sizeof(CHAR16))/sizeof(CHAR16), L":", StrLen(L":"));
- if (EFI_ERROR(StrRetStatus)) {
- FreePool(NewSName);
- return ((SHELL_STATUS) (StrRetStatus & (~MAX_BIT)));
+
+ if (NewSName[StrLen (NewSName)-1] != L':') {
+ StrRetStatus = StrnCatS (NewSName, (StrSize (SName) + sizeof (CHAR16))/sizeof (CHAR16), L":", StrLen (L":"));
+ if (EFI_ERROR (StrRetStatus)) {
+ FreePool (NewSName);
+ return ((SHELL_STATUS)(StrRetStatus & (~MAX_BIT)));
}
}
- if (!IsNumberLetterOnly(NewSName, StrLen(NewSName)-1)) {
- FreePool(NewSName);
+ if (!IsNumberLetterOnly (NewSName, StrLen (NewSName)-1)) {
+ FreePool (NewSName);
return (SHELL_INVALID_PARAMETER);
}
- DevPath = gEfiShellProtocol->GetDevicePathFromMap(Map);
+ DevPath = gEfiShellProtocol->GetDevicePathFromMap (Map);
if (DevPath == NULL) {
- FreePool(NewSName);
+ FreePool (NewSName);
return (SHELL_INVALID_PARAMETER);
}
- Status = gEfiShellProtocol->SetMap(DevPath, NewSName);
- FreePool(NewSName);
- if (EFI_ERROR(Status)) {
+ Status = gEfiShellProtocol->SetMap (DevPath, NewSName);
+ FreePool (NewSName);
+ if (EFI_ERROR (Status)) {
return (SHELL_DEVICE_ERROR);
}
+
return (SHELL_SUCCESS);
}
@@ -920,9 +985,9 @@ AddMappingFromMapping( **/
SHELL_STATUS
-AddMappingFromHandle(
- IN CONST EFI_HANDLE Handle,
- IN CONST CHAR16 *SName
+AddMappingFromHandle (
+ IN CONST EFI_HANDLE Handle,
+ IN CONST CHAR16 *SName
)
{
EFI_DEVICE_PATH_PROTOCOL *DevPath;
@@ -930,54 +995,57 @@ AddMappingFromHandle( CHAR16 *NewSName;
RETURN_STATUS StrRetStatus;
- NewSName = AllocateCopyPool(StrSize(SName) + sizeof(CHAR16), SName);
+ NewSName = AllocateCopyPool (StrSize (SName) + sizeof (CHAR16), SName);
if (NewSName == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- if (NewSName[StrLen(NewSName)-1] != L':') {
- StrRetStatus = StrnCatS(NewSName, (StrSize(SName) + sizeof(CHAR16))/sizeof(CHAR16), L":", StrLen(L":"));
- if (EFI_ERROR(StrRetStatus)) {
- FreePool(NewSName);
- return ((SHELL_STATUS) (StrRetStatus & (~MAX_BIT)));
+
+ if (NewSName[StrLen (NewSName)-1] != L':') {
+ StrRetStatus = StrnCatS (NewSName, (StrSize (SName) + sizeof (CHAR16))/sizeof (CHAR16), L":", StrLen (L":"));
+ if (EFI_ERROR (StrRetStatus)) {
+ FreePool (NewSName);
+ return ((SHELL_STATUS)(StrRetStatus & (~MAX_BIT)));
}
}
- if (!IsNumberLetterOnly(NewSName, StrLen(NewSName)-1)) {
- FreePool(NewSName);
+ if (!IsNumberLetterOnly (NewSName, StrLen (NewSName)-1)) {
+ FreePool (NewSName);
return (SHELL_INVALID_PARAMETER);
}
- Status = gBS->OpenProtocol(
- Handle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&DevPath,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR(Status)) {
- FreePool(NewSName);
+ Status = gBS->OpenProtocol (
+ Handle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **)&DevPath,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (NewSName);
return (SHELL_DEVICE_ERROR);
}
- Status = gEfiShellProtocol->SetMap(DevPath, NewSName);
- FreePool(NewSName);
- if (EFI_ERROR(Status)) {
+
+ Status = gEfiShellProtocol->SetMap (DevPath, NewSName);
+ FreePool (NewSName);
+ if (EFI_ERROR (Status)) {
return (SHELL_DEVICE_ERROR);
}
+
return (SHELL_SUCCESS);
}
-STATIC CONST SHELL_PARAM_ITEM MapParamList[] = {
- {L"-d", TypeValue},
- {L"-r", TypeFlag},
- {L"-v", TypeFlag},
- {L"-c", TypeFlag},
- {L"-f", TypeFlag},
- {L"-u", TypeFlag},
- {L"-t", TypeValue},
- {L"-sfo", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM MapParamList[] = {
+ { L"-d", TypeValue },
+ { L"-r", TypeFlag },
+ { L"-v", TypeFlag },
+ { L"-c", TypeFlag },
+ { L"-f", TypeFlag },
+ { L"-u", TypeFlag },
+ { L"-t", TypeValue },
+ { L"-sfo", TypeValue },
+ { NULL, TypeMax }
+};
/**
The routine issues dummy read for every physical block device to cause
@@ -988,11 +1056,11 @@ ProbeForMediaChange ( VOID
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *Handles;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- UINTN Index;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *Handles;
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;
+ UINTN Index;
gBS->LocateHandleBuffer (
ByProtocol,
@@ -1008,7 +1076,7 @@ ProbeForMediaChange ( Status = gBS->HandleProtocol (
Handles[Index],
&gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo
+ (VOID **)&BlockIo
);
if (!EFI_ERROR (Status)) {
if (!BlockIo->Media->LogicalPartition) {
@@ -1057,227 +1125,235 @@ ShellCommandRunMap ( CONST CHAR16 *TypeString;
UINTN TempStringLength;
- ProblemParam = NULL;
- Mapping = NULL;
- SName = NULL;
- ShellStatus = SHELL_SUCCESS;
- MapAsHandle = NULL;
+ ProblemParam = NULL;
+ Mapping = NULL;
+ SName = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ MapAsHandle = NULL;
//
// 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 (MapParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"map", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"map", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- SfoMode = ShellCommandLineGetFlag(Package, L"-sfo");
- ConstMode = ShellCommandLineGetFlag(Package, L"-c");
- NormlMode = ShellCommandLineGetFlag(Package, L"-f");
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 3) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"map");
+ SfoMode = ShellCommandLineGetFlag (Package, L"-sfo");
+ ConstMode = ShellCommandLineGetFlag (Package, L"-c");
+ NormlMode = ShellCommandLineGetFlag (Package, L"-f");
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 3) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"map");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// Deleting a map name...
//
- if (ShellCommandLineGetFlag(Package, L"-d")) {
- if ( ShellCommandLineGetFlag(Package, L"-r")
- || ShellCommandLineGetFlag(Package, L"-v")
- || ConstMode
- || NormlMode
- || ShellCommandLineGetFlag(Package, L"-u")
- || ShellCommandLineGetFlag(Package, L"-t")
- ){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel2HiiHandle, L"map");
+ if (ShellCommandLineGetFlag (Package, L"-d")) {
+ if ( ShellCommandLineGetFlag (Package, L"-r")
+ || ShellCommandLineGetFlag (Package, L"-v")
+ || ConstMode
+ || NormlMode
+ || ShellCommandLineGetFlag (Package, L"-u")
+ || ShellCommandLineGetFlag (Package, L"-t")
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel2HiiHandle, L"map");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- SName = ShellCommandLineGetValue(Package, L"-d");
+ SName = ShellCommandLineGetValue (Package, L"-d");
if (SName != NULL) {
- Status = PerformMappingDelete(SName);
- if (EFI_ERROR(Status)) {
+ Status = PerformMappingDelete (SName);
+ if (EFI_ERROR (Status)) {
if (Status == EFI_ACCESS_DENIED) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle, L"map");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle, L"map");
ShellStatus = SHELL_ACCESS_DENIED;
} else if (Status == EFI_NOT_FOUND) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, L"map", SName);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, L"map", SName);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status);
ShellStatus = SHELL_UNSUPPORTED;
}
}
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"map");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"map");
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
- } else if ( ShellCommandLineGetFlag(Package, L"-r")
-// || ShellCommandLineGetFlag(Package, L"-v")
- || ConstMode
- || NormlMode
- || ShellCommandLineGetFlag(Package, L"-u")
- || ShellCommandLineGetFlag(Package, L"-t")
- ){
+ } else if ( ShellCommandLineGetFlag (Package, L"-r")
+ // || ShellCommandLineGetFlag(Package, L"-v")
+ || ConstMode
+ || NormlMode
+ || ShellCommandLineGetFlag (Package, L"-u")
+ || ShellCommandLineGetFlag (Package, L"-t")
+ )
+ {
ProbeForMediaChange ();
- if ( ShellCommandLineGetFlag(Package, L"-r")) {
+ if ( ShellCommandLineGetFlag (Package, L"-r")) {
//
// Do the reset
//
- Status = ShellCommandCreateInitialMappingsAndPaths();
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status);
+ Status = ShellCommandCreateInitialMappingsAndPaths ();
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status);
ShellStatus = SHELL_UNSUPPORTED;
}
}
- if ( ShellStatus == SHELL_SUCCESS && ShellCommandLineGetFlag(Package, L"-u")) {
+
+ if ((ShellStatus == SHELL_SUCCESS) && ShellCommandLineGetFlag (Package, L"-u")) {
//
// Do the Update
//
Status = ShellCommandUpdateMapping ();
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", Status);
ShellStatus = SHELL_UNSUPPORTED;
}
}
+
if (ShellStatus == SHELL_SUCCESS) {
- Param1 = ShellCommandLineGetRawValue(Package, 1);
- TypeString = ShellCommandLineGetValue(Package, L"-t");
- if (!ConstMode
- &&!NormlMode
- &&TypeString == NULL
- ) {
+ Param1 = ShellCommandLineGetRawValue (Package, 1);
+ TypeString = ShellCommandLineGetValue (Package, L"-t");
+ if ( !ConstMode
+ && !NormlMode
+ && (TypeString == NULL)
+ )
+ {
//
// now do the display...
//
- ShellStatus = PerformMappingDisplay(
- ShellCommandLineGetFlag(Package, L"-v"),
- TRUE,
- TRUE,
- NULL,
- SfoMode,
- Param1,
- TRUE
- );
+ ShellStatus = PerformMappingDisplay (
+ ShellCommandLineGetFlag (Package, L"-v"),
+ TRUE,
+ TRUE,
+ NULL,
+ SfoMode,
+ Param1,
+ TRUE
+ );
} else {
//
// now do the display...
//
- ShellStatus = PerformMappingDisplay2(
- ShellCommandLineGetFlag(Package, L"-v"),
- ConstMode,
- NormlMode,
- TypeString,
- SfoMode,
- Param1
- );
+ ShellStatus = PerformMappingDisplay2 (
+ ShellCommandLineGetFlag (Package, L"-v"),
+ ConstMode,
+ NormlMode,
+ TypeString,
+ SfoMode,
+ Param1
+ );
}
}
} else {
//
// adding or displaying (there were no flags)
//
- SName = ShellCommandLineGetRawValue(Package, 1);
- Mapping = ShellCommandLineGetRawValue(Package, 2);
- if ( SName == NULL
- && Mapping == NULL
- ){
+ SName = ShellCommandLineGetRawValue (Package, 1);
+ Mapping = ShellCommandLineGetRawValue (Package, 2);
+ if ( (SName == NULL)
+ && (Mapping == NULL)
+ )
+ {
//
// display only since no flags
//
- ShellStatus = PerformMappingDisplay(
- ShellCommandLineGetFlag(Package, L"-v"),
- TRUE,
- TRUE,
- NULL,
- SfoMode,
- NULL,
- TRUE
- );
- } else if ( SName == NULL
- || Mapping == NULL
- ){
- //
- // Display only the one specified
- //
- ShellStatus = PerformMappingDisplay(
- FALSE,
- FALSE,
- FALSE,
- NULL,
- SfoMode,
- SName, // note the variable here...
- TRUE
- );
+ ShellStatus = PerformMappingDisplay (
+ ShellCommandLineGetFlag (Package, L"-v"),
+ TRUE,
+ TRUE,
+ NULL,
+ SfoMode,
+ NULL,
+ TRUE
+ );
+ } else if ( (SName == NULL)
+ || (Mapping == NULL)
+ )
+ {
+ //
+ // Display only the one specified
+ //
+ ShellStatus = PerformMappingDisplay (
+ FALSE,
+ FALSE,
+ FALSE,
+ NULL,
+ SfoMode,
+ SName, // note the variable here...
+ TRUE
+ );
} else {
- if (ShellIsHexOrDecimalNumber(Mapping, TRUE, FALSE)) {
- MapAsHandle = ConvertHandleIndexToHandle(ShellStrToUintn(Mapping));
+ if (ShellIsHexOrDecimalNumber (Mapping, TRUE, FALSE)) {
+ MapAsHandle = ConvertHandleIndexToHandle (ShellStrToUintn (Mapping));
} else {
MapAsHandle = NULL;
}
- if (MapAsHandle == NULL && Mapping[StrLen(Mapping)-1] != L':') {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", Mapping);
+
+ if ((MapAsHandle == NULL) && (Mapping[StrLen (Mapping)-1] != L':')) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", Mapping);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- TempStringLength = StrLen(SName);
- if (!IsNumberLetterOnly(SName, TempStringLength-(SName[TempStringLength-1]==L':'?1:0))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", SName);
+ TempStringLength = StrLen (SName);
+ if (!IsNumberLetterOnly (SName, TempStringLength-((SName[TempStringLength-1] == L':') ? 1 : 0))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", SName);
ShellStatus = SHELL_INVALID_PARAMETER;
}
if (ShellStatus == SHELL_SUCCESS) {
if (MapAsHandle != NULL) {
- ShellStatus = AddMappingFromHandle(MapAsHandle, SName);
+ ShellStatus = AddMappingFromHandle (MapAsHandle, SName);
} else {
- ShellStatus = AddMappingFromMapping(Mapping, SName);
+ ShellStatus = AddMappingFromMapping (Mapping, SName);
}
if (ShellStatus != SHELL_SUCCESS) {
switch (ShellStatus) {
case SHELL_ACCESS_DENIED:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle, L"map");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle, L"map");
break;
case SHELL_INVALID_PARAMETER:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", Mapping);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", Mapping);
break;
case SHELL_DEVICE_ERROR:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_NOF), gShellLevel2HiiHandle, L"map", Mapping);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MAP_NOF), gShellLevel2HiiHandle, L"map", Mapping);
break;
default:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", ShellStatus|MAX_BIT);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"map", ShellStatus|MAX_BIT);
}
} else {
//
// now do the display...
//
- ShellStatus = PerformMappingDisplay(
- FALSE,
- FALSE,
- FALSE,
- NULL,
- SfoMode,
- SName,
- TRUE
- );
+ ShellStatus = PerformMappingDisplay (
+ FALSE,
+ FALSE,
+ FALSE,
+ NULL,
+ SfoMode,
+ SName,
+ TRUE
+ );
} // we were sucessful so do an output
}
} // got a valid map target
@@ -1293,4 +1369,3 @@ ShellCommandRunMap ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/MkDir.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/MkDir.c index e3d7aaa1ac..bdc6a0d08d 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/MkDir.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/MkDir.c @@ -22,129 +22,139 @@ ShellCommandRunMkDir ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- CONST CHAR16 *NewDirName;
- CHAR16 *NewDirNameCopy;
- CHAR16 *SplitName;
- CHAR16 SaveSplitChar;
- UINTN DirCreateCount;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_FILE_HANDLE FileHandle;
- SHELL_STATUS ShellStatus;
-
- ShellStatus = SHELL_SUCCESS;
- NewDirNameCopy = NULL;
- SplitName = NULL;
- SaveSplitChar = CHAR_NULL;
+ EFI_STATUS Status;
+ CONST CHAR16 *NewDirName;
+ CHAR16 *NewDirNameCopy;
+ CHAR16 *SplitName;
+ CHAR16 SaveSplitChar;
+ UINTN DirCreateCount;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_FILE_HANDLE FileHandle;
+ SHELL_STATUS ShellStatus;
+
+ ShellStatus = SHELL_SUCCESS;
+ NewDirNameCopy = NULL;
+ SplitName = NULL;
+ SaveSplitChar = CHAR_NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ 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), gShellLevel2HiiHandle, L"mkdir", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mkdir", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
//
// create a set of directories
//
- if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
+ if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
//
// we didnt get a single parameter
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"mkdir");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"mkdir");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
for ( DirCreateCount = 1
- ;
- ; DirCreateCount++
- ){
+ ;
+ ; DirCreateCount++
+ )
+ {
//
// loop through each directory specified
//
- NewDirName = ShellCommandLineGetRawValue(Package, DirCreateCount);
+ NewDirName = ShellCommandLineGetRawValue (Package, DirCreateCount);
if (NewDirName == NULL) {
break;
}
+
//
// check if that already exists... if yes fail
//
FileHandle = NULL;
- Status = ShellOpenFileByName(NewDirName,
- &FileHandle,
- EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE,
- EFI_FILE_DIRECTORY
- );
- if (!EFI_ERROR(Status)) {
- ShellCloseFile(&FileHandle);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MKDIR_ALREADY), gShellLevel2HiiHandle, NewDirName);
+ Status = ShellOpenFileByName (
+ NewDirName,
+ &FileHandle,
+ EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE,
+ EFI_FILE_DIRECTORY
+ );
+ if (!EFI_ERROR (Status)) {
+ ShellCloseFile (&FileHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MKDIR_ALREADY), gShellLevel2HiiHandle, NewDirName);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FileHandle == NULL);
+ ASSERT (FileHandle == NULL);
//
// create the nested directory from parent to child.
// if NewDirName = test1\test2\test3, first create "test1\" directory, then "test1\test2\", finally "test1\test2\test3".
//
- NewDirNameCopy = AllocateCopyPool (StrSize(NewDirName), NewDirName);
+ NewDirNameCopy = AllocateCopyPool (StrSize (NewDirName), NewDirName);
NewDirNameCopy = PathCleanUpDirectories (NewDirNameCopy);
- if(NewDirNameCopy == NULL) {
+ if (NewDirNameCopy == NULL) {
ShellStatus = SHELL_OUT_OF_RESOURCES;
break;
}
+
SplitName = NewDirNameCopy;
while (SplitName != NULL) {
SplitName = StrStr (SplitName + 1, L"\\");
if (SplitName != NULL) {
- SaveSplitChar = *(SplitName + 1);
+ SaveSplitChar = *(SplitName + 1);
*(SplitName + 1) = '\0';
}
+
//
// check if current nested directory already exists... continue to create the child directory.
//
- Status = ShellOpenFileByName (NewDirNameCopy,
- &FileHandle,
- EFI_FILE_MODE_READ,
- EFI_FILE_DIRECTORY
- );
- if (!EFI_ERROR(Status)) {
+ Status = ShellOpenFileByName (
+ NewDirNameCopy,
+ &FileHandle,
+ EFI_FILE_MODE_READ,
+ EFI_FILE_DIRECTORY
+ );
+ if (!EFI_ERROR (Status)) {
ShellCloseFile (&FileHandle);
} else {
Status = ShellCreateDirectory (NewDirNameCopy, &FileHandle);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
break;
}
+
if (FileHandle != NULL) {
gEfiShellProtocol->CloseFile (FileHandle);
}
}
+
if (SplitName != NULL) {
*(SplitName + 1) = SaveSplitChar;
}
}
- if (EFI_ERROR(Status)) {
+
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MKDIR_CREATEFAIL), gShellLevel2HiiHandle, NewDirName);
ShellStatus = SHELL_ACCESS_DENIED;
break;
}
+
SHELL_FREE_NON_NULL (NewDirNameCopy);
}
}
@@ -158,4 +168,3 @@ ShellCommandRunMkDir ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c index f50c1e4c20..58cdeca7cb 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c @@ -20,34 +20,37 @@ @retval FALSE The move is within a file system.
**/
BOOLEAN
-IsBetweenFileSystem(
- IN CONST CHAR16 *FullName,
- IN CONST CHAR16 *Cwd,
- IN CONST CHAR16 *DestPath
+IsBetweenFileSystem (
+ IN CONST CHAR16 *FullName,
+ IN CONST CHAR16 *Cwd,
+ IN CONST CHAR16 *DestPath
)
{
CHAR16 *Test;
CHAR16 *Test1;
UINTN Result;
- Test = StrStr(FullName, L":");
- if (Test == NULL && Cwd != NULL) {
- Test = StrStr(Cwd, L":");
+ Test = StrStr (FullName, L":");
+ if ((Test == NULL) && (Cwd != NULL)) {
+ Test = StrStr (Cwd, L":");
}
- Test1 = StrStr(DestPath, L":");
- if (Test1 == NULL && Cwd != NULL) {
- Test1 = StrStr(Cwd, L":");
+
+ Test1 = StrStr (DestPath, L":");
+ if ((Test1 == NULL) && (Cwd != NULL)) {
+ Test1 = StrStr (Cwd, L":");
}
- if (Test1 != NULL && Test != NULL) {
- *Test = CHAR_NULL;
+
+ if ((Test1 != NULL) && (Test != NULL)) {
+ *Test = CHAR_NULL;
*Test1 = CHAR_NULL;
- Result = StringNoCaseCompare(&FullName, &DestPath);
- *Test = L':';
+ Result = StringNoCaseCompare (&FullName, &DestPath);
+ *Test = L':';
*Test1 = L':';
if (Result != 0) {
return (TRUE);
}
}
+
return (FALSE);
}
@@ -67,14 +70,14 @@ IsBetweenFileSystem( @retval FALSE The source path is invalid.
**/
BOOLEAN
-IsSoucePathValid(
- IN CONST CHAR16* SrcPath,
- IN CONST CHAR16* CwdPath
+IsSoucePathValid (
+ IN CONST CHAR16 *SrcPath,
+ IN CONST CHAR16 *CwdPath
)
{
- CHAR16* SrcPathBuffer;
- CHAR16* CwdPathBuffer;
- BOOLEAN Ret;
+ CHAR16 *SrcPathBuffer;
+ CHAR16 *CwdPathBuffer;
+ BOOLEAN Ret;
ASSERT (CwdPath != NULL);
if (SrcPath == NULL) {
@@ -90,14 +93,14 @@ IsSoucePathValid( CwdPathBuffer = AllocateCopyPool (StrSize (CwdPath), CwdPath);
if (CwdPathBuffer == NULL) {
- FreePool(SrcPathBuffer);
+ FreePool (SrcPathBuffer);
return FALSE;
}
gUnicodeCollation->StrUpr (gUnicodeCollation, SrcPathBuffer);
gUnicodeCollation->StrUpr (gUnicodeCollation, CwdPathBuffer);
- if (SrcPathBuffer[StrLen (SrcPathBuffer) -1 ] == L'\\') {
+ if (SrcPathBuffer[StrLen (SrcPathBuffer) -1] == L'\\') {
SrcPathBuffer[StrLen (SrcPathBuffer) - 1] = CHAR_NULL;
}
@@ -105,10 +108,11 @@ IsSoucePathValid( CwdPathBuffer[StrLen (CwdPathBuffer) - 1] = CHAR_NULL;
}
- if (StrCmp (CwdPathBuffer, SrcPathBuffer) == 0 ||
+ if ((StrCmp (CwdPathBuffer, SrcPathBuffer) == 0) ||
((StrStr (CwdPathBuffer, SrcPathBuffer) == CwdPathBuffer) &&
(CwdPathBuffer[StrLen (SrcPathBuffer)] == L'\\'))
- ) {
+ )
+ {
Ret = FALSE;
}
@@ -139,13 +143,13 @@ IsSoucePathValid( @retval FALSE The move is not
**/
BOOLEAN
-IsValidMove(
- IN CONST CHAR16 *SourcePath,
- IN CONST CHAR16 *Cwd,
- IN CONST CHAR16 *DestPath,
- IN CONST UINT64 Attribute,
- IN CONST UINT64 DestAttr,
- IN CONST EFI_STATUS FileStatus
+IsValidMove (
+ IN CONST CHAR16 *SourcePath,
+ IN CONST CHAR16 *Cwd,
+ IN CONST CHAR16 *DestPath,
+ IN CONST UINT64 Attribute,
+ IN CONST UINT64 DestAttr,
+ IN CONST EFI_STATUS FileStatus
)
{
CHAR16 *DestPathCopy;
@@ -156,7 +160,7 @@ IsValidMove( //
// Invalid move
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_MV_INV_CWD), gShellLevel2HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MV_INV_CWD), gShellLevel2HiiHandle);
return FALSE;
}
}
@@ -164,41 +168,45 @@ IsValidMove( //
// invalid to move read only or move to a read only destination
//
- if (((Attribute & EFI_FILE_READ_ONLY) != 0)
- || (FileStatus == EFI_WRITE_PROTECTED)
- || ((DestAttr & EFI_FILE_READ_ONLY) != 0)
- ) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_RO), gShellLevel2HiiHandle, SourcePath);
+ if ( ((Attribute & EFI_FILE_READ_ONLY) != 0)
+ || (FileStatus == EFI_WRITE_PROTECTED)
+ || ((DestAttr & EFI_FILE_READ_ONLY) != 0)
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MV_INV_RO), gShellLevel2HiiHandle, SourcePath);
return (FALSE);
}
- DestPathCopy = AllocateCopyPool(StrSize(DestPath), DestPath);
+ DestPathCopy = AllocateCopyPool (StrSize (DestPath), DestPath);
if (DestPathCopy == NULL) {
return (FALSE);
}
- for (DestPathWalker = DestPathCopy; *DestPathWalker == L'\\'; DestPathWalker++) ;
+ for (DestPathWalker = DestPathCopy; *DestPathWalker == L'\\'; DestPathWalker++) {
+ }
- while(DestPathWalker != NULL && DestPathWalker[StrLen(DestPathWalker)-1] == L'\\') {
- DestPathWalker[StrLen(DestPathWalker)-1] = CHAR_NULL;
+ while (DestPathWalker != NULL && DestPathWalker[StrLen (DestPathWalker)-1] == L'\\') {
+ DestPathWalker[StrLen (DestPathWalker)-1] = CHAR_NULL;
}
- ASSERT(DestPathWalker != NULL);
- ASSERT(SourcePath != NULL);
+ ASSERT (DestPathWalker != NULL);
+ ASSERT (SourcePath != NULL);
//
// If they're the same, or if source is "above" dest on file path tree
//
- if ( StringNoCaseCompare (&DestPathWalker, &SourcePath) == 0 ||
- ((StrStr(DestPathWalker, SourcePath) == DestPathWalker) &&
- (DestPathWalker[StrLen(SourcePath)] == '\\')
- )
- ) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_SUB), gShellLevel2HiiHandle);
- FreePool(DestPathCopy);
+ if ((StringNoCaseCompare (&DestPathWalker, &SourcePath) == 0) ||
+ ((StrStr (DestPathWalker, SourcePath) == DestPathWalker) &&
+ (DestPathWalker[StrLen (SourcePath)] == '\\')
+ )
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MV_INV_SUB), gShellLevel2HiiHandle);
+ FreePool (DestPathCopy);
return (FALSE);
}
- FreePool(DestPathCopy);
+
+ FreePool (DestPathCopy);
return (TRUE);
}
@@ -222,116 +230,124 @@ IsValidMove( @retval SHELL_SUCCESS The operation was sucessful.
**/
SHELL_STATUS
-GetDestinationLocation(
- IN CONST CHAR16 *DestParameter,
- IN OUT CHAR16 **DestPathPointer,
- IN CONST CHAR16 *Cwd,
- IN CONST BOOLEAN SingleSource,
- IN OUT UINT64 *DestAttr
+GetDestinationLocation (
+ IN CONST CHAR16 *DestParameter,
+ IN OUT CHAR16 **DestPathPointer,
+ IN CONST CHAR16 *Cwd,
+ IN CONST BOOLEAN SingleSource,
+ IN OUT UINT64 *DestAttr
)
{
- EFI_SHELL_FILE_INFO *DestList;
- EFI_SHELL_FILE_INFO *Node;
- CHAR16 *DestPath;
- UINTN NewSize;
- UINTN CurrentSize;
+ EFI_SHELL_FILE_INFO *DestList;
+ EFI_SHELL_FILE_INFO *Node;
+ CHAR16 *DestPath;
+ UINTN NewSize;
+ UINTN CurrentSize;
DestList = NULL;
DestPath = NULL;
- ASSERT(DestAttr != NULL);
+ ASSERT (DestAttr != NULL);
- if (StrStr(DestParameter, L"\\") == DestParameter) {
+ if (StrStr (DestParameter, L"\\") == DestParameter) {
if (Cwd == NULL) {
return SHELL_INVALID_PARAMETER;
}
- DestPath = AllocateZeroPool(StrSize(Cwd));
+
+ DestPath = AllocateZeroPool (StrSize (Cwd));
if (DestPath == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- StrCpyS(DestPath, StrSize(Cwd) / sizeof(CHAR16), Cwd);
- while (PathRemoveLastItem(DestPath)) ;
+
+ StrCpyS (DestPath, StrSize (Cwd) / sizeof (CHAR16), Cwd);
+ while (PathRemoveLastItem (DestPath)) {
+ }
//
// Append DestParameter beyond '\' which may be present
//
- CurrentSize = StrSize(DestPath);
- StrnCatGrow(&DestPath, &CurrentSize, &DestParameter[1], 0);
+ CurrentSize = StrSize (DestPath);
+ StrnCatGrow (&DestPath, &CurrentSize, &DestParameter[1], 0);
*DestPathPointer = DestPath;
return (SHELL_SUCCESS);
}
+
//
// get the destination path
//
- ShellOpenFileMetaArg((CHAR16*)DestParameter, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, &DestList);
- if (DestList == NULL || IsListEmpty(&DestList->Link)) {
+ ShellOpenFileMetaArg ((CHAR16 *)DestParameter, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, &DestList);
+ if ((DestList == NULL) || IsListEmpty (&DestList->Link)) {
//
// Not existing... must be renaming
//
- if (StrStr(DestParameter, L":") == NULL) {
+ if (StrStr (DestParameter, L":") == NULL) {
if (Cwd == NULL) {
- ShellCloseFileMetaArg(&DestList);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle);
+ ShellCloseFileMetaArg (&DestList);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle);
return (SHELL_INVALID_PARAMETER);
}
- NewSize = StrSize(Cwd);
- NewSize += StrSize(DestParameter);
- DestPath = AllocateZeroPool(NewSize);
+
+ NewSize = StrSize (Cwd);
+ NewSize += StrSize (DestParameter);
+ DestPath = AllocateZeroPool (NewSize);
if (DestPath == NULL) {
- ShellCloseFileMetaArg(&DestList);
+ ShellCloseFileMetaArg (&DestList);
return (SHELL_OUT_OF_RESOURCES);
}
- StrCpyS(DestPath, NewSize / sizeof(CHAR16), Cwd);
- if (DestPath[StrLen(DestPath)-1] != L'\\' && DestParameter[0] != L'\\') {
- StrCatS(DestPath, NewSize / sizeof(CHAR16), L"\\");
- } else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestParameter[0] == L'\\') {
- ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;
+
+ StrCpyS (DestPath, NewSize / sizeof (CHAR16), Cwd);
+ if ((DestPath[StrLen (DestPath)-1] != L'\\') && (DestParameter[0] != L'\\')) {
+ StrCatS (DestPath, NewSize / sizeof (CHAR16), L"\\");
+ } else if ((DestPath[StrLen (DestPath)-1] == L'\\') && (DestParameter[0] == L'\\')) {
+ ((CHAR16 *)DestPath)[StrLen (DestPath)-1] = CHAR_NULL;
}
- StrCatS(DestPath, NewSize / sizeof(CHAR16), DestParameter);
+
+ StrCatS (DestPath, NewSize / sizeof (CHAR16), DestParameter);
} else {
- ASSERT(DestPath == NULL);
- DestPath = StrnCatGrow(&DestPath, NULL, DestParameter, 0);
+ ASSERT (DestPath == NULL);
+ DestPath = StrnCatGrow (&DestPath, NULL, DestParameter, 0);
if (DestPath == NULL) {
- ShellCloseFileMetaArg(&DestList);
+ ShellCloseFileMetaArg (&DestList);
return (SHELL_OUT_OF_RESOURCES);
}
}
} else {
- Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&DestList->Link);
+ Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&DestList->Link);
*DestAttr = Node->Info->Attribute;
//
// Make sure there is only 1 node in the list.
//
- if (!IsNodeAtEnd(&DestList->Link, &Node->Link)) {
- ShellCloseFileMetaArg(&DestList);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, L"mv", DestParameter);
+ if (!IsNodeAtEnd (&DestList->Link, &Node->Link)) {
+ ShellCloseFileMetaArg (&DestList);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, L"mv", DestParameter);
return (SHELL_INVALID_PARAMETER);
}
//
// If we are a directory or a single file, then one node is fine.
//
- if (ShellIsDirectory(Node->FullName)==EFI_SUCCESS || SingleSource) {
- DestPath = AllocateZeroPool(StrSize(Node->FullName)+sizeof(CHAR16));
+ if ((ShellIsDirectory (Node->FullName) == EFI_SUCCESS) || SingleSource) {
+ DestPath = AllocateZeroPool (StrSize (Node->FullName)+sizeof (CHAR16));
if (DestPath == NULL) {
- ShellCloseFileMetaArg(&DestList);
+ ShellCloseFileMetaArg (&DestList);
return (SHELL_OUT_OF_RESOURCES);
}
- StrCpyS(DestPath, (StrSize(Node->FullName)+sizeof(CHAR16)) / sizeof(CHAR16), Node->FullName);
- StrCatS(DestPath, (StrSize(Node->FullName)+sizeof(CHAR16)) / sizeof(CHAR16), L"\\");
+
+ StrCpyS (DestPath, (StrSize (Node->FullName)+sizeof (CHAR16)) / sizeof (CHAR16), Node->FullName);
+ StrCatS (DestPath, (StrSize (Node->FullName)+sizeof (CHAR16)) / sizeof (CHAR16), L"\\");
} else {
//
// cant move multiple files onto a single file.
//
- ShellCloseFileMetaArg(&DestList);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_ERROR), gShellLevel2HiiHandle, L"mv", DestParameter);
+ ShellCloseFileMetaArg (&DestList);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_ERROR), gShellLevel2HiiHandle, L"mv", DestParameter);
return (SHELL_INVALID_PARAMETER);
}
}
*DestPathPointer = DestPath;
- ShellCloseFileMetaArg(&DestList);
+ ShellCloseFileMetaArg (&DestList);
return (SHELL_SUCCESS);
}
@@ -346,13 +362,13 @@ GetDestinationLocation( @retval SHELL_SUCCESS The source file was moved to the destination.
**/
EFI_STATUS
-MoveBetweenFileSystems(
+MoveBetweenFileSystems (
IN EFI_SHELL_FILE_INFO *Node,
IN CONST CHAR16 *DestPath,
OUT VOID **Resp
)
{
- SHELL_STATUS ShellStatus;
+ SHELL_STATUS ShellStatus;
//
// First we copy the file
@@ -366,7 +382,7 @@ MoveBetweenFileSystems( //
// The copy was successful. delete the source file.
//
- CascadeDelete(Node, TRUE);
+ CascadeDelete (Node, TRUE);
Node->Handle = NULL;
} else if (ShellStatus == SHELL_ABORTED) {
return EFI_ABORTED;
@@ -393,29 +409,31 @@ MoveBetweenFileSystems( @retval SHELL_OUT_OF_RESOURCES a memory allocation failed
**/
EFI_STATUS
-CreateFullDestPath(
- IN CONST CHAR16 **DestPath,
- OUT CHAR16 **FullDestPath,
- IN CONST CHAR16 *FileName
+CreateFullDestPath (
+ IN CONST CHAR16 **DestPath,
+ OUT CHAR16 **FullDestPath,
+ IN CONST CHAR16 *FileName
)
{
- UINTN Size;
- if (FullDestPath == NULL || FileName == NULL || DestPath == NULL || *DestPath == NULL){
+ UINTN Size;
+
+ if ((FullDestPath == NULL) || (FileName == NULL) || (DestPath == NULL) || (*DestPath == NULL)) {
return (EFI_INVALID_PARAMETER);
}
- Size = StrSize(*DestPath) + StrSize(FileName);
+ Size = StrSize (*DestPath) + StrSize (FileName);
- *FullDestPath = AllocateZeroPool(Size);
- if (*FullDestPath == NULL){
+ *FullDestPath = AllocateZeroPool (Size);
+ if (*FullDestPath == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- StrCpyS(*FullDestPath, Size / sizeof(CHAR16), *DestPath);
- if ((*FullDestPath)[StrLen(*FullDestPath)-1] != L'\\' && FileName[0] != L'\\') {
- StrCatS(*FullDestPath, Size / sizeof(CHAR16), L"\\");
+ StrCpyS (*FullDestPath, Size / sizeof (CHAR16), *DestPath);
+ if (((*FullDestPath)[StrLen (*FullDestPath)-1] != L'\\') && (FileName[0] != L'\\')) {
+ StrCatS (*FullDestPath, Size / sizeof (CHAR16), L"\\");
}
- StrCatS(*FullDestPath, Size / sizeof(CHAR16), FileName);
+
+ StrCatS (*FullDestPath, Size / sizeof (CHAR16), FileName);
return (EFI_SUCCESS);
}
@@ -431,46 +449,48 @@ CreateFullDestPath( @retval SHELL_OUT_OF_RESOURCES A memory allocation failed.
**/
EFI_STATUS
-MoveWithinFileSystems(
+MoveWithinFileSystems (
IN EFI_SHELL_FILE_INFO *Node,
IN CHAR16 *DestPath,
OUT VOID **Resp
)
{
- EFI_FILE_INFO *NewFileInfo;
- CHAR16 *TempLocation;
- UINTN NewSize;
- UINTN Length;
- EFI_STATUS Status;
+ EFI_FILE_INFO *NewFileInfo;
+ CHAR16 *TempLocation;
+ UINTN NewSize;
+ UINTN Length;
+ EFI_STATUS Status;
//
// Chop off map info from DestPath
//
- if ((TempLocation = StrStr(DestPath, L":")) != NULL) {
- CopyMem(DestPath, TempLocation+1, StrSize(TempLocation+1));
+ if ((TempLocation = StrStr (DestPath, L":")) != NULL) {
+ CopyMem (DestPath, TempLocation+1, StrSize (TempLocation+1));
}
//
// construct the new file info block
//
- NewSize = StrSize(DestPath);
- NewSize += StrSize(Node->FileName) + SIZE_OF_EFI_FILE_INFO + sizeof(CHAR16);
- NewFileInfo = AllocateZeroPool(NewSize);
+ NewSize = StrSize (DestPath);
+ NewSize += StrSize (Node->FileName) + SIZE_OF_EFI_FILE_INFO + sizeof (CHAR16);
+ NewFileInfo = AllocateZeroPool (NewSize);
if (NewFileInfo == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellLevel2HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellLevel2HiiHandle);
Status = EFI_OUT_OF_RESOURCES;
} else {
- CopyMem(NewFileInfo, Node->Info, SIZE_OF_EFI_FILE_INFO);
+ CopyMem (NewFileInfo, Node->Info, SIZE_OF_EFI_FILE_INFO);
if (DestPath[0] != L'\\') {
- StrCpyS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), L"\\");
- StrCatS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), DestPath);
+ StrCpyS (NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof (CHAR16), L"\\");
+ StrCatS (NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof (CHAR16), DestPath);
} else {
- StrCpyS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), DestPath);
+ StrCpyS (NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof (CHAR16), DestPath);
}
- Length = StrLen(NewFileInfo->FileName);
+
+ Length = StrLen (NewFileInfo->FileName);
if (Length > 0) {
Length--;
}
+
if (NewFileInfo->FileName[Length] == L'\\') {
if (Node->FileName[0] == L'\\') {
//
@@ -478,23 +498,26 @@ MoveWithinFileSystems( //
NewFileInfo->FileName[Length] = CHAR_NULL;
}
- StrCatS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), Node->FileName);
+
+ StrCatS (NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof (CHAR16), Node->FileName);
}
- NewFileInfo->Size = SIZE_OF_EFI_FILE_INFO + StrSize(NewFileInfo->FileName);
+
+ NewFileInfo->Size = SIZE_OF_EFI_FILE_INFO + StrSize (NewFileInfo->FileName);
//
// Perform the move operation
//
- Status = ShellSetFileInfo(Node->Handle, NewFileInfo);
+ Status = ShellSetFileInfo (Node->Handle, NewFileInfo);
//
// Free the info object we used...
//
- FreePool(NewFileInfo);
+ FreePool (NewFileInfo);
}
return (Status);
}
+
/**
function to take a list of files to move and a destination location and do
the verification and moving of those files to that location. This function
@@ -511,49 +534,49 @@ MoveWithinFileSystems( @retval SHELL_OUT_OF_RESOURCES a memory allocation failed
**/
SHELL_STATUS
-ValidateAndMoveFiles(
- IN EFI_SHELL_FILE_INFO *FileList,
- OUT VOID **Resp,
- IN CONST CHAR16 *DestParameter
+ValidateAndMoveFiles (
+ IN EFI_SHELL_FILE_INFO *FileList,
+ OUT VOID **Resp,
+ IN CONST CHAR16 *DestParameter
)
{
- EFI_STATUS Status;
- CHAR16 *HiiOutput;
- CHAR16 *HiiResultOk;
- CHAR16 *DestPath;
- CHAR16 *FullDestPath;
- CONST CHAR16 *Cwd;
- CHAR16 *FullCwd;
- SHELL_STATUS ShellStatus;
- EFI_SHELL_FILE_INFO *Node;
- VOID *Response;
- UINT64 Attr;
- CHAR16 *CleanFilePathStr;
-
- ASSERT(FileList != NULL);
- ASSERT(DestParameter != NULL);
-
- DestPath = NULL;
- FullDestPath = NULL;
- Cwd = ShellGetCurrentDir(NULL);
- Response = *Resp;
- Attr = 0;
- CleanFilePathStr = NULL;
- FullCwd = NULL;
+ EFI_STATUS Status;
+ CHAR16 *HiiOutput;
+ CHAR16 *HiiResultOk;
+ CHAR16 *DestPath;
+ CHAR16 *FullDestPath;
+ CONST CHAR16 *Cwd;
+ CHAR16 *FullCwd;
+ SHELL_STATUS ShellStatus;
+ EFI_SHELL_FILE_INFO *Node;
+ VOID *Response;
+ UINT64 Attr;
+ CHAR16 *CleanFilePathStr;
+
+ ASSERT (FileList != NULL);
+ ASSERT (DestParameter != NULL);
+
+ DestPath = NULL;
+ FullDestPath = NULL;
+ Cwd = ShellGetCurrentDir (NULL);
+ Response = *Resp;
+ Attr = 0;
+ CleanFilePathStr = NULL;
+ FullCwd = NULL;
if (Cwd != NULL) {
- FullCwd = AllocateZeroPool(StrSize(Cwd) + sizeof(CHAR16));
+ FullCwd = AllocateZeroPool (StrSize (Cwd) + sizeof (CHAR16));
if (FullCwd == NULL) {
return SHELL_OUT_OF_RESOURCES;
} else {
- StrCpyS(FullCwd, StrSize(Cwd)/sizeof(CHAR16)+1, Cwd);
- StrCatS(FullCwd, StrSize(Cwd)/sizeof(CHAR16)+1, L"\\");
+ StrCpyS (FullCwd, StrSize (Cwd)/sizeof (CHAR16)+1, Cwd);
+ StrCatS (FullCwd, StrSize (Cwd)/sizeof (CHAR16)+1, L"\\");
}
}
Status = ShellLevel2StripQuotes (DestParameter, &CleanFilePathStr);
if (EFI_ERROR (Status)) {
- SHELL_FREE_NON_NULL(FullCwd);
+ SHELL_FREE_NON_NULL (FullCwd);
if (Status == EFI_OUT_OF_RESOURCES) {
return SHELL_OUT_OF_RESOURCES;
} else {
@@ -566,14 +589,15 @@ ValidateAndMoveFiles( //
// Get and validate the destination location
//
- ShellStatus = GetDestinationLocation(CleanFilePathStr, &DestPath, FullCwd, (BOOLEAN)(FileList->Link.ForwardLink == FileList->Link.BackLink), &Attr);
+ ShellStatus = GetDestinationLocation (CleanFilePathStr, &DestPath, FullCwd, (BOOLEAN)(FileList->Link.ForwardLink == FileList->Link.BackLink), &Attr);
FreePool (CleanFilePathStr);
if (ShellStatus != SHELL_SUCCESS) {
SHELL_FREE_NON_NULL (FullCwd);
return (ShellStatus);
}
- DestPath = PathCleanUpDirectories(DestPath);
+
+ DestPath = PathCleanUpDirectories (DestPath);
if (DestPath == NULL) {
FreePool (FullCwd);
return (SHELL_OUT_OF_RESOURCES);
@@ -581,68 +605,71 @@ ValidateAndMoveFiles( HiiOutput = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_MV_OUTPUT), NULL);
HiiResultOk = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_GEN_RES_OK), NULL);
- if (HiiOutput == NULL || HiiResultOk == NULL) {
- SHELL_FREE_NON_NULL(DestPath);
- SHELL_FREE_NON_NULL(HiiOutput);
- SHELL_FREE_NON_NULL(HiiResultOk);
- SHELL_FREE_NON_NULL(FullCwd);
+ if ((HiiOutput == NULL) || (HiiResultOk == NULL)) {
+ SHELL_FREE_NON_NULL (DestPath);
+ SHELL_FREE_NON_NULL (HiiOutput);
+ SHELL_FREE_NON_NULL (HiiResultOk);
+ SHELL_FREE_NON_NULL (FullCwd);
return (SHELL_OUT_OF_RESOURCES);
}
//
// Go through the list of files and directories to move...
//
- for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link)
- ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link)
- ){
- if (ShellGetExecutionBreakFlag()) {
+ for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; !IsNull (&FileList->Link, &Node->Link)
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
+ )
+ {
+ if (ShellGetExecutionBreakFlag ()) {
break;
}
//
// These should never be NULL
//
- ASSERT(Node->FileName != NULL);
- ASSERT(Node->FullName != NULL);
- ASSERT(Node->Info != NULL);
+ ASSERT (Node->FileName != NULL);
+ ASSERT (Node->FullName != NULL);
+ ASSERT (Node->Info != NULL);
//
// skip the directory traversing stuff...
//
- if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) {
+ if ((StrCmp (Node->FileName, L".") == 0) || (StrCmp (Node->FileName, L"..") == 0)) {
continue;
}
- SHELL_FREE_NON_NULL(FullDestPath);
+ SHELL_FREE_NON_NULL (FullDestPath);
FullDestPath = NULL;
- if (ShellIsDirectory(DestPath)==EFI_SUCCESS) {
- CreateFullDestPath((CONST CHAR16 **)&DestPath, &FullDestPath, Node->FileName);
+ if (ShellIsDirectory (DestPath) == EFI_SUCCESS) {
+ CreateFullDestPath ((CONST CHAR16 **)&DestPath, &FullDestPath, Node->FileName);
}
//
// Validate that the move is valid
//
- if (!IsValidMove(Node->FullName, FullCwd, FullDestPath!=NULL? FullDestPath:DestPath, Node->Info->Attribute, Attr, Node->Status)) {
+ if (!IsValidMove (Node->FullName, FullCwd, (FullDestPath != NULL) ? FullDestPath : DestPath, Node->Info->Attribute, Attr, Node->Status)) {
ShellStatus = SHELL_INVALID_PARAMETER;
continue;
}
- ShellPrintEx(-1, -1, HiiOutput, Node->FullName, FullDestPath!=NULL? FullDestPath:DestPath);
+ ShellPrintEx (-1, -1, HiiOutput, Node->FullName, FullDestPath != NULL ? FullDestPath : DestPath);
//
// See if destination exists
//
- if (!EFI_ERROR(ShellFileExists(FullDestPath!=NULL? FullDestPath:DestPath))) {
+ if (!EFI_ERROR (ShellFileExists ((FullDestPath != NULL) ? FullDestPath : DestPath))) {
if (Response == NULL) {
- ShellPromptForResponseHii(ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response);
+ ShellPromptForResponseHii (ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response);
}
+
if (Response == NULL) {
return SHELL_ABORTED;
}
- switch (*(SHELL_PROMPT_RESPONSE*)Response) {
+
+ switch (*(SHELL_PROMPT_RESPONSE *)Response) {
case ShellPromptResponseNo:
- FreePool(Response);
+ FreePool (Response);
Response = NULL;
continue;
case ShellPromptResponseCancel:
@@ -650,42 +677,44 @@ ValidateAndMoveFiles( //
// indicate to stop everything
//
- SHELL_FREE_NON_NULL(FullCwd);
+ SHELL_FREE_NON_NULL (FullCwd);
return (SHELL_ABORTED);
case ShellPromptResponseAll:
*Resp = Response;
break;
case ShellPromptResponseYes:
- FreePool(Response);
+ FreePool (Response);
Response = NULL;
break;
default:
- FreePool(Response);
- SHELL_FREE_NON_NULL(FullCwd);
+ FreePool (Response);
+ SHELL_FREE_NON_NULL (FullCwd);
return SHELL_ABORTED;
}
- Status = ShellDeleteFileByName(FullDestPath!=NULL? FullDestPath:DestPath);
+
+ Status = ShellDeleteFileByName (FullDestPath != NULL ? FullDestPath : DestPath);
}
- if (IsBetweenFileSystem(Node->FullName, FullCwd, DestPath)) {
- while (FullDestPath == NULL && DestPath != NULL && DestPath[0] != CHAR_NULL && DestPath[StrLen(DestPath) - 1] == L'\\') {
- DestPath[StrLen(DestPath) - 1] = CHAR_NULL;
+ if (IsBetweenFileSystem (Node->FullName, FullCwd, DestPath)) {
+ while (FullDestPath == NULL && DestPath != NULL && DestPath[0] != CHAR_NULL && DestPath[StrLen (DestPath) - 1] == L'\\') {
+ DestPath[StrLen (DestPath) - 1] = CHAR_NULL;
}
- Status = MoveBetweenFileSystems(Node, FullDestPath!=NULL? FullDestPath:DestPath, &Response);
+
+ Status = MoveBetweenFileSystems (Node, FullDestPath != NULL ? FullDestPath : DestPath, &Response);
} else {
- Status = MoveWithinFileSystems(Node, DestPath, &Response);
+ Status = MoveWithinFileSystems (Node, DestPath, &Response);
//
// Display error status
//
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"mv", Status);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, L"mv", Status);
}
}
//
// Check our result
//
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_INVALID_PARAMETER;
if (Status == EFI_SECURITY_VIOLATION) {
ShellStatus = SHELL_SECURITY_VIOLATION;
@@ -699,16 +728,15 @@ ValidateAndMoveFiles( ShellStatus = SHELL_ACCESS_DENIED;
}
} else {
- ShellPrintEx(-1, -1, L"%s", HiiResultOk);
+ ShellPrintEx (-1, -1, L"%s", HiiResultOk);
}
-
} // main for loop
- SHELL_FREE_NON_NULL(FullDestPath);
- SHELL_FREE_NON_NULL(DestPath);
- SHELL_FREE_NON_NULL(HiiOutput);
- SHELL_FREE_NON_NULL(HiiResultOk);
- SHELL_FREE_NON_NULL(FullCwd);
+ SHELL_FREE_NON_NULL (FullDestPath);
+ SHELL_FREE_NON_NULL (DestPath);
+ SHELL_FREE_NON_NULL (HiiOutput);
+ SHELL_FREE_NON_NULL (HiiResultOk);
+ SHELL_FREE_NON_NULL (FullCwd);
return (ShellStatus);
}
@@ -725,76 +753,76 @@ ShellCommandRunMv ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- CHAR16 *Cwd;
- UINTN CwdSize;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- UINTN LoopCounter;
- EFI_SHELL_FILE_INFO *FileList;
- VOID *Response;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- ParamCount = 0;
- FileList = NULL;
- Response = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ CHAR16 *Cwd;
+ UINTN CwdSize;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamCount;
+ UINTN LoopCounter;
+ EFI_SHELL_FILE_INFO *FileList;
+ VOID *Response;
+
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ ParamCount = 0;
+ FileList = NULL;
+ Response = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ 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), gShellLevel2HiiHandle, L"mv", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mv", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
- switch (ParamCount = ShellCommandLineGetCount(Package)) {
+ switch (ParamCount = ShellCommandLineGetCount (Package)) {
case 0:
case 1:
//
// we have insufficient parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"mv");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"mv");
ShellStatus = SHELL_INVALID_PARAMETER;
break;
case 2:
//
// must have valid CWD for single parameter...
//
- if (ShellGetCurrentDir(NULL) == NULL){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"mv");
+ if (ShellGetCurrentDir (NULL) == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"mv");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, 1), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
- if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue(Package, 1));
+ Status = ShellOpenFileMetaArg ((CHAR16 *)ShellCommandLineGetRawValue (Package, 1), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
+ if ((FileList == NULL) || IsListEmpty (&FileList->Link) || EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue (Package, 1));
ShellStatus = SHELL_NOT_FOUND;
- } else {
+ } else {
//
// ValidateAndMoveFiles will report errors to the screen itself
//
- CwdSize = StrSize(ShellGetCurrentDir(NULL)) + sizeof(CHAR16);
- Cwd = AllocateZeroPool(CwdSize);
+ CwdSize = StrSize (ShellGetCurrentDir (NULL)) + sizeof (CHAR16);
+ Cwd = AllocateZeroPool (CwdSize);
if (Cwd == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"mv");
ShellStatus = SHELL_OUT_OF_RESOURCES;
@@ -809,39 +837,42 @@ ShellCommandRunMv ( break;
default:
- ///@todo make sure this works with error half way through and continues...
- for (ParamCount--, LoopCounter = 1 ; LoopCounter < ParamCount ; LoopCounter++) {
- if (ShellGetExecutionBreakFlag()) {
+ /// @todo make sure this works with error half way through and continues...
+ for (ParamCount--, LoopCounter = 1; LoopCounter < ParamCount; LoopCounter++) {
+ if (ShellGetExecutionBreakFlag ()) {
break;
}
- Status = ShellOpenFileMetaArg((CHAR16*)ShellCommandLineGetRawValue(Package, LoopCounter), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
- if (FileList == NULL || IsListEmpty(&FileList->Link) || EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue(Package, LoopCounter));
+
+ Status = ShellOpenFileMetaArg ((CHAR16 *)ShellCommandLineGetRawValue (Package, LoopCounter), EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
+ if ((FileList == NULL) || IsListEmpty (&FileList->Link) || EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue (Package, LoopCounter));
ShellStatus = SHELL_NOT_FOUND;
- } else {
+ } else {
//
// ValidateAndMoveFiles will report errors to the screen itself
// Only change ShellStatus if it's sucessful
//
if (ShellStatus == SHELL_SUCCESS) {
- ShellStatus = ValidateAndMoveFiles(FileList, &Response, ShellCommandLineGetRawValue(Package, ParamCount));
+ ShellStatus = ValidateAndMoveFiles (FileList, &Response, ShellCommandLineGetRawValue (Package, ParamCount));
} else {
- ValidateAndMoveFiles(FileList, &Response, ShellCommandLineGetRawValue(Package, ParamCount));
+ ValidateAndMoveFiles (FileList, &Response, ShellCommandLineGetRawValue (Package, ParamCount));
}
}
- if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
- Status = ShellCloseFileMetaArg(&FileList);
- if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) {
+
+ if ((FileList != NULL) && !IsListEmpty (&FileList->Link)) {
+ Status = ShellCloseFileMetaArg (&FileList);
+ if (EFI_ERROR (Status) && (ShellStatus == SHELL_SUCCESS)) {
ShellStatus = SHELL_ACCESS_DENIED;
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_FILE), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue(Package, 1), ShellStatus|MAX_BIT);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_FILE), gShellLevel2HiiHandle, L"mv", ShellCommandLineGetRawValue (Package, 1), ShellStatus|MAX_BIT);
}
}
}
+
break;
} // switch on parameter count
if (FileList != NULL) {
- ShellCloseFileMetaArg(&FileList);
+ ShellCloseFileMetaArg (&FileList);
}
//
@@ -850,9 +881,9 @@ ShellCommandRunMv ( ShellCommandLineFreeVarList (Package);
}
- SHELL_FREE_NON_NULL(Response);
+ SHELL_FREE_NON_NULL (Response);
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
return (SHELL_ABORTED);
}
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c index 47cb33252f..955e082a93 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c @@ -22,24 +22,25 @@ IsStdInDataAvailable ( VOID
)
{
- SHELL_FILE_HANDLE FileHandle;
- EFI_STATUS Status;
- CHAR16 CharBuffer;
- UINTN CharSize;
- UINT64 OriginalFilePosition;
+ SHELL_FILE_HANDLE FileHandle;
+ EFI_STATUS Status;
+ CHAR16 CharBuffer;
+ UINTN CharSize;
+ UINT64 OriginalFilePosition;
Status = EFI_SUCCESS;
FileHandle = NULL;
OriginalFilePosition = 0;
if (ShellOpenFileByName (L">i", &FileHandle, EFI_FILE_MODE_READ, 0) == EFI_SUCCESS) {
- CharSize = sizeof(CHAR16);
+ CharSize = sizeof (CHAR16);
gEfiShellProtocol->GetFilePosition (FileHandle, &OriginalFilePosition);
Status = gEfiShellProtocol->ReadFile (FileHandle, &CharSize, &CharBuffer);
- if (EFI_ERROR (Status) || (CharSize != sizeof(CHAR16))) {
+ if (EFI_ERROR (Status) || (CharSize != sizeof (CHAR16))) {
return FALSE;
}
- gEfiShellProtocol->SetFilePosition(FileHandle, OriginalFilePosition);
+
+ gEfiShellProtocol->SetFilePosition (FileHandle, OriginalFilePosition);
}
if (FileHandle == NULL) {
@@ -78,15 +79,17 @@ HandleStringWithEscapeCharForParse ( if (NewStr == NULL) {
return NULL;
}
+
ReturnStr = NewStr;
StrWalker = String;
while (*StrWalker != CHAR_NULL) {
- if (*StrWalker == L'^' && (*(StrWalker + 1) == L'^' || *(StrWalker + 1) == L'"')) {
+ if ((*StrWalker == L'^') && ((*(StrWalker + 1) == L'^') || (*(StrWalker + 1) == L'"'))) {
*NewStr = *(StrWalker + 1);
StrWalker++;
} else {
*NewStr = *StrWalker;
}
+
StrWalker++;
NewStr++;
}
@@ -94,7 +97,6 @@ HandleStringWithEscapeCharForParse ( return ReturnStr;
}
-
/**
Do the actual parsing of the file. the file should be SFO output from a
shell command or a similar format.
@@ -110,44 +112,44 @@ HandleStringWithEscapeCharForParse ( @retval SHELL_SUCCESS The operation was successful.
**/
SHELL_STATUS
-PerformParsing(
- IN CONST CHAR16 *FileName,
- IN CONST CHAR16 *TableName,
- IN CONST UINTN ColumnIndex,
- IN CONST UINTN TableNameInstance,
- IN CONST UINTN ShellCommandInstance,
- IN BOOLEAN StreamingUnicode
+PerformParsing (
+ IN CONST CHAR16 *FileName,
+ IN CONST CHAR16 *TableName,
+ IN CONST UINTN ColumnIndex,
+ IN CONST UINTN TableNameInstance,
+ IN CONST UINTN ShellCommandInstance,
+ IN BOOLEAN StreamingUnicode
)
{
- SHELL_FILE_HANDLE FileHandle;
- EFI_STATUS Status;
- BOOLEAN Ascii;
- UINTN LoopVariable;
- UINTN ColumnLoop;
- CHAR16 *TempLine;
- CHAR16 *ColumnPointer;
- SHELL_STATUS ShellStatus;
- CHAR16 *TempSpot;
- CHAR16 *SfoString;
-
- ASSERT(FileName != NULL);
- ASSERT(TableName != NULL);
-
- ShellStatus = SHELL_SUCCESS;
-
- Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"parse", FileName);
+ SHELL_FILE_HANDLE FileHandle;
+ EFI_STATUS Status;
+ BOOLEAN Ascii;
+ UINTN LoopVariable;
+ UINTN ColumnLoop;
+ CHAR16 *TempLine;
+ CHAR16 *ColumnPointer;
+ SHELL_STATUS ShellStatus;
+ CHAR16 *TempSpot;
+ CHAR16 *SfoString;
+
+ ASSERT (FileName != NULL);
+ ASSERT (TableName != NULL);
+
+ ShellStatus = SHELL_SUCCESS;
+
+ Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"parse", FileName);
ShellStatus = SHELL_NOT_FOUND;
} else if (!EFI_ERROR (FileHandleIsDirectory (FileHandle))) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_FILE), gShellLevel2HiiHandle, L"parse", FileName);
ShellStatus = SHELL_NOT_FOUND;
} else {
- for (LoopVariable = 0 ; LoopVariable < ShellCommandInstance && !ShellFileHandleEof(FileHandle);) {
- TempLine = ShellFileHandleReturnLine (FileHandle, &Ascii);
+ for (LoopVariable = 0; LoopVariable < ShellCommandInstance && !ShellFileHandleEof (FileHandle);) {
+ TempLine = ShellFileHandleReturnLine (FileHandle, &Ascii);
- if ((TempLine == NULL) || (*TempLine == CHAR_NULL && StreamingUnicode)) {
- break;
+ if ((TempLine == NULL) || ((*TempLine == CHAR_NULL) && StreamingUnicode)) {
+ break;
}
//
@@ -158,46 +160,56 @@ PerformParsing( if (StrStr (TempLine, L"ShellCommand,") == TempLine) {
LoopVariable++;
}
- SHELL_FREE_NON_NULL(TempLine);
+
+ SHELL_FREE_NON_NULL (TempLine);
}
+
if (LoopVariable == ShellCommandInstance) {
LoopVariable = 0;
- while(1) {
+ while (1) {
TempLine = ShellFileHandleReturnLine (FileHandle, &Ascii);
- if (TempLine == NULL
- || *TempLine == CHAR_NULL
- || StrStr (TempLine, L"ShellCommand,") == TempLine) {
- SHELL_FREE_NON_NULL(TempLine);
+ if ( (TempLine == NULL)
+ || (*TempLine == CHAR_NULL)
+ || (StrStr (TempLine, L"ShellCommand,") == TempLine))
+ {
+ SHELL_FREE_NON_NULL (TempLine);
break;
}
+
if (StrStr (TempLine, TableName) == TempLine) {
LoopVariable++;
- if (LoopVariable == TableNameInstance
- || (TableNameInstance == (UINTN)-1)) {
+ if ( (LoopVariable == TableNameInstance)
+ || (TableNameInstance == (UINTN)-1))
+ {
for (ColumnLoop = 1, ColumnPointer = TempLine; ColumnLoop < ColumnIndex && ColumnPointer != NULL && *ColumnPointer != CHAR_NULL; ColumnLoop++) {
ColumnPointer = StrStr (ColumnPointer, L",\"");
- if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL){
+ if ((ColumnPointer != NULL) && (*ColumnPointer != CHAR_NULL)) {
ColumnPointer++;
}
}
+
if (ColumnLoop == ColumnIndex) {
if (ColumnPointer == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"parse", L"Column Index");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"parse", L"Column Index");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
TempSpot = StrStr (ColumnPointer, L",\"");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
- while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' '){
+
+ while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' ') {
ColumnPointer++;
}
- if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L'\"'){
+
+ if ((ColumnPointer != NULL) && (*ColumnPointer != CHAR_NULL) && (ColumnPointer[0] == L'\"')) {
ColumnPointer++;
}
- if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[StrLen (ColumnPointer) - 1] == L'\"'){
+
+ if ((ColumnPointer != NULL) && (*ColumnPointer != CHAR_NULL) && (ColumnPointer[StrLen (ColumnPointer) - 1] == L'\"')) {
ColumnPointer[StrLen (ColumnPointer) - 1] = CHAR_NULL;
}
+
SfoString = HandleStringWithEscapeCharForParse (ColumnPointer);
if (SfoString != NULL) {
ShellPrintEx (-1, -1, L"%s\r\n", SfoString);
@@ -207,18 +219,20 @@ PerformParsing( }
}
}
- SHELL_FREE_NON_NULL(TempLine);
+
+ SHELL_FREE_NON_NULL (TempLine);
}
}
}
+
return (ShellStatus);
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-i", TypeValue},
- {L"-s", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-i", TypeValue },
+ { L"-s", TypeValue },
+ { NULL, TypeMax }
+};
/**
Function for 'parse' command.
@@ -233,16 +247,16 @@ ShellCommandRunParse ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- CONST CHAR16 *FileName;
- CONST CHAR16 *TableName;
- CONST CHAR16 *ColumnString;
- SHELL_STATUS ShellStatus;
- UINTN ShellCommandInstance;
- UINTN TableNameInstance;
- BOOLEAN StreamingUnicode;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ CONST CHAR16 *FileName;
+ CONST CHAR16 *TableName;
+ CONST CHAR16 *ColumnString;
+ SHELL_STATUS ShellStatus;
+ UINTN ShellCommandInstance;
+ UINTN TableNameInstance;
+ BOOLEAN StreamingUnicode;
ShellStatus = SHELL_SUCCESS;
ProblemParam = NULL;
@@ -251,53 +265,57 @@ ShellCommandRunParse ( //
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParseEx (ParamList, &Package, &ProblemParam, TRUE, FALSE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"parse", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"parse", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
StreamingUnicode = IsStdInDataAvailable ();
- if ((!StreamingUnicode && (ShellCommandLineGetCount(Package) < 4)) ||
- (ShellCommandLineGetCount(Package) < 3)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"parse");
+ if ((!StreamingUnicode && (ShellCommandLineGetCount (Package) < 4)) ||
+ (ShellCommandLineGetCount (Package) < 3))
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"parse");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if ((StreamingUnicode && (ShellCommandLineGetCount(Package) > 3)) ||
- (ShellCommandLineGetCount(Package) > 4)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"parse");
+ } else if ((StreamingUnicode && (ShellCommandLineGetCount (Package) > 3)) ||
+ (ShellCommandLineGetCount (Package) > 4))
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"parse");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (StreamingUnicode) {
- FileName = L">i";
- TableName = ShellCommandLineGetRawValue(Package, 1);
- ColumnString = ShellCommandLineGetRawValue(Package, 2);
+ FileName = L">i";
+ TableName = ShellCommandLineGetRawValue (Package, 1);
+ ColumnString = ShellCommandLineGetRawValue (Package, 2);
} else {
- FileName = ShellCommandLineGetRawValue(Package, 1);
- TableName = ShellCommandLineGetRawValue(Package, 2);
- ColumnString = ShellCommandLineGetRawValue(Package, 3);
+ FileName = ShellCommandLineGetRawValue (Package, 1);
+ TableName = ShellCommandLineGetRawValue (Package, 2);
+ ColumnString = ShellCommandLineGetRawValue (Package, 3);
}
- if (ShellCommandLineGetValue(Package, L"-i") == NULL) {
+
+ if (ShellCommandLineGetValue (Package, L"-i") == NULL) {
TableNameInstance = (UINTN)-1;
} else {
- TableNameInstance = ShellStrToUintn(ShellCommandLineGetValue(Package, L"-i"));
+ TableNameInstance = ShellStrToUintn (ShellCommandLineGetValue (Package, L"-i"));
}
- if (ShellCommandLineGetValue(Package, L"-s") == NULL) {
+
+ if (ShellCommandLineGetValue (Package, L"-s") == NULL) {
ShellCommandInstance = 1;
} else {
- ShellCommandInstance = ShellStrToUintn(ShellCommandLineGetValue(Package, L"-s"));
+ ShellCommandInstance = ShellStrToUintn (ShellCommandLineGetValue (Package, L"-s"));
}
- ShellStatus = PerformParsing(FileName, TableName, ShellStrToUintn(ColumnString), TableNameInstance, ShellCommandInstance, StreamingUnicode);
+ ShellStatus = PerformParsing (FileName, TableName, ShellStrToUintn (ColumnString), TableNameInstance, ShellCommandInstance, StreamingUnicode);
}
}
@@ -308,4 +326,3 @@ ShellCommandRunParse ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c index 8412af721e..57ba3c90f3 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c @@ -9,13 +9,13 @@ #include "UefiShellLevel2CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ResetParamList[] = {
- {L"-w", TypeValue},
- {L"-s", TypeValue},
- {L"-c", TypeValue},
- {L"-fwui", TypeFlag },
- {NULL, TypeMax }
- };
+STATIC CONST SHELL_PARAM_ITEM ResetParamList[] = {
+ { L"-w", TypeValue },
+ { L"-s", TypeValue },
+ { L"-c", TypeValue },
+ { L"-fwui", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'reset' command.
@@ -39,64 +39,72 @@ ShellCommandRunReset ( UINT32 Attr;
UINTN DataSize;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
ProblemParam = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParse (ResetParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"reset", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"reset", ProblemParam);
+ FreePool (ProblemParam);
return (SHELL_INVALID_PARAMETER);
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 1) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
-
if (ShellCommandLineGetFlag (Package, L"-fwui")) {
-
- DataSize = sizeof (OsIndications);
- Status = gRT->GetVariable (
- EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME, &gEfiGlobalVariableGuid,
- &Attr, &DataSize, &OsIndications
- );
+ DataSize = sizeof (OsIndications);
+ Status = gRT->GetVariable (
+ EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME,
+ &gEfiGlobalVariableGuid,
+ &Attr,
+ &DataSize,
+ &OsIndications
+ );
if (!EFI_ERROR (Status)) {
if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0) {
DataSize = sizeof (OsIndications);
- Status = gRT->GetVariable (
- EFI_OS_INDICATIONS_VARIABLE_NAME, &gEfiGlobalVariableGuid,
- &Attr, &DataSize, &OsIndications
- );
+ Status = gRT->GetVariable (
+ EFI_OS_INDICATIONS_VARIABLE_NAME,
+ &gEfiGlobalVariableGuid,
+ &Attr,
+ &DataSize,
+ &OsIndications
+ );
if (!EFI_ERROR (Status)) {
OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
} else {
OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
}
+
Status = gRT->SetVariable (
- EFI_OS_INDICATIONS_VARIABLE_NAME, &gEfiGlobalVariableGuid,
+ EFI_OS_INDICATIONS_VARIABLE_NAME,
+ &gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (OsIndications), &OsIndications
+ sizeof (OsIndications),
+ &OsIndications
);
}
}
+
if (EFI_ERROR (Status)) {
ShellStatus = SHELL_UNSUPPORTED;
goto Error;
@@ -106,40 +114,42 @@ ShellCommandRunReset ( //
// check for warm reset flag, then shutdown reset flag, then cold (default) reset flag
//
- if (ShellCommandLineGetFlag(Package, L"-w")) {
- if (ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-c")) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");
+ if (ShellCommandLineGetFlag (Package, L"-w")) {
+ if (ShellCommandLineGetFlag (Package, L"-s") || ShellCommandLineGetFlag (Package, L"-c")) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- String = ShellCommandLineGetValue(Package, L"-w");
+ String = ShellCommandLineGetValue (Package, L"-w");
if (String != NULL) {
- gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, StrSize(String), (VOID*)String);
+ gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, StrSize (String), (VOID *)String);
} else {
- gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
+ gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
}
}
- } else if (ShellCommandLineGetFlag(Package, L"-s")) {
- if (ShellCommandLineGetFlag(Package, L"-c")) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");
+ } else if (ShellCommandLineGetFlag (Package, L"-s")) {
+ if (ShellCommandLineGetFlag (Package, L"-c")) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"reset");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- String = ShellCommandLineGetValue(Package, L"-s");
- DEBUG_CODE(ShellPrintEx(-1,-1,L"Reset with %s (%d bytes)", String, String!=NULL?StrSize(String):0););
+ String = ShellCommandLineGetValue (Package, L"-s");
+ DEBUG_CODE (
+ ShellPrintEx (-1, -1, L"Reset with %s (%d bytes)", String, String != NULL ? StrSize (String) : 0);
+ );
if (String != NULL) {
- gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, StrSize(String), (VOID*)String);
+ gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, StrSize (String), (VOID *)String);
} else {
- gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
+ gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);
}
}
} else {
//
// this is default so dont worry about flag...
//
- String = ShellCommandLineGetValue(Package, L"-c");
+ String = ShellCommandLineGetValue (Package, L"-c");
if (String != NULL) {
- gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, StrSize(String), (VOID*)String);
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, StrSize (String), (VOID *)String);
} else {
- gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
}
}
}
@@ -161,4 +171,3 @@ Error: //
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c index bc85039588..2354cd0620 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c @@ -9,10 +9,10 @@ #include "UefiShellLevel2CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-q", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-q", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Determine if a directory has no files in it.
@@ -24,27 +24,30 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { **/
BOOLEAN
IsDirectoryEmpty (
- IN SHELL_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
)
{
- EFI_STATUS Status;
- EFI_FILE_INFO *FileInfo;
- BOOLEAN NoFile;
- BOOLEAN RetVal;
+ EFI_STATUS Status;
+ EFI_FILE_INFO *FileInfo;
+ BOOLEAN NoFile;
+ BOOLEAN RetVal;
- RetVal = TRUE;
- NoFile = FALSE;
+ RetVal = TRUE;
+ NoFile = FALSE;
FileInfo = NULL;
- for (Status = FileHandleFindFirstFile(FileHandle, &FileInfo)
- ; !NoFile && !EFI_ERROR (Status)
- ; FileHandleFindNextFile(FileHandle, FileInfo, &NoFile)
- ){
- if (StrStr(FileInfo->FileName, L".") != FileInfo->FileName
- &&StrStr(FileInfo->FileName, L"..") != FileInfo->FileName) {
+ for (Status = FileHandleFindFirstFile (FileHandle, &FileInfo)
+ ; !NoFile && !EFI_ERROR (Status)
+ ; FileHandleFindNextFile (FileHandle, FileInfo, &NoFile)
+ )
+ {
+ if ( (StrStr (FileInfo->FileName, L".") != FileInfo->FileName)
+ && (StrStr (FileInfo->FileName, L"..") != FileInfo->FileName))
+ {
RetVal = FALSE;
}
}
+
return (RetVal);
}
@@ -60,75 +63,81 @@ IsDirectoryEmpty ( @retval SHELL_DEVICE_ERROR A device error occurred reading this Node.
**/
SHELL_STATUS
-CascadeDelete(
+CascadeDelete (
IN EFI_SHELL_FILE_INFO *Node,
IN CONST BOOLEAN Quiet
)
{
- SHELL_STATUS ShellStatus;
- EFI_SHELL_FILE_INFO *List;
- EFI_SHELL_FILE_INFO *Node2;
- EFI_STATUS Status;
- SHELL_PROMPT_RESPONSE *Resp;
- CHAR16 *TempName;
- UINTN NewSize;
-
- Resp = NULL;
- ShellStatus = SHELL_SUCCESS;
- List = NULL;
- Status = EFI_SUCCESS;
+ SHELL_STATUS ShellStatus;
+ EFI_SHELL_FILE_INFO *List;
+ EFI_SHELL_FILE_INFO *Node2;
+ EFI_STATUS Status;
+ SHELL_PROMPT_RESPONSE *Resp;
+ CHAR16 *TempName;
+ UINTN NewSize;
+
+ Resp = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ List = NULL;
+ Status = EFI_SUCCESS;
if ((Node->Info->Attribute & EFI_FILE_READ_ONLY) == EFI_FILE_READ_ONLY) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DETELE_RO), gShellLevel2HiiHandle, L"rm", Node->FullName);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DETELE_RO), gShellLevel2HiiHandle, L"rm", Node->FullName);
return (SHELL_ACCESS_DENIED);
}
if ((Node->Info->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) {
- if (!IsDirectoryEmpty(Node->Handle)) {
+ if (!IsDirectoryEmpty (Node->Handle)) {
if (!Quiet) {
- Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_RM_LOG_DELETE_CONF), gShellLevel2HiiHandle, Node->FullName);
- Status = ShellPromptForResponse(ShellPromptResponseTypeYesNo, NULL, (VOID**)&Resp);
- ASSERT(Resp != NULL);
- if (EFI_ERROR(Status) || *Resp != ShellPromptResponseYes) {
- SHELL_FREE_NON_NULL(Resp);
+ Status = ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_CONF), gShellLevel2HiiHandle, Node->FullName);
+ Status = ShellPromptForResponse (ShellPromptResponseTypeYesNo, NULL, (VOID **)&Resp);
+ ASSERT (Resp != NULL);
+ if (EFI_ERROR (Status) || (*Resp != ShellPromptResponseYes)) {
+ SHELL_FREE_NON_NULL (Resp);
return (SHELL_ABORTED);
}
- SHELL_FREE_NON_NULL(Resp);
+
+ SHELL_FREE_NON_NULL (Resp);
}
+
//
// empty out the directory
//
- Status = gEfiShellProtocol->FindFilesInDir(Node->Handle, &List);
- if (EFI_ERROR(Status)) {
- if (List!=NULL) {
- gEfiShellProtocol->FreeFileList(&List);
+ Status = gEfiShellProtocol->FindFilesInDir (Node->Handle, &List);
+ if (EFI_ERROR (Status)) {
+ if (List != NULL) {
+ gEfiShellProtocol->FreeFileList (&List);
}
+
return (SHELL_DEVICE_ERROR);
}
- for (Node2 = (EFI_SHELL_FILE_INFO *)GetFirstNode(&List->Link)
- ; !IsNull(&List->Link, &Node2->Link)
- ; Node2 = (EFI_SHELL_FILE_INFO *)GetNextNode(&List->Link, &Node2->Link)
- ){
+
+ for (Node2 = (EFI_SHELL_FILE_INFO *)GetFirstNode (&List->Link)
+ ; !IsNull (&List->Link, &Node2->Link)
+ ; Node2 = (EFI_SHELL_FILE_INFO *)GetNextNode (&List->Link, &Node2->Link)
+ )
+ {
//
// skip the directory traversing stuff...
//
- if (StrCmp(Node2->FileName, L".") == 0 || StrCmp(Node2->FileName, L"..") == 0) {
+ if ((StrCmp (Node2->FileName, L".") == 0) || (StrCmp (Node2->FileName, L"..") == 0)) {
continue;
}
+
Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);
- if (EFI_ERROR(Node2->Status) && StrStr(Node2->FileName, L":") == NULL) {
+ if (EFI_ERROR (Node2->Status) && (StrStr (Node2->FileName, L":") == NULL)) {
//
// Update the node filename to have full path with file system identifier
//
- NewSize = StrSize(Node->FullName) + StrSize(Node2->FullName);
- TempName = AllocateZeroPool(NewSize);
+ NewSize = StrSize (Node->FullName) + StrSize (Node2->FullName);
+ TempName = AllocateZeroPool (NewSize);
if (TempName == NULL) {
ShellStatus = SHELL_OUT_OF_RESOURCES;
} else {
- StrCpyS(TempName, NewSize/sizeof(CHAR16), Node->FullName);
- TempName[StrStr(TempName, L":")+1-TempName] = CHAR_NULL;
- StrCatS(TempName, NewSize/sizeof(CHAR16), Node2->FullName);
- FreePool((VOID*)Node2->FullName);
+ StrCpyS (TempName, NewSize/sizeof (CHAR16), Node->FullName);
+ TempName[StrStr (TempName, L":")+1-TempName] = CHAR_NULL;
+ StrCatS (TempName, NewSize/sizeof (CHAR16), Node2->FullName);
+ FreePool ((VOID *)Node2->FullName);
Node2->FullName = TempName;
//
@@ -137,45 +146,51 @@ CascadeDelete( Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);
}
}
- if (!EFI_ERROR(Node2->Status)) {
- ShellStatus = CascadeDelete(Node2, Quiet);
+
+ if (!EFI_ERROR (Node2->Status)) {
+ ShellStatus = CascadeDelete (Node2, Quiet);
} else if (ShellStatus == SHELL_SUCCESS) {
ShellStatus = (SHELL_STATUS)(Node2->Status&(~0x80000000));
}
+
if (ShellStatus != SHELL_SUCCESS) {
- if (List!=NULL) {
- gEfiShellProtocol->FreeFileList(&List);
+ if (List != NULL) {
+ gEfiShellProtocol->FreeFileList (&List);
}
+
return (ShellStatus);
}
}
- if (List!=NULL) {
- gEfiShellProtocol->FreeFileList(&List);
+
+ if (List != NULL) {
+ gEfiShellProtocol->FreeFileList (&List);
}
}
}
- if (!(StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0)) {
+ if (!((StrCmp (Node->FileName, L".") == 0) || (StrCmp (Node->FileName, L"..") == 0))) {
//
// now delete the current node...
//
if (!Quiet) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE), gShellLevel2HiiHandle, Node->FullName);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE), gShellLevel2HiiHandle, Node->FullName);
}
- Status = gEfiShellProtocol->DeleteFile(Node->Handle);
+
+ Status = gEfiShellProtocol->DeleteFile (Node->Handle);
Node->Handle = NULL;
}
//
// We cant allow for the warning here! (Dont use EFI_ERROR Macro).
//
- if (Status != EFI_SUCCESS){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR), gShellLevel2HiiHandle, Status);
+ if (Status != EFI_SUCCESS) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR), gShellLevel2HiiHandle, Status);
return (SHELL_ACCESS_DENIED);
} else {
if (!Quiet) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_COMP), gShellLevel2HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_COMP), gShellLevel2HiiHandle);
}
+
return (SHELL_SUCCESS);
}
}
@@ -188,31 +203,31 @@ CascadeDelete( @param[in] Package RESERVED. Not used.
**/
BOOLEAN
-IsValidDeleteTarget(
+IsValidDeleteTarget (
IN CONST EFI_SHELL_FILE_INFO *List,
IN CONST EFI_SHELL_FILE_INFO *Node,
IN CONST LIST_ENTRY *Package
)
{
- CONST CHAR16 *TempLocation;
- BOOLEAN RetVal;
- CHAR16 *SearchString;
- CHAR16 *Pattern;
- UINTN Size;
+ CONST CHAR16 *TempLocation;
+ BOOLEAN RetVal;
+ CHAR16 *SearchString;
+ CHAR16 *Pattern;
+ UINTN Size;
- if (Node == NULL || Node->FullName == NULL) {
+ if ((Node == NULL) || (Node->FullName == NULL)) {
return (FALSE);
}
- TempLocation = StrStr(Node->FullName, L":");
- if (StrLen(TempLocation) <= 2) {
+ TempLocation = StrStr (Node->FullName, L":");
+ if (StrLen (TempLocation) <= 2) {
//
// Deleting the root directory is invalid.
//
return (FALSE);
}
- TempLocation = ShellGetCurrentDir(NULL);
+ TempLocation = ShellGetCurrentDir (NULL);
if (TempLocation == NULL) {
//
// No working directory is specified so whatever is left is ok.
@@ -220,29 +235,29 @@ IsValidDeleteTarget( return (TRUE);
}
- Pattern = NULL;
- SearchString = NULL;
- Size = 0;
- Pattern = StrnCatGrow(&Pattern, &Size, TempLocation , 0);
- Pattern = StrnCatGrow(&Pattern, &Size, L"\\" , 0);
- Size = 0;
- SearchString = StrnCatGrow(&SearchString, &Size, Node->FullName, 0);
- if (!EFI_ERROR(ShellIsDirectory(SearchString))) {
- SearchString = StrnCatGrow(&SearchString, &Size, L"\\", 0);
- SearchString = StrnCatGrow(&SearchString, &Size, L"*", 0);
+ Pattern = NULL;
+ SearchString = NULL;
+ Size = 0;
+ Pattern = StrnCatGrow (&Pattern, &Size, TempLocation, 0);
+ Pattern = StrnCatGrow (&Pattern, &Size, L"\\", 0);
+ Size = 0;
+ SearchString = StrnCatGrow (&SearchString, &Size, Node->FullName, 0);
+ if (!EFI_ERROR (ShellIsDirectory (SearchString))) {
+ SearchString = StrnCatGrow (&SearchString, &Size, L"\\", 0);
+ SearchString = StrnCatGrow (&SearchString, &Size, L"*", 0);
}
- if (Pattern == NULL || SearchString == NULL) {
+ if ((Pattern == NULL) || (SearchString == NULL)) {
RetVal = FALSE;
} else {
RetVal = TRUE;
- if (gUnicodeCollation->MetaiMatch(gUnicodeCollation, Pattern, SearchString)) {
+ if (gUnicodeCollation->MetaiMatch (gUnicodeCollation, Pattern, SearchString)) {
RetVal = FALSE;
}
}
- SHELL_FREE_NON_NULL(Pattern );
- SHELL_FREE_NON_NULL(SearchString);
+ SHELL_FREE_NON_NULL (Pattern);
+ SHELL_FREE_NON_NULL (SearchString);
return (RetVal);
}
@@ -260,106 +275,112 @@ ShellCommandRunRm ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- CONST CHAR16 *Param;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- EFI_SHELL_FILE_INFO *FileList;
- EFI_SHELL_FILE_INFO *Node;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- ParamCount = 0;
- FileList = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ CONST CHAR16 *Param;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamCount;
+ EFI_SHELL_FILE_INFO *FileList;
+ EFI_SHELL_FILE_INFO *Node;
+
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ ParamCount = 0;
+ FileList = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ 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), gShellLevel2HiiHandle, L"rm", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"rm", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
- if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
+
+ if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
//
// we insufficient parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"rm");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel2HiiHandle, L"rm");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// get a list with each file specified by parameters
// if parameter is a directory then add all the files below it to the list
//
- for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ; Param != NULL
- ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ){
- Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
- if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"rm", (CHAR16*)Param);
+ for ( ParamCount = 1, Param = ShellCommandLineGetRawValue (Package, ParamCount)
+ ; Param != NULL
+ ; ParamCount++, Param = ShellCommandLineGetRawValue (Package, ParamCount)
+ )
+ {
+ Status = ShellOpenFileMetaArg ((CHAR16 *)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
+ if (EFI_ERROR (Status) || (FileList == NULL) || IsListEmpty (&FileList->Link)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel2HiiHandle, L"rm", (CHAR16 *)Param);
ShellStatus = SHELL_NOT_FOUND;
break;
}
}
- if (ShellStatus == SHELL_SUCCESS){
+ if (ShellStatus == SHELL_SUCCESS) {
//
// loop through the list and make sure we are not aborting...
//
- for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag()
- ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link)
- ){
+ for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; !IsNull (&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag ()
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
+ )
+ {
//
// skip the directory traversing stuff...
//
- if (StrCmp(Node->FileName, L".") == 0 || StrCmp(Node->FileName, L"..") == 0) {
+ if ((StrCmp (Node->FileName, L".") == 0) || (StrCmp (Node->FileName, L"..") == 0)) {
continue;
}
//
// do the deleting of nodes
//
- if (EFI_ERROR(Node->Status)){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR2), gShellLevel2HiiHandle, Node->Status);
+ if (EFI_ERROR (Node->Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR2), gShellLevel2HiiHandle, Node->Status);
ShellStatus = SHELL_ACCESS_DENIED;
break;
}
- if (!IsValidDeleteTarget(FileList, Node, Package)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR3), gShellLevel2HiiHandle, Node->FullName);
+
+ if (!IsValidDeleteTarget (FileList, Node, Package)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_ERR3), gShellLevel2HiiHandle, Node->FullName);
ShellStatus = SHELL_INVALID_PARAMETER;
break;
}
- ShellStatus = CascadeDelete(Node, ShellCommandLineGetFlag(Package, L"-q"));
+ ShellStatus = CascadeDelete (Node, ShellCommandLineGetFlag (Package, L"-q"));
}
}
+
//
// Free the fileList
//
if (FileList != NULL) {
- Status = ShellCloseFileMetaArg(&FileList);
+ Status = ShellCloseFileMetaArg (&FileList);
}
+
FileList = NULL;
}
@@ -371,4 +392,3 @@ ShellCommandRunRm ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c index 6f9c1ec45c..c9082eb76c 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c @@ -18,31 +18,32 @@ @return any return code from GetNextVariableName except EFI_NOT_FOUND
**/
SHELL_STATUS
-PrintAllShellEnvVars(
+PrintAllShellEnvVars (
VOID
)
{
- CONST CHAR16 *Value;
- CONST CHAR16 *ConstEnvNameList;
+ CONST CHAR16 *Value;
+ CONST CHAR16 *ConstEnvNameList;
- ConstEnvNameList = gEfiShellProtocol->GetEnv(NULL);
+ ConstEnvNameList = gEfiShellProtocol->GetEnv (NULL);
if (ConstEnvNameList == NULL) {
return (SHELL_SUCCESS);
}
- while (*ConstEnvNameList != CHAR_NULL){
- Value = gEfiShellProtocol->GetEnv(ConstEnvNameList);
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, ConstEnvNameList, Value);
- ConstEnvNameList += StrLen(ConstEnvNameList)+1;
+
+ while (*ConstEnvNameList != CHAR_NULL) {
+ Value = gEfiShellProtocol->GetEnv (ConstEnvNameList);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, ConstEnvNameList, Value);
+ ConstEnvNameList += StrLen (ConstEnvNameList)+1;
}
return (SHELL_SUCCESS);
}
-STATIC CONST SHELL_PARAM_ITEM SetParamList[] = {
- {L"-d", TypeValue},
- {L"-v", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM SetParamList[] = {
+ { L"-d", TypeValue },
+ { L"-v", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'set' command.
@@ -70,90 +71,89 @@ ShellCommandRunSet ( //
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// Make sure globals are good...
//
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParse (SetParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"set", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"set", ProblemParam);
+ FreePool (ProblemParam);
return (SHELL_INVALID_PARAMETER);
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 3) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set");
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 3) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetRawValue(Package, 1) != NULL && ShellCommandLineGetFlag(Package, L"-d")) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set");
+ } else if ((ShellCommandLineGetRawValue (Package, 1) != NULL) && ShellCommandLineGetFlag (Package, L"-d")) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetFlag(Package, L"-d")) {
+ } else if (ShellCommandLineGetFlag (Package, L"-d")) {
//
// delete a environment variable
//
- KeyName = ShellCommandLineGetValue(Package, L"-d");
+ KeyName = ShellCommandLineGetValue (Package, L"-d");
if (KeyName == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"set", L"-d");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"set", L"-d");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- Status = ShellSetEnvironmentVariable(KeyName, L"", ShellCommandLineGetFlag(Package, L"-v"));
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_ND), gShellLevel2HiiHandle, L"set", KeyName);
+ Status = ShellSetEnvironmentVariable (KeyName, L"", ShellCommandLineGetFlag (Package, L"-v"));
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_ND), gShellLevel2HiiHandle, L"set", KeyName);
ShellStatus = SHELL_DEVICE_ERROR;
}
}
- } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
+ } else if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
//
// print out all current environment variables
//
- return(PrintAllShellEnvVars());
+ return (PrintAllShellEnvVars ());
} else {
//
// we are either printing one or assigning one
//
- KeyName = ShellCommandLineGetRawValue(Package, 1);
- Value = ShellCommandLineGetRawValue(Package, 2);
- if (KeyName != NULL && Value != NULL) {
+ KeyName = ShellCommandLineGetRawValue (Package, 1);
+ Value = ShellCommandLineGetRawValue (Package, 2);
+ if ((KeyName != NULL) && (Value != NULL)) {
//
// assigning one
//
- Status = ShellSetEnvironmentVariable(KeyName, Value, ShellCommandLineGetFlag(Package, L"-v"));
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_ERROR_SET), gShellLevel2HiiHandle, L"set", KeyName);
- ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));
+ Status = ShellSetEnvironmentVariable (KeyName, Value, ShellCommandLineGetFlag (Package, L"-v"));
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_ERROR_SET), gShellLevel2HiiHandle, L"set", KeyName);
+ ShellStatus = (SHELL_STATUS)(Status & (~MAX_BIT));
}
-
} else {
if (KeyName != NULL) {
//
// print out value for this one only.
//
- Value = ShellGetEnvironmentVariable(KeyName);
+ Value = ShellGetEnvironmentVariable (KeyName);
if (Value == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_NF), gShellLevel2HiiHandle, L"set", KeyName);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_NF), gShellLevel2HiiHandle, L"set", KeyName);
ShellStatus = SHELL_SUCCESS;
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, KeyName, Value);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, KeyName, Value);
ShellStatus = SHELL_SUCCESS;
}
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
}
}
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c index be8e952546..f01f4e450b 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c @@ -30,7 +30,8 @@ InternalIsTimeLikeString ( IN CONST BOOLEAN MinusOk
)
{
- UINTN Count;
+ UINTN Count;
+
Count = 0;
if (MinusOk) {
@@ -45,27 +46,32 @@ InternalIsTimeLikeString ( //
// the first char must be numeric.
//
- if (!ShellIsDecimalDigitCharacter(*String)) {
+ if (!ShellIsDecimalDigitCharacter (*String)) {
return (FALSE);
}
+
//
// loop through the characters and use the lib function
//
- for ( ; String != NULL && *String != CHAR_NULL ; String++){
+ for ( ; String != NULL && *String != CHAR_NULL; String++) {
if (*String == Char) {
Count++;
if (Count > Max) {
return (FALSE);
}
+
continue;
}
- if (!ShellIsDecimalDigitCharacter(*String)) {
+
+ if (!ShellIsDecimalDigitCharacter (*String)) {
return (FALSE);
}
}
+
if (Count < Min) {
return (FALSE);
}
+
return (TRUE);
}
@@ -81,38 +87,39 @@ InternalIsTimeLikeString ( **/
SHELL_STATUS
CheckAndSetDate (
- IN CONST CHAR16 *DateString
+ IN CONST CHAR16 *DateString
)
{
- EFI_TIME TheTime;
- EFI_STATUS Status;
- CHAR16 *DateStringCopy;
- CHAR16 *Walker;
- CHAR16 *Walker1;
+ EFI_TIME TheTime;
+ EFI_STATUS Status;
+ CHAR16 *DateStringCopy;
+ CHAR16 *Walker;
+ CHAR16 *Walker1;
- if (!InternalIsTimeLikeString(DateString, L'/', 2, 2, FALSE)) {
+ if (!InternalIsTimeLikeString (DateString, L'/', 2, 2, FALSE)) {
return (SHELL_INVALID_PARAMETER);
}
- Status = gRT->GetTime(&TheTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"date", L"gRT->GetTime", Status);
+ Status = gRT->GetTime (&TheTime, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"date", L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
DateStringCopy = NULL;
- DateStringCopy = StrnCatGrow(&DateStringCopy, NULL, DateString, 0);
+ DateStringCopy = StrnCatGrow (&DateStringCopy, NULL, DateString, 0);
if (DateStringCopy == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
+
Walker = DateStringCopy;
TheTime.Month = 0xFF;
TheTime.Day = 0xFF;
TheTime.Year = 0xFFFF;
- Walker1 = StrStr(Walker, L"/");
- if (Walker1 != NULL && *Walker1 == L'/') {
+ Walker1 = StrStr (Walker, L"/");
+ if ((Walker1 != NULL) && (*Walker1 == L'/')) {
*Walker1 = CHAR_NULL;
}
@@ -120,20 +127,24 @@ CheckAndSetDate ( if (Walker1 != NULL) {
Walker = Walker1 + 1;
}
- Walker1 = Walker!=NULL?StrStr(Walker, L"/"):NULL;
- if (Walker1 != NULL && *Walker1 == L'/') {
+
+ Walker1 = Walker != NULL ? StrStr (Walker, L"/") : NULL;
+ if ((Walker1 != NULL) && (*Walker1 == L'/')) {
*Walker1 = CHAR_NULL;
}
- if (Walker != NULL && Walker[0] != CHAR_NULL) {
+
+ if ((Walker != NULL) && (Walker[0] != CHAR_NULL)) {
TheTime.Day = (UINT8)ShellStrToUintn (Walker);
if (Walker1 != NULL) {
Walker = Walker1 + 1;
}
- Walker1 = Walker!=NULL?StrStr(Walker, L"/"):NULL;
- if (Walker1 != NULL && *Walker1 == L'/') {
+
+ Walker1 = Walker != NULL ? StrStr (Walker, L"/") : NULL;
+ if ((Walker1 != NULL) && (*Walker1 == L'/')) {
*Walker1 = CHAR_NULL;
}
- if (Walker != NULL && Walker[0] != CHAR_NULL) {
+
+ if ((Walker != NULL) && (Walker[0] != CHAR_NULL)) {
TheTime.Year = (UINT16)ShellStrToUintn (Walker);
}
}
@@ -146,11 +157,12 @@ CheckAndSetDate ( }
}
- Status = gRT->SetTime(&TheTime);
+ Status = gRT->SetTime (&TheTime);
- if (!EFI_ERROR(Status)){
+ if (!EFI_ERROR (Status)) {
return (SHELL_SUCCESS);
}
+
return (SHELL_INVALID_PARAMETER);
}
@@ -180,49 +192,49 @@ ShellCommandRunDate ( //
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"date", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"date", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"date");
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 2) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"date");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// If there are 0 value parameters, then print the current date
// else If there are any value paramerers, then print error
//
- if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
+ if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
//
// get the current date
//
- Status = gRT->GetTime(&TheTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"date", L"gRT->GetTime", Status);
+ Status = gRT->GetTime (&TheTime, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"date", L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
//
// ShellPrintEx the date in SFO or regular format
//
- if (ShellCommandLineGetFlag(Package, L"-sfo")) {
+ if (ShellCommandLineGetFlag (Package, L"-sfo")) {
//
// Match UEFI Shell spec:
// ShellCommand,"date"
@@ -231,30 +243,32 @@ ShellCommandRunDate ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellLevel2HiiHandle, L"date");
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DATE_SFO_FORMAT), gShellLevel2HiiHandle, TheTime.Day, TheTime.Month, TheTime.Year);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DATE_FORMAT), gShellLevel2HiiHandle, TheTime.Month, TheTime.Day, TheTime.Year);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DATE_FORMAT), gShellLevel2HiiHandle, TheTime.Month, TheTime.Day, TheTime.Year);
}
} else {
- if (PcdGet8(PcdShellSupportLevel) == 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"date");
+ if (PcdGet8 (PcdShellSupportLevel) == 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"date");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// perform level 3 operation here.
//
- Param1 = ShellCommandLineGetRawValue(Package, 1);
+ Param1 = ShellCommandLineGetRawValue (Package, 1);
if (Param1 == NULL) {
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ShellStatus = CheckAndSetDate(Param1);
+ ShellStatus = CheckAndSetDate (Param1);
}
+
if (ShellStatus != SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"date", Param1);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"date", Param1);
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
}
}
}
+
//
// free the command line package
//
@@ -269,16 +283,16 @@ ShellCommandRunDate ( //
// Note "-tz" is invalid for this (non-interactive) version of 'time'.
//
-STATIC CONST SHELL_PARAM_ITEM TimeParamList2[] = {
- {L"-d", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM TimeParamList2[] = {
+ { L"-d", TypeValue },
+ { NULL, TypeMax }
+};
-STATIC CONST SHELL_PARAM_ITEM TimeParamList3[] = {
- {L"-d", TypeValue},
- {L"-tz", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM TimeParamList3[] = {
+ { L"-d", TypeValue },
+ { L"-tz", TypeValue },
+ { NULL, TypeMax }
+};
/**
Verify that the TimeString is valid and if so set that as the current
@@ -294,67 +308,70 @@ STATIC CONST SHELL_PARAM_ITEM TimeParamList3[] = { **/
SHELL_STATUS
CheckAndSetTime (
- IN CONST CHAR16 *TimeString,
- IN CONST INT16 Tz,
- IN CONST UINT8 Daylight
+ IN CONST CHAR16 *TimeString,
+ IN CONST INT16 Tz,
+ IN CONST UINT8 Daylight
)
{
- EFI_TIME TheTime;
- EFI_STATUS Status;
- CHAR16 *TimeStringCopy;
- CHAR16 *Walker1;
- CHAR16 *Walker2;
+ EFI_TIME TheTime;
+ EFI_STATUS Status;
+ CHAR16 *TimeStringCopy;
+ CHAR16 *Walker1;
+ CHAR16 *Walker2;
- if (TimeString != NULL && !InternalIsTimeLikeString(TimeString, L':', 1, 2, FALSE)) {
+ if ((TimeString != NULL) && !InternalIsTimeLikeString (TimeString, L':', 1, 2, FALSE)) {
return (SHELL_INVALID_PARAMETER);
}
- if (Daylight != 0xFF &&((Daylight & (EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT)) != Daylight)) {
+
+ if ((Daylight != 0xFF) && ((Daylight & (EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT)) != Daylight)) {
return (SHELL_INVALID_PARAMETER);
}
- Status = gRT->GetTime(&TheTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", Status);
+ Status = gRT->GetTime (&TheTime, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
if (TimeString != NULL) {
TimeStringCopy = NULL;
- TimeStringCopy = StrnCatGrow(&TimeStringCopy, NULL, TimeString, 0);
- Walker1 = TimeStringCopy;
- TheTime.Hour = 0xFF;
- TheTime.Minute = 0xFF;
+ TimeStringCopy = StrnCatGrow (&TimeStringCopy, NULL, TimeString, 0);
+ Walker1 = TimeStringCopy;
+ TheTime.Hour = 0xFF;
+ TheTime.Minute = 0xFF;
- Walker2 = Walker1!=NULL?StrStr(Walker1, L":"):NULL;
- if (Walker2 != NULL && *Walker2 == L':') {
+ Walker2 = Walker1 != NULL ? StrStr (Walker1, L":") : NULL;
+ if ((Walker2 != NULL) && (*Walker2 == L':')) {
*Walker2 = CHAR_NULL;
}
- TheTime.Hour = (UINT8)ShellStrToUintn (Walker1);
+
+ TheTime.Hour = (UINT8)ShellStrToUintn (Walker1);
if (Walker2 != NULL) {
Walker1 = Walker2 + 1;
}
- Walker2 = Walker1!=NULL?StrStr(Walker1, L":"):NULL;
- if (Walker2 != NULL && *Walker2 == L':') {
- *Walker2 = CHAR_NULL;
+
+ Walker2 = Walker1 != NULL ? StrStr (Walker1, L":") : NULL;
+ if ((Walker2 != NULL) && (*Walker2 == L':')) {
+ *Walker2 = CHAR_NULL;
TheTime.Second = (UINT8)0;
- }
- else if (Walker2 == NULL) {
+ } else if (Walker2 == NULL) {
TheTime.Second = (UINT8)0;
}
- if (Walker1 != NULL && Walker1[0] != CHAR_NULL) {
+
+ if ((Walker1 != NULL) && (Walker1[0] != CHAR_NULL)) {
TheTime.Minute = (UINT8)ShellStrToUintn (Walker1);
if (Walker2 != NULL) {
Walker1 = Walker2 + 1;
- if (Walker1 != NULL && Walker1[0] != CHAR_NULL) {
+ if ((Walker1 != NULL) && (Walker1[0] != CHAR_NULL)) {
TheTime.Second = (UINT8)ShellStrToUintn (Walker1);
}
}
}
- SHELL_FREE_NON_NULL(TimeStringCopy);
- }
+ SHELL_FREE_NON_NULL (TimeStringCopy);
+ }
- if (Tz >= -1440 && Tz <= 1440) {
+ if ((Tz >= -1440) && (Tz <= 1440)) {
//
// EFI_TIME TimeZone is stored to meet the following calculation (see UEFI Spec):
// Localtime = UTC - TimeZone
@@ -372,9 +389,9 @@ CheckAndSetTime ( TheTime.Daylight = Daylight;
}
- Status = gRT->SetTime(&TheTime);
+ Status = gRT->SetTime (&TheTime);
- if (!EFI_ERROR(Status)){
+ if (!EFI_ERROR (Status)) {
return (SHELL_SUCCESS);
}
@@ -413,55 +430,57 @@ ShellCommandRunTime ( //
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
- if (PcdGet8(PcdShellSupportLevel) == 2) {
+ if (PcdGet8 (PcdShellSupportLevel) == 2) {
Status = ShellCommandLineParseEx (TimeParamList2, &Package, &ProblemParam, TRUE, TRUE);
} else {
- ASSERT(PcdGet8(PcdShellSupportLevel) == 3);
+ ASSERT (PcdGet8 (PcdShellSupportLevel) == 3);
Status = ShellCommandLineParseEx (TimeParamList3, &Package, &ProblemParam, TRUE, TRUE);
}
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"time", ProblemParam);
- FreePool(ProblemParam);
+
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"time", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- Status = gRT->GetTime(&TheTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", Status);
+ Status = gRT->GetTime (&TheTime, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time");
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 2) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// If there are no parameters, then print the current time
//
- if (ShellCommandLineGetRawValue(Package, 1) == NULL
- && !ShellCommandLineGetFlag(Package, L"-d")
- && !ShellCommandLineGetFlag(Package, L"-tz")) {
+ if ( (ShellCommandLineGetRawValue (Package, 1) == NULL)
+ && !ShellCommandLineGetFlag (Package, L"-d")
+ && !ShellCommandLineGetFlag (Package, L"-tz"))
+ {
//
// ShellPrintEx the current time
//
if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) {
TzMinutes = 0;
} else {
- TzMinutes = (ABS(TheTime.TimeZone)) % 60;
+ TzMinutes = (ABS (TheTime.TimeZone)) % 60;
}
if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) {
@@ -474,8 +493,8 @@ ShellCommandRunTime ( TheTime.Hour,
TheTime.Minute,
TheTime.Second,
- (TheTime.TimeZone > 0?L"-":L"+"),
- ((ABS(TheTime.TimeZone)) / 60),
+ (TheTime.TimeZone > 0 ? L"-" : L"+"),
+ ((ABS (TheTime.TimeZone)) / 60),
TzMinutes
);
} else {
@@ -490,8 +509,9 @@ ShellCommandRunTime ( TheTime.Second
);
}
+
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel2HiiHandle);
- } else if (ShellCommandLineGetFlag(Package, L"-d") && ShellCommandLineGetValue(Package, L"-d") == NULL) {
+ } else if (ShellCommandLineGetFlag (Package, L"-d") && (ShellCommandLineGetValue (Package, L"-d") == NULL)) {
if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) {
ShellPrintHiiEx (
-1,
@@ -504,7 +524,7 @@ ShellCommandRunTime ( TheTime.Second
);
} else {
- TzMinutes = (ABS(TheTime.TimeZone)) % 60;
+ TzMinutes = (ABS (TheTime.TimeZone)) % 60;
ShellPrintHiiEx (
-1,
-1,
@@ -514,49 +534,49 @@ ShellCommandRunTime ( TheTime.Hour,
TheTime.Minute,
TheTime.Second,
- (TheTime.TimeZone > 0?L"-":L"+"),
- ((ABS(TheTime.TimeZone)) / 60),
+ (TheTime.TimeZone > 0 ? L"-" : L"+"),
+ ((ABS (TheTime.TimeZone)) / 60),
TzMinutes
- );
+ );
+ }
+
+ switch (TheTime.Daylight) {
+ case 0:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TIME_DST0), gShellLevel2HiiHandle);
+ break;
+ case EFI_TIME_ADJUST_DAYLIGHT:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TIME_DST1), gShellLevel2HiiHandle);
+ break;
+ case EFI_TIME_IN_DAYLIGHT:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TIME_DST2), gShellLevel2HiiHandle);
+ break;
+ case EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TIME_DST3), gShellLevel2HiiHandle);
+ break;
+ default:
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_ERROR), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", L"TheTime.Daylight", TheTime.Daylight);
}
- switch (TheTime.Daylight) {
- case 0:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST0), gShellLevel2HiiHandle);
- break;
- case EFI_TIME_ADJUST_DAYLIGHT:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST1), gShellLevel2HiiHandle);
- break;
- case EFI_TIME_IN_DAYLIGHT:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST2), gShellLevel2HiiHandle);
- break;
- case EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST3), gShellLevel2HiiHandle);
- break;
- default:
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_ERROR), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", L"TheTime.Daylight", TheTime.Daylight);
- }
} else {
- if (PcdGet8(PcdShellSupportLevel) == 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time");
+ if (PcdGet8 (PcdShellSupportLevel) == 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// perform level 3 operation here.
//
- if ((TempLocation = ShellCommandLineGetValue(Package, L"-tz")) != NULL) {
- if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16 *)TempLocation, L"_local") == 0) {
+ if ((TempLocation = ShellCommandLineGetValue (Package, L"-tz")) != NULL) {
+ if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)TempLocation, L"_local") == 0) {
Tz = EFI_UNSPECIFIED_TIMEZONE;
} else if (TempLocation[0] == L'-') {
-
- Tz = (INT16) ShellStrToUintn (++TempLocation);
+ Tz = (INT16)ShellStrToUintn (++TempLocation);
//
// When the argument of "time [-tz tz]" is not numeric, ShellStrToUintn() returns "-1".
// Here we can detect the argument error by checking the return of ShellStrToUintn().
//
if (Tz == -1) {
- Tz = 1441; //make it to be out of bounds value
+ Tz = 1441; // make it to be out of bounds value
} else {
- Tz *= (-1); //sign convert
+ Tz *= (-1); // sign convert
}
} else {
if (TempLocation[0] == L'+') {
@@ -564,15 +584,17 @@ ShellCommandRunTime ( } else {
Tz = (INT16)ShellStrToUintn (TempLocation);
}
+
//
// Detect the return of ShellStrToUintn() to make sure the argument is valid.
//
if (Tz == -1) {
- Tz = 1441; //make it to be out of bounds value
+ Tz = 1441; // make it to be out of bounds value
}
}
- if (!(Tz >= -1440 && Tz <= 1440) && Tz != EFI_UNSPECIFIED_TIMEZONE) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"time", TempLocation, L"-tz");
+
+ if (!((Tz >= -1440) && (Tz <= 1440)) && (Tz != EFI_UNSPECIFIED_TIMEZONE)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"time", TempLocation, L"-tz");
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else {
@@ -581,19 +603,21 @@ ShellCommandRunTime ( //
Tz = 1441;
}
- TempLocation = ShellCommandLineGetValue(Package, L"-d");
+
+ TempLocation = ShellCommandLineGetValue (Package, L"-d");
if (TempLocation != NULL) {
- Daylight = (UINT8)ShellStrToUintn(TempLocation);
+ Daylight = (UINT8)ShellStrToUintn (TempLocation);
//
// The argument of "time [-d dl]" is unsigned, if the first character is '-',
// the argument is incorrect. That's because ShellStrToUintn() will skip past
// any '-' sign and convert what's next, forgetting the sign is here.
//
if (TempLocation[0] == '-') {
- Daylight = 0xff; //make it invalid = will not use
+ Daylight = 0xff; // make it invalid = will not use
}
- if (Daylight != 0 && Daylight != 1 && Daylight != 3) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"time", TempLocation, L"-d");
+
+ if ((Daylight != 0) && (Daylight != 1) && (Daylight != 3)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"time", TempLocation, L"-d");
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else {
@@ -602,10 +626,11 @@ ShellCommandRunTime ( //
Daylight = 0xFF;
}
+
if (ShellStatus == SHELL_SUCCESS) {
- ShellStatus = CheckAndSetTime(ShellCommandLineGetRawValue(Package, 1), Tz, Daylight);
+ ShellStatus = CheckAndSetTime (ShellCommandLineGetRawValue (Package, 1), Tz, Daylight);
if (ShellStatus != SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"time", ShellCommandLineGetRawValue(Package, 1));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"time", ShellCommandLineGetRawValue (Package, 1));
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
@@ -626,59 +651,59 @@ ShellCommandRunTime ( }
typedef struct {
- INT16 TimeZone;
- EFI_STRING_ID StringId;
+ INT16 TimeZone;
+ EFI_STRING_ID StringId;
} TIME_ZONE_ITEM;
-STATIC CONST SHELL_PARAM_ITEM TimeZoneParamList2[] = {
- {L"-l", TypeFlag},
- {L"-f", TypeFlag},
- {NULL, TypeMax}
- };
-STATIC CONST SHELL_PARAM_ITEM TimeZoneParamList3[] = {
- {L"-l", TypeFlag},
- {L"-f", TypeFlag},
- {L"-s", TypeTimeValue},
- {NULL, TypeMax}
- };
-
- STATIC CONST TIME_ZONE_ITEM TimeZoneList[] = {
- {720, STRING_TOKEN (STR_TIMEZONE_M12)},
- {660, STRING_TOKEN (STR_TIMEZONE_M11)},
- {600, STRING_TOKEN (STR_TIMEZONE_M10)},
- {540, STRING_TOKEN (STR_TIMEZONE_M9)},
- {480, STRING_TOKEN (STR_TIMEZONE_M8)},
- {420, STRING_TOKEN (STR_TIMEZONE_M7)},
- {360, STRING_TOKEN (STR_TIMEZONE_M6)},
- {300, STRING_TOKEN (STR_TIMEZONE_M5)},
- {270, STRING_TOKEN (STR_TIMEZONE_M430)},
- {240, STRING_TOKEN (STR_TIMEZONE_M4)},
- {210, STRING_TOKEN (STR_TIMEZONE_M330)},
- {180, STRING_TOKEN (STR_TIMEZONE_M3)},
- {120, STRING_TOKEN (STR_TIMEZONE_M2)},
- {60 , STRING_TOKEN (STR_TIMEZONE_M1)},
- {0 , STRING_TOKEN (STR_TIMEZONE_0)},
- {-60 , STRING_TOKEN (STR_TIMEZONE_P1)},
- {-120 , STRING_TOKEN (STR_TIMEZONE_P2)},
- {-180 , STRING_TOKEN (STR_TIMEZONE_P3)},
- {-210 , STRING_TOKEN (STR_TIMEZONE_P330)},
- {-240 , STRING_TOKEN (STR_TIMEZONE_P4)},
- {-270 , STRING_TOKEN (STR_TIMEZONE_P430)},
- {-300 , STRING_TOKEN (STR_TIMEZONE_P5)},
- {-330 , STRING_TOKEN (STR_TIMEZONE_P530)},
- {-345 , STRING_TOKEN (STR_TIMEZONE_P545)},
- {-360 , STRING_TOKEN (STR_TIMEZONE_P6)},
- {-390 , STRING_TOKEN (STR_TIMEZONE_P630)},
- {-420 , STRING_TOKEN (STR_TIMEZONE_P7)},
- {-480 , STRING_TOKEN (STR_TIMEZONE_P8)},
- {-540 , STRING_TOKEN (STR_TIMEZONE_P9)},
- {-570 , STRING_TOKEN (STR_TIMEZONE_P930)},
- {-600 , STRING_TOKEN (STR_TIMEZONE_P10)},
- {-660 , STRING_TOKEN (STR_TIMEZONE_P11)},
- {-720 , STRING_TOKEN (STR_TIMEZONE_P12)},
- {-780 , STRING_TOKEN (STR_TIMEZONE_P13)},
- {-840 , STRING_TOKEN (STR_TIMEZONE_P14)},
- {EFI_UNSPECIFIED_TIMEZONE, STRING_TOKEN (STR_TIMEZONE_LOCAL)}
+STATIC CONST SHELL_PARAM_ITEM TimeZoneParamList2[] = {
+ { L"-l", TypeFlag },
+ { L"-f", TypeFlag },
+ { NULL, TypeMax }
+};
+STATIC CONST SHELL_PARAM_ITEM TimeZoneParamList3[] = {
+ { L"-l", TypeFlag },
+ { L"-f", TypeFlag },
+ { L"-s", TypeTimeValue },
+ { NULL, TypeMax }
+};
+
+STATIC CONST TIME_ZONE_ITEM TimeZoneList[] = {
+ { 720, STRING_TOKEN (STR_TIMEZONE_M12) },
+ { 660, STRING_TOKEN (STR_TIMEZONE_M11) },
+ { 600, STRING_TOKEN (STR_TIMEZONE_M10) },
+ { 540, STRING_TOKEN (STR_TIMEZONE_M9) },
+ { 480, STRING_TOKEN (STR_TIMEZONE_M8) },
+ { 420, STRING_TOKEN (STR_TIMEZONE_M7) },
+ { 360, STRING_TOKEN (STR_TIMEZONE_M6) },
+ { 300, STRING_TOKEN (STR_TIMEZONE_M5) },
+ { 270, STRING_TOKEN (STR_TIMEZONE_M430) },
+ { 240, STRING_TOKEN (STR_TIMEZONE_M4) },
+ { 210, STRING_TOKEN (STR_TIMEZONE_M330) },
+ { 180, STRING_TOKEN (STR_TIMEZONE_M3) },
+ { 120, STRING_TOKEN (STR_TIMEZONE_M2) },
+ { 60, STRING_TOKEN (STR_TIMEZONE_M1) },
+ { 0, STRING_TOKEN (STR_TIMEZONE_0) },
+ { -60, STRING_TOKEN (STR_TIMEZONE_P1) },
+ { -120, STRING_TOKEN (STR_TIMEZONE_P2) },
+ { -180, STRING_TOKEN (STR_TIMEZONE_P3) },
+ { -210, STRING_TOKEN (STR_TIMEZONE_P330) },
+ { -240, STRING_TOKEN (STR_TIMEZONE_P4) },
+ { -270, STRING_TOKEN (STR_TIMEZONE_P430) },
+ { -300, STRING_TOKEN (STR_TIMEZONE_P5) },
+ { -330, STRING_TOKEN (STR_TIMEZONE_P530) },
+ { -345, STRING_TOKEN (STR_TIMEZONE_P545) },
+ { -360, STRING_TOKEN (STR_TIMEZONE_P6) },
+ { -390, STRING_TOKEN (STR_TIMEZONE_P630) },
+ { -420, STRING_TOKEN (STR_TIMEZONE_P7) },
+ { -480, STRING_TOKEN (STR_TIMEZONE_P8) },
+ { -540, STRING_TOKEN (STR_TIMEZONE_P9) },
+ { -570, STRING_TOKEN (STR_TIMEZONE_P930) },
+ { -600, STRING_TOKEN (STR_TIMEZONE_P10) },
+ { -660, STRING_TOKEN (STR_TIMEZONE_P11) },
+ { -720, STRING_TOKEN (STR_TIMEZONE_P12) },
+ { -780, STRING_TOKEN (STR_TIMEZONE_P13) },
+ { -840, STRING_TOKEN (STR_TIMEZONE_P14) },
+ { EFI_UNSPECIFIED_TIMEZONE, STRING_TOKEN (STR_TIMEZONE_LOCAL) }
};
/**
@@ -693,63 +718,69 @@ STATIC CONST SHELL_PARAM_ITEM TimeZoneParamList3[] = { **/
SHELL_STATUS
CheckAndSetTimeZone (
- IN CONST CHAR16 *TimeZoneString
+ IN CONST CHAR16 *TimeZoneString
)
{
- EFI_TIME TheTime;
- EFI_STATUS Status;
- CHAR16 *TimeZoneCopy;
- CHAR16 *Walker;
- CHAR16 *Walker2;
- UINTN LoopVar;
+ EFI_TIME TheTime;
+ EFI_STATUS Status;
+ CHAR16 *TimeZoneCopy;
+ CHAR16 *Walker;
+ CHAR16 *Walker2;
+ UINTN LoopVar;
if (TimeZoneString == NULL) {
return (SHELL_INVALID_PARAMETER);
}
- if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16 *)TimeZoneString, L"_local") == 0) {
+ if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)TimeZoneString, L"_local") == 0) {
Status = gRT->GetTime (&TheTime, NULL);
if (EFI_ERROR (Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
TheTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
- Status = gRT->SetTime (&TheTime);
- if (!EFI_ERROR(Status)){
+ Status = gRT->SetTime (&TheTime);
+ if (!EFI_ERROR (Status)) {
return (SHELL_SUCCESS);
}
+
return (SHELL_INVALID_PARAMETER);
}
- if (TimeZoneString != NULL && !InternalIsTimeLikeString(TimeZoneString, L':', 1, 1, TRUE)) {
+
+ if ((TimeZoneString != NULL) && !InternalIsTimeLikeString (TimeZoneString, L':', 1, 1, TRUE)) {
return (SHELL_INVALID_PARAMETER);
}
- Status = gRT->GetTime(&TheTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"timezone", L"gRT->GetTime", Status);
+ Status = gRT->GetTime (&TheTime, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"timezone", L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
TimeZoneCopy = NULL;
- TimeZoneCopy = StrnCatGrow(&TimeZoneCopy, NULL, TimeZoneString, 0);
+ TimeZoneCopy = StrnCatGrow (&TimeZoneCopy, NULL, TimeZoneString, 0);
if (TimeZoneCopy == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- Walker = TimeZoneCopy;
- Walker2 = StrStr(Walker, L":");
- if (Walker2 != NULL && *Walker2 == L':') {
+
+ Walker = TimeZoneCopy;
+ Walker2 = StrStr (Walker, L":");
+ if ((Walker2 != NULL) && (*Walker2 == L':')) {
*Walker2 = CHAR_NULL;
}
+
if (*Walker == L'-') {
TheTime.TimeZone = (INT16)((ShellStrToUintn (++Walker)) * 60);
} else {
TheTime.TimeZone = (INT16)((INT16)(ShellStrToUintn (Walker)) * -60);
}
+
if (Walker2 != NULL) {
Walker = Walker2 + 1;
}
- if (Walker != NULL && Walker[0] != CHAR_NULL) {
+
+ if ((Walker != NULL) && (Walker[0] != CHAR_NULL)) {
if (TheTime.TimeZone < 0) {
TheTime.TimeZone = (INT16)(TheTime.TimeZone - (UINT8)ShellStrToUintn (Walker));
} else {
@@ -760,24 +791,25 @@ CheckAndSetTimeZone ( Status = EFI_INVALID_PARAMETER;
for ( LoopVar = 0
- ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0])
- ; LoopVar++
- ){
+ ; LoopVar < sizeof (TimeZoneList) / sizeof (TimeZoneList[0])
+ ; LoopVar++
+ )
+ {
if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) {
- Status = gRT->SetTime(&TheTime);
- break;
+ Status = gRT->SetTime (&TheTime);
+ break;
}
}
- FreePool(TimeZoneCopy);
+ FreePool (TimeZoneCopy);
- if (!EFI_ERROR(Status)){
+ if (!EFI_ERROR (Status)) {
return (SHELL_SUCCESS);
}
+
return (SHELL_INVALID_PARAMETER);
}
-
/**
Function for 'timezone' command.
@@ -809,83 +841,86 @@ ShellCommandRunTimeZone ( //
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
- if (PcdGet8(PcdShellSupportLevel) == 2) {
+ if (PcdGet8 (PcdShellSupportLevel) == 2) {
Status = ShellCommandLineParse (TimeZoneParamList2, &Package, &ProblemParam, TRUE);
} else {
- ASSERT(PcdGet8(PcdShellSupportLevel) == 3);
+ ASSERT (PcdGet8 (PcdShellSupportLevel) == 3);
Status = ShellCommandLineParseEx (TimeZoneParamList3, &Package, &ProblemParam, TRUE, TRUE);
}
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"timezone", ProblemParam);
- FreePool(ProblemParam);
+
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"timezone", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetCount(Package) > 1) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"timezone");
+ if (ShellCommandLineGetCount (Package) > 1) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"timezone");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetFlag(Package, L"-s")) {
- if ((ShellCommandLineGetFlag(Package, L"-l")) || (ShellCommandLineGetFlag(Package, L"-f"))) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"timezone", L"-l or -f");
+ } else if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetFlag (Package, L"-s")) {
+ if ((ShellCommandLineGetFlag (Package, L"-l")) || (ShellCommandLineGetFlag (Package, L"-f"))) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"timezone", L"-l or -f");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(PcdGet8(PcdShellSupportLevel) == 3);
- if (ShellCommandLineGetValue(Package, L"-s") == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"timezone", L"-s");
+ ASSERT (PcdGet8 (PcdShellSupportLevel) == 3);
+ if (ShellCommandLineGetValue (Package, L"-s") == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"timezone", L"-s");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// Set the time zone
//
- ShellStatus = CheckAndSetTimeZone(ShellCommandLineGetValue(Package, L"-s"));
+ ShellStatus = CheckAndSetTimeZone (ShellCommandLineGetValue (Package, L"-s"));
if (ShellStatus != SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"timezone", ShellCommandLineGetValue(Package, L"-s"));
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"timezone", ShellCommandLineGetValue (Package, L"-s"));
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
}
- } else if (ShellCommandLineGetFlag(Package, L"-l")) {
+ } else if (ShellCommandLineGetFlag (Package, L"-l")) {
//
// Print a list of all time zones
//
for ( LoopVar = 0
- ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0])
- ; LoopVar++
- ){
+ ; LoopVar < sizeof (TimeZoneList) / sizeof (TimeZoneList[0])
+ ; LoopVar++
+ )
+ {
ShellPrintHiiEx (-1, -1, NULL, TimeZoneList[LoopVar].StringId, gShellLevel2HiiHandle);
}
} else {
//
// Get Current Time Zone Info
//
- Status = gRT->GetTime(&TheTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"timezone", L"gRT->GetTime", Status);
+ Status = gRT->GetTime (&TheTime, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"timezone", L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) {
Found = FALSE;
for ( LoopVar = 0
- ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0])
- ; LoopVar++
- ){
+ ; LoopVar < sizeof (TimeZoneList) / sizeof (TimeZoneList[0])
+ ; LoopVar++
+ )
+ {
if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) {
- if (ShellCommandLineGetFlag(Package, L"-f")) {
+ if (ShellCommandLineGetFlag (Package, L"-f")) {
//
// Print all info about current time zone
//
@@ -894,40 +929,44 @@ ShellCommandRunTimeZone ( //
// Print basic info only
//
- TzMinutes = (ABS(TheTime.TimeZone)) % 60;
+ TzMinutes = (ABS (TheTime.TimeZone)) % 60;
ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_TIMEZONE_SIMPLE),
+ STRING_TOKEN (STR_TIMEZONE_SIMPLE),
gShellLevel2HiiHandle,
- (TheTime.TimeZone > 0?L"-":L"+"),
- (ABS(TheTime.TimeZone)) / 60,
- TzMinutes);
+ (TheTime.TimeZone > 0 ? L"-" : L"+"),
+ (ABS (TheTime.TimeZone)) / 60,
+ TzMinutes
+ );
}
+
Found = TRUE;
break;
}
}
+
if (!Found) {
//
// Print basic info only
//
- TzMinutes = (ABS(TheTime.TimeZone)) % 60;
+ TzMinutes = (ABS (TheTime.TimeZone)) % 60;
ShellPrintHiiEx (
-1,
-1,
NULL,
- STRING_TOKEN(STR_TIMEZONE_SIMPLE),
+ STRING_TOKEN (STR_TIMEZONE_SIMPLE),
gShellLevel2HiiHandle,
- (TheTime.TimeZone > 0?L"-":L"+"),
- (ABS(TheTime.TimeZone)) / 60,
- TzMinutes);
+ (TheTime.TimeZone > 0 ? L"-" : L"+"),
+ (ABS (TheTime.TimeZone)) / 60,
+ TzMinutes
+ );
- if (ShellCommandLineGetFlag(Package, L"-f")) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_TIMEZONE_NI), gShellLevel2HiiHandle);
+ if (ShellCommandLineGetFlag (Package, L"-f")) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TIMEZONE_NI), gShellLevel2HiiHandle);
}
}
} else {
@@ -936,9 +975,10 @@ ShellCommandRunTimeZone ( //
if (ShellCommandLineGetFlag (Package, L"-f")) {
for ( LoopVar = 0
- ; LoopVar < ARRAY_SIZE (TimeZoneList)
- ; LoopVar++
- ){
+ ; LoopVar < ARRAY_SIZE (TimeZoneList)
+ ; LoopVar++
+ )
+ {
if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) {
//
// Print all info about current time zone
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c index 69427637bb..794284d02e 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c @@ -28,15 +28,15 @@ **/
#include "UefiShellLevel2CommandsLib.h"
-CONST CHAR16 mFileName[] = L"ShellCommands";
-EFI_HII_HANDLE gShellLevel2HiiHandle = NULL;
+CONST CHAR16 mFileName[] = L"ShellCommands";
+EFI_HII_HANDLE gShellLevel2HiiHandle = NULL;
/**
Get the filename to get help text from if not using HII.
@retval The filename.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameLevel2 (
VOID
@@ -66,7 +66,7 @@ ShellLevel2CommandsLibConstructor ( //
// if shell level is less than 2 do nothing
//
- if (PcdGet8(PcdShellSupportLevel) < 2) {
+ if (PcdGet8 (PcdShellSupportLevel) < 2) {
return (EFI_SUCCESS);
}
@@ -78,48 +78,48 @@ ShellLevel2CommandsLibConstructor ( //
// install our shell command handlers that are always installed
//
- ShellCommandRegisterCommandName(L"attrib", ShellCommandRunAttrib , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_ATTRIB) );
- ShellCommandRegisterCommandName(L"cd", ShellCommandRunCd , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_CD) );
- ShellCommandRegisterCommandName(L"cp", ShellCommandRunCp , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_CP) );
- ShellCommandRegisterCommandName(L"load", ShellCommandRunLoad , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_LOAD) );
- ShellCommandRegisterCommandName(L"map", ShellCommandRunMap , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_MAP) );
- ShellCommandRegisterCommandName(L"mkdir", ShellCommandRunMkDir , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_MKDIR) );
- ShellCommandRegisterCommandName(L"mv", ShellCommandRunMv , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_MV) );
- ShellCommandRegisterCommandName(L"parse", ShellCommandRunParse , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_PARSE) );
- ShellCommandRegisterCommandName(L"reset", ShellCommandRunReset , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RESET) );
- ShellCommandRegisterCommandName(L"set", ShellCommandRunSet , ShellCommandGetManFileNameLevel2, 2, L"",FALSE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_SET) );
- ShellCommandRegisterCommandName(L"ls", ShellCommandRunLs , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_LS) );
- ShellCommandRegisterCommandName(L"rm", ShellCommandRunRm , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RM) );
- ShellCommandRegisterCommandName(L"vol", ShellCommandRunVol , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_VOL) );
+ ShellCommandRegisterCommandName (L"attrib", ShellCommandRunAttrib, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_ATTRIB));
+ ShellCommandRegisterCommandName (L"cd", ShellCommandRunCd, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_CD));
+ ShellCommandRegisterCommandName (L"cp", ShellCommandRunCp, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_CP));
+ ShellCommandRegisterCommandName (L"load", ShellCommandRunLoad, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_LOAD));
+ ShellCommandRegisterCommandName (L"map", ShellCommandRunMap, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_MAP));
+ ShellCommandRegisterCommandName (L"mkdir", ShellCommandRunMkDir, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_MKDIR));
+ ShellCommandRegisterCommandName (L"mv", ShellCommandRunMv, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_MV));
+ ShellCommandRegisterCommandName (L"parse", ShellCommandRunParse, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_PARSE));
+ ShellCommandRegisterCommandName (L"reset", ShellCommandRunReset, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_RESET));
+ ShellCommandRegisterCommandName (L"set", ShellCommandRunSet, ShellCommandGetManFileNameLevel2, 2, L"", FALSE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_SET));
+ ShellCommandRegisterCommandName (L"ls", ShellCommandRunLs, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_LS));
+ ShellCommandRegisterCommandName (L"rm", ShellCommandRunRm, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_RM));
+ ShellCommandRegisterCommandName (L"vol", ShellCommandRunVol, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_VOL));
//
// support for permanent (built in) aliases
//
- ShellCommandRegisterAlias(L"rm", L"del");
- ShellCommandRegisterAlias(L"ls", L"dir");
- ShellCommandRegisterAlias(L"cp", L"copy");
- ShellCommandRegisterAlias(L"mkdir", L"md");
- ShellCommandRegisterAlias(L"cd ..", L"cd..");
- ShellCommandRegisterAlias(L"cd \\", L"cd\\");
- ShellCommandRegisterAlias(L"mv", L"ren");
- ShellCommandRegisterAlias(L"mv", L"move");
- ShellCommandRegisterAlias(L"map", L"mount");
+ ShellCommandRegisterAlias (L"rm", L"del");
+ ShellCommandRegisterAlias (L"ls", L"dir");
+ ShellCommandRegisterAlias (L"cp", L"copy");
+ ShellCommandRegisterAlias (L"mkdir", L"md");
+ ShellCommandRegisterAlias (L"cd ..", L"cd..");
+ ShellCommandRegisterAlias (L"cd \\", L"cd\\");
+ ShellCommandRegisterAlias (L"mv", L"ren");
+ ShellCommandRegisterAlias (L"mv", L"move");
+ ShellCommandRegisterAlias (L"map", L"mount");
//
// These are installed in level 2 or 3...
//
- if (PcdGet8(PcdShellSupportLevel) == 2 || PcdGet8(PcdShellSupportLevel) == 3) {
- ShellCommandRegisterCommandName(L"date", ShellCommandRunDate , ShellCommandGetManFileNameLevel2, PcdGet8(PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_DATE) );
- ShellCommandRegisterCommandName(L"time", ShellCommandRunTime , ShellCommandGetManFileNameLevel2, PcdGet8(PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_TIME) );
- ShellCommandRegisterCommandName(L"timezone", ShellCommandRunTimeZone, ShellCommandGetManFileNameLevel2, PcdGet8(PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_TIMEZONE));
+ if ((PcdGet8 (PcdShellSupportLevel) == 2) || (PcdGet8 (PcdShellSupportLevel) == 3)) {
+ ShellCommandRegisterCommandName (L"date", ShellCommandRunDate, ShellCommandGetManFileNameLevel2, PcdGet8 (PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_DATE));
+ ShellCommandRegisterCommandName (L"time", ShellCommandRunTime, ShellCommandGetManFileNameLevel2, PcdGet8 (PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_TIME));
+ ShellCommandRegisterCommandName (L"timezone", ShellCommandRunTimeZone, ShellCommandGetManFileNameLevel2, PcdGet8 (PcdShellSupportLevel), L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_TIMEZONE));
} else {
- DEBUG_CODE_BEGIN();
+ DEBUG_CODE_BEGIN ();
//
// we want to be able to test these so install them under a different name in debug mode...
//
- ShellCommandRegisterCommandName(L"l2date", ShellCommandRunDate , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_DATE) );
- ShellCommandRegisterCommandName(L"l2time", ShellCommandRunTime , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_TIME) );
- ShellCommandRegisterCommandName(L"l2timezone", ShellCommandRunTimeZone, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_TIMEZONE));
- DEBUG_CODE_END();
+ ShellCommandRegisterCommandName (L"l2date", ShellCommandRunDate, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_DATE));
+ ShellCommandRegisterCommandName (L"l2time", ShellCommandRunTime, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_TIME));
+ ShellCommandRegisterCommandName (L"l2timezone", ShellCommandRunTimeZone, ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN (STR_GET_HELP_TIMEZONE));
+ DEBUG_CODE_END ();
}
return (EFI_SUCCESS);
@@ -141,8 +141,9 @@ ShellLevel2CommandsLibDestructor ( )
{
if (gShellLevel2HiiHandle != NULL) {
- HiiRemovePackages(gShellLevel2HiiHandle);
+ HiiRemovePackages (gShellLevel2HiiHandle);
}
+
return (EFI_SUCCESS);
}
@@ -162,40 +163,41 @@ ShellLevel2CommandsLibDestructor ( @retval NULL A fully qualified path could not be discovered.
@retval other An allocated pointer to a fuly qualified path.
**/
-CHAR16*
-GetFullyQualifiedPath(
- IN CONST CHAR16* Path
+CHAR16 *
+GetFullyQualifiedPath (
+ IN CONST CHAR16 *Path
)
{
CHAR16 *PathToReturn;
UINTN Size;
CONST CHAR16 *CurDir;
- PathToReturn = NULL;
- Size = 0;
+ PathToReturn = NULL;
+ Size = 0;
- ASSERT((PathToReturn == NULL && Size == 0) || (PathToReturn != NULL));
+ ASSERT ((PathToReturn == NULL && Size == 0) || (PathToReturn != NULL));
//
// convert a local path to an absolute path
//
- if (StrStr(Path, L":") == NULL) {
- CurDir = gEfiShellProtocol->GetCurDir(NULL);
- StrnCatGrow(&PathToReturn, &Size, CurDir, 0);
- StrnCatGrow(&PathToReturn, &Size, L"\\", 0);
+ if (StrStr (Path, L":") == NULL) {
+ CurDir = gEfiShellProtocol->GetCurDir (NULL);
+ StrnCatGrow (&PathToReturn, &Size, CurDir, 0);
+ StrnCatGrow (&PathToReturn, &Size, L"\\", 0);
if (*Path == L'\\') {
Path++;
}
}
- StrnCatGrow(&PathToReturn, &Size, Path, 0);
- PathCleanUpDirectories(PathToReturn);
+ StrnCatGrow (&PathToReturn, &Size, Path, 0);
+
+ PathCleanUpDirectories (PathToReturn);
if (PathToReturn == NULL) {
return NULL;
}
- while (PathToReturn[StrLen(PathToReturn)-1] == L'*') {
- PathToReturn[StrLen(PathToReturn)-1] = CHAR_NULL;
+ while (PathToReturn[StrLen (PathToReturn)-1] == L'*') {
+ PathToReturn[StrLen (PathToReturn)-1] = CHAR_NULL;
}
return (PathToReturn);
@@ -210,46 +212,47 @@ GetFullyQualifiedPath( **/
EFI_STATUS
VerifyIntermediateDirectories (
- IN CONST CHAR16 *Path
+ IN CONST CHAR16 *Path
)
{
- EFI_STATUS Status;
- CHAR16 *PathCopy;
- CHAR16 *TempSpot;
- SHELL_FILE_HANDLE FileHandle;
+ EFI_STATUS Status;
+ CHAR16 *PathCopy;
+ CHAR16 *TempSpot;
+ SHELL_FILE_HANDLE FileHandle;
- ASSERT(Path != NULL);
+ ASSERT (Path != NULL);
- Status = EFI_SUCCESS;
- PathCopy = NULL;
- PathCopy = StrnCatGrow(&PathCopy, NULL, Path, 0);
- FileHandle = NULL;
+ Status = EFI_SUCCESS;
+ PathCopy = NULL;
+ PathCopy = StrnCatGrow (&PathCopy, NULL, Path, 0);
+ FileHandle = NULL;
if (PathCopy == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- for (TempSpot = &PathCopy[StrLen(PathCopy)-1] ; *TempSpot != CHAR_NULL && *TempSpot != L'\\' ; TempSpot = &PathCopy[StrLen(PathCopy)-1]){
+ for (TempSpot = &PathCopy[StrLen (PathCopy)-1]; *TempSpot != CHAR_NULL && *TempSpot != L'\\'; TempSpot = &PathCopy[StrLen (PathCopy)-1]) {
*TempSpot = CHAR_NULL;
}
+
if (*TempSpot == L'\\') {
*TempSpot = CHAR_NULL;
}
- if (PathCopy != NULL && *PathCopy != CHAR_NULL) {
- Status = VerifyIntermediateDirectories(PathCopy);
+ if ((PathCopy != NULL) && (*PathCopy != CHAR_NULL)) {
+ Status = VerifyIntermediateDirectories (PathCopy);
- if (PathCopy[StrLen(PathCopy)-1] != L':') {
- if (!EFI_ERROR(Status)) {
- Status = ShellOpenFileByName(PathCopy, &FileHandle, EFI_FILE_MODE_READ, 0);
+ if (PathCopy[StrLen (PathCopy)-1] != L':') {
+ if (!EFI_ERROR (Status)) {
+ Status = ShellOpenFileByName (PathCopy, &FileHandle, EFI_FILE_MODE_READ, 0);
if (FileHandle != NULL) {
- ShellCloseFile(&FileHandle);
+ ShellCloseFile (&FileHandle);
}
}
}
}
- SHELL_FREE_NON_NULL(PathCopy);
+ SHELL_FREE_NON_NULL (PathCopy);
return (Status);
}
@@ -266,17 +269,17 @@ VerifyIntermediateDirectories ( **/
INTN
-StrniCmp(
- IN CONST CHAR16 *Source,
- IN CONST CHAR16 *Target,
- IN CONST UINTN Count
+StrniCmp (
+ IN CONST CHAR16 *Source,
+ IN CONST CHAR16 *Target,
+ IN CONST UINTN Count
)
{
- CHAR16 *SourceCopy;
- CHAR16 *TargetCopy;
- UINTN SourceLength;
- UINTN TargetLength;
- INTN Result;
+ CHAR16 *SourceCopy;
+ CHAR16 *TargetCopy;
+ UINTN SourceLength;
+ UINTN TargetLength;
+ INTN Result;
if (Count == 0) {
return 0;
@@ -286,10 +289,11 @@ StrniCmp( TargetLength = StrLen (Target);
SourceLength = MIN (SourceLength, Count);
TargetLength = MIN (TargetLength, Count);
- SourceCopy = AllocateCopyPool ((SourceLength + 1) * sizeof (CHAR16), Source);
+ SourceCopy = AllocateCopyPool ((SourceLength + 1) * sizeof (CHAR16), Source);
if (SourceCopy == NULL) {
return -1;
}
+
TargetCopy = AllocateCopyPool ((TargetLength + 1) * sizeof (CHAR16), Target);
if (TargetCopy == NULL) {
FreePool (SourceCopy);
@@ -298,13 +302,12 @@ StrniCmp( SourceCopy[SourceLength] = L'\0';
TargetCopy[TargetLength] = L'\0';
- Result = gUnicodeCollation->StriColl (gUnicodeCollation, SourceCopy, TargetCopy);
+ Result = gUnicodeCollation->StriColl (gUnicodeCollation, SourceCopy, TargetCopy);
FreePool (SourceCopy);
FreePool (TargetCopy);
return Result;
}
-
/**
Cleans off all the quotes in the string.
@@ -317,13 +320,13 @@ StrniCmp( **/
EFI_STATUS
ShellLevel2StripQuotes (
- IN CONST CHAR16 *OriginalString,
- OUT CHAR16 **CleanString
+ IN CONST CHAR16 *OriginalString,
+ OUT CHAR16 **CleanString
)
{
- CHAR16 *Walker;
+ CHAR16 *Walker;
- if (OriginalString == NULL || CleanString == NULL) {
+ if ((OriginalString == NULL) || (CleanString == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -332,13 +335,11 @@ ShellLevel2StripQuotes ( return EFI_OUT_OF_RESOURCES;
}
- for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL ; Walker++) {
+ for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL; Walker++) {
if (*Walker == L'\"') {
- CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0]));
+ CopyMem (Walker, Walker+1, StrSize (Walker) - sizeof (Walker[0]));
}
}
return EFI_SUCCESS;
}
-
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h index 426b6490f4..7c525b31d0 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h @@ -42,8 +42,8 @@ #include <Library/SortLib.h>
#include <Library/FileHandleLib.h>
-extern CONST CHAR16 mFileName[];
-extern EFI_HII_HANDLE gShellLevel2HiiHandle;
+extern CONST CHAR16 mFileName[];
+extern EFI_HII_HANDLE gShellLevel2HiiHandle;
/**
Function for 'attrib' command.
@@ -256,9 +256,9 @@ ShellCommandRunMv ( @retval NULL a fully qualified path could not be discovered.
@retval other pointer to a fuly qualified path.
**/
-CHAR16*
-GetFullyQualifiedPath(
- IN CONST CHAR16* Path
+CHAR16 *
+GetFullyQualifiedPath (
+ IN CONST CHAR16 *Path
);
/**
@@ -270,7 +270,7 @@ GetFullyQualifiedPath( **/
EFI_STATUS
VerifyIntermediateDirectories (
- IN CONST CHAR16 *Path
+ IN CONST CHAR16 *Path
);
/**
@@ -285,10 +285,10 @@ VerifyIntermediateDirectories ( **/
INTN
-StrniCmp(
- IN CONST CHAR16 *Source,
- IN CONST CHAR16 *Target,
- IN CONST UINTN Count
+StrniCmp (
+ IN CONST CHAR16 *Source,
+ IN CONST CHAR16 *Target,
+ IN CONST UINTN Count
);
/**
@@ -303,8 +303,8 @@ StrniCmp( **/
EFI_STATUS
ShellLevel2StripQuotes (
- IN CONST CHAR16 *OriginalString,
- OUT CHAR16 **CleanString
+ IN CONST CHAR16 *OriginalString,
+ OUT CHAR16 **CleanString
);
/**
@@ -334,12 +334,12 @@ ShellCommandRunVol ( @retval SHELL_SUCCESS The source file was copied to the destination
**/
SHELL_STATUS
-CopySingleFile(
- IN CONST CHAR16 *Source,
- IN CONST CHAR16 *Dest,
- OUT VOID **Resp,
- IN BOOLEAN SilentMode,
- IN CONST CHAR16 *CmdName
+CopySingleFile (
+ IN CONST CHAR16 *Source,
+ IN CONST CHAR16 *Dest,
+ OUT VOID **Resp,
+ IN BOOLEAN SilentMode,
+ IN CONST CHAR16 *CmdName
);
/**
@@ -354,10 +354,9 @@ CopySingleFile( @retval SHELL_DEVICE_ERROR A device error occurred reading this Node.
**/
SHELL_STATUS
-CascadeDelete(
+CascadeDelete (
IN EFI_SHELL_FILE_INFO *Node,
IN CONST BOOLEAN Quiet
);
#endif
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c index 2ed97666b9..8f7310c074 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c @@ -21,10 +21,10 @@ @retval SHELL_SUCCESS The operation was sucessful.
**/
SHELL_STATUS
-HandleVol(
- IN CONST CHAR16 *Path,
- IN CONST BOOLEAN Delete,
- IN CONST CHAR16 *Name OPTIONAL
+HandleVol (
+ IN CONST CHAR16 *Path,
+ IN CONST BOOLEAN Delete,
+ IN CONST CHAR16 *Name OPTIONAL
)
{
EFI_STATUS Status;
@@ -36,38 +36,40 @@ HandleVol( UINTN Size1;
UINTN Size2;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
if (
- Name != NULL && (
- StrStr(Name, L"%") != NULL ||
- StrStr(Name, L"^") != NULL ||
- StrStr(Name, L"*") != NULL ||
- StrStr(Name, L"+") != NULL ||
- StrStr(Name, L"=") != NULL ||
- StrStr(Name, L"[") != NULL ||
- StrStr(Name, L"]") != NULL ||
- StrStr(Name, L"|") != NULL ||
- StrStr(Name, L":") != NULL ||
- StrStr(Name, L";") != NULL ||
- StrStr(Name, L"\"") != NULL ||
- StrStr(Name, L"<") != NULL ||
- StrStr(Name, L">") != NULL ||
- StrStr(Name, L"?") != NULL ||
- StrStr(Name, L"/") != NULL ||
- StrStr(Name, L" ") != NULL )
- ){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"vol", Name);
+ (Name != NULL) && (
+ (StrStr (Name, L"%") != NULL) ||
+ (StrStr (Name, L"^") != NULL) ||
+ (StrStr (Name, L"*") != NULL) ||
+ (StrStr (Name, L"+") != NULL) ||
+ (StrStr (Name, L"=") != NULL) ||
+ (StrStr (Name, L"[") != NULL) ||
+ (StrStr (Name, L"]") != NULL) ||
+ (StrStr (Name, L"|") != NULL) ||
+ (StrStr (Name, L":") != NULL) ||
+ (StrStr (Name, L";") != NULL) ||
+ (StrStr (Name, L"\"") != NULL) ||
+ (StrStr (Name, L"<") != NULL) ||
+ (StrStr (Name, L">") != NULL) ||
+ (StrStr (Name, L"?") != NULL) ||
+ (StrStr (Name, L"/") != NULL) ||
+ (StrStr (Name, L" ") != NULL))
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"vol", Name);
return (SHELL_INVALID_PARAMETER);
}
- Status = gEfiShellProtocol->OpenFileByName(
- Path,
- &ShellFileHandle,
- Name != NULL?EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE:EFI_FILE_MODE_READ);
+ Status = gEfiShellProtocol->OpenFileByName (
+ Path,
+ &ShellFileHandle,
+ Name != NULL ? EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE : EFI_FILE_MODE_READ
+ );
- if (EFI_ERROR(Status) || ShellFileHandle == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"vol", Path);
+ if (EFI_ERROR (Status) || (ShellFileHandle == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, L"vol", Path);
return (SHELL_ACCESS_DENIED);
}
@@ -76,86 +78,94 @@ HandleVol( //
SysInfo = NULL;
SysInfoSize = 0;
- EfiFpHandle = ConvertShellHandleToEfiFileProtocol(ShellFileHandle);
- Status = EfiFpHandle->GetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo);
+ EfiFpHandle = ConvertShellHandleToEfiFileProtocol (ShellFileHandle);
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- SysInfo = AllocateZeroPool(SysInfoSize);
- Status = EfiFpHandle->GetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo);
+ SysInfo = AllocateZeroPool (SysInfoSize);
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
}
- ASSERT(SysInfo != NULL);
+ ASSERT (SysInfo != NULL);
if (Delete) {
- *((CHAR16 *) SysInfo->VolumeLabel) = CHAR_NULL;
- SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize(SysInfo->VolumeLabel);
- Status = EfiFpHandle->SetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- (UINTN)SysInfo->Size,
- SysInfo);
+ *((CHAR16 *)SysInfo->VolumeLabel) = CHAR_NULL;
+ SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (SysInfo->VolumeLabel);
+ Status = EfiFpHandle->SetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ (UINTN)SysInfo->Size,
+ SysInfo
+ );
} else if (Name != NULL) {
- Size1 = StrSize(Name);
- Size2 = StrSize(SysInfo->VolumeLabel);
+ Size1 = StrSize (Name);
+ Size2 = StrSize (SysInfo->VolumeLabel);
if (Size1 > Size2) {
- SysInfo = ReallocatePool((UINTN)SysInfo->Size, (UINTN)SysInfo->Size + Size1 - Size2, SysInfo);
+ SysInfo = ReallocatePool ((UINTN)SysInfo->Size, (UINTN)SysInfo->Size + Size1 - Size2, SysInfo);
if (SysInfo == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"vol");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"vol");
ShellStatus = SHELL_OUT_OF_RESOURCES;
}
}
+
if (SysInfo != NULL) {
- StrCpyS ( (CHAR16 *) SysInfo->VolumeLabel,
- (Size1>Size2? Size1/sizeof(CHAR16) : Size2/sizeof(CHAR16)),
- Name
- );
+ StrCpyS (
+ (CHAR16 *)SysInfo->VolumeLabel,
+ (Size1 > Size2 ? Size1/sizeof (CHAR16) : Size2/sizeof (CHAR16)),
+ Name
+ );
SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + Size1;
- Status = EfiFpHandle->SetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- (UINTN)SysInfo->Size,
- SysInfo);
+ Status = EfiFpHandle->SetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ (UINTN)SysInfo->Size,
+ SysInfo
+ );
}
}
- FreePool(SysInfo);
+ FreePool (SysInfo);
- if (Delete || Name != NULL) {
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"vol", Path);
+ if (Delete || (Name != NULL)) {
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_AD), gShellLevel2HiiHandle, L"vol", Path);
ShellStatus = SHELL_ACCESS_DENIED;
}
}
SysInfoSize = 0;
- SysInfo = NULL;
+ SysInfo = NULL;
- Status = EfiFpHandle->GetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo);
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
- SysInfo = AllocateZeroPool(SysInfoSize);
- Status = EfiFpHandle->GetInfo(
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo);
+ SysInfo = AllocateZeroPool (SysInfoSize);
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
}
- gEfiShellProtocol->CloseFile(ShellFileHandle);
+ gEfiShellProtocol->CloseFile (ShellFileHandle);
- ASSERT(SysInfo != NULL);
+ ASSERT (SysInfo != NULL);
if (SysInfo != NULL) {
//
@@ -168,22 +178,22 @@ HandleVol( STRING_TOKEN (STR_VOL_VOLINFO),
gShellLevel2HiiHandle,
SysInfo->VolumeLabel,
- SysInfo->ReadOnly?L"r":L"rw",
+ SysInfo->ReadOnly ? L"r" : L"rw",
SysInfo->VolumeSize,
SysInfo->FreeSpace,
SysInfo->BlockSize
- );
- SHELL_FREE_NON_NULL(SysInfo);
+ );
+ SHELL_FREE_NON_NULL (SysInfo);
}
return (ShellStatus);
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-d", TypeFlag},
- {L"-n", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-d", TypeFlag },
+ { L"-n", TypeValue },
+ { NULL, TypeMax }
+};
/**
Function for 'Vol' command.
@@ -210,93 +220,96 @@ ShellCommandRunVol ( UINTN Length;
CONST CHAR16 *NewName;
- Length = 0;
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- PathName = NULL;
- CurDir = NULL;
- FullPath = NULL;
+ Length = 0;
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ PathName = NULL;
+ CurDir = NULL;
+ FullPath = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// Fix local copies of the protocol pointers
//
- 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), gShellLevel2HiiHandle, L"vol", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"vol", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
- if (ShellCommandLineGetCount(Package) > 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"vol");
+ if (ShellCommandLineGetCount (Package) > 2) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"vol");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- PathName = ShellCommandLineGetRawValue(Package, 1);
+ PathName = ShellCommandLineGetRawValue (Package, 1);
if (PathName == NULL) {
- CurDir = gEfiShellProtocol->GetCurDir(NULL);
+ CurDir = gEfiShellProtocol->GetCurDir (NULL);
if (CurDir == NULL) {
ShellStatus = SHELL_NOT_FOUND;
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"vol");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"vol");
} else {
PathName = CurDir;
}
}
+
if (PathName != NULL) {
- TempSpot = StrStr(PathName, L":");
+ TempSpot = StrStr (PathName, L":");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
- TempSpot = StrStr(PathName, L"\\");
+
+ TempSpot = StrStr (PathName, L"\\");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
- StrnCatGrow(&FullPath, &Length, PathName, 0);
- StrnCatGrow(&FullPath, &Length, L":\\", 0);
- DeleteMode = ShellCommandLineGetFlag(Package, L"-d");
- NewName = ShellCommandLineGetValue(Package, L"-n");
- if (DeleteMode && ShellCommandLineGetFlag(Package, L"-n")) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellLevel2HiiHandle, L"vol", L"-d", L"-n");
+
+ StrnCatGrow (&FullPath, &Length, PathName, 0);
+ StrnCatGrow (&FullPath, &Length, L":\\", 0);
+ DeleteMode = ShellCommandLineGetFlag (Package, L"-d");
+ NewName = ShellCommandLineGetValue (Package, L"-n");
+ if (DeleteMode && ShellCommandLineGetFlag (Package, L"-n")) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellLevel2HiiHandle, L"vol", L"-d", L"-n");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetFlag(Package, L"-n") && NewName == NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"vol", L"-n");
+ } else if (ShellCommandLineGetFlag (Package, L"-n") && (NewName == NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"vol", L"-n");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (NewName != NULL && StrLen(NewName) > 11) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"vol", NewName, L"-n");
+ } else if ((NewName != NULL) && (StrLen (NewName) > 11)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"vol", NewName, L"-n");
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellStatus == SHELL_SUCCESS) {
- ShellStatus = HandleVol(
- FullPath,
- DeleteMode,
- NewName
- );
+ ShellStatus = HandleVol (
+ FullPath,
+ DeleteMode,
+ NewName
+ );
}
}
}
}
- SHELL_FREE_NON_NULL(FullPath);
+ SHELL_FREE_NON_NULL (FullPath);
//
// free the command line package
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c index 70f7f28b1d..5a8a21aac7 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c @@ -20,15 +20,15 @@ @retval SHELL_SUCCESS the printout was sucessful
**/
SHELL_STATUS
-PrintSingleShellAlias(
- IN CONST CHAR16 *Alias
+PrintSingleShellAlias (
+ IN CONST CHAR16 *Alias
)
{
- CONST CHAR16 *ConstAliasVal;
- SHELL_STATUS ShellStatus;
- BOOLEAN Volatile;
+ CONST CHAR16 *ConstAliasVal;
+ SHELL_STATUS ShellStatus;
+ BOOLEAN Volatile;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
ConstAliasVal = gEfiShellProtocol->GetAlias (Alias, &Volatile);
if (ConstAliasVal == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"alias", Alias);
@@ -37,8 +37,10 @@ PrintSingleShellAlias( if (ShellCommandIsOnAliasList (Alias)) {
Volatile = FALSE;
}
+
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_ALIAS_OUTPUT), gShellLevel3HiiHandle, !Volatile ? L' ' : L'*', Alias, ConstAliasVal);
}
+
return ShellStatus;
}
@@ -49,35 +51,38 @@ PrintSingleShellAlias( @return any return code from GetNextVariableName except EFI_NOT_FOUND
**/
SHELL_STATUS
-PrintAllShellAlias(
+PrintAllShellAlias (
VOID
)
{
- CONST CHAR16 *ConstAllAliasList;
- CHAR16 *Alias;
- CHAR16 *Walker;
+ CONST CHAR16 *ConstAllAliasList;
+ CHAR16 *Alias;
+ CHAR16 *Walker;
- ConstAllAliasList = gEfiShellProtocol->GetAlias(NULL, NULL);
+ ConstAllAliasList = gEfiShellProtocol->GetAlias (NULL, NULL);
if (ConstAllAliasList == NULL) {
return (SHELL_SUCCESS);
}
- Alias = AllocateZeroPool(StrSize(ConstAllAliasList));
+
+ Alias = AllocateZeroPool (StrSize (ConstAllAliasList));
if (Alias == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- Walker = (CHAR16*)ConstAllAliasList;
+
+ Walker = (CHAR16 *)ConstAllAliasList;
do {
- CopyMem(Alias, Walker, StrSize(Walker));
- Walker = StrStr(Alias, L";");
+ CopyMem (Alias, Walker, StrSize (Walker));
+ Walker = StrStr (Alias, L";");
if (Walker != NULL) {
Walker[0] = CHAR_NULL;
- Walker = Walker + 1;
+ Walker = Walker + 1;
}
- PrintSingleShellAlias(Alias);
+
+ PrintSingleShellAlias (Alias);
} while (Walker != NULL && Walker[0] != CHAR_NULL);
- FreePool(Alias);
+ FreePool (Alias);
return (SHELL_SUCCESS);
}
@@ -104,19 +109,19 @@ PrintAllShellAlias( @retval SHELL_DEVICE_ERROR Command is null or the empty string.
**/
SHELL_STATUS
-ShellLevel3CommandsLibSetAlias(
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Alias,
- IN BOOLEAN Replace,
- IN BOOLEAN Volatile
+ShellLevel3CommandsLibSetAlias (
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias,
+ IN BOOLEAN Replace,
+ IN BOOLEAN Volatile
)
{
- SHELL_STATUS ShellStatus;
- EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
ShellStatus = SHELL_SUCCESS;
- Status = gEfiShellProtocol->SetAlias (Command, Alias, Replace, Volatile);
- if (EFI_ERROR(Status)) {
+ Status = gEfiShellProtocol->SetAlias (Command, Alias, Replace, Volatile);
+ if (EFI_ERROR (Status)) {
if (Status == EFI_ACCESS_DENIED) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle, L"alias");
ShellStatus = SHELL_ACCESS_DENIED;
@@ -128,14 +133,15 @@ ShellLevel3CommandsLibSetAlias( ShellStatus = SHELL_DEVICE_ERROR;
}
}
+
return ShellStatus;
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-v", TypeFlag},
- {L"-d", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-v", TypeFlag },
+ { L"-d", TypeValue },
+ { NULL, TypeMax }
+};
/**
Function for 'alias' command.
@@ -150,59 +156,59 @@ ShellCommandRunAlias ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Param1;
- CONST CHAR16 *Param2;
- CONST CHAR16 *ParamStrD;
- CHAR16 *CleanParam2;
- BOOLEAN DeleteFlag;
- BOOLEAN VolatileFlag;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- CleanParam2 = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Param1;
+ CONST CHAR16 *Param2;
+ CONST CHAR16 *ParamStrD;
+ CHAR16 *CleanParam2;
+ BOOLEAN DeleteFlag;
+ BOOLEAN VolatileFlag;
+
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ CleanParam2 = NULL;
//
// 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), gShellLevel3HiiHandle, L"alias", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"alias", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- Param1 = ShellCommandLineGetRawValue(Package, 1);
- Param2 = ShellCommandLineGetRawValue(Package, 2);
+ Param1 = ShellCommandLineGetRawValue (Package, 1);
+ Param2 = ShellCommandLineGetRawValue (Package, 2);
DeleteFlag = ShellCommandLineGetFlag (Package, L"-d");
VolatileFlag = ShellCommandLineGetFlag (Package, L"-v");
if (Param2 != NULL) {
- CleanParam2 = AllocateCopyPool (StrSize(Param2), Param2);
+ CleanParam2 = AllocateCopyPool (StrSize (Param2), Param2);
if (CleanParam2 == NULL) {
ShellCommandLineFreeVarList (Package);
return SHELL_OUT_OF_RESOURCES;
}
- if (CleanParam2[0] == L'\"' && CleanParam2[StrLen(CleanParam2)-1] == L'\"') {
- CleanParam2[StrLen(CleanParam2)-1] = L'\0';
- CopyMem (CleanParam2, CleanParam2 + 1, StrSize(CleanParam2) - sizeof(CleanParam2[0]));
+ if ((CleanParam2[0] == L'\"') && (CleanParam2[StrLen (CleanParam2)-1] == L'\"')) {
+ CleanParam2[StrLen (CleanParam2)-1] = L'\0';
+ CopyMem (CleanParam2, CleanParam2 + 1, StrSize (CleanParam2) - sizeof (CleanParam2[0]));
}
}
@@ -231,7 +237,7 @@ ShellCommandRunAlias ( ShellStatus = SHELL_INVALID_PARAMETER;
}
} else if (DeleteFlag) {
- if (VolatileFlag || ShellCommandLineGetCount (Package) > 1) {
+ if (VolatileFlag || (ShellCommandLineGetCount (Package) > 1)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"alias");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
@@ -269,6 +275,7 @@ ShellCommandRunAlias ( ShellStatus = SHELL_INVALID_PARAMETER;
}
}
+
//
// free the command line package
//
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c index 446266dd89..8c0e232bc9 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c @@ -10,10 +10,10 @@ #include "UefiShellLevel3CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-sfo", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-sfo", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'cls' command.
@@ -40,35 +40,35 @@ ShellCommandRunCls ( //
// Initialize variables
//
- ShellStatus = SHELL_SUCCESS;
- ProblemParam = NULL;
- Background = 0;
- Foreground = 0;
+ ShellStatus = SHELL_SUCCESS;
+ ProblemParam = NULL;
+ Background = 0;
+ Foreground = 0;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ 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), gShellLevel3HiiHandle, L"cls", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"cls", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
} else if (ShellCommandLineGetFlag (Package, L"-sfo")) {
if (ShellCommandLineGetCount (Package) > 1) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"cls");
@@ -95,7 +95,7 @@ ShellCommandRunCls ( BackColorStr = ShellCommandLineGetRawValue (Package, 1);
ForeColorStr = ShellCommandLineGetRawValue (Package, 2);
- if (BackColorStr == NULL && ForeColorStr == NULL) {
+ if ((BackColorStr == NULL) && (ForeColorStr == NULL)) {
//
// clear screen
//
@@ -211,6 +211,7 @@ ShellCommandRunCls ( }
}
}
+
//
// free the command line package
//
@@ -221,4 +222,3 @@ ShellCommandRunCls ( //
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c index 9bab8ef65d..a055a06a91 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c @@ -11,11 +11,11 @@ #include <Library/ShellLib.h>
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-on", TypeFlag},
- {L"-off", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-on", TypeFlag },
+ { L"-off", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'echo' command.
@@ -30,78 +30,81 @@ ShellCommandRunEcho ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- CHAR16 *ProblemParam;
- UINTN Size;
- CHAR16 *PrintString;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamCount;
+ CHAR16 *ProblemParam;
+ UINTN Size;
+ CHAR16 *PrintString;
- Size = 0;
- ProblemParam = NULL;
- PrintString = NULL;
- ShellStatus = SHELL_SUCCESS;
+ Size = 0;
+ ProblemParam = NULL;
+ PrintString = NULL;
+ ShellStatus = SHELL_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParseEx (ParamList, &Package, &ProblemParam, TRUE, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"echo", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"echo", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
- if (ShellCommandLineGetFlag(Package, L"-on")) {
+
+ if (ShellCommandLineGetFlag (Package, L"-on")) {
//
// Turn it on
//
- ShellCommandSetEchoState(TRUE);
- } else if (ShellCommandLineGetFlag(Package, L"-off")) {
+ ShellCommandSetEchoState (TRUE);
+ } else if (ShellCommandLineGetFlag (Package, L"-off")) {
//
// turn it off
//
- ShellCommandSetEchoState(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
+ ShellCommandSetEchoState (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
//
// output its current state
//
- if (ShellCommandGetEchoState()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ECHO_ON), gShellLevel3HiiHandle);
+ if (ShellCommandGetEchoState ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_ECHO_ON), gShellLevel3HiiHandle);
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ECHO_OFF), gShellLevel3HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_ECHO_OFF), gShellLevel3HiiHandle);
}
} else {
//
// print the line
//
for ( ParamCount = 1
- ; ShellCommandLineGetRawValue(Package, ParamCount) != NULL
- ; ParamCount++
- ) {
- StrnCatGrow(&PrintString, &Size, ShellCommandLineGetRawValue(Package, ParamCount), 0);
- if (ShellCommandLineGetRawValue(Package, ParamCount+1) != NULL) {
- StrnCatGrow(&PrintString, &Size, L" ", 0);
+ ; ShellCommandLineGetRawValue (Package, ParamCount) != NULL
+ ; ParamCount++
+ )
+ {
+ StrnCatGrow (&PrintString, &Size, ShellCommandLineGetRawValue (Package, ParamCount), 0);
+ if (ShellCommandLineGetRawValue (Package, ParamCount+1) != NULL) {
+ StrnCatGrow (&PrintString, &Size, L" ", 0);
}
}
- ShellPrintEx(-1, -1, L"%s\r\n", PrintString);
- SHELL_FREE_NON_NULL(PrintString);
+
+ ShellPrintEx (-1, -1, L"%s\r\n", PrintString);
+ SHELL_FREE_NON_NULL (PrintString);
}
//
@@ -112,4 +115,3 @@ ShellCommandRunEcho ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c index 7a76d11938..f3c91cede3 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c @@ -24,52 +24,52 @@ ShellCommandRunGetMtc ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINT64 Mtc;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINT64 Mtc;
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ 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), gShellLevel3HiiHandle, L"getmtc", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"getmtc", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"getmtc");
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 1) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"getmtc");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// Get the monotonic counter count
//
- Status = gBS->GetNextMonotonicCount(&Mtc);
+ Status = gBS->GetNextMonotonicCount (&Mtc);
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_DEVICE_ERROR;
}
@@ -77,9 +77,10 @@ ShellCommandRunGetMtc ( // print it...
//
if (ShellStatus == SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GET_MTC_OUTPUT), gShellLevel3HiiHandle, Mtc);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GET_MTC_OUTPUT), gShellLevel3HiiHandle, Mtc);
}
}
+
//
// free the command line package
//
@@ -88,4 +89,3 @@ ShellCommandRunGetMtc ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c index c22c3356f3..7f146bb9fb 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c @@ -31,64 +31,65 @@ @retval EFI_SUCCESS the operation was successful.
**/
EFI_STATUS
-LexicalInsertIntoList(
- IN OUT CHAR16 **DestList,
- IN OUT UINTN *DestSize,
- IN CONST CHAR16 *Item
+LexicalInsertIntoList (
+ IN OUT CHAR16 **DestList,
+ IN OUT UINTN *DestSize,
+ IN CONST CHAR16 *Item
)
{
- CHAR16 *NewList;
- INTN LexicalMatchValue;
- CHAR16 *LexicalSpot;
- UINTN SizeOfAddedNameInBytes;
+ CHAR16 *NewList;
+ INTN LexicalMatchValue;
+ CHAR16 *LexicalSpot;
+ UINTN SizeOfAddedNameInBytes;
//
// If there are none, then just return with success
//
- if (Item == NULL || *Item == CHAR_NULL || StrLen(Item)==0) {
+ if ((Item == NULL) || (*Item == CHAR_NULL) || (StrLen (Item) == 0)) {
return (EFI_SUCCESS);
}
NewList = *DestList;
- SizeOfAddedNameInBytes = StrSize(Item);
- NewList = ReallocatePool(*DestSize, (*DestSize) + SizeOfAddedNameInBytes, NewList);
- (*DestSize) = (*DestSize) + SizeOfAddedNameInBytes;
+ SizeOfAddedNameInBytes = StrSize (Item);
+ NewList = ReallocatePool (*DestSize, (*DestSize) + SizeOfAddedNameInBytes, NewList);
+ (*DestSize) = (*DestSize) + SizeOfAddedNameInBytes;
//
// Find the correct spot in the list
//
for (LexicalSpot = NewList
- ; LexicalSpot != NULL && LexicalSpot < NewList + (*DestSize)
- ; LexicalSpot += StrLen(LexicalSpot) + 1
- ) {
+ ; LexicalSpot != NULL && LexicalSpot < NewList + (*DestSize)
+ ; LexicalSpot += StrLen (LexicalSpot) + 1
+ )
+ {
//
// Get Lexical Comparison Value between PrevCommand and Command list entry
//
LexicalMatchValue = gUnicodeCollation->StriColl (
- gUnicodeCollation,
- (CHAR16 *)LexicalSpot,
- (CHAR16 *)Item
- );
+ gUnicodeCollation,
+ (CHAR16 *)LexicalSpot,
+ (CHAR16 *)Item
+ );
//
// The new item goes before this one.
//
- if (LexicalMatchValue > 0 || StrLen(LexicalSpot) == 0) {
- if (StrLen(LexicalSpot) != 0) {
+ if ((LexicalMatchValue > 0) || (StrLen (LexicalSpot) == 0)) {
+ if (StrLen (LexicalSpot) != 0) {
//
// Move this and all other items out of the way
//
- CopyMem(
- LexicalSpot + (SizeOfAddedNameInBytes/sizeof(CHAR16)),
+ CopyMem (
+ LexicalSpot + (SizeOfAddedNameInBytes/sizeof (CHAR16)),
LexicalSpot,
- (*DestSize) - SizeOfAddedNameInBytes - ((LexicalSpot - NewList) * sizeof(CHAR16))
+ (*DestSize) - SizeOfAddedNameInBytes - ((LexicalSpot - NewList) * sizeof (CHAR16))
);
}
//
// Stick this one in place
//
- StrCpyS(LexicalSpot, SizeOfAddedNameInBytes/sizeof(CHAR16), Item);
+ StrCpyS (LexicalSpot, SizeOfAddedNameInBytes/sizeof (CHAR16), Item);
break;
}
}
@@ -109,20 +110,22 @@ LexicalInsertIntoList( @retval EFI_SUCCESS the operation was successful.
**/
EFI_STATUS
-CopyListOfCommandNames(
- IN OUT CHAR16 **DestList,
- IN OUT UINTN *DestSize,
- IN CONST COMMAND_LIST *SourceList
+CopyListOfCommandNames (
+ IN OUT CHAR16 **DestList,
+ IN OUT UINTN *DestSize,
+ IN CONST COMMAND_LIST *SourceList
)
{
CONST COMMAND_LIST *Node;
- for ( Node = (COMMAND_LIST*)GetFirstNode(&SourceList->Link)
- ; SourceList != NULL && !IsListEmpty(&SourceList->Link) && !IsNull(&SourceList->Link, &Node->Link)
- ; Node = (COMMAND_LIST*)GetNextNode(&SourceList->Link, &Node->Link)
- ) {
- LexicalInsertIntoList(DestList, DestSize, Node->CommandString);
+ for ( Node = (COMMAND_LIST *)GetFirstNode (&SourceList->Link)
+ ; SourceList != NULL && !IsListEmpty (&SourceList->Link) && !IsNull (&SourceList->Link, &Node->Link)
+ ; Node = (COMMAND_LIST *)GetNextNode (&SourceList->Link, &Node->Link)
+ )
+ {
+ LexicalInsertIntoList (DestList, DestSize, Node->CommandString);
}
+
return (EFI_SUCCESS);
}
@@ -139,9 +142,9 @@ CopyListOfCommandNames( **/
STATIC
EFI_STATUS
-CopyListOfCommandNamesWithDynamic(
- IN OUT CHAR16** DestList,
- IN OUT UINTN *DestSize
+CopyListOfCommandNamesWithDynamic (
+ IN OUT CHAR16 **DestList,
+ IN OUT UINTN *DestSize
)
{
EFI_HANDLE *CommandHandleList;
@@ -149,7 +152,7 @@ CopyListOfCommandNamesWithDynamic( EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand;
EFI_STATUS Status;
- CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid);
+ CommandHandleList = GetHandleListByProtocol (&gEfiShellDynamicCommandProtocolGuid);
//
// If there are none, then just return with success
@@ -163,25 +166,24 @@ CopyListOfCommandNamesWithDynamic( //
// Append those to the list.
//
- for (NextCommand = CommandHandleList ; *NextCommand != NULL && !EFI_ERROR(Status) ; NextCommand++) {
- Status = gBS->HandleProtocol(
- *NextCommand,
- &gEfiShellDynamicCommandProtocolGuid,
- (VOID **)&DynamicCommand
- );
-
- if (EFI_ERROR(Status)) {
+ for (NextCommand = CommandHandleList; *NextCommand != NULL && !EFI_ERROR (Status); NextCommand++) {
+ Status = gBS->HandleProtocol (
+ *NextCommand,
+ &gEfiShellDynamicCommandProtocolGuid,
+ (VOID **)&DynamicCommand
+ );
+
+ if (EFI_ERROR (Status)) {
continue;
}
- Status = LexicalInsertIntoList(DestList, DestSize, DynamicCommand->CommandName);
+ Status = LexicalInsertIntoList (DestList, DestSize, DynamicCommand->CommandName);
}
- SHELL_FREE_NON_NULL(CommandHandleList);
+ SHELL_FREE_NON_NULL (CommandHandleList);
return (Status);
}
-
/**
Attempt to print help from a dynamically added command.
@@ -196,11 +198,11 @@ CopyListOfCommandNamesWithDynamic( @retval EFI_DEVICE_ERROR The help data format was incorrect.
**/
EFI_STATUS
-PrintDynamicCommandHelp(
+PrintDynamicCommandHelp (
IN CONST CHAR16 *CommandToGetHelpOn,
IN CONST CHAR16 *SectionToGetHelpOn,
IN BOOLEAN PrintCommandText
- )
+ )
{
EFI_STATUS Status;
BOOLEAN Found;
@@ -208,11 +210,11 @@ PrintDynamicCommandHelp( EFI_HANDLE *NextCommand;
EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand;
- Status = EFI_NOT_FOUND;
- Found = FALSE;
+ Status = EFI_NOT_FOUND;
+ Found = FALSE;
CommandHandleList = NULL;
- CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid);
+ CommandHandleList = GetHandleListByProtocol (&gEfiShellDynamicCommandProtocolGuid);
if (CommandHandleList == NULL) {
//
@@ -222,13 +224,13 @@ PrintDynamicCommandHelp( }
for (NextCommand = CommandHandleList; *NextCommand != NULL; NextCommand++) {
- Status = gBS->HandleProtocol(
- *NextCommand,
- &gEfiShellDynamicCommandProtocolGuid,
- (VOID **)&DynamicCommand
- );
+ Status = gBS->HandleProtocol (
+ *NextCommand,
+ &gEfiShellDynamicCommandProtocolGuid,
+ (VOID **)&DynamicCommand
+ );
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
continue;
}
@@ -239,36 +241,51 @@ PrintDynamicCommandHelp( break;
}
- if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)CommandToGetHelpOn)) ||
- (gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) {
+ if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16 *)CommandToGetHelpOn)) ||
+ ((gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL) && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16 *)(gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL))))))
+ {
// Print as Shell Help if in ManPage format.
- Status = ShellPrintHelp (DynamicCommand->CommandName, SectionToGetHelpOn,
- PrintCommandText);
+ Status = ShellPrintHelp (
+ DynamicCommand->CommandName,
+ SectionToGetHelpOn,
+ PrintCommandText
+ );
if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV),
- gShellLevel3HiiHandle, DynamicCommand->CommandName);
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF),
- gShellLevel3HiiHandle, DynamicCommand->CommandName);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_HELP_INV),
+ gShellLevel3HiiHandle,
+ DynamicCommand->CommandName
+ );
+ } else if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_HELP_NF),
+ gShellLevel3HiiHandle,
+ DynamicCommand->CommandName
+ );
} else {
Found = TRUE;
}
}
}
- SHELL_FREE_NON_NULL(CommandHandleList);
+ SHELL_FREE_NON_NULL (CommandHandleList);
return (Found ? EFI_SUCCESS : Status);
-
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-usage", TypeFlag},
- {L"-section", TypeMaxValue},
- {L"-verbose", TypeFlag},
- {L"-v", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-usage", TypeFlag },
+ { L"-section", TypeMaxValue },
+ { L"-verbose", TypeFlag },
+ { L"-v", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'help' command.
@@ -283,90 +300,91 @@ ShellCommandRunHelp ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CHAR16 *SortedCommandList;
- CONST CHAR16 *CurrentCommand;
- CHAR16 *CommandToGetHelpOn;
- CHAR16 *SectionToGetHelpOn;
- CHAR16 *HiiString;
- BOOLEAN Found;
- BOOLEAN PrintCommandText;
- UINTN SortedCommandListSize;
-
- PrintCommandText = TRUE;
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- CommandToGetHelpOn = NULL;
- SectionToGetHelpOn = NULL;
- SortedCommandList = NULL;
- Found = FALSE;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CHAR16 *SortedCommandList;
+ CONST CHAR16 *CurrentCommand;
+ CHAR16 *CommandToGetHelpOn;
+ CHAR16 *SectionToGetHelpOn;
+ CHAR16 *HiiString;
+ BOOLEAN Found;
+ BOOLEAN PrintCommandText;
+ UINTN SortedCommandListSize;
+
+ PrintCommandText = TRUE;
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ CommandToGetHelpOn = NULL;
+ SectionToGetHelpOn = NULL;
+ SortedCommandList = NULL;
+ Found = FALSE;
//
// 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), gShellLevel3HiiHandle, L"help", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"help", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// Check for conflicting parameters.
//
- if (ShellCommandLineGetFlag(Package, L"-usage")
- &&ShellCommandLineGetFlag(Package, L"-section")
- &&(ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v"))
- ){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel3HiiHandle, L"help");
+ if ( ShellCommandLineGetFlag (Package, L"-usage")
+ && ShellCommandLineGetFlag (Package, L"-section")
+ && (ShellCommandLineGetFlag (Package, L"-verbose") || ShellCommandLineGetFlag (Package, L"-v"))
+ )
+ {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel3HiiHandle, L"help");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"help");
+ } else if (ShellCommandLineGetRawValue (Package, 2) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"help");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// Get the command name we are getting help on
//
- ASSERT(CommandToGetHelpOn == NULL);
- StrnCatGrow(&CommandToGetHelpOn, NULL, ShellCommandLineGetRawValue(Package, 1), 0);
- if (CommandToGetHelpOn == NULL && ShellCommandLineGetFlag(Package, L"-?")) {
+ ASSERT (CommandToGetHelpOn == NULL);
+ StrnCatGrow (&CommandToGetHelpOn, NULL, ShellCommandLineGetRawValue (Package, 1), 0);
+ if ((CommandToGetHelpOn == NULL) && ShellCommandLineGetFlag (Package, L"-?")) {
//
// If we dont have a command and we got a simple -?
// we are looking for help on help command.
//
- StrnCatGrow(&CommandToGetHelpOn, NULL, L"help", 0);
+ StrnCatGrow (&CommandToGetHelpOn, NULL, L"help", 0);
}
if (CommandToGetHelpOn == NULL) {
- StrnCatGrow(&CommandToGetHelpOn, NULL, L"*", 0);
- ASSERT(SectionToGetHelpOn == NULL);
- StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME", 0);
+ StrnCatGrow (&CommandToGetHelpOn, NULL, L"*", 0);
+ ASSERT (SectionToGetHelpOn == NULL);
+ StrnCatGrow (&SectionToGetHelpOn, NULL, L"NAME", 0);
} else {
PrintCommandText = FALSE;
- ASSERT(SectionToGetHelpOn == NULL);
+ ASSERT (SectionToGetHelpOn == NULL);
//
// Get the section name for the given command name
//
- if (ShellCommandLineGetFlag(Package, L"-section")) {
- StrnCatGrow(&SectionToGetHelpOn, NULL, ShellCommandLineGetValue(Package, L"-section"), 0);
- } else if (ShellCommandLineGetFlag(Package, L"-usage")) {
- StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS", 0);
- } else if (ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v")) {
+ if (ShellCommandLineGetFlag (Package, L"-section")) {
+ StrnCatGrow (&SectionToGetHelpOn, NULL, ShellCommandLineGetValue (Package, L"-section"), 0);
+ } else if (ShellCommandLineGetFlag (Package, L"-usage")) {
+ StrnCatGrow (&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS", 0);
+ } else if (ShellCommandLineGetFlag (Package, L"-verbose") || ShellCommandLineGetFlag (Package, L"-v")) {
} else {
//
// The output of help <command> will display NAME, SYNOPSIS, OPTIONS, DESCRIPTION, and EXAMPLES sections.
@@ -375,25 +393,26 @@ ShellCommandRunHelp ( }
}
- if (gUnicodeCollation->StriColl(gUnicodeCollation, CommandToGetHelpOn, L"special") == 0) {
+ if (gUnicodeCollation->StriColl (gUnicodeCollation, CommandToGetHelpOn, L"special") == 0) {
//
// we need info on the special characters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_SC_HEADER), gShellLevel3HiiHandle);
- HiiString = HiiGetString(gShellLevel3HiiHandle, STRING_TOKEN(STR_HELP_SC_DATA), NULL);
- ShellPrintEx(-1, -1, L"%s", HiiString);
- FreePool(HiiString);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_SC_HEADER), gShellLevel3HiiHandle);
+ HiiString = HiiGetString (gShellLevel3HiiHandle, STRING_TOKEN (STR_HELP_SC_DATA), NULL);
+ ShellPrintEx (-1, -1, L"%s", HiiString);
+ FreePool (HiiString);
Found = TRUE;
} else {
- SortedCommandList = NULL;
+ SortedCommandList = NULL;
SortedCommandListSize = 0;
- CopyListOfCommandNames(&SortedCommandList, &SortedCommandListSize, ShellCommandGetCommandList(TRUE));
- CopyListOfCommandNamesWithDynamic(&SortedCommandList, &SortedCommandListSize);
+ CopyListOfCommandNames (&SortedCommandList, &SortedCommandListSize, ShellCommandGetCommandList (TRUE));
+ CopyListOfCommandNamesWithDynamic (&SortedCommandList, &SortedCommandListSize);
for (CurrentCommand = SortedCommandList
- ; CurrentCommand != NULL && CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof(CHAR16) && *CurrentCommand != CHAR_NULL
- ; CurrentCommand += StrLen(CurrentCommand) + 1
- ) {
+ ; CurrentCommand != NULL && CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof (CHAR16) && *CurrentCommand != CHAR_NULL
+ ; CurrentCommand += StrLen (CurrentCommand) + 1
+ )
+ {
//
// Checking execution break flag when print multiple command help information.
//
@@ -401,24 +420,26 @@ ShellCommandRunHelp ( break;
}
- if ((gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)CurrentCommand, CommandToGetHelpOn)) ||
- (gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)CurrentCommand, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) {
+ if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)CurrentCommand, CommandToGetHelpOn)) ||
+ ((gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL) && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)CurrentCommand, (CHAR16 *)(gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL))))))
+ {
//
// We have a command to look for help on.
//
- Status = ShellPrintHelp(CurrentCommand, SectionToGetHelpOn, PrintCommandText);
- if (EFI_ERROR(Status)) {
+ Status = ShellPrintHelp (CurrentCommand, SectionToGetHelpOn, PrintCommandText);
+ if (EFI_ERROR (Status)) {
//
// now try to match against the dynamic command list and print help
//
Status = PrintDynamicCommandHelp (CurrentCommand, SectionToGetHelpOn, PrintCommandText);
}
+
if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CurrentCommand);
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CurrentCommand);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CurrentCommand);
+ } else if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CurrentCommand);
} else {
- Found = TRUE;
+ Found = TRUE;
}
}
}
@@ -427,11 +448,11 @@ ShellCommandRunHelp ( // Search the .man file for Shell applications (Shell external commands).
//
if (!Found) {
- Status = ShellPrintHelp(CommandToGetHelpOn, SectionToGetHelpOn, FALSE);
+ Status = ShellPrintHelp (CommandToGetHelpOn, SectionToGetHelpOn, FALSE);
if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn);
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn);
+ } else if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn);
} else {
Found = TRUE;
}
@@ -449,20 +470,23 @@ ShellCommandRunHelp ( }
}
- if (CommandToGetHelpOn != NULL && StrCmp(CommandToGetHelpOn, L"*") == 0){
+ if ((CommandToGetHelpOn != NULL) && (StrCmp (CommandToGetHelpOn, L"*") == 0)) {
//
// If '*' then the command entered was 'Help' without qualifiers, This footer
// provides additional info on help switches
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_FOOTER), gShellLevel3HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_FOOTER), gShellLevel3HiiHandle);
}
+
if (CommandToGetHelpOn != NULL) {
- FreePool(CommandToGetHelpOn);
+ FreePool (CommandToGetHelpOn);
}
+
if (SectionToGetHelpOn != NULL) {
- FreePool(SectionToGetHelpOn);
+ FreePool (SectionToGetHelpOn);
}
- SHELL_FREE_NON_NULL(SortedCommandList);
+
+ SHELL_FREE_NON_NULL (SortedCommandList);
return (ShellStatus);
}
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c index 5504e1ca3a..ca0fe1bdc5 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c @@ -9,10 +9,10 @@ #include "UefiShellLevel3CommandsLib.h"
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-q", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-q", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'pause' command.
@@ -27,27 +27,27 @@ ShellCommandRunPause ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- SHELL_PROMPT_RESPONSE *Resp;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ SHELL_PROMPT_RESPONSE *Resp;
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- Resp = NULL;
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ Resp = NULL;
//
// 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);
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel3HiiHandle, L"pause");
+ if (!gEfiShellProtocol->BatchIsActive ()) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel3HiiHandle, L"pause");
return (SHELL_UNSUPPORTED);
}
@@ -55,37 +55,37 @@ ShellCommandRunPause ( // 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), gShellLevel3HiiHandle, L"pause", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"pause", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"pause");
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
+ } else if (ShellCommandLineGetRawValue (Package, 1) != NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"pause");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- if (!ShellCommandLineGetFlag(Package, L"-q")) {
- Status = ShellPromptForResponseHii(ShellPromptResponseTypeQuitContinue, STRING_TOKEN (STR_PAUSE_PROMPT), gShellLevel3HiiHandle, (VOID**)&Resp);
+ if (!ShellCommandLineGetFlag (Package, L"-q")) {
+ Status = ShellPromptForResponseHii (ShellPromptResponseTypeQuitContinue, STRING_TOKEN (STR_PAUSE_PROMPT), gShellLevel3HiiHandle, (VOID **)&Resp);
} else {
- Status = ShellPromptForResponse(ShellPromptResponseTypeQuitContinue, NULL, (VOID**)&Resp);
+ Status = ShellPromptForResponse (ShellPromptResponseTypeQuitContinue, NULL, (VOID **)&Resp);
}
- if (EFI_ERROR(Status) || Resp == NULL || *Resp == ShellPromptResponseQuit) {
- ShellCommandRegisterExit(TRUE, 0);
+ if (EFI_ERROR (Status) || (Resp == NULL) || (*Resp == ShellPromptResponseQuit)) {
+ ShellCommandRegisterExit (TRUE, 0);
ShellStatus = SHELL_ABORTED;
}
if (Resp != NULL) {
- FreePool(Resp);
+ FreePool (Resp);
}
}
@@ -95,7 +95,5 @@ ShellCommandRunPause ( ShellCommandLineFreeVarList (Package);
}
-
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c index a215f5774c..823328155b 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c @@ -21,27 +21,28 @@ **/
EFI_STATUS
TouchFileByHandle (
- IN SHELL_FILE_HANDLE Handle
+ IN SHELL_FILE_HANDLE Handle
)
{
- EFI_STATUS Status;
- EFI_FILE_INFO *FileInfo;
+ EFI_STATUS Status;
+ EFI_FILE_INFO *FileInfo;
- FileInfo = gEfiShellProtocol->GetFileInfo(Handle);
- if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) != 0){
+ FileInfo = gEfiShellProtocol->GetFileInfo (Handle);
+ if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) != 0) {
return (EFI_ACCESS_DENIED);
}
- Status = gRT->GetTime(&FileInfo->ModificationTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"gRT->GetTime", Status);
+
+ Status = gRT->GetTime (&FileInfo->ModificationTime, NULL);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"gRT->GetTime", Status);
return (SHELL_DEVICE_ERROR);
}
- CopyMem(&FileInfo->LastAccessTime, &FileInfo->ModificationTime, sizeof(EFI_TIME));
+ CopyMem (&FileInfo->LastAccessTime, &FileInfo->ModificationTime, sizeof (EFI_TIME));
- Status = gEfiShellProtocol->SetFileInfo(Handle, FileInfo);
+ Status = gEfiShellProtocol->SetFileInfo (Handle, FileInfo);
- FreePool(FileInfo);
+ FreePool (FileInfo);
return (Status);
}
@@ -65,24 +66,25 @@ DoTouchByHandle ( IN BOOLEAN Rec
)
{
- EFI_STATUS Status;
- EFI_SHELL_FILE_INFO *FileList;
- EFI_SHELL_FILE_INFO *Walker;
- CHAR16 *TempSpot;
+ EFI_STATUS Status;
+ EFI_SHELL_FILE_INFO *FileList;
+ EFI_SHELL_FILE_INFO *Walker;
+ CHAR16 *TempSpot;
- Status = EFI_SUCCESS;
- FileList = NULL;
- Walker = NULL;
+ Status = EFI_SUCCESS;
+ FileList = NULL;
+ Walker = NULL;
if (FS == NULL) {
- FS = StrnCatGrow(&FS, NULL, Name, 0);
+ FS = StrnCatGrow (&FS, NULL, Name, 0);
if (FS != NULL) {
- TempSpot = StrStr(FS, L"\\");
+ TempSpot = StrStr (FS, L"\\");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
}
}
+
if (FS == NULL) {
return (EFI_INVALID_PARAMETER);
}
@@ -90,43 +92,45 @@ DoTouchByHandle ( //
// do it
//
- Status = TouchFileByHandle(Handle);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Name);
+ Status = TouchFileByHandle (Handle);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Name);
return (Status);
}
//
// if it's a directory recurse...
//
- if (FileHandleIsDirectory(Handle) == EFI_SUCCESS && Rec) {
+ if ((FileHandleIsDirectory (Handle) == EFI_SUCCESS) && Rec) {
//
// get each file under this directory
//
- if (EFI_ERROR(gEfiShellProtocol->FindFilesInDir(Handle, &FileList))) {
+ if (EFI_ERROR (gEfiShellProtocol->FindFilesInDir (Handle, &FileList))) {
Status = EFI_INVALID_PARAMETER;
}
//
// recurse on each
//
- for (Walker = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
- ; FileList != NULL && !IsNull(&FileList->Link, &Walker->Link) && !EFI_ERROR(Status)
- ; Walker = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Walker->Link)
- ){
- if ( (StrCmp(Walker->FileName, L".") != 0)
- && (StrCmp(Walker->FileName, L"..") != 0)
- ){
+ for (Walker = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; FileList != NULL && !IsNull (&FileList->Link, &Walker->Link) && !EFI_ERROR (Status)
+ ; Walker = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Walker->Link)
+ )
+ {
+ if ( (StrCmp (Walker->FileName, L".") != 0)
+ && (StrCmp (Walker->FileName, L"..") != 0)
+ )
+ {
//
// Open the file since we need that handle.
//
Status = gEfiShellProtocol->OpenFileByName (Walker->FullName, &Walker->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Walker->FullName);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Walker->FullName);
Status = EFI_ACCESS_DENIED;
} else {
- Status = DoTouchByHandle(Walker->FullName, FS, Walker->Handle, TRUE);
- gEfiShellProtocol->CloseFile(Walker->Handle);
+ Status = DoTouchByHandle (Walker->FullName, FS, Walker->Handle, TRUE);
+ gEfiShellProtocol->CloseFile (Walker->Handle);
Walker->Handle = NULL;
}
}
@@ -135,7 +139,7 @@ DoTouchByHandle ( //
// free stuff
//
- if (FileList != NULL && EFI_ERROR(gEfiShellProtocol->FreeFileList(&FileList))) {
+ if ((FileList != NULL) && EFI_ERROR (gEfiShellProtocol->FreeFileList (&FileList))) {
Status = EFI_INVALID_PARAMETER;
}
}
@@ -143,10 +147,10 @@ DoTouchByHandle ( return (Status);
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-r", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-r", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'touch' command.
@@ -161,69 +165,72 @@ ShellCommandRunTouch ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- CONST CHAR16 *Param;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- EFI_SHELL_FILE_INFO *FileList;
- EFI_SHELL_FILE_INFO *Node;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- ParamCount = 0;
- FileList = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ CONST CHAR16 *Param;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamCount;
+ EFI_SHELL_FILE_INFO *FileList;
+ EFI_SHELL_FILE_INFO *Node;
+
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ ParamCount = 0;
+ FileList = NULL;
//
// 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), gShellLevel3HiiHandle, L"touch", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"touch", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
- if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
+
+ if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
//
// we insufficient parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"touch");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"touch");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// get a list with each file specified by parameters
// if parameter is a directory then add all the files below it to the list
//
- for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ; Param != NULL
- ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ){
- Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, &FileList);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"touch", (CHAR16*)Param);
+ for ( ParamCount = 1, Param = ShellCommandLineGetRawValue (Package, ParamCount)
+ ; Param != NULL
+ ; ParamCount++, Param = ShellCommandLineGetRawValue (Package, ParamCount)
+ )
+ {
+ Status = ShellOpenFileMetaArg ((CHAR16 *)Param, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, &FileList);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"touch", (CHAR16 *)Param);
ShellStatus = SHELL_NOT_FOUND;
break;
}
+
//
// make sure we completed the param parsing sucessfully...
// Also make sure that any previous action was sucessful
@@ -232,41 +239,44 @@ ShellCommandRunTouch ( //
// check that we have at least 1 file
//
- if (FileList == NULL || IsListEmpty(&FileList->Link)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel3HiiHandle, L"touch", Param);
+ if ((FileList == NULL) || IsListEmpty (&FileList->Link)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel3HiiHandle, L"touch", Param);
continue;
} else {
//
// loop through the list and make sure we are not aborting...
//
- for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag()
- ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link)
- ){
+ for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; !IsNull (&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag ()
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
+ )
+ {
//
// make sure the file opened ok
//
- if (EFI_ERROR(Node->Status)){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Node->FileName);
+ if (EFI_ERROR (Node->Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Node->FileName);
ShellStatus = SHELL_NOT_FOUND;
continue;
}
- Status = DoTouchByHandle(Node->FullName, NULL, Node->Handle, ShellCommandLineGetFlag(Package, L"-r"));
- if (EFI_ERROR(Status) && Status != EFI_ACCESS_DENIED) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Node->FileName);
+ Status = DoTouchByHandle (Node->FullName, NULL, Node->Handle, ShellCommandLineGetFlag (Package, L"-r"));
+ if (EFI_ERROR (Status) && (Status != EFI_ACCESS_DENIED)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Node->FileName);
ShellStatus = SHELL_NOT_FOUND;
}
}
}
}
+
//
// Free the fileList
//
- if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
- Status = ShellCloseFileMetaArg(&FileList);
- ASSERT_EFI_ERROR(Status);
+ if ((FileList != NULL) && !IsListEmpty (&FileList->Link)) {
+ Status = ShellCloseFileMetaArg (&FileList);
+ ASSERT_EFI_ERROR (Status);
}
+
FileList = NULL;
}
}
@@ -277,10 +287,9 @@ ShellCommandRunTouch ( ShellCommandLineFreeVarList (Package);
}
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
return (SHELL_ABORTED);
}
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c index f0aa57af3d..d00997d818 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c @@ -25,9 +25,9 @@ **/
EFI_STATUS
TypeFileByHandle (
- IN SHELL_FILE_HANDLE Handle,
- IN BOOLEAN Ascii,
- IN BOOLEAN UCS2
+ IN SHELL_FILE_HANDLE Handle,
+ IN BOOLEAN Ascii,
+ IN BOOLEAN UCS2
)
{
UINTN ReadSize;
@@ -39,25 +39,25 @@ TypeFileByHandle ( CHAR16 AsciiChar;
CHAR16 Ucs2Char;
- ReadSize = PcdGet32(PcdShellFileOperationSize);
- AllocatedBuffer = AllocateZeroPool(ReadSize);
+ ReadSize = PcdGet32 (PcdShellFileOperationSize);
+ AllocatedBuffer = AllocateZeroPool (ReadSize);
if (AllocatedBuffer == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- Status = ShellSetFilePosition(Handle, 0);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellSetFilePosition (Handle, 0);
+ ASSERT_EFI_ERROR (Status);
- while (ReadSize == ((UINTN)PcdGet32(PcdShellFileOperationSize))) {
+ while (ReadSize == ((UINTN)PcdGet32 (PcdShellFileOperationSize))) {
Buffer = AllocatedBuffer;
- ZeroMem(Buffer, ReadSize);
- Status = ShellReadFile(Handle, &ReadSize, Buffer);
- if (EFI_ERROR(Status)){
+ ZeroMem (Buffer, ReadSize);
+ Status = ShellReadFile (Handle, &ReadSize, Buffer);
+ if (EFI_ERROR (Status)) {
break;
}
if (!(Ascii|UCS2)) {
- if (*(UINT16*)Buffer == gUnicodeFileTag) {
+ if (*(UINT16 *)Buffer == gUnicodeFileTag) {
UCS2 = TRUE;
} else {
Ascii = TRUE;
@@ -66,20 +66,21 @@ TypeFileByHandle ( if (Ascii) {
LoopSize = ReadSize;
- for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) {
+ for (LoopVar = 0; LoopVar < LoopSize; LoopVar++) {
//
// The valid range of ASCII characters is 0x20-0x7E.
// Display "." when there is an invalid character.
//
AsciiChar = CHAR_NULL;
- AsciiChar = ((CHAR8*)Buffer)[LoopVar];
- if (AsciiChar == '\r' || AsciiChar == '\n') {
+ AsciiChar = ((CHAR8 *)Buffer)[LoopVar];
+ if ((AsciiChar == '\r') || (AsciiChar == '\n')) {
//
// Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD)
// characters to be displayed as is.
//
- if ((AsciiChar == '\n' && LoopVar == 0) ||
- (AsciiChar == '\n' && ((CHAR8*)Buffer)[LoopVar-1] != '\r')) {
+ if (((AsciiChar == '\n') && (LoopVar == 0)) ||
+ ((AsciiChar == '\n') && (((CHAR8 *)Buffer)[LoopVar-1] != '\r')))
+ {
//
// In case file begin with single line Feed or Line Feed (0xA) is
// encountered & Carriage Return (0xD) was not previous character,
@@ -93,37 +94,39 @@ TypeFileByHandle ( //
// For all other characters which are not printable, display '.'
//
- if (AsciiChar < 0x20 || AsciiChar >= 0x7F) {
+ if ((AsciiChar < 0x20) || (AsciiChar >= 0x7F)) {
AsciiChar = '.';
}
}
+
ShellPrintEx (-1, -1, L"%c", AsciiChar);
}
} else {
- if (*(UINT16*)Buffer == gUnicodeFileTag) {
+ if (*(UINT16 *)Buffer == gUnicodeFileTag) {
//
// For unicode files, skip displaying the byte order marker.
//
- Buffer = ((UINT16*)Buffer) + 1;
+ Buffer = ((UINT16 *)Buffer) + 1;
LoopSize = (ReadSize / (sizeof (CHAR16))) - 1;
} else {
LoopSize = ReadSize / (sizeof (CHAR16));
}
- for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) {
+ for (LoopVar = 0; LoopVar < LoopSize; LoopVar++) {
//
// An invalid range of characters is 0x0-0x1F.
// Display "." when there is an invalid character.
//
Ucs2Char = CHAR_NULL;
- Ucs2Char = ((CHAR16*)Buffer)[LoopVar];
- if (Ucs2Char == '\r' || Ucs2Char == '\n') {
+ Ucs2Char = ((CHAR16 *)Buffer)[LoopVar];
+ if ((Ucs2Char == '\r') || (Ucs2Char == '\n')) {
//
// Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD)
// characters to be displayed as is.
//
- if ((Ucs2Char == '\n' && LoopVar == 0) ||
- (Ucs2Char == '\n' && ((CHAR16*)Buffer)[LoopVar-1] != '\r')) {
+ if (((Ucs2Char == '\n') && (LoopVar == 0)) ||
+ ((Ucs2Char == '\n') && (((CHAR16 *)Buffer)[LoopVar-1] != '\r')))
+ {
//
// In case file begin with single line Feed or Line Feed (0xA) is
// encountered & Carriage Return (0xD) was not previous character,
@@ -133,31 +136,32 @@ TypeFileByHandle ( ShellPrintEx (-1, -1, L"\r\n");
continue;
}
- }
- else if (Ucs2Char < 0x20) {
+ } else if (Ucs2Char < 0x20) {
//
// For all other characters which are not printable, display '.'
//
Ucs2Char = L'.';
}
+
ShellPrintEx (-1, -1, L"%c", Ucs2Char);
}
}
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
break;
}
}
+
FreePool (AllocatedBuffer);
ShellPrintEx (-1, -1, L"\r\n");
return (Status);
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-a", TypeFlag},
- {L"-u", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-a", TypeFlag },
+ { L"-u", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'type' command.
@@ -172,77 +176,80 @@ ShellCommandRunType ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- CONST CHAR16 *Param;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- EFI_SHELL_FILE_INFO *FileList;
- EFI_SHELL_FILE_INFO *Node;
- BOOLEAN AsciiMode;
- BOOLEAN UnicodeMode;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- ParamCount = 0;
- FileList = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ CONST CHAR16 *Param;
+ SHELL_STATUS ShellStatus;
+ UINTN ParamCount;
+ EFI_SHELL_FILE_INFO *FileList;
+ EFI_SHELL_FILE_INFO *Node;
+ BOOLEAN AsciiMode;
+ BOOLEAN UnicodeMode;
+
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ ParamCount = 0;
+ FileList = NULL;
//
// 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), gShellLevel3HiiHandle, L"type", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"type", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
- AsciiMode = ShellCommandLineGetFlag(Package, L"-a");
- UnicodeMode = ShellCommandLineGetFlag(Package, L"-u");
+
+ AsciiMode = ShellCommandLineGetFlag (Package, L"-a");
+ UnicodeMode = ShellCommandLineGetFlag (Package, L"-u");
if (AsciiMode && UnicodeMode) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"type", L"-a & -u");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"type", L"-a & -u");
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
+ } else if (ShellCommandLineGetRawValue (Package, 1) == NULL) {
//
// we insufficient parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"type");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"type");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
//
// get a list with each file specified by parameters
// if parameter is a directory then add all the files below it to the list
//
- for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ; Param != NULL
- ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ){
- Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_READ, &FileList);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"type", (CHAR16*)Param);
+ for ( ParamCount = 1, Param = ShellCommandLineGetRawValue (Package, ParamCount)
+ ; Param != NULL
+ ; ParamCount++, Param = ShellCommandLineGetRawValue (Package, ParamCount)
+ )
+ {
+ Status = ShellOpenFileMetaArg ((CHAR16 *)Param, EFI_FILE_MODE_READ, &FileList);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"type", (CHAR16 *)Param);
ShellStatus = SHELL_NOT_FOUND;
break;
}
+
//
// make sure we completed the param parsing sucessfully...
// Also make sure that any previous action was sucessful
@@ -251,27 +258,27 @@ ShellCommandRunType ( //
// check that we have at least 1 file
//
- if (FileList == NULL || IsListEmpty(&FileList->Link)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel3HiiHandle, L"type", Param);
+ if ((FileList == NULL) || IsListEmpty (&FileList->Link)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel3HiiHandle, L"type", Param);
continue;
} else {
//
// loop through the list and make sure we are not aborting...
//
- for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag()
- ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link)
- ){
-
- if (ShellGetExecutionBreakFlag()) {
+ for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
+ ; !IsNull (&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag ()
+ ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
+ )
+ {
+ if (ShellGetExecutionBreakFlag ()) {
break;
}
//
// make sure the file opened ok
//
- if (EFI_ERROR(Node->Status)){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"type", Node->FileName);
+ if (EFI_ERROR (Node->Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"type", Node->FileName);
ShellStatus = SHELL_NOT_FOUND;
continue;
}
@@ -279,8 +286,8 @@ ShellCommandRunType ( //
// make sure its not a directory
//
- if (FileHandleIsDirectory(Node->Handle) == EFI_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_IS_DIR), gShellLevel3HiiHandle, L"type", Node->FileName);
+ if (FileHandleIsDirectory (Node->Handle) == EFI_SUCCESS) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_IS_DIR), gShellLevel3HiiHandle, L"type", Node->FileName);
ShellStatus = SHELL_NOT_FOUND;
continue;
}
@@ -289,21 +296,24 @@ ShellCommandRunType ( // do it
//
Status = TypeFileByHandle (Node->Handle, AsciiMode, UnicodeMode);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TYP_ERROR), gShellLevel3HiiHandle, L"type", Node->FileName);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TYP_ERROR), gShellLevel3HiiHandle, L"type", Node->FileName);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- ASSERT(ShellStatus == SHELL_SUCCESS);
+
+ ASSERT (ShellStatus == SHELL_SUCCESS);
}
}
}
+
//
// Free the fileList
//
- if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
- Status = ShellCloseFileMetaArg(&FileList);
+ if ((FileList != NULL) && !IsListEmpty (&FileList->Link)) {
+ Status = ShellCloseFileMetaArg (&FileList);
}
- ASSERT_EFI_ERROR(Status);
+
+ ASSERT_EFI_ERROR (Status);
FileList = NULL;
}
}
@@ -314,10 +324,9 @@ ShellCommandRunType ( ShellCommandLineFreeVarList (Package);
}
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
return (SHELL_ABORTED);
}
return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c index ce4afd117a..bef59b031c 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c @@ -8,15 +8,15 @@ **/
#include "UefiShellLevel3CommandsLib.h"
-CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands";
-EFI_HII_HANDLE gShellLevel3HiiHandle = NULL;
+CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands";
+EFI_HII_HANDLE gShellLevel3HiiHandle = NULL;
/**
return the filename to get help from is not using HII.
@retval The filename.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameLevel3 (
VOID
@@ -47,7 +47,7 @@ ShellLevel3CommandsLibConstructor ( //
// if shell level is less than 3 do nothing
//
- if (PcdGet8(PcdShellSupportLevel) < 3) {
+ if (PcdGet8 (PcdShellSupportLevel) < 3) {
return (EFI_SUCCESS);
}
@@ -55,22 +55,23 @@ ShellLevel3CommandsLibConstructor ( if (gShellLevel3HiiHandle == NULL) {
return (EFI_DEVICE_ERROR);
}
+
//
// install our shell command handlers that are always installed
//
// Note: that Time, Timezone, and Date are part of level 2 library
//
- ShellCommandRegisterCommandName(L"type", ShellCommandRunType , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TYPE));
- ShellCommandRegisterCommandName(L"touch", ShellCommandRunTouch , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TOUCH));
- ShellCommandRegisterCommandName(L"ver", ShellCommandRunVer , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_VER));
- ShellCommandRegisterCommandName(L"alias", ShellCommandRunAlias , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ALIAS));
- ShellCommandRegisterCommandName(L"cls", ShellCommandRunCls , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_CLS));
- ShellCommandRegisterCommandName(L"echo", ShellCommandRunEcho , ShellCommandGetManFileNameLevel3, 3, L"", FALSE, gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ECHO));
- ShellCommandRegisterCommandName(L"pause", ShellCommandRunPause , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_PAUSE));
- ShellCommandRegisterCommandName(L"getmtc", ShellCommandRunGetMtc , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_GETMTC));
- ShellCommandRegisterCommandName(L"help", ShellCommandRunHelp , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_HELP));
-
- ShellCommandRegisterAlias(L"type", L"cat");
+ ShellCommandRegisterCommandName (L"type", ShellCommandRunType, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_TYPE));
+ ShellCommandRegisterCommandName (L"touch", ShellCommandRunTouch, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_TOUCH));
+ ShellCommandRegisterCommandName (L"ver", ShellCommandRunVer, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_VER));
+ ShellCommandRegisterCommandName (L"alias", ShellCommandRunAlias, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_ALIAS));
+ ShellCommandRegisterCommandName (L"cls", ShellCommandRunCls, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_CLS));
+ ShellCommandRegisterCommandName (L"echo", ShellCommandRunEcho, ShellCommandGetManFileNameLevel3, 3, L"", FALSE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_ECHO));
+ ShellCommandRegisterCommandName (L"pause", ShellCommandRunPause, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_PAUSE));
+ ShellCommandRegisterCommandName (L"getmtc", ShellCommandRunGetMtc, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_GETMTC));
+ ShellCommandRegisterCommandName (L"help", ShellCommandRunHelp, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_HELP));
+
+ ShellCommandRegisterAlias (L"type", L"cat");
return (EFI_SUCCESS);
}
@@ -89,7 +90,8 @@ ShellLevel3CommandsLibDestructor ( )
{
if (gShellLevel3HiiHandle != NULL) {
- HiiRemovePackages(gShellLevel3HiiHandle);
+ HiiRemovePackages (gShellLevel3HiiHandle);
}
+
return (EFI_SUCCESS);
}
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h index c095b9275e..4763ee0811 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h @@ -32,7 +32,7 @@ #include <Library/HiiLib.h>
#include <Library/FileHandleLib.h>
-extern EFI_HII_HANDLE gShellLevel3HiiHandle;
+extern EFI_HII_HANDLE gShellLevel3HiiHandle;
/**
Function for 'type' command.
@@ -152,4 +152,3 @@ ShellCommandRunHelp ( );
#endif
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c index 68ca06d1c7..fe6a9ca3de 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c @@ -12,13 +12,13 @@ #include <Library/ShellLib.h>
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-s", TypeFlag},
- {L"-terse", TypeFlag},
- {L"-t", TypeFlag},
- {L"-_pa", TypeFlag},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-s", TypeFlag },
+ { L"-terse", TypeFlag },
+ { L"-t", TypeFlag },
+ { L"-_pa", TypeFlag },
+ { NULL, TypeMax }
+};
/**
Function for 'ver' command.
@@ -33,54 +33,55 @@ ShellCommandRunVer ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINT8 Level;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ UINT8 Level;
- Level = PcdGet8(PcdShellSupportLevel);
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
+ Level = PcdGet8 (PcdShellSupportLevel);
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
//
// 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), gShellLevel3HiiHandle, L"ver", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"ver", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
//
// check for "-?"
//
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
+ if (ShellCommandLineGetFlag (Package, L"-?")) {
+ ASSERT (FALSE);
}
- if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
+
+ if (ShellCommandLineGetRawValue (Package, 1) != NULL) {
//
// we have too many parameters
//
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"ver");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"ver");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- if (ShellCommandLineGetFlag(Package, L"-s")) {
- if (ShellCommandLineGetFlag(Package, L"-terse") || ShellCommandLineGetFlag(Package, L"-t")){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellLevel3HiiHandle, L"ver", L"-t or -terse", L"-s");
+ if (ShellCommandLineGetFlag (Package, L"-s")) {
+ if (ShellCommandLineGetFlag (Package, L"-terse") || ShellCommandLineGetFlag (Package, L"-t")) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellLevel3HiiHandle, L"ver", L"-t or -terse", L"-s");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
ShellPrintHiiEx (
@@ -91,7 +92,7 @@ ShellCommandRunVer ( gShellLevel3HiiHandle,
gEfiShellProtocol->MajorVersion,
gEfiShellProtocol->MinorVersion
- );
+ );
}
} else {
ShellPrintHiiEx (
@@ -103,17 +104,16 @@ ShellCommandRunVer ( SupportLevel[Level],
gEfiShellProtocol->MajorVersion,
gEfiShellProtocol->MinorVersion
- );
- if (!ShellCommandLineGetFlag(Package, L"-terse") && !ShellCommandLineGetFlag(Package, L"-t")){
- ShellPrintHiiEx(
+ );
+ if (!ShellCommandLineGetFlag (Package, L"-terse") && !ShellCommandLineGetFlag (Package, L"-t")) {
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_VER_OUTPUT_SUPPLIER),
gShellLevel3HiiHandle,
- (CHAR16 *) PcdGetPtr (PcdShellSupplier)
- );
-
+ (CHAR16 *)PcdGetPtr (PcdShellSupplier)
+ );
ShellPrintHiiEx (
-1,
@@ -125,14 +125,15 @@ ShellCommandRunVer ( (gST->Hdr.Revision&0x0000ffff),
gST->FirmwareVendor,
gST->FirmwareRevision
- );
+ );
}
}
+
//
// implementation specific support for displaying processor architecture
//
- if (ShellCommandLineGetFlag(Package, L"-_pa")) {
- ShellPrintEx(-1, -1, L"%d\r\n", sizeof(UINTN)==sizeof(UINT64)?64:32);
+ if (ShellCommandLineGetFlag (Package, L"-_pa")) {
+ ShellPrintEx (-1, -1, L"%d\r\n", sizeof (UINTN) == sizeof (UINT64) ? 64 : 32);
}
}
@@ -144,4 +145,3 @@ ShellCommandRunVer ( return (ShellStatus);
}
-
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index c4749941a6..a72767bd86 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -15,19 +15,19 @@ //
// globals...
//
-SHELL_PARAM_ITEM EmptyParamList[] = {
- {NULL, TypeMax}
- };
-SHELL_PARAM_ITEM SfoParamList[] = {
- {L"-sfo", TypeFlag},
- {NULL, TypeMax}
- };
-EFI_SHELL_ENVIRONMENT2 *mEfiShellEnvironment2;
-EFI_SHELL_INTERFACE *mEfiShellInterface;
-EFI_SHELL_PROTOCOL *gEfiShellProtocol;
-EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
-EFI_HANDLE mEfiShellEnvironment2Handle;
-FILE_HANDLE_FUNCTION_MAP FileFunctionMap;
+SHELL_PARAM_ITEM EmptyParamList[] = {
+ { NULL, TypeMax }
+};
+SHELL_PARAM_ITEM SfoParamList[] = {
+ { L"-sfo", TypeFlag },
+ { NULL, TypeMax }
+};
+EFI_SHELL_ENVIRONMENT2 *mEfiShellEnvironment2;
+EFI_SHELL_INTERFACE *mEfiShellInterface;
+EFI_SHELL_PROTOCOL *gEfiShellProtocol;
+EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
+EFI_HANDLE mEfiShellEnvironment2Handle;
+FILE_HANDLE_FUNCTION_MAP FileFunctionMap;
EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationProtocol;
/**
@@ -58,29 +58,30 @@ EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationProtocol; Path. The caller must free this memory when it is no
longer needed.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-FullyQualifyPath(
- IN CONST CHAR16 *Path
+FullyQualifyPath (
+ IN CONST CHAR16 *Path
)
{
- CONST CHAR16 *WorkingPath;
- CONST CHAR16 *InputPath;
- CHAR16 *CharPtr;
- CHAR16 *InputFileSystem;
- UINTN FileSystemCharCount;
- CHAR16 *FullyQualifiedPath;
- UINTN Size;
+ CONST CHAR16 *WorkingPath;
+ CONST CHAR16 *InputPath;
+ CHAR16 *CharPtr;
+ CHAR16 *InputFileSystem;
+ UINTN FileSystemCharCount;
+ CHAR16 *FullyQualifiedPath;
+ UINTN Size;
FullyQualifiedPath = NULL;
- ASSERT(Path != NULL);
+ ASSERT (Path != NULL);
//
// Handle erroneous input when asserts are disabled.
//
if (Path == NULL) {
return NULL;
}
+
//
// In paths that contain ":", like fs0:dir/file.ext and fs2:\fqpath\file.ext,
// we have to consider the file system part separately from the "path" part.
@@ -88,45 +89,46 @@ FullyQualifyPath( // directory for that file system. Then we need to use the part of the path
// following the ":". If a path does not contain ":", we use it as given.
//
- InputPath = StrStr(Path, L":");
+ InputPath = StrStr (Path, L":");
if (InputPath != NULL) {
InputPath++;
- FileSystemCharCount = ((UINTN)InputPath - (UINTN)Path + sizeof(CHAR16)) / sizeof(CHAR16);
- InputFileSystem = AllocateCopyPool(FileSystemCharCount * sizeof(CHAR16), Path);
+ FileSystemCharCount = ((UINTN)InputPath - (UINTN)Path + sizeof (CHAR16)) / sizeof (CHAR16);
+ InputFileSystem = AllocateCopyPool (FileSystemCharCount * sizeof (CHAR16), Path);
if (InputFileSystem != NULL) {
InputFileSystem[FileSystemCharCount - 1] = CHAR_NULL;
}
- WorkingPath = ShellGetCurrentDir(InputFileSystem);
- SHELL_FREE_NON_NULL(InputFileSystem);
+
+ WorkingPath = ShellGetCurrentDir (InputFileSystem);
+ SHELL_FREE_NON_NULL (InputFileSystem);
} else {
- InputPath = Path;
- WorkingPath = ShellGetEnvironmentVariable(L"cwd");
+ InputPath = Path;
+ WorkingPath = ShellGetEnvironmentVariable (L"cwd");
}
if (WorkingPath == NULL) {
//
// With no working directory, all we can do is copy and clean the input path.
//
- FullyQualifiedPath = AllocateCopyPool(StrSize(Path), Path);
+ FullyQualifiedPath = AllocateCopyPool (StrSize (Path), Path);
} else {
//
// Allocate space for both strings plus one more character.
//
- Size = StrSize(WorkingPath) + StrSize(InputPath);
- FullyQualifiedPath = AllocateZeroPool(Size);
+ Size = StrSize (WorkingPath) + StrSize (InputPath);
+ FullyQualifiedPath = AllocateZeroPool (Size);
if (FullyQualifiedPath == NULL) {
//
// Try to copy and clean just the input. No harm if not enough memory.
//
- FullyQualifiedPath = AllocateCopyPool(StrSize(Path), Path);
+ FullyQualifiedPath = AllocateCopyPool (StrSize (Path), Path);
} else {
- if (*InputPath == L'\\' || *InputPath == L'/') {
+ if ((*InputPath == L'\\') || (*InputPath == L'/')) {
//
// Absolute path: start with the current working directory, then
// truncate the new path after the file system part.
//
- StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
- CharPtr = StrStr(FullyQualifiedPath, L":");
+ StrCpyS (FullyQualifiedPath, Size/sizeof (CHAR16), WorkingPath);
+ CharPtr = StrStr (FullyQualifiedPath, L":");
if (CharPtr != NULL) {
*(CharPtr + 1) = CHAR_NULL;
}
@@ -134,17 +136,18 @@ FullyQualifyPath( //
// Relative path: start with the working directory and append "\".
//
- StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);
- StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), L"\\");
+ StrCpyS (FullyQualifiedPath, Size/sizeof (CHAR16), WorkingPath);
+ StrCatS (FullyQualifiedPath, Size/sizeof (CHAR16), L"\\");
}
+
//
// Now append the absolute or relative path.
//
- StrCatS(FullyQualifiedPath, Size/sizeof(CHAR16), InputPath);
+ StrCatS (FullyQualifiedPath, Size/sizeof (CHAR16), InputPath);
}
}
- PathCleanUpDirectories(FullyQualifiedPath);
+ PathCleanUpDirectories (FullyQualifiedPath);
return FullyQualifiedPath;
}
@@ -165,10 +168,10 @@ FullyQualifyPath( BOOLEAN
EFIAPI
ShellIsHexaDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
- return (BOOLEAN) ((Char >= L'0' && Char <= L'9') || (Char >= L'A' && Char <= L'F') || (Char >= L'a' && Char <= L'f'));
+ return (BOOLEAN)((Char >= L'0' && Char <= L'9') || (Char >= L'A' && Char <= L'F') || (Char >= L'a' && Char <= L'f'));
}
/**
@@ -188,10 +191,10 @@ ShellIsHexaDecimalDigitCharacter ( BOOLEAN
EFIAPI
ShellIsDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
- return (BOOLEAN) (Char >= L'0' && Char <= L'9');
+ return (BOOLEAN)(Char >= L'0' && Char <= L'9');
}
/**
@@ -203,7 +206,7 @@ ShellIsDecimalDigitCharacter ( **/
EFI_STATUS
ShellFindSE2 (
- IN EFI_HANDLE ImageHandle
+ IN EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
@@ -212,66 +215,74 @@ ShellFindSE2 ( UINTN HandleIndex;
BufferSize = 0;
- Buffer = NULL;
- Status = gBS->OpenProtocol(ImageHandle,
- &gEfiShellEnvironment2Guid,
- (VOID **)&mEfiShellEnvironment2,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ Buffer = NULL;
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEfiShellEnvironment2Guid,
+ (VOID **)&mEfiShellEnvironment2,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
//
// look for the mEfiShellEnvironment2 protocol at a higher level
//
- if (EFI_ERROR (Status) || !(CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid))){
+ if (EFI_ERROR (Status) || !(CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid))) {
//
// figure out how big of a buffer we need.
//
- Status = gBS->LocateHandle (ByProtocol,
- &gEfiShellEnvironment2Guid,
- NULL, // ignored for ByProtocol
- &BufferSize,
- Buffer
- );
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiShellEnvironment2Guid,
+ NULL, // ignored for ByProtocol
+ &BufferSize,
+ Buffer
+ );
//
// maybe it's not there???
//
if (Status == EFI_BUFFER_TOO_SMALL) {
- Buffer = (EFI_HANDLE*)AllocateZeroPool(BufferSize);
+ Buffer = (EFI_HANDLE *)AllocateZeroPool (BufferSize);
if (Buffer == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- Status = gBS->LocateHandle (ByProtocol,
- &gEfiShellEnvironment2Guid,
- NULL, // ignored for ByProtocol
- &BufferSize,
- Buffer
- );
+
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiShellEnvironment2Guid,
+ NULL, // ignored for ByProtocol
+ &BufferSize,
+ Buffer
+ );
}
- if (!EFI_ERROR (Status) && Buffer != NULL) {
+
+ if (!EFI_ERROR (Status) && (Buffer != NULL)) {
//
// now parse the list of returned handles
//
Status = EFI_NOT_FOUND;
- for (HandleIndex = 0; HandleIndex < (BufferSize/sizeof(Buffer[0])); HandleIndex++) {
- Status = gBS->OpenProtocol(Buffer[HandleIndex],
- &gEfiShellEnvironment2Guid,
- (VOID **)&mEfiShellEnvironment2,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid)) {
+ for (HandleIndex = 0; HandleIndex < (BufferSize/sizeof (Buffer[0])); HandleIndex++) {
+ Status = gBS->OpenProtocol (
+ Buffer[HandleIndex],
+ &gEfiShellEnvironment2Guid,
+ (VOID **)&mEfiShellEnvironment2,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (CompareGuid (&mEfiShellEnvironment2->SESGuid, &gEfiShellEnvironment2ExtGuid)) {
mEfiShellEnvironment2Handle = Buffer[HandleIndex];
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
break;
}
}
}
}
+
if (Buffer != NULL) {
FreePool (Buffer);
}
+
return (Status);
}
@@ -297,22 +308,22 @@ ShellLibConstructorWorker ( // UEFI 2.0 shell interfaces (used preferentially)
//
Status = gBS->OpenProtocol (
- ImageHandle,
- &gEfiShellProtocolGuid,
- (VOID **)&gEfiShellProtocol,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ ImageHandle,
+ &gEfiShellProtocolGuid,
+ (VOID **)&gEfiShellProtocol,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
//
// Search for the shell protocol
//
Status = gBS->LocateProtocol (
- &gEfiShellProtocolGuid,
- NULL,
- (VOID **)&gEfiShellProtocol
- );
+ &gEfiShellProtocolGuid,
+ NULL,
+ (VOID **)&gEfiShellProtocol
+ );
if (EFI_ERROR (Status)) {
gEfiShellProtocol = NULL;
}
@@ -321,13 +332,13 @@ ShellLibConstructorWorker ( if (gEfiShellParametersProtocol == NULL) {
Status = gBS->OpenProtocol (
- ImageHandle,
- &gEfiShellParametersProtocolGuid,
- (VOID **)&gEfiShellParametersProtocol,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ ImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ (VOID **)&gEfiShellParametersProtocol,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
gEfiShellParametersProtocol = NULL;
}
@@ -337,20 +348,22 @@ ShellLibConstructorWorker ( //
// Moved to seperate function due to complexity
//
- Status = ShellFindSE2(ImageHandle);
+ Status = ShellFindSE2 (ImageHandle);
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_ERROR, "Status: 0x%08x\r\n", Status));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Status: 0x%08x\r\n", Status));
mEfiShellEnvironment2 = NULL;
}
- Status = gBS->OpenProtocol(ImageHandle,
- &gEfiShellInterfaceGuid,
- (VOID **)&mEfiShellInterface,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR(Status)) {
+
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEfiShellInterfaceGuid,
+ (VOID **)&mEfiShellInterface,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
mEfiShellInterface = NULL;
}
}
@@ -361,9 +374,10 @@ ShellLibConstructorWorker ( // When ShellLib is linked to a driver producing DynamicCommand protocol,
// ShellParameters protocol is set by DynamicCommand.Handler().
//
- if ((mEfiShellEnvironment2 != NULL && mEfiShellInterface != NULL) ||
+ if (((mEfiShellEnvironment2 != NULL) && (mEfiShellInterface != NULL)) ||
(gEfiShellProtocol != NULL)
- ) {
+ )
+ {
if (gEfiShellProtocol != NULL) {
FileFunctionMap.GetFileInfo = gEfiShellProtocol->GetFileInfo;
FileFunctionMap.SetFileInfo = gEfiShellProtocol->SetFileInfo;
@@ -387,10 +401,13 @@ ShellLibConstructorWorker ( FileFunctionMap.FlushFile = (EFI_SHELL_FLUSH_FILE)FileHandleFlush;
FileFunctionMap.GetFileSize = (EFI_SHELL_GET_FILE_SIZE)FileHandleGetSize;
}
+
return (EFI_SUCCESS);
}
+
return (EFI_NOT_FOUND);
}
+
/**
Constructor for the Shell library.
@@ -419,11 +436,11 @@ ShellLibConstructor ( //
// verify that auto initialize is not set false
//
- if (PcdGetBool(PcdShellLibAutoInitialize) == 0) {
+ if (PcdGetBool (PcdShellLibAutoInitialize) == 0) {
return (EFI_SUCCESS);
}
- return (ShellLibConstructorWorker(ImageHandle, SystemTable));
+ return (ShellLibConstructorWorker (ImageHandle, SystemTable));
}
/**
@@ -442,41 +459,52 @@ ShellLibDestructor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (mEfiShellEnvironment2 != NULL) {
- Status = gBS->CloseProtocol(mEfiShellEnvironment2Handle==NULL?ImageHandle:mEfiShellEnvironment2Handle,
- &gEfiShellEnvironment2Guid,
- ImageHandle,
- NULL);
+ Status = gBS->CloseProtocol (
+ mEfiShellEnvironment2Handle == NULL ? ImageHandle : mEfiShellEnvironment2Handle,
+ &gEfiShellEnvironment2Guid,
+ ImageHandle,
+ NULL
+ );
if (!EFI_ERROR (Status)) {
mEfiShellEnvironment2 = NULL;
mEfiShellEnvironment2Handle = NULL;
}
}
+
if (mEfiShellInterface != NULL) {
- Status = gBS->CloseProtocol(ImageHandle,
- &gEfiShellInterfaceGuid,
- ImageHandle,
- NULL);
+ Status = gBS->CloseProtocol (
+ ImageHandle,
+ &gEfiShellInterfaceGuid,
+ ImageHandle,
+ NULL
+ );
if (!EFI_ERROR (Status)) {
mEfiShellInterface = NULL;
}
}
+
if (gEfiShellProtocol != NULL) {
- Status = gBS->CloseProtocol(ImageHandle,
- &gEfiShellProtocolGuid,
- ImageHandle,
- NULL);
+ Status = gBS->CloseProtocol (
+ ImageHandle,
+ &gEfiShellProtocolGuid,
+ ImageHandle,
+ NULL
+ );
if (!EFI_ERROR (Status)) {
gEfiShellProtocol = NULL;
}
}
+
if (gEfiShellParametersProtocol != NULL) {
- Status = gBS->CloseProtocol(ImageHandle,
- &gEfiShellParametersProtocolGuid,
- ImageHandle,
- NULL);
+ Status = gBS->CloseProtocol (
+ ImageHandle,
+ &gEfiShellParametersProtocolGuid,
+ ImageHandle,
+ NULL
+ );
if (!EFI_ERROR (Status)) {
gEfiShellParametersProtocol = NULL;
}
@@ -504,12 +532,12 @@ ShellInitialize ( VOID
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// if auto initialize is not false then skip
//
- if (PcdGetBool(PcdShellLibAutoInitialize) != 0) {
+ if (PcdGetBool (PcdShellLibAutoInitialize) != 0) {
return (EFI_SUCCESS);
}
@@ -522,7 +550,7 @@ ShellInitialize ( //
// init the new stuff
//
- return (ShellLibConstructorWorker(gImageHandle, gST));
+ return (ShellLibConstructorWorker (gImageHandle, gST));
}
/**
@@ -539,13 +567,13 @@ ShellInitialize ( @return the information about the file
**/
-EFI_FILE_INFO*
+EFI_FILE_INFO *
EFIAPI
ShellGetFileInfo (
- IN SHELL_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
)
{
- return (FileFunctionMap.GetFileInfo(FileHandle));
+ return (FileFunctionMap.GetFileInfo (FileHandle));
}
/**
@@ -570,56 +598,56 @@ ShellGetFileInfo ( EFI_STATUS
EFIAPI
ShellSetFileInfo (
- IN SHELL_FILE_HANDLE FileHandle,
- IN EFI_FILE_INFO *FileInfo
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN EFI_FILE_INFO *FileInfo
)
{
- return (FileFunctionMap.SetFileInfo(FileHandle, FileInfo));
+ return (FileFunctionMap.SetFileInfo (FileHandle, FileInfo));
}
- /**
- This function will open a file or directory referenced by DevicePath.
-
- This function opens a file with the open mode according to the file path. The
- Attributes is valid only for EFI_FILE_MODE_CREATE.
-
- @param FilePath on input the device path to the file. On output
- the remaining device path.
- @param FileHandle pointer to the file handle.
- @param OpenMode the mode to open the file with.
- @param Attributes the file's file attributes.
-
- @retval EFI_SUCCESS The information was set.
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
- @retval EFI_UNSUPPORTED Could not open the file path.
- @retval EFI_NOT_FOUND The specified file could not be found on the
- device or the file system could not be found on
- the device.
- @retval EFI_NO_MEDIA The device has no medium.
- @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
- medium is no longer supported.
- @retval EFI_DEVICE_ERROR The device reported an error.
- @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
- @retval EFI_WRITE_PROTECTED The file or medium is write protected.
- @retval EFI_ACCESS_DENIED The file was opened read only.
- @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
- file.
- @retval EFI_VOLUME_FULL The volume is full.
+/**
+This function will open a file or directory referenced by DevicePath.
+
+This function opens a file with the open mode according to the file path. The
+Attributes is valid only for EFI_FILE_MODE_CREATE.
+
+@param FilePath on input the device path to the file. On output
+ the remaining device path.
+@param FileHandle pointer to the file handle.
+@param OpenMode the mode to open the file with.
+@param Attributes the file's file attributes.
+
+@retval EFI_SUCCESS The information was set.
+@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
+@retval EFI_UNSUPPORTED Could not open the file path.
+@retval EFI_NOT_FOUND The specified file could not be found on the
+ device or the file system could not be found on
+ the device.
+@retval EFI_NO_MEDIA The device has no medium.
+@retval EFI_MEDIA_CHANGED The device has a different medium in it or the
+ medium is no longer supported.
+@retval EFI_DEVICE_ERROR The device reported an error.
+@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+@retval EFI_WRITE_PROTECTED The file or medium is write protected.
+@retval EFI_ACCESS_DENIED The file was opened read only.
+@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
+ file.
+@retval EFI_VOLUME_FULL The volume is full.
**/
EFI_STATUS
EFIAPI
-ShellOpenFileByDevicePath(
- IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
- OUT SHELL_FILE_HANDLE *FileHandle,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
+ShellOpenFileByDevicePath (
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
+ OUT SHELL_FILE_HANDLE *FileHandle,
+ IN UINT64 OpenMode,
+ IN UINT64 Attributes
)
{
- CHAR16 *FileName;
- EFI_STATUS Status;
- EFI_FILE_PROTOCOL *File;
+ CHAR16 *FileName;
+ EFI_STATUS Status;
+ EFI_FILE_PROTOCOL *File;
- if (FilePath == NULL || FileHandle == NULL) {
+ if ((FilePath == NULL) || (FileHandle == NULL)) {
return (EFI_INVALID_PARAMETER);
}
@@ -630,16 +658,16 @@ ShellOpenFileByDevicePath( //
// use UEFI Shell 2.0 method.
//
- FileName = gEfiShellProtocol->GetFilePathFromDevicePath(*FilePath);
+ FileName = gEfiShellProtocol->GetFilePathFromDevicePath (*FilePath);
if (FileName == NULL) {
return (EFI_INVALID_PARAMETER);
}
- Status = ShellOpenFileByName(FileName, FileHandle, OpenMode, Attributes);
- FreePool(FileName);
+
+ Status = ShellOpenFileByName (FileName, FileHandle, OpenMode, Attributes);
+ FreePool (FileName);
return (Status);
}
-
//
// use old shell method.
//
@@ -651,7 +679,7 @@ ShellOpenFileByDevicePath( //
// This is a weak spot since if the undefined SHELL_FILE_HANDLE format changes this must change also!
//
- *FileHandle = (VOID*)File;
+ *FileHandle = (VOID *)File;
return (EFI_SUCCESS);
}
@@ -688,23 +716,23 @@ ShellOpenFileByDevicePath( **/
EFI_STATUS
EFIAPI
-ShellOpenFileByName(
- IN CONST CHAR16 *FileName,
- OUT SHELL_FILE_HANDLE *FileHandle,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
+ShellOpenFileByName (
+ IN CONST CHAR16 *FileName,
+ OUT SHELL_FILE_HANDLE *FileHandle,
+ IN UINT64 OpenMode,
+ IN UINT64 Attributes
)
{
- EFI_DEVICE_PATH_PROTOCOL *FilePath;
- EFI_STATUS Status;
- EFI_FILE_INFO *FileInfo;
- CHAR16 *FileNameCopy;
- EFI_STATUS Status2;
+ EFI_DEVICE_PATH_PROTOCOL *FilePath;
+ EFI_STATUS Status;
+ EFI_FILE_INFO *FileInfo;
+ CHAR16 *FileNameCopy;
+ EFI_STATUS Status2;
//
// ASSERT if FileName is NULL
//
- ASSERT(FileName != NULL);
+ ASSERT (FileName != NULL);
if (FileName == NULL) {
return (EFI_INVALID_PARAMETER);
@@ -712,12 +740,11 @@ ShellOpenFileByName( if (gEfiShellProtocol != NULL) {
if ((OpenMode & EFI_FILE_MODE_CREATE) == EFI_FILE_MODE_CREATE) {
-
//
// Create only a directory
//
if ((Attributes & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) {
- return ShellCreateDirectory(FileName, FileHandle);
+ return ShellCreateDirectory (FileName, FileHandle);
}
//
@@ -727,63 +754,75 @@ ShellOpenFileByName( if (FileNameCopy == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
+
PathCleanUpDirectories (FileNameCopy);
if (PathRemoveLastItem (FileNameCopy)) {
- if (!EFI_ERROR(ShellCreateDirectory (FileNameCopy, FileHandle))) {
+ if (!EFI_ERROR (ShellCreateDirectory (FileNameCopy, FileHandle))) {
ShellCloseFile (FileHandle);
}
}
+
SHELL_FREE_NON_NULL (FileNameCopy);
}
//
// Use UEFI Shell 2.0 method to create the file
//
- Status = gEfiShellProtocol->OpenFileByName(FileName,
- FileHandle,
- OpenMode);
- if (EFI_ERROR(Status)) {
+ Status = gEfiShellProtocol->OpenFileByName (
+ FileName,
+ FileHandle,
+ OpenMode
+ );
+ if (EFI_ERROR (Status)) {
return Status;
}
if (mUnicodeCollationProtocol == NULL) {
- Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&mUnicodeCollationProtocol);
+ Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID **)&mUnicodeCollationProtocol);
if (EFI_ERROR (Status)) {
gEfiShellProtocol->CloseFile (*FileHandle);
return Status;
}
}
- if ((mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NUL") != 0) &&
- (mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NULL") != 0) &&
- !EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)){
- FileInfo = FileFunctionMap.GetFileInfo(*FileHandle);
- ASSERT(FileInfo != NULL);
+ if ((mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16 *)FileName, L"NUL") != 0) &&
+ (mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16 *)FileName, L"NULL") != 0) &&
+ !EFI_ERROR (Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0))
+ {
+ FileInfo = FileFunctionMap.GetFileInfo (*FileHandle);
+ ASSERT (FileInfo != NULL);
FileInfo->Attribute = Attributes;
- Status2 = FileFunctionMap.SetFileInfo(*FileHandle, FileInfo);
- FreePool(FileInfo);
+ Status2 = FileFunctionMap.SetFileInfo (*FileHandle, FileInfo);
+ FreePool (FileInfo);
if (EFI_ERROR (Status2)) {
- gEfiShellProtocol->CloseFile(*FileHandle);
+ gEfiShellProtocol->CloseFile (*FileHandle);
}
+
Status = Status2;
}
+
return (Status);
}
+
//
// Using EFI Shell version
// this means convert name to path and call that function
// since this will use EFI method again that will open it.
//
- ASSERT(mEfiShellEnvironment2 != NULL);
- FilePath = mEfiShellEnvironment2->NameToPath ((CHAR16*)FileName);
+ ASSERT (mEfiShellEnvironment2 != NULL);
+ FilePath = mEfiShellEnvironment2->NameToPath ((CHAR16 *)FileName);
if (FilePath != NULL) {
- return (ShellOpenFileByDevicePath(&FilePath,
- FileHandle,
- OpenMode,
- Attributes));
+ return (ShellOpenFileByDevicePath (
+ &FilePath,
+ FileHandle,
+ OpenMode,
+ Attributes
+ ));
}
+
return (EFI_DEVICE_ERROR);
}
+
/**
This function create a directory
@@ -814,25 +853,27 @@ ShellOpenFileByName( **/
EFI_STATUS
EFIAPI
-ShellCreateDirectory(
- IN CONST CHAR16 *DirectoryName,
- OUT SHELL_FILE_HANDLE *FileHandle
+ShellCreateDirectory (
+ IN CONST CHAR16 *DirectoryName,
+ OUT SHELL_FILE_HANDLE *FileHandle
)
{
if (gEfiShellProtocol != NULL) {
//
// Use UEFI Shell 2.0 method
//
- return (gEfiShellProtocol->CreateFile(DirectoryName,
- EFI_FILE_DIRECTORY,
- FileHandle
- ));
+ return (gEfiShellProtocol->CreateFile (
+ DirectoryName,
+ EFI_FILE_DIRECTORY,
+ FileHandle
+ ));
} else {
- return (ShellOpenFileByName(DirectoryName,
- FileHandle,
- EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE,
- EFI_FILE_DIRECTORY
- ));
+ return (ShellOpenFileByName (
+ DirectoryName,
+ FileHandle,
+ EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE,
+ EFI_FILE_DIRECTORY
+ ));
}
}
@@ -867,16 +908,15 @@ ShellCreateDirectory( **/
EFI_STATUS
EFIAPI
-ShellReadFile(
- IN SHELL_FILE_HANDLE FileHandle,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
+ShellReadFile (
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
)
{
- return (FileFunctionMap.ReadFile(FileHandle, BufferSize, Buffer));
+ return (FileFunctionMap.ReadFile (FileHandle, BufferSize, Buffer));
}
-
/**
Write data to a file.
@@ -903,13 +943,13 @@ ShellReadFile( **/
EFI_STATUS
EFIAPI
-ShellWriteFile(
- IN SHELL_FILE_HANDLE FileHandle,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
+ShellWriteFile (
+ IN SHELL_FILE_HANDLE FileHandle,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
)
{
- return (FileFunctionMap.WriteFile(FileHandle, BufferSize, Buffer));
+ return (FileFunctionMap.WriteFile (FileHandle, BufferSize, Buffer));
}
/**
@@ -926,10 +966,10 @@ ShellWriteFile( EFI_STATUS
EFIAPI
ShellCloseFile (
- IN SHELL_FILE_HANDLE *FileHandle
+ IN SHELL_FILE_HANDLE *FileHandle
)
{
- return (FileFunctionMap.CloseFile(*FileHandle));
+ return (FileFunctionMap.CloseFile (*FileHandle));
}
/**
@@ -949,10 +989,10 @@ ShellCloseFile ( EFI_STATUS
EFIAPI
ShellDeleteFile (
- IN SHELL_FILE_HANDLE *FileHandle
+ IN SHELL_FILE_HANDLE *FileHandle
)
{
- return (FileFunctionMap.DeleteFile(*FileHandle));
+ return (FileFunctionMap.DeleteFile (*FileHandle));
}
/**
@@ -977,11 +1017,11 @@ ShellDeleteFile ( EFI_STATUS
EFIAPI
ShellSetFilePosition (
- IN SHELL_FILE_HANDLE FileHandle,
+ IN SHELL_FILE_HANDLE FileHandle,
IN UINT64 Position
)
{
- return (FileFunctionMap.SetFilePosition(FileHandle, Position));
+ return (FileFunctionMap.SetFilePosition (FileHandle, Position));
}
/**
@@ -1002,12 +1042,13 @@ ShellSetFilePosition ( EFI_STATUS
EFIAPI
ShellGetFilePosition (
- IN SHELL_FILE_HANDLE FileHandle,
- OUT UINT64 *Position
+ IN SHELL_FILE_HANDLE FileHandle,
+ OUT UINT64 *Position
)
{
- return (FileFunctionMap.GetFilePosition(FileHandle, Position));
+ return (FileFunctionMap.GetFilePosition (FileHandle, Position));
}
+
/**
Flushes data on a file
@@ -1025,10 +1066,10 @@ ShellGetFilePosition ( EFI_STATUS
EFIAPI
ShellFlushFile (
- IN SHELL_FILE_HANDLE FileHandle
+ IN SHELL_FILE_HANDLE FileHandle
)
{
- return (FileFunctionMap.FlushFile(FileHandle));
+ return (FileFunctionMap.FlushFile (FileHandle));
}
/** Retrieve first entry from a directory.
@@ -1056,15 +1097,16 @@ ShellFlushFile ( EFI_STATUS
EFIAPI
ShellFindFirstFile (
- IN SHELL_FILE_HANDLE DirHandle,
- OUT EFI_FILE_INFO **Buffer
+ IN SHELL_FILE_HANDLE DirHandle,
+ OUT EFI_FILE_INFO **Buffer
)
{
//
// pass to file handle lib
//
- return (FileHandleFindFirstFile(DirHandle, Buffer));
+ return (FileHandleFindFirstFile (DirHandle, Buffer));
}
+
/** Retrieve next entries from a directory.
To use this function, the caller must first call the ShellFindFirstFile()
@@ -1085,17 +1127,18 @@ ShellFindFirstFile ( **/
EFI_STATUS
EFIAPI
-ShellFindNextFile(
- IN SHELL_FILE_HANDLE DirHandle,
- OUT EFI_FILE_INFO *Buffer,
- OUT BOOLEAN *NoFile
+ShellFindNextFile (
+ IN SHELL_FILE_HANDLE DirHandle,
+ OUT EFI_FILE_INFO *Buffer,
+ OUT BOOLEAN *NoFile
)
{
//
// pass to file handle lib
//
- return (FileHandleFindNextFile(DirHandle, Buffer, NoFile));
+ return (FileHandleFindNextFile (DirHandle, Buffer, NoFile));
}
+
/**
Retrieve the size of a file.
@@ -1114,12 +1157,13 @@ ShellFindNextFile( EFI_STATUS
EFIAPI
ShellGetFileSize (
- IN SHELL_FILE_HANDLE FileHandle,
- OUT UINT64 *Size
+ IN SHELL_FILE_HANDLE FileHandle,
+ OUT UINT64 *Size
)
{
- return (FileFunctionMap.GetFileSize(FileHandle, Size));
+ return (FileFunctionMap.GetFileSize (FileHandle, Size));
}
+
/**
Retrieves the status of the break execution flag
@@ -1130,7 +1174,7 @@ ShellGetFileSize ( **/
BOOLEAN
EFIAPI
-ShellGetExecutionBreakFlag(
+ShellGetExecutionBreakFlag (
VOID
)
{
@@ -1138,13 +1182,13 @@ ShellGetExecutionBreakFlag( // Check for UEFI Shell 2.0 protocols
//
if (gEfiShellProtocol != NULL) {
-
//
// We are using UEFI Shell 2.0; see if the event has been triggered
//
- if (gBS->CheckEvent(gEfiShellProtocol->ExecutionBreak) != EFI_SUCCESS) {
+ if (gBS->CheckEvent (gEfiShellProtocol->ExecutionBreak) != EFI_SUCCESS) {
return (FALSE);
}
+
return (TRUE);
}
@@ -1152,11 +1196,12 @@ ShellGetExecutionBreakFlag( // using EFI Shell; call the function to check
//
if (mEfiShellEnvironment2 != NULL) {
- return (mEfiShellEnvironment2->GetExecutionBreak());
+ return (mEfiShellEnvironment2->GetExecutionBreak ());
}
return (FALSE);
}
+
/**
return the value of an environment variable
@@ -1168,28 +1213,29 @@ ShellGetExecutionBreakFlag( @retval NULL the named environment variable does not exist.
@return != NULL pointer to the value of the environment variable
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellGetEnvironmentVariable (
- IN CONST CHAR16 *EnvKey
+ IN CONST CHAR16 *EnvKey
)
{
//
// Check for UEFI Shell 2.0 protocols
//
if (gEfiShellProtocol != NULL) {
- return (gEfiShellProtocol->GetEnv(EnvKey));
+ return (gEfiShellProtocol->GetEnv (EnvKey));
}
//
// Check for EFI shell
//
if (mEfiShellEnvironment2 != NULL) {
- return (mEfiShellEnvironment2->GetEnv((CHAR16*)EnvKey));
+ return (mEfiShellEnvironment2->GetEnv ((CHAR16 *)EnvKey));
}
return NULL;
}
+
/**
set the value of an environment variable
@@ -1213,16 +1259,16 @@ environment variable is created and assigned the specified value. EFI_STATUS
EFIAPI
ShellSetEnvironmentVariable (
- IN CONST CHAR16 *EnvKey,
- IN CONST CHAR16 *EnvVal,
- IN BOOLEAN Volatile
+ IN CONST CHAR16 *EnvKey,
+ IN CONST CHAR16 *EnvVal,
+ IN BOOLEAN Volatile
)
{
//
// Check for UEFI Shell 2.0 protocols
//
if (gEfiShellProtocol != NULL) {
- return (gEfiShellProtocol->SetEnv(EnvKey, EnvVal, Volatile));
+ return (gEfiShellProtocol->SetEnv (EnvKey, EnvVal, Volatile));
}
//
@@ -1264,14 +1310,15 @@ ShellSetEnvironmentVariable ( EFI_STATUS
EFIAPI
ShellExecute (
- IN EFI_HANDLE *ParentHandle,
- IN CHAR16 *CommandLine OPTIONAL,
- IN BOOLEAN Output OPTIONAL,
- IN CHAR16 **EnvironmentVariables OPTIONAL,
- OUT EFI_STATUS *Status OPTIONAL
+ IN EFI_HANDLE *ParentHandle,
+ IN CHAR16 *CommandLine OPTIONAL,
+ IN BOOLEAN Output OPTIONAL,
+ IN CHAR16 **EnvironmentVariables OPTIONAL,
+ OUT EFI_STATUS *Status OPTIONAL
)
{
- EFI_STATUS CmdStatus;
+ EFI_STATUS CmdStatus;
+
//
// Check for UEFI Shell 2.0 protocols
//
@@ -1279,10 +1326,12 @@ ShellExecute ( //
// Call UEFI Shell 2.0 version (not using Output parameter)
//
- return (gEfiShellProtocol->Execute(ParentHandle,
- CommandLine,
- EnvironmentVariables,
- Status));
+ return (gEfiShellProtocol->Execute (
+ ParentHandle,
+ CommandLine,
+ EnvironmentVariables,
+ Status
+ ));
}
//
@@ -1311,15 +1360,18 @@ ShellExecute ( // SEnvDoExecute(), and
// - pass the resultant EFI_HANDLE as an (EFI_HANDLE*).
//
- CmdStatus = (mEfiShellEnvironment2->Execute((EFI_HANDLE *)*ParentHandle,
+ CmdStatus = (mEfiShellEnvironment2->Execute (
+ (EFI_HANDLE *)*ParentHandle,
CommandLine,
- Output));
+ Output
+ ));
//
// No Status output parameter so just use the returned status
//
if (Status != NULL) {
*Status = CmdStatus;
}
+
//
// If there was an error, we can't tell if it was from the command or from
// the Execute() function, so we'll just assume the shell ran successfully
@@ -1345,28 +1397,29 @@ ShellExecute ( @retval NULL the directory does not exist
@return != NULL the directory
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellGetCurrentDir (
- IN CHAR16 * CONST DeviceName OPTIONAL
+ IN CHAR16 *CONST DeviceName OPTIONAL
)
{
//
// Check for UEFI Shell 2.0 protocols
//
if (gEfiShellProtocol != NULL) {
- return (gEfiShellProtocol->GetCurDir(DeviceName));
+ return (gEfiShellProtocol->GetCurDir (DeviceName));
}
//
// Check for EFI shell
//
if (mEfiShellEnvironment2 != NULL) {
- return (mEfiShellEnvironment2->CurDir(DeviceName));
+ return (mEfiShellEnvironment2->CurDir (DeviceName));
}
return (NULL);
}
+
/**
sets (enabled or disabled) the page break mode
@@ -1378,7 +1431,7 @@ ShellGetCurrentDir ( VOID
EFIAPI
ShellSetPageBreakMode (
- IN BOOLEAN CurrentState
+ IN BOOLEAN CurrentState
)
{
//
@@ -1392,7 +1445,7 @@ ShellSetPageBreakMode ( //
// Enable with UEFI 2.0 Shell
//
- gEfiShellProtocol->EnablePageBreak();
+ gEfiShellProtocol->EnablePageBreak ();
return;
} else {
//
@@ -1414,7 +1467,7 @@ ShellSetPageBreakMode ( //
// Disable with UEFI 2.0 Shell
//
- gEfiShellProtocol->DisablePageBreak();
+ gEfiShellProtocol->DisablePageBreak ();
return;
} else {
//
@@ -1436,12 +1489,12 @@ ShellSetPageBreakMode ( /// This allows for the struct to be populated.
///
typedef struct {
- LIST_ENTRY Link;
- EFI_STATUS Status;
- CHAR16 *FullName;
- CHAR16 *FileName;
- SHELL_FILE_HANDLE Handle;
- EFI_FILE_INFO *Info;
+ LIST_ENTRY Link;
+ EFI_STATUS Status;
+ CHAR16 *FullName;
+ CHAR16 *FileName;
+ SHELL_FILE_HANDLE Handle;
+ EFI_FILE_INFO *Info;
} EFI_SHELL_FILE_INFO_NO_CONST;
/**
@@ -1458,10 +1511,10 @@ typedef struct { @retval the resultant head of the double linked new format list;
**/
-LIST_ENTRY*
+LIST_ENTRY *
InternalShellConvertFileListType (
- IN LIST_ENTRY *FileList,
- IN OUT LIST_ENTRY *ListHead
+ IN LIST_ENTRY *FileList,
+ IN OUT LIST_ENTRY *ListHead
)
{
SHELL_FILE_ARG *OldInfo;
@@ -1471,15 +1524,15 @@ InternalShellConvertFileListType ( //
// ASSERTs
//
- ASSERT(FileList != NULL);
- ASSERT(ListHead != NULL);
+ ASSERT (FileList != NULL);
+ ASSERT (ListHead != NULL);
//
// enumerate through each member of the old list and copy
//
for (Link = FileList->ForwardLink; Link != FileList; Link = Link->ForwardLink) {
OldInfo = CR (Link, SHELL_FILE_ARG, Link, SHELL_FILE_ARG_SIGNATURE);
- ASSERT(OldInfo != NULL);
+ ASSERT (OldInfo != NULL);
//
// Skip ones that failed to open...
@@ -1491,16 +1544,16 @@ InternalShellConvertFileListType ( //
// make sure the old list was valid
//
- ASSERT(OldInfo->Info != NULL);
- ASSERT(OldInfo->FullName != NULL);
- ASSERT(OldInfo->FileName != NULL);
+ ASSERT (OldInfo->Info != NULL);
+ ASSERT (OldInfo->FullName != NULL);
+ ASSERT (OldInfo->FileName != NULL);
//
// allocate a new EFI_SHELL_FILE_INFO object
//
- NewInfo = AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
+ NewInfo = AllocateZeroPool (sizeof (EFI_SHELL_FILE_INFO));
if (NewInfo == NULL) {
- ShellCloseFileMetaArg((EFI_SHELL_FILE_INFO**)(&ListHead));
+ ShellCloseFileMetaArg ((EFI_SHELL_FILE_INFO **)(&ListHead));
ListHead = NULL;
break;
}
@@ -1508,8 +1561,8 @@ InternalShellConvertFileListType ( //
// copy the simple items
//
- NewInfo->Handle = OldInfo->Handle;
- NewInfo->Status = OldInfo->Status;
+ NewInfo->Handle = OldInfo->Handle;
+ NewInfo->Status = OldInfo->Status;
// old shell checks for 0 not NULL
OldInfo->Handle = 0;
@@ -1517,26 +1570,26 @@ InternalShellConvertFileListType ( //
// allocate new space to copy strings and structure
//
- NewInfo->FullName = AllocateCopyPool(StrSize(OldInfo->FullName), OldInfo->FullName);
- NewInfo->FileName = AllocateCopyPool(StrSize(OldInfo->FileName), OldInfo->FileName);
- NewInfo->Info = AllocateCopyPool((UINTN)OldInfo->Info->Size, OldInfo->Info);
+ NewInfo->FullName = AllocateCopyPool (StrSize (OldInfo->FullName), OldInfo->FullName);
+ NewInfo->FileName = AllocateCopyPool (StrSize (OldInfo->FileName), OldInfo->FileName);
+ NewInfo->Info = AllocateCopyPool ((UINTN)OldInfo->Info->Size, OldInfo->Info);
//
// make sure all the memory allocations were sucessful
//
- if (NULL == NewInfo->FullName || NewInfo->FileName == NULL || NewInfo->Info == NULL) {
+ if ((NULL == NewInfo->FullName) || (NewInfo->FileName == NULL) || (NewInfo->Info == NULL)) {
//
// Free the partially allocated new node
//
- SHELL_FREE_NON_NULL(NewInfo->FullName);
- SHELL_FREE_NON_NULL(NewInfo->FileName);
- SHELL_FREE_NON_NULL(NewInfo->Info);
- SHELL_FREE_NON_NULL(NewInfo);
+ SHELL_FREE_NON_NULL (NewInfo->FullName);
+ SHELL_FREE_NON_NULL (NewInfo->FileName);
+ SHELL_FREE_NON_NULL (NewInfo->Info);
+ SHELL_FREE_NON_NULL (NewInfo);
//
// Free the previously converted stuff
//
- ShellCloseFileMetaArg((EFI_SHELL_FILE_INFO**)(&ListHead));
+ ShellCloseFileMetaArg ((EFI_SHELL_FILE_INFO **)(&ListHead));
ListHead = NULL;
break;
}
@@ -1544,10 +1597,12 @@ InternalShellConvertFileListType ( //
// add that to the list
//
- InsertTailList(ListHead, &NewInfo->Link);
+ InsertTailList (ListHead, &NewInfo->Link);
}
+
return (ListHead);
}
+
/**
Opens a group of files based on a path.
@@ -1574,20 +1629,20 @@ InternalShellConvertFileListType ( EFI_STATUS
EFIAPI
ShellOpenFileMetaArg (
- IN CHAR16 *Arg,
- IN UINT64 OpenMode,
- IN OUT EFI_SHELL_FILE_INFO **ListHead
+ IN CHAR16 *Arg,
+ IN UINT64 OpenMode,
+ IN OUT EFI_SHELL_FILE_INFO **ListHead
)
{
- EFI_STATUS Status;
- LIST_ENTRY mOldStyleFileList;
- CHAR16 *CleanFilePathStr;
+ EFI_STATUS Status;
+ LIST_ENTRY mOldStyleFileList;
+ CHAR16 *CleanFilePathStr;
//
// ASSERT that Arg and ListHead are not NULL
//
- ASSERT(Arg != NULL);
- ASSERT(ListHead != NULL);
+ ASSERT (Arg != NULL);
+ ASSERT (ListHead != NULL);
CleanFilePathStr = NULL;
@@ -1601,28 +1656,34 @@ ShellOpenFileMetaArg ( //
if (gEfiShellProtocol != NULL) {
if (*ListHead == NULL) {
- *ListHead = (EFI_SHELL_FILE_INFO*)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
+ *ListHead = (EFI_SHELL_FILE_INFO *)AllocateZeroPool (sizeof (EFI_SHELL_FILE_INFO));
if (*ListHead == NULL) {
- FreePool(CleanFilePathStr);
+ FreePool (CleanFilePathStr);
return (EFI_OUT_OF_RESOURCES);
}
- InitializeListHead(&((*ListHead)->Link));
+
+ InitializeListHead (&((*ListHead)->Link));
}
- Status = gEfiShellProtocol->OpenFileList(CleanFilePathStr,
- OpenMode,
- ListHead);
- if (EFI_ERROR(Status)) {
- gEfiShellProtocol->RemoveDupInFileList(ListHead);
+
+ Status = gEfiShellProtocol->OpenFileList (
+ CleanFilePathStr,
+ OpenMode,
+ ListHead
+ );
+ if (EFI_ERROR (Status)) {
+ gEfiShellProtocol->RemoveDupInFileList (ListHead);
} else {
- Status = gEfiShellProtocol->RemoveDupInFileList(ListHead);
+ Status = gEfiShellProtocol->RemoveDupInFileList (ListHead);
}
- if (*ListHead != NULL && IsListEmpty(&(*ListHead)->Link)) {
- FreePool(*ListHead);
- FreePool(CleanFilePathStr);
+
+ if ((*ListHead != NULL) && IsListEmpty (&(*ListHead)->Link)) {
+ FreePool (*ListHead);
+ FreePool (CleanFilePathStr);
*ListHead = NULL;
return (EFI_NOT_FOUND);
}
- FreePool(CleanFilePathStr);
+
+ FreePool (CleanFilePathStr);
return (Status);
}
@@ -1633,49 +1694,52 @@ ShellOpenFileMetaArg ( //
// make sure the list head is initialized
//
- InitializeListHead(&mOldStyleFileList);
+ InitializeListHead (&mOldStyleFileList);
//
// Get the EFI Shell list of files
//
- Status = mEfiShellEnvironment2->FileMetaArg(CleanFilePathStr, &mOldStyleFileList);
- if (EFI_ERROR(Status)) {
+ Status = mEfiShellEnvironment2->FileMetaArg (CleanFilePathStr, &mOldStyleFileList);
+ if (EFI_ERROR (Status)) {
*ListHead = NULL;
- FreePool(CleanFilePathStr);
+ FreePool (CleanFilePathStr);
return (Status);
}
if (*ListHead == NULL) {
- *ListHead = (EFI_SHELL_FILE_INFO *)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
+ *ListHead = (EFI_SHELL_FILE_INFO *)AllocateZeroPool (sizeof (EFI_SHELL_FILE_INFO));
if (*ListHead == NULL) {
- FreePool(CleanFilePathStr);
+ FreePool (CleanFilePathStr);
return (EFI_OUT_OF_RESOURCES);
}
- InitializeListHead(&((*ListHead)->Link));
+
+ InitializeListHead (&((*ListHead)->Link));
}
//
// Convert that to equivalent of UEFI Shell 2.0 structure
//
- InternalShellConvertFileListType(&mOldStyleFileList, &(*ListHead)->Link);
+ InternalShellConvertFileListType (&mOldStyleFileList, &(*ListHead)->Link);
//
// Free the EFI Shell version that was converted.
//
- mEfiShellEnvironment2->FreeFileList(&mOldStyleFileList);
+ mEfiShellEnvironment2->FreeFileList (&mOldStyleFileList);
- if ((*ListHead)->Link.ForwardLink == (*ListHead)->Link.BackLink && (*ListHead)->Link.BackLink == &((*ListHead)->Link)) {
- FreePool(*ListHead);
+ if (((*ListHead)->Link.ForwardLink == (*ListHead)->Link.BackLink) && ((*ListHead)->Link.BackLink == &((*ListHead)->Link))) {
+ FreePool (*ListHead);
*ListHead = NULL;
- Status = EFI_NOT_FOUND;
+ Status = EFI_NOT_FOUND;
}
- FreePool(CleanFilePathStr);
+
+ FreePool (CleanFilePathStr);
return (Status);
}
- FreePool(CleanFilePathStr);
+ FreePool (CleanFilePathStr);
return (EFI_UNSUPPORTED);
}
+
/**
Free the linked list returned from ShellOpenFileMetaArg.
@@ -1688,37 +1752,39 @@ ShellOpenFileMetaArg ( EFI_STATUS
EFIAPI
ShellCloseFileMetaArg (
- IN OUT EFI_SHELL_FILE_INFO **ListHead
+ IN OUT EFI_SHELL_FILE_INFO **ListHead
)
{
- LIST_ENTRY *Node;
+ LIST_ENTRY *Node;
//
// ASSERT that ListHead is not NULL
//
- ASSERT(ListHead != NULL);
+ ASSERT (ListHead != NULL);
//
// Check for UEFI Shell 2.0 protocols
//
if (gEfiShellProtocol != NULL) {
- return (gEfiShellProtocol->FreeFileList(ListHead));
+ return (gEfiShellProtocol->FreeFileList (ListHead));
} else if (mEfiShellEnvironment2 != NULL) {
//
// Since this is EFI Shell version we need to free our internally made copy
// of the list
//
- for ( Node = GetFirstNode(&(*ListHead)->Link)
- ; *ListHead != NULL && !IsListEmpty(&(*ListHead)->Link)
- ; Node = GetFirstNode(&(*ListHead)->Link)) {
- RemoveEntryList(Node);
- ((EFI_FILE_PROTOCOL*)((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Handle)->Close(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Handle);
- FreePool(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->FullName);
- FreePool(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->FileName);
- FreePool(((EFI_SHELL_FILE_INFO_NO_CONST*)Node)->Info);
- FreePool((EFI_SHELL_FILE_INFO_NO_CONST*)Node);
+ for ( Node = GetFirstNode (&(*ListHead)->Link)
+ ; *ListHead != NULL && !IsListEmpty (&(*ListHead)->Link)
+ ; Node = GetFirstNode (&(*ListHead)->Link))
+ {
+ RemoveEntryList (Node);
+ ((EFI_FILE_PROTOCOL *)((EFI_SHELL_FILE_INFO_NO_CONST *)Node)->Handle)->Close (((EFI_SHELL_FILE_INFO_NO_CONST *)Node)->Handle);
+ FreePool (((EFI_SHELL_FILE_INFO_NO_CONST *)Node)->FullName);
+ FreePool (((EFI_SHELL_FILE_INFO_NO_CONST *)Node)->FileName);
+ FreePool (((EFI_SHELL_FILE_INFO_NO_CONST *)Node)->Info);
+ FreePool ((EFI_SHELL_FILE_INFO_NO_CONST *)Node);
}
- SHELL_FREE_NON_NULL(*ListHead);
+
+ SHELL_FREE_NON_NULL (*ListHead);
return EFI_SUCCESS;
}
@@ -1740,103 +1806,113 @@ ShellCloseFileMetaArg ( CHAR16 *
EFIAPI
ShellFindFilePath (
- IN CONST CHAR16 *FileName
+ IN CONST CHAR16 *FileName
)
{
- CONST CHAR16 *Path;
- SHELL_FILE_HANDLE Handle;
- EFI_STATUS Status;
- CHAR16 *RetVal;
- CHAR16 *TestPath;
- CONST CHAR16 *Walker;
- UINTN Size;
- CHAR16 *TempChar;
+ CONST CHAR16 *Path;
+ SHELL_FILE_HANDLE Handle;
+ EFI_STATUS Status;
+ CHAR16 *RetVal;
+ CHAR16 *TestPath;
+ CONST CHAR16 *Walker;
+ UINTN Size;
+ CHAR16 *TempChar;
RetVal = NULL;
//
// First make sure its not an absolute path.
//
- Status = ShellOpenFileByName(FileName, &Handle, EFI_FILE_MODE_READ, 0);
- if (!EFI_ERROR(Status)){
- if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) {
- ASSERT(RetVal == NULL);
- RetVal = StrnCatGrow(&RetVal, NULL, FileName, 0);
- ShellCloseFile(&Handle);
+ Status = ShellOpenFileByName (FileName, &Handle, EFI_FILE_MODE_READ, 0);
+ if (!EFI_ERROR (Status)) {
+ if (FileHandleIsDirectory (Handle) != EFI_SUCCESS) {
+ ASSERT (RetVal == NULL);
+ RetVal = StrnCatGrow (&RetVal, NULL, FileName, 0);
+ ShellCloseFile (&Handle);
return (RetVal);
} else {
- ShellCloseFile(&Handle);
+ ShellCloseFile (&Handle);
}
}
- Path = ShellGetEnvironmentVariable(L"cwd");
+ Path = ShellGetEnvironmentVariable (L"cwd");
if (Path != NULL) {
- Size = StrSize(Path) + sizeof(CHAR16);
- Size += StrSize(FileName);
- TestPath = AllocateZeroPool(Size);
+ Size = StrSize (Path) + sizeof (CHAR16);
+ Size += StrSize (FileName);
+ TestPath = AllocateZeroPool (Size);
if (TestPath == NULL) {
return (NULL);
}
- StrCpyS(TestPath, Size/sizeof(CHAR16), Path);
- StrCatS(TestPath, Size/sizeof(CHAR16), L"\\");
- StrCatS(TestPath, Size/sizeof(CHAR16), FileName);
- Status = ShellOpenFileByName(TestPath, &Handle, EFI_FILE_MODE_READ, 0);
- if (!EFI_ERROR(Status)){
- if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) {
- ASSERT(RetVal == NULL);
- RetVal = StrnCatGrow(&RetVal, NULL, TestPath, 0);
- ShellCloseFile(&Handle);
- FreePool(TestPath);
+
+ StrCpyS (TestPath, Size/sizeof (CHAR16), Path);
+ StrCatS (TestPath, Size/sizeof (CHAR16), L"\\");
+ StrCatS (TestPath, Size/sizeof (CHAR16), FileName);
+ Status = ShellOpenFileByName (TestPath, &Handle, EFI_FILE_MODE_READ, 0);
+ if (!EFI_ERROR (Status)) {
+ if (FileHandleIsDirectory (Handle) != EFI_SUCCESS) {
+ ASSERT (RetVal == NULL);
+ RetVal = StrnCatGrow (&RetVal, NULL, TestPath, 0);
+ ShellCloseFile (&Handle);
+ FreePool (TestPath);
return (RetVal);
} else {
- ShellCloseFile(&Handle);
+ ShellCloseFile (&Handle);
}
}
- FreePool(TestPath);
+
+ FreePool (TestPath);
}
- Path = ShellGetEnvironmentVariable(L"path");
+
+ Path = ShellGetEnvironmentVariable (L"path");
if (Path != NULL) {
- Size = StrSize(Path)+sizeof(CHAR16);
- Size += StrSize(FileName);
- TestPath = AllocateZeroPool(Size);
+ Size = StrSize (Path)+sizeof (CHAR16);
+ Size += StrSize (FileName);
+ TestPath = AllocateZeroPool (Size);
if (TestPath == NULL) {
return (NULL);
}
- Walker = (CHAR16*)Path;
+
+ Walker = (CHAR16 *)Path;
do {
- CopyMem(TestPath, Walker, StrSize(Walker));
+ CopyMem (TestPath, Walker, StrSize (Walker));
if (TestPath != NULL) {
- TempChar = StrStr(TestPath, L";");
+ TempChar = StrStr (TestPath, L";");
if (TempChar != NULL) {
*TempChar = CHAR_NULL;
}
- if (TestPath[StrLen(TestPath)-1] != L'\\') {
- StrCatS(TestPath, Size/sizeof(CHAR16), L"\\");
+
+ if (TestPath[StrLen (TestPath)-1] != L'\\') {
+ StrCatS (TestPath, Size/sizeof (CHAR16), L"\\");
}
+
if (FileName[0] == L'\\') {
FileName++;
}
- StrCatS(TestPath, Size/sizeof(CHAR16), FileName);
- if (StrStr(Walker, L";") != NULL) {
- Walker = StrStr(Walker, L";") + 1;
+
+ StrCatS (TestPath, Size/sizeof (CHAR16), FileName);
+ if (StrStr (Walker, L";") != NULL) {
+ Walker = StrStr (Walker, L";") + 1;
} else {
Walker = NULL;
}
- Status = ShellOpenFileByName(TestPath, &Handle, EFI_FILE_MODE_READ, 0);
- if (!EFI_ERROR(Status)){
- if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) {
- ASSERT(RetVal == NULL);
- RetVal = StrnCatGrow(&RetVal, NULL, TestPath, 0);
- ShellCloseFile(&Handle);
+
+ Status = ShellOpenFileByName (TestPath, &Handle, EFI_FILE_MODE_READ, 0);
+ if (!EFI_ERROR (Status)) {
+ if (FileHandleIsDirectory (Handle) != EFI_SUCCESS) {
+ ASSERT (RetVal == NULL);
+ RetVal = StrnCatGrow (&RetVal, NULL, TestPath, 0);
+ ShellCloseFile (&Handle);
break;
} else {
- ShellCloseFile(&Handle);
+ ShellCloseFile (&Handle);
}
}
}
} while (Walker != NULL && Walker[0] != CHAR_NULL);
- FreePool(TestPath);
+
+ FreePool (TestPath);
}
+
return (RetVal);
}
@@ -1859,57 +1935,64 @@ ShellFindFilePath ( CHAR16 *
EFIAPI
ShellFindFilePathEx (
- IN CONST CHAR16 *FileName,
- IN CONST CHAR16 *FileExtension
+ IN CONST CHAR16 *FileName,
+ IN CONST CHAR16 *FileExtension
)
{
- CHAR16 *TestPath;
- CHAR16 *RetVal;
- CONST CHAR16 *ExtensionWalker;
- UINTN Size;
- CHAR16 *TempChar;
- CHAR16 *TempChar2;
-
- ASSERT(FileName != NULL);
+ CHAR16 *TestPath;
+ CHAR16 *RetVal;
+ CONST CHAR16 *ExtensionWalker;
+ UINTN Size;
+ CHAR16 *TempChar;
+ CHAR16 *TempChar2;
+
+ ASSERT (FileName != NULL);
if (FileExtension == NULL) {
- return (ShellFindFilePath(FileName));
+ return (ShellFindFilePath (FileName));
}
- RetVal = ShellFindFilePath(FileName);
+
+ RetVal = ShellFindFilePath (FileName);
if (RetVal != NULL) {
return (RetVal);
}
- Size = StrSize(FileName);
- Size += StrSize(FileExtension);
- TestPath = AllocateZeroPool(Size);
+
+ Size = StrSize (FileName);
+ Size += StrSize (FileExtension);
+ TestPath = AllocateZeroPool (Size);
if (TestPath == NULL) {
return (NULL);
}
- for (ExtensionWalker = FileExtension, TempChar2 = (CHAR16*)FileExtension; TempChar2 != NULL ; ExtensionWalker = TempChar2 + 1){
- StrCpyS(TestPath, Size/sizeof(CHAR16), FileName);
+
+ for (ExtensionWalker = FileExtension, TempChar2 = (CHAR16 *)FileExtension; TempChar2 != NULL; ExtensionWalker = TempChar2 + 1) {
+ StrCpyS (TestPath, Size/sizeof (CHAR16), FileName);
if (ExtensionWalker != NULL) {
- StrCatS(TestPath, Size/sizeof(CHAR16), ExtensionWalker);
+ StrCatS (TestPath, Size/sizeof (CHAR16), ExtensionWalker);
}
- TempChar = StrStr(TestPath, L";");
+
+ TempChar = StrStr (TestPath, L";");
if (TempChar != NULL) {
*TempChar = CHAR_NULL;
}
- RetVal = ShellFindFilePath(TestPath);
+
+ RetVal = ShellFindFilePath (TestPath);
if (RetVal != NULL) {
break;
}
- ASSERT(ExtensionWalker != NULL);
- TempChar2 = StrStr(ExtensionWalker, L";");
+
+ ASSERT (ExtensionWalker != NULL);
+ TempChar2 = StrStr (ExtensionWalker, L";");
}
- FreePool(TestPath);
+
+ FreePool (TestPath);
return (RetVal);
}
typedef struct {
- LIST_ENTRY Link;
- CHAR16 *Name;
- SHELL_PARAM_TYPE Type;
- CHAR16 *Value;
- UINTN OriginalPosition;
+ LIST_ENTRY Link;
+ CHAR16 *Name;
+ SHELL_PARAM_TYPE Type;
+ CHAR16 *Value;
+ UINTN OriginalPosition;
} SHELL_PARAM_PACKAGE;
/**
@@ -1929,55 +2012,58 @@ typedef struct { **/
BOOLEAN
InternalIsOnCheckList (
- IN CONST CHAR16 *Name,
- IN CONST SHELL_PARAM_ITEM *CheckList,
- OUT SHELL_PARAM_TYPE *Type
+ IN CONST CHAR16 *Name,
+ IN CONST SHELL_PARAM_ITEM *CheckList,
+ OUT SHELL_PARAM_TYPE *Type
)
{
- SHELL_PARAM_ITEM *TempListItem;
- CHAR16 *TempString;
+ SHELL_PARAM_ITEM *TempListItem;
+ CHAR16 *TempString;
//
// ASSERT that all 3 pointer parameters aren't NULL
//
- ASSERT(CheckList != NULL);
- ASSERT(Type != NULL);
- ASSERT(Name != NULL);
+ ASSERT (CheckList != NULL);
+ ASSERT (Type != NULL);
+ ASSERT (Name != NULL);
//
// question mark and page break mode are always supported
//
- if ((StrCmp(Name, L"-?") == 0) ||
- (StrCmp(Name, L"-b") == 0)
- ) {
- *Type = TypeFlag;
- return (TRUE);
+ if ((StrCmp (Name, L"-?") == 0) ||
+ (StrCmp (Name, L"-b") == 0)
+ )
+ {
+ *Type = TypeFlag;
+ return (TRUE);
}
//
// Enumerate through the list
//
- for (TempListItem = (SHELL_PARAM_ITEM*)CheckList ; TempListItem->Name != NULL ; TempListItem++) {
+ for (TempListItem = (SHELL_PARAM_ITEM *)CheckList; TempListItem->Name != NULL; TempListItem++) {
//
// If the Type is TypeStart only check the first characters of the passed in param
// If it matches set the type and return TRUE
//
if (TempListItem->Type == TypeStart) {
- if (StrnCmp(Name, TempListItem->Name, StrLen(TempListItem->Name)) == 0) {
+ if (StrnCmp (Name, TempListItem->Name, StrLen (TempListItem->Name)) == 0) {
*Type = TempListItem->Type;
return (TRUE);
}
+
TempString = NULL;
- TempString = StrnCatGrow(&TempString, NULL, Name, StrLen(TempListItem->Name));
+ TempString = StrnCatGrow (&TempString, NULL, Name, StrLen (TempListItem->Name));
if (TempString != NULL) {
- if (StringNoCaseCompare(&TempString, &TempListItem->Name) == 0) {
+ if (StringNoCaseCompare (&TempString, &TempListItem->Name) == 0) {
*Type = TempListItem->Type;
- FreePool(TempString);
+ FreePool (TempString);
return (TRUE);
}
- FreePool(TempString);
+
+ FreePool (TempString);
}
- } else if (StringNoCaseCompare(&Name, &TempListItem->Name) == 0) {
+ } else if (StringNoCaseCompare (&Name, &TempListItem->Name) == 0) {
*Type = TempListItem->Type;
return (TRUE);
}
@@ -1985,6 +2071,7 @@ InternalIsOnCheckList ( return (FALSE);
}
+
/**
Checks the string for indicators of "flag" status. this is a leading '/', '-', or '+'
@@ -1997,20 +2084,20 @@ InternalIsOnCheckList ( **/
BOOLEAN
InternalIsFlag (
- IN CONST CHAR16 *Name,
- IN CONST BOOLEAN AlwaysAllowNumbers,
- IN CONST BOOLEAN TimeNumbers
+ IN CONST CHAR16 *Name,
+ IN CONST BOOLEAN AlwaysAllowNumbers,
+ IN CONST BOOLEAN TimeNumbers
)
{
//
// ASSERT that Name isn't NULL
//
- ASSERT(Name != NULL);
+ ASSERT (Name != NULL);
//
// If we accept numbers then dont return TRUE. (they will be values)
//
- if (((Name[0] == L'-' || Name[0] == L'+') && InternalShellIsHexOrDecimalNumber(Name+1, FALSE, FALSE, TimeNumbers)) && AlwaysAllowNumbers) {
+ if ((((Name[0] == L'-') || (Name[0] == L'+')) && InternalShellIsHexOrDecimalNumber (Name+1, FALSE, FALSE, TimeNumbers)) && AlwaysAllowNumbers) {
return (FALSE);
}
@@ -2020,9 +2107,11 @@ InternalIsFlag ( if ((Name[0] == L'/') ||
(Name[0] == L'-') ||
(Name[0] == L'+')
- ) {
- return (TRUE);
+ )
+ {
+ return (TRUE);
}
+
return (FALSE);
}
@@ -2053,29 +2142,29 @@ InternalIsFlag ( **/
EFI_STATUS
InternalCommandLineParse (
- IN CONST SHELL_PARAM_ITEM *CheckList,
- OUT LIST_ENTRY **CheckPackage,
- OUT CHAR16 **ProblemParam OPTIONAL,
- IN BOOLEAN AutoPageBreak,
- IN CONST CHAR16 **Argv,
- IN UINTN Argc,
- IN BOOLEAN AlwaysAllowNumbers
+ IN CONST SHELL_PARAM_ITEM *CheckList,
+ OUT LIST_ENTRY **CheckPackage,
+ OUT CHAR16 **ProblemParam OPTIONAL,
+ IN BOOLEAN AutoPageBreak,
+ IN CONST CHAR16 **Argv,
+ IN UINTN Argc,
+ IN BOOLEAN AlwaysAllowNumbers
)
{
- UINTN LoopCounter;
- SHELL_PARAM_TYPE CurrentItemType;
- SHELL_PARAM_PACKAGE *CurrentItemPackage;
- UINTN GetItemValue;
- UINTN ValueSize;
- UINTN Count;
- CONST CHAR16 *TempPointer;
- UINTN CurrentValueSize;
- CHAR16 *NewValue;
+ UINTN LoopCounter;
+ SHELL_PARAM_TYPE CurrentItemType;
+ SHELL_PARAM_PACKAGE *CurrentItemPackage;
+ UINTN GetItemValue;
+ UINTN ValueSize;
+ UINTN Count;
+ CONST CHAR16 *TempPointer;
+ UINTN CurrentValueSize;
+ CHAR16 *NewValue;
CurrentItemPackage = NULL;
- GetItemValue = 0;
- ValueSize = 0;
- Count = 0;
+ GetItemValue = 0;
+ ValueSize = 0;
+ Count = 0;
//
// If there is only 1 item we dont need to do anything
@@ -2088,53 +2177,56 @@ InternalCommandLineParse ( //
// ASSERTs
//
- ASSERT(CheckList != NULL);
- ASSERT(Argv != NULL);
+ ASSERT (CheckList != NULL);
+ ASSERT (Argv != NULL);
//
// initialize the linked list
//
- *CheckPackage = (LIST_ENTRY*)AllocateZeroPool(sizeof(LIST_ENTRY));
+ *CheckPackage = (LIST_ENTRY *)AllocateZeroPool (sizeof (LIST_ENTRY));
if (*CheckPackage == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- InitializeListHead(*CheckPackage);
+ InitializeListHead (*CheckPackage);
//
// loop through each of the arguments
//
- for (LoopCounter = 0 ; LoopCounter < Argc ; ++LoopCounter) {
+ for (LoopCounter = 0; LoopCounter < Argc; ++LoopCounter) {
if (Argv[LoopCounter] == NULL) {
//
// do nothing for NULL argv
//
- } else if (InternalIsOnCheckList(Argv[LoopCounter], CheckList, &CurrentItemType)) {
+ } else if (InternalIsOnCheckList (Argv[LoopCounter], CheckList, &CurrentItemType)) {
//
// We might have leftover if last parameter didnt have optional value
//
if (GetItemValue != 0) {
GetItemValue = 0;
- InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);
+ InsertHeadList (*CheckPackage, &CurrentItemPackage->Link);
}
+
//
// this is a flag
//
- CurrentItemPackage = AllocateZeroPool(sizeof(SHELL_PARAM_PACKAGE));
+ CurrentItemPackage = AllocateZeroPool (sizeof (SHELL_PARAM_PACKAGE));
if (CurrentItemPackage == NULL) {
- ShellCommandLineFreeVarList(*CheckPackage);
+ ShellCommandLineFreeVarList (*CheckPackage);
*CheckPackage = NULL;
return (EFI_OUT_OF_RESOURCES);
}
- CurrentItemPackage->Name = AllocateCopyPool(StrSize(Argv[LoopCounter]), Argv[LoopCounter]);
+
+ CurrentItemPackage->Name = AllocateCopyPool (StrSize (Argv[LoopCounter]), Argv[LoopCounter]);
if (CurrentItemPackage->Name == NULL) {
- ShellCommandLineFreeVarList(*CheckPackage);
+ ShellCommandLineFreeVarList (*CheckPackage);
*CheckPackage = NULL;
return (EFI_OUT_OF_RESOURCES);
}
- CurrentItemPackage->Type = CurrentItemType;
+
+ CurrentItemPackage->Type = CurrentItemType;
CurrentItemPackage->OriginalPosition = (UINTN)(-1);
- CurrentItemPackage->Value = NULL;
+ CurrentItemPackage->Value = NULL;
//
// Does this flag require a value
@@ -2146,30 +2238,30 @@ InternalCommandLineParse ( case TypeValue:
case TypeTimeValue:
GetItemValue = 1;
- ValueSize = 0;
+ ValueSize = 0;
break;
case TypeDoubleValue:
GetItemValue = 2;
- ValueSize = 0;
+ ValueSize = 0;
break;
case TypeMaxValue:
GetItemValue = (UINTN)(-1);
- ValueSize = 0;
+ ValueSize = 0;
break;
default:
//
// this item has no value expected; we are done
//
- InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);
- ASSERT(GetItemValue == 0);
+ InsertHeadList (*CheckPackage, &CurrentItemPackage->Link);
+ ASSERT (GetItemValue == 0);
break;
}
- } else if (GetItemValue != 0 && CurrentItemPackage != NULL && !InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, (BOOLEAN)(CurrentItemPackage->Type == TypeTimeValue))) {
+ } else if ((GetItemValue != 0) && (CurrentItemPackage != NULL) && !InternalIsFlag (Argv[LoopCounter], AlwaysAllowNumbers, (BOOLEAN)(CurrentItemPackage->Type == TypeTimeValue))) {
//
// get the item VALUE for a previous flag
//
- CurrentValueSize = ValueSize + StrSize(Argv[LoopCounter]) + sizeof(CHAR16);
- NewValue = ReallocatePool(ValueSize, CurrentValueSize, CurrentItemPackage->Value);
+ CurrentValueSize = ValueSize + StrSize (Argv[LoopCounter]) + sizeof (CHAR16);
+ NewValue = ReallocatePool (ValueSize, CurrentValueSize, CurrentItemPackage->Value);
if (NewValue == NULL) {
SHELL_FREE_NON_NULL (CurrentItemPackage->Value);
SHELL_FREE_NON_NULL (CurrentItemPackage);
@@ -2177,78 +2269,91 @@ InternalCommandLineParse ( *CheckPackage = NULL;
return EFI_OUT_OF_RESOURCES;
}
+
CurrentItemPackage->Value = NewValue;
if (ValueSize == 0) {
- StrCpyS( CurrentItemPackage->Value,
- CurrentValueSize/sizeof(CHAR16),
- Argv[LoopCounter]
- );
+ StrCpyS (
+ CurrentItemPackage->Value,
+ CurrentValueSize/sizeof (CHAR16),
+ Argv[LoopCounter]
+ );
} else {
- StrCatS( CurrentItemPackage->Value,
- CurrentValueSize/sizeof(CHAR16),
- L" "
- );
- StrCatS( CurrentItemPackage->Value,
- CurrentValueSize/sizeof(CHAR16),
- Argv[LoopCounter]
- );
+ StrCatS (
+ CurrentItemPackage->Value,
+ CurrentValueSize/sizeof (CHAR16),
+ L" "
+ );
+ StrCatS (
+ CurrentItemPackage->Value,
+ CurrentValueSize/sizeof (CHAR16),
+ Argv[LoopCounter]
+ );
}
- ValueSize += StrSize(Argv[LoopCounter]) + sizeof(CHAR16);
+
+ ValueSize += StrSize (Argv[LoopCounter]) + sizeof (CHAR16);
GetItemValue--;
if (GetItemValue == 0) {
- InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);
+ InsertHeadList (*CheckPackage, &CurrentItemPackage->Link);
}
- } else if (!InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, FALSE)){
+ } else if (!InternalIsFlag (Argv[LoopCounter], AlwaysAllowNumbers, FALSE)) {
//
// add this one as a non-flag
//
TempPointer = Argv[LoopCounter];
- if ((*TempPointer == L'^' && *(TempPointer+1) == L'-')
- || (*TempPointer == L'^' && *(TempPointer+1) == L'/')
- || (*TempPointer == L'^' && *(TempPointer+1) == L'+')
- ){
+ if ( ((*TempPointer == L'^') && (*(TempPointer+1) == L'-'))
+ || ((*TempPointer == L'^') && (*(TempPointer+1) == L'/'))
+ || ((*TempPointer == L'^') && (*(TempPointer+1) == L'+'))
+ )
+ {
TempPointer++;
}
- CurrentItemPackage = AllocateZeroPool(sizeof(SHELL_PARAM_PACKAGE));
+
+ CurrentItemPackage = AllocateZeroPool (sizeof (SHELL_PARAM_PACKAGE));
if (CurrentItemPackage == NULL) {
- ShellCommandLineFreeVarList(*CheckPackage);
+ ShellCommandLineFreeVarList (*CheckPackage);
*CheckPackage = NULL;
return (EFI_OUT_OF_RESOURCES);
}
+
CurrentItemPackage->Name = NULL;
CurrentItemPackage->Type = TypePosition;
- CurrentItemPackage->Value = AllocateCopyPool(StrSize(TempPointer), TempPointer);
+ CurrentItemPackage->Value = AllocateCopyPool (StrSize (TempPointer), TempPointer);
if (CurrentItemPackage->Value == NULL) {
- ShellCommandLineFreeVarList(*CheckPackage);
+ ShellCommandLineFreeVarList (*CheckPackage);
*CheckPackage = NULL;
return (EFI_OUT_OF_RESOURCES);
}
+
CurrentItemPackage->OriginalPosition = Count++;
- InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);
+ InsertHeadList (*CheckPackage, &CurrentItemPackage->Link);
} else {
//
// this was a non-recognised flag... error!
//
if (ProblemParam != NULL) {
- *ProblemParam = AllocateCopyPool(StrSize(Argv[LoopCounter]), Argv[LoopCounter]);
+ *ProblemParam = AllocateCopyPool (StrSize (Argv[LoopCounter]), Argv[LoopCounter]);
}
- ShellCommandLineFreeVarList(*CheckPackage);
+
+ ShellCommandLineFreeVarList (*CheckPackage);
*CheckPackage = NULL;
return (EFI_VOLUME_CORRUPTED);
}
}
+
if (GetItemValue != 0) {
GetItemValue = 0;
- InsertHeadList(*CheckPackage, &CurrentItemPackage->Link);
+ InsertHeadList (*CheckPackage, &CurrentItemPackage->Link);
}
+
//
// support for AutoPageBreak
//
- if (AutoPageBreak && ShellCommandLineGetFlag(*CheckPackage, L"-b")) {
- ShellSetPageBreakMode(TRUE);
+ if (AutoPageBreak && ShellCommandLineGetFlag (*CheckPackage, L"-b")) {
+ ShellSetPageBreakMode (TRUE);
}
+
return (EFI_SUCCESS);
}
@@ -2279,43 +2384,47 @@ InternalCommandLineParse ( EFI_STATUS
EFIAPI
ShellCommandLineParseEx (
- IN CONST SHELL_PARAM_ITEM *CheckList,
- OUT LIST_ENTRY **CheckPackage,
- OUT CHAR16 **ProblemParam OPTIONAL,
- IN BOOLEAN AutoPageBreak,
- IN BOOLEAN AlwaysAllowNumbers
+ IN CONST SHELL_PARAM_ITEM *CheckList,
+ OUT LIST_ENTRY **CheckPackage,
+ OUT CHAR16 **ProblemParam OPTIONAL,
+ IN BOOLEAN AutoPageBreak,
+ IN BOOLEAN AlwaysAllowNumbers
)
{
//
// ASSERT that CheckList and CheckPackage aren't NULL
//
- ASSERT(CheckList != NULL);
- ASSERT(CheckPackage != NULL);
+ ASSERT (CheckList != NULL);
+ ASSERT (CheckPackage != NULL);
//
// Check for UEFI Shell 2.0 protocols
//
if (gEfiShellParametersProtocol != NULL) {
- return (InternalCommandLineParse(CheckList,
- CheckPackage,
- ProblemParam,
- AutoPageBreak,
- (CONST CHAR16**) gEfiShellParametersProtocol->Argv,
- gEfiShellParametersProtocol->Argc,
- AlwaysAllowNumbers));
+ return (InternalCommandLineParse (
+ CheckList,
+ CheckPackage,
+ ProblemParam,
+ AutoPageBreak,
+ (CONST CHAR16 **)gEfiShellParametersProtocol->Argv,
+ gEfiShellParametersProtocol->Argc,
+ AlwaysAllowNumbers
+ ));
}
//
// ASSERT That EFI Shell is not required
//
ASSERT (mEfiShellInterface != NULL);
- return (InternalCommandLineParse(CheckList,
- CheckPackage,
- ProblemParam,
- AutoPageBreak,
- (CONST CHAR16**) mEfiShellInterface->Argv,
- mEfiShellInterface->Argc,
- AlwaysAllowNumbers));
+ return (InternalCommandLineParse (
+ CheckList,
+ CheckPackage,
+ ProblemParam,
+ AutoPageBreak,
+ (CONST CHAR16 **)mEfiShellInterface->Argv,
+ mEfiShellInterface->Argc,
+ AlwaysAllowNumbers
+ ));
}
/**
@@ -2333,10 +2442,10 @@ ShellCommandLineParseEx ( VOID
EFIAPI
ShellCommandLineFreeVarList (
- IN LIST_ENTRY *CheckPackage
+ IN LIST_ENTRY *CheckPackage
)
{
- LIST_ENTRY *Node;
+ LIST_ENTRY *Node;
//
// check for CheckPackage == NULL
@@ -2348,39 +2457,42 @@ ShellCommandLineFreeVarList ( //
// for each node in the list
//
- for ( Node = GetFirstNode(CheckPackage)
- ; !IsListEmpty(CheckPackage)
- ; Node = GetFirstNode(CheckPackage)
- ){
+ for ( Node = GetFirstNode (CheckPackage)
+ ; !IsListEmpty (CheckPackage)
+ ; Node = GetFirstNode (CheckPackage)
+ )
+ {
//
// Remove it from the list
//
- RemoveEntryList(Node);
+ RemoveEntryList (Node);
//
// if it has a name free the name
//
- if (((SHELL_PARAM_PACKAGE*)Node)->Name != NULL) {
- FreePool(((SHELL_PARAM_PACKAGE*)Node)->Name);
+ if (((SHELL_PARAM_PACKAGE *)Node)->Name != NULL) {
+ FreePool (((SHELL_PARAM_PACKAGE *)Node)->Name);
}
//
// if it has a value free the value
//
- if (((SHELL_PARAM_PACKAGE*)Node)->Value != NULL) {
- FreePool(((SHELL_PARAM_PACKAGE*)Node)->Value);
+ if (((SHELL_PARAM_PACKAGE *)Node)->Value != NULL) {
+ FreePool (((SHELL_PARAM_PACKAGE *)Node)->Value);
}
//
// free the node structure
//
- FreePool((SHELL_PARAM_PACKAGE*)Node);
+ FreePool ((SHELL_PARAM_PACKAGE *)Node);
}
+
//
// free the list head node
//
- FreePool(CheckPackage);
+ FreePool (CheckPackage);
}
+
/**
Checks for presence of a flag parameter
@@ -2398,54 +2510,59 @@ 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
)
{
- LIST_ENTRY *Node;
- CHAR16 *TempString;
+ LIST_ENTRY *Node;
+ CHAR16 *TempString;
//
// return FALSE for no package or KeyString is NULL
//
- if (CheckPackage == NULL || KeyString == NULL) {
+ if ((CheckPackage == NULL) || (KeyString == NULL)) {
return (FALSE);
}
//
// enumerate through the list of parametrs
//
- for ( Node = GetFirstNode(CheckPackage)
- ; !IsNull (CheckPackage, Node)
- ; Node = GetNextNode(CheckPackage, Node)
- ){
+ for ( Node = GetFirstNode (CheckPackage)
+ ; !IsNull (CheckPackage, Node)
+ ; Node = GetNextNode (CheckPackage, Node)
+ )
+ {
//
// If the Name matches, return TRUE (and there may be NULL name)
//
- if (((SHELL_PARAM_PACKAGE*)Node)->Name != NULL) {
+ if (((SHELL_PARAM_PACKAGE *)Node)->Name != NULL) {
//
// If Type is TypeStart then only compare the begining of the strings
//
- if (((SHELL_PARAM_PACKAGE*)Node)->Type == TypeStart) {
- if (StrnCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name, StrLen(KeyString)) == 0) {
+ if (((SHELL_PARAM_PACKAGE *)Node)->Type == TypeStart) {
+ if (StrnCmp (KeyString, ((SHELL_PARAM_PACKAGE *)Node)->Name, StrLen (KeyString)) == 0) {
return (TRUE);
}
+
TempString = NULL;
- TempString = StrnCatGrow(&TempString, NULL, KeyString, StrLen(((SHELL_PARAM_PACKAGE*)Node)->Name));
+ TempString = StrnCatGrow (&TempString, NULL, KeyString, StrLen (((SHELL_PARAM_PACKAGE *)Node)->Name));
if (TempString != NULL) {
- if (StringNoCaseCompare(&KeyString, &((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) {
- FreePool(TempString);
+ if (StringNoCaseCompare (&KeyString, &((SHELL_PARAM_PACKAGE *)Node)->Name) == 0) {
+ FreePool (TempString);
return (TRUE);
}
- FreePool(TempString);
+
+ FreePool (TempString);
}
- } else if (StringNoCaseCompare(&KeyString, &((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) {
+ } else if (StringNoCaseCompare (&KeyString, &((SHELL_PARAM_PACKAGE *)Node)->Name) == 0) {
return (TRUE);
}
}
}
+
return (FALSE);
}
+
/**
Returns value from command line argument.
@@ -2459,55 +2576,59 @@ 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,
- IN CHAR16 *KeyString
+ IN CONST LIST_ENTRY *CheckPackage,
+ IN CHAR16 *KeyString
)
{
- LIST_ENTRY *Node;
- CHAR16 *TempString;
+ LIST_ENTRY *Node;
+ CHAR16 *TempString;
//
// return NULL for no package or KeyString is NULL
//
- if (CheckPackage == NULL || KeyString == NULL) {
+ if ((CheckPackage == NULL) || (KeyString == NULL)) {
return (NULL);
}
//
// enumerate through the list of parametrs
//
- for ( Node = GetFirstNode(CheckPackage)
- ; !IsNull (CheckPackage, Node)
- ; Node = GetNextNode(CheckPackage, Node)
- ){
+ for ( Node = GetFirstNode (CheckPackage)
+ ; !IsNull (CheckPackage, Node)
+ ; Node = GetNextNode (CheckPackage, Node)
+ )
+ {
//
// If the Name matches, return TRUE (and there may be NULL name)
//
- if (((SHELL_PARAM_PACKAGE*)Node)->Name != NULL) {
+ if (((SHELL_PARAM_PACKAGE *)Node)->Name != NULL) {
//
// If Type is TypeStart then only compare the begining of the strings
//
- if (((SHELL_PARAM_PACKAGE*)Node)->Type == TypeStart) {
- if (StrnCmp(KeyString, ((SHELL_PARAM_PACKAGE*)Node)->Name, StrLen(KeyString)) == 0) {
- return (((SHELL_PARAM_PACKAGE*)Node)->Name + StrLen(KeyString));
+ if (((SHELL_PARAM_PACKAGE *)Node)->Type == TypeStart) {
+ if (StrnCmp (KeyString, ((SHELL_PARAM_PACKAGE *)Node)->Name, StrLen (KeyString)) == 0) {
+ return (((SHELL_PARAM_PACKAGE *)Node)->Name + StrLen (KeyString));
}
+
TempString = NULL;
- TempString = StrnCatGrow(&TempString, NULL, KeyString, StrLen(((SHELL_PARAM_PACKAGE*)Node)->Name));
+ TempString = StrnCatGrow (&TempString, NULL, KeyString, StrLen (((SHELL_PARAM_PACKAGE *)Node)->Name));
if (TempString != NULL) {
- if (StringNoCaseCompare(&KeyString, &((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) {
- FreePool(TempString);
- return (((SHELL_PARAM_PACKAGE*)Node)->Name + StrLen(KeyString));
+ if (StringNoCaseCompare (&KeyString, &((SHELL_PARAM_PACKAGE *)Node)->Name) == 0) {
+ FreePool (TempString);
+ return (((SHELL_PARAM_PACKAGE *)Node)->Name + StrLen (KeyString));
}
- FreePool(TempString);
+
+ FreePool (TempString);
}
- } else if (StringNoCaseCompare(&KeyString, &((SHELL_PARAM_PACKAGE*)Node)->Name) == 0) {
- return (((SHELL_PARAM_PACKAGE*)Node)->Value);
+ } else if (StringNoCaseCompare (&KeyString, &((SHELL_PARAM_PACKAGE *)Node)->Name) == 0) {
+ return (((SHELL_PARAM_PACKAGE *)Node)->Value);
}
}
}
+
return (NULL);
}
@@ -2524,14 +2645,14 @@ 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 UINTN Position
+ IN CONST LIST_ENTRY *CONST CheckPackage,
+ IN UINTN Position
)
{
- LIST_ENTRY *Node;
+ LIST_ENTRY *Node;
//
// check for CheckPackage == NULL
@@ -2543,17 +2664,19 @@ ShellCommandLineGetRawValue ( //
// enumerate through the list of parametrs
//
- for ( Node = GetFirstNode(CheckPackage)
- ; !IsNull (CheckPackage, Node)
- ; Node = GetNextNode(CheckPackage, Node)
- ){
+ for ( Node = GetFirstNode (CheckPackage)
+ ; !IsNull (CheckPackage, Node)
+ ; Node = GetNextNode (CheckPackage, Node)
+ )
+ {
//
// If the position matches, return the value
//
- if (((SHELL_PARAM_PACKAGE*)Node)->OriginalPosition == Position) {
- return (((SHELL_PARAM_PACKAGE*)Node)->Value);
+ if (((SHELL_PARAM_PACKAGE *)Node)->OriginalPosition == Position) {
+ return (((SHELL_PARAM_PACKAGE *)Node)->Value);
}
}
+
return (NULL);
}
@@ -2569,8 +2692,8 @@ ShellCommandLineGetRawValue ( **/
UINTN
EFIAPI
-ShellCommandLineGetCount(
- IN CONST LIST_ENTRY *CheckPackage
+ShellCommandLineGetCount (
+ IN CONST LIST_ENTRY *CheckPackage
)
{
LIST_ENTRY *Node1;
@@ -2579,14 +2702,17 @@ ShellCommandLineGetCount( if (CheckPackage == NULL) {
return (0);
}
- for ( Node1 = GetFirstNode(CheckPackage), Count = 0
- ; !IsNull (CheckPackage, Node1)
- ; Node1 = GetNextNode(CheckPackage, Node1)
- ){
- if (((SHELL_PARAM_PACKAGE*)Node1)->Name == NULL) {
+
+ for ( Node1 = GetFirstNode (CheckPackage), Count = 0
+ ; !IsNull (CheckPackage, Node1)
+ ; Node1 = GetNextNode (CheckPackage, Node1)
+ )
+ {
+ if (((SHELL_PARAM_PACKAGE *)Node1)->Name == NULL) {
Count++;
}
}
+
return (Count);
}
@@ -2607,32 +2733,36 @@ ShellCommandLineGetCount( EFI_STATUS
EFIAPI
ShellCommandLineCheckDuplicate (
- IN CONST LIST_ENTRY *CheckPackage,
- OUT CHAR16 **Param
+ IN CONST LIST_ENTRY *CheckPackage,
+ OUT CHAR16 **Param
)
{
- LIST_ENTRY *Node1;
- LIST_ENTRY *Node2;
-
- ASSERT(CheckPackage != NULL);
-
- for ( Node1 = GetFirstNode(CheckPackage)
- ; !IsNull (CheckPackage, Node1)
- ; Node1 = GetNextNode(CheckPackage, Node1)
- ){
- for ( Node2 = GetNextNode(CheckPackage, Node1)
- ; !IsNull (CheckPackage, Node2)
- ; Node2 = GetNextNode(CheckPackage, Node2)
- ){
- if ((((SHELL_PARAM_PACKAGE*)Node1)->Name != NULL) && (((SHELL_PARAM_PACKAGE*)Node2)->Name != NULL) && StrCmp(((SHELL_PARAM_PACKAGE*)Node1)->Name, ((SHELL_PARAM_PACKAGE*)Node2)->Name) == 0) {
+ LIST_ENTRY *Node1;
+ LIST_ENTRY *Node2;
+
+ ASSERT (CheckPackage != NULL);
+
+ for ( Node1 = GetFirstNode (CheckPackage)
+ ; !IsNull (CheckPackage, Node1)
+ ; Node1 = GetNextNode (CheckPackage, Node1)
+ )
+ {
+ for ( Node2 = GetNextNode (CheckPackage, Node1)
+ ; !IsNull (CheckPackage, Node2)
+ ; Node2 = GetNextNode (CheckPackage, Node2)
+ )
+ {
+ if ((((SHELL_PARAM_PACKAGE *)Node1)->Name != NULL) && (((SHELL_PARAM_PACKAGE *)Node2)->Name != NULL) && (StrCmp (((SHELL_PARAM_PACKAGE *)Node1)->Name, ((SHELL_PARAM_PACKAGE *)Node2)->Name) == 0)) {
if (Param != NULL) {
*Param = NULL;
- *Param = StrnCatGrow(Param, NULL, ((SHELL_PARAM_PACKAGE*)Node1)->Name, 0);
+ *Param = StrnCatGrow (Param, NULL, ((SHELL_PARAM_PACKAGE *)Node1)->Name, 0);
}
+
return (EFI_DEVICE_ERROR);
}
}
}
+
return (EFI_SUCCESS);
}
@@ -2665,67 +2795,75 @@ ShellCommandLineCheckDuplicate ( **/
EFI_STATUS
EFIAPI
-ShellCopySearchAndReplace(
- IN CHAR16 CONST *SourceString,
- IN OUT CHAR16 *NewString,
- IN UINTN NewSize,
- IN CONST CHAR16 *FindTarget,
- IN CONST CHAR16 *ReplaceWith,
- IN CONST BOOLEAN SkipPreCarrot,
- IN CONST BOOLEAN ParameterReplacing
+ShellCopySearchAndReplace (
+ IN CHAR16 CONST *SourceString,
+ IN OUT CHAR16 *NewString,
+ IN UINTN NewSize,
+ IN CONST CHAR16 *FindTarget,
+ IN CONST CHAR16 *ReplaceWith,
+ IN CONST BOOLEAN SkipPreCarrot,
+ IN CONST BOOLEAN ParameterReplacing
)
{
- UINTN Size;
- CHAR16 *Replace;
-
- if ( (SourceString == NULL)
- || (NewString == NULL)
- || (FindTarget == NULL)
- || (ReplaceWith == NULL)
- || (StrLen(FindTarget) < 1)
- || (StrLen(SourceString) < 1)
- ){
+ UINTN Size;
+ CHAR16 *Replace;
+
+ if ( (SourceString == NULL)
+ || (NewString == NULL)
+ || (FindTarget == NULL)
+ || (ReplaceWith == NULL)
+ || (StrLen (FindTarget) < 1)
+ || (StrLen (SourceString) < 1)
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
+
Replace = NULL;
- if (StrStr(ReplaceWith, L" ") == NULL || !ParameterReplacing) {
- Replace = StrnCatGrow(&Replace, NULL, ReplaceWith, 0);
+ if ((StrStr (ReplaceWith, L" ") == NULL) || !ParameterReplacing) {
+ Replace = StrnCatGrow (&Replace, NULL, ReplaceWith, 0);
} else {
- Replace = AllocateZeroPool(StrSize(ReplaceWith) + 2*sizeof(CHAR16));
+ Replace = AllocateZeroPool (StrSize (ReplaceWith) + 2*sizeof (CHAR16));
if (Replace != NULL) {
- UnicodeSPrint(Replace, StrSize(ReplaceWith) + 2*sizeof(CHAR16), L"\"%s\"", ReplaceWith);
+ UnicodeSPrint (Replace, StrSize (ReplaceWith) + 2*sizeof (CHAR16), L"\"%s\"", ReplaceWith);
}
}
+
if (Replace == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
- NewString = ZeroMem(NewString, NewSize);
+
+ NewString = ZeroMem (NewString, NewSize);
while (*SourceString != CHAR_NULL) {
//
// if we find the FindTarget and either Skip == FALSE or Skip and we
// dont have a carrot do a replace...
//
- if (StrnCmp(SourceString, FindTarget, StrLen(FindTarget)) == 0
- && ((SkipPreCarrot && *(SourceString-1) != L'^') || !SkipPreCarrot)
- ){
- SourceString += StrLen(FindTarget);
- Size = StrSize(NewString);
- if ((Size + (StrLen(Replace)*sizeof(CHAR16))) > NewSize) {
- FreePool(Replace);
+ if ( (StrnCmp (SourceString, FindTarget, StrLen (FindTarget)) == 0)
+ && ((SkipPreCarrot && (*(SourceString-1) != L'^')) || !SkipPreCarrot)
+ )
+ {
+ SourceString += StrLen (FindTarget);
+ Size = StrSize (NewString);
+ if ((Size + (StrLen (Replace)*sizeof (CHAR16))) > NewSize) {
+ FreePool (Replace);
return (EFI_BUFFER_TOO_SMALL);
}
- StrCatS(NewString, NewSize/sizeof(CHAR16), Replace);
+
+ StrCatS (NewString, NewSize/sizeof (CHAR16), Replace);
} else {
- Size = StrSize(NewString);
- if (Size + sizeof(CHAR16) > NewSize) {
- FreePool(Replace);
+ Size = StrSize (NewString);
+ if (Size + sizeof (CHAR16) > NewSize) {
+ FreePool (Replace);
return (EFI_BUFFER_TOO_SMALL);
}
- StrnCatS(NewString, NewSize/sizeof(CHAR16), SourceString, 1);
+
+ StrnCatS (NewString, NewSize/sizeof (CHAR16), SourceString, 1);
SourceString++;
}
}
- FreePool(Replace);
+
+ FreePool (Replace);
return (EFI_SUCCESS);
}
@@ -2741,27 +2879,32 @@ ShellCopySearchAndReplace( **/
EFI_STATUS
InternalPrintTo (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINTN Size;
- Size = StrSize(String) - sizeof(CHAR16);
+ UINTN Size;
+
+ Size = StrSize (String) - sizeof (CHAR16);
if (Size == 0) {
return (EFI_SUCCESS);
}
+
if (gEfiShellParametersProtocol != NULL) {
- return (gEfiShellProtocol->WriteFile(gEfiShellParametersProtocol->StdOut, &Size, (VOID*)String));
+ return (gEfiShellProtocol->WriteFile (gEfiShellParametersProtocol->StdOut, &Size, (VOID *)String));
}
+
if (mEfiShellInterface != NULL) {
if (mEfiShellInterface->RedirArgc == 0) {
- //
- // Divide in half for old shell. Must be string length not size.
//
- Size /=2; // Divide in half only when no redirection.
+ // Divide in half for old shell. Must be string length not size.
+ //
+ Size /= 2; // Divide in half only when no redirection.
}
- return (mEfiShellInterface->StdOut->Write(mEfiShellInterface->StdOut, &Size, (VOID*)String));
+
+ return (mEfiShellInterface->StdOut->Write (mEfiShellInterface->StdOut, &Size, (VOID *)String));
}
- ASSERT(FALSE);
+
+ ASSERT (FALSE);
return (EFI_UNSUPPORTED);
}
@@ -2795,26 +2938,26 @@ InternalPrintTo ( @return EFI_DEVICE_ERROR The console device reported an error.
**/
EFI_STATUS
-InternalShellPrintWorker(
- IN INT32 Col OPTIONAL,
- IN INT32 Row OPTIONAL,
- IN CONST CHAR16 *Format,
- IN VA_LIST Marker
+InternalShellPrintWorker (
+ IN INT32 Col OPTIONAL,
+ IN INT32 Row OPTIONAL,
+ IN CONST CHAR16 *Format,
+ IN VA_LIST Marker
)
{
- EFI_STATUS Status;
- CHAR16 *ResumeLocation;
- CHAR16 *FormatWalker;
- UINTN OriginalAttribute;
- CHAR16 *mPostReplaceFormat;
- CHAR16 *mPostReplaceFormat2;
-
- mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
+ EFI_STATUS Status;
+ CHAR16 *ResumeLocation;
+ CHAR16 *FormatWalker;
+ UINTN OriginalAttribute;
+ CHAR16 *mPostReplaceFormat;
+ CHAR16 *mPostReplaceFormat2;
+
+ mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
mPostReplaceFormat2 = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
- if (mPostReplaceFormat == NULL || mPostReplaceFormat2 == NULL) {
- SHELL_FREE_NON_NULL(mPostReplaceFormat);
- SHELL_FREE_NON_NULL(mPostReplaceFormat2);
+ if ((mPostReplaceFormat == NULL) || (mPostReplaceFormat2 == NULL)) {
+ SHELL_FREE_NON_NULL (mPostReplaceFormat);
+ SHELL_FREE_NON_NULL (mPostReplaceFormat2);
return (EFI_OUT_OF_RESOURCES);
}
@@ -2824,24 +2967,24 @@ InternalShellPrintWorker( //
// Back and forth each time fixing up 1 of our flags...
//
- Status = ShellCopySearchAndReplace(Format, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%N", L"%%N", FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
- Status = ShellCopySearchAndReplace(mPostReplaceFormat, mPostReplaceFormat2, PcdGet16 (PcdShellPrintBufferSize), L"%E", L"%%E", FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
- Status = ShellCopySearchAndReplace(mPostReplaceFormat2, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%H", L"%%H", FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
- Status = ShellCopySearchAndReplace(mPostReplaceFormat, mPostReplaceFormat2, PcdGet16 (PcdShellPrintBufferSize), L"%B", L"%%B", FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
- Status = ShellCopySearchAndReplace(mPostReplaceFormat2, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%V", L"%%V", FALSE, FALSE);
- ASSERT_EFI_ERROR(Status);
+ Status = ShellCopySearchAndReplace (Format, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%N", L"%%N", FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
+ Status = ShellCopySearchAndReplace (mPostReplaceFormat, mPostReplaceFormat2, PcdGet16 (PcdShellPrintBufferSize), L"%E", L"%%E", FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
+ Status = ShellCopySearchAndReplace (mPostReplaceFormat2, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%H", L"%%H", FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
+ Status = ShellCopySearchAndReplace (mPostReplaceFormat, mPostReplaceFormat2, PcdGet16 (PcdShellPrintBufferSize), L"%B", L"%%B", FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
+ Status = ShellCopySearchAndReplace (mPostReplaceFormat2, mPostReplaceFormat, PcdGet16 (PcdShellPrintBufferSize), L"%V", L"%%V", FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
//
// Use the last buffer from replacing to print from...
//
UnicodeVSPrint (mPostReplaceFormat2, PcdGet16 (PcdShellPrintBufferSize), mPostReplaceFormat, Marker);
- if (Col != -1 && Row != -1) {
- Status = gST->ConOut->SetCursorPosition(gST->ConOut, Col, Row);
+ if ((Col != -1) && (Row != -1)) {
+ Status = gST->ConOut->SetCursorPosition (gST->ConOut, Col, Row);
}
FormatWalker = mPostReplaceFormat2;
@@ -2849,16 +2992,17 @@ InternalShellPrintWorker( //
// Find the next attribute change request
//
- ResumeLocation = StrStr(FormatWalker, L"%");
+ ResumeLocation = StrStr (FormatWalker, L"%");
if (ResumeLocation != NULL) {
*ResumeLocation = CHAR_NULL;
}
+
//
// print the current FormatWalker string
//
- if (StrLen(FormatWalker)>0) {
- Status = InternalPrintTo(FormatWalker);
- if (EFI_ERROR(Status)) {
+ if (StrLen (FormatWalker) > 0) {
+ Status = InternalPrintTo (FormatWalker);
+ if (EFI_ERROR (Status)) {
break;
}
}
@@ -2871,38 +3015,39 @@ InternalShellPrintWorker( //
// Move cursor back 1 position to overwrite the ^
//
- gST->ConOut->SetCursorPosition(gST->ConOut, gST->ConOut->Mode->CursorColumn - 1, gST->ConOut->Mode->CursorRow);
+ gST->ConOut->SetCursorPosition (gST->ConOut, gST->ConOut->Mode->CursorColumn - 1, gST->ConOut->Mode->CursorRow);
//
// Print a simple '%' symbol
//
- Status = InternalPrintTo(L"%");
+ Status = InternalPrintTo (L"%");
ResumeLocation = ResumeLocation - 1;
} else {
switch (*(ResumeLocation+1)) {
case (L'N'):
- gST->ConOut->SetAttribute(gST->ConOut, OriginalAttribute);
+ gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
break;
case (L'E'):
- gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_YELLOW, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)));
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_YELLOW, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)));
break;
case (L'H'):
- gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_WHITE, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)));
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_WHITE, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)));
break;
case (L'B'):
- gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_LIGHTBLUE, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)));
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTBLUE, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)));
break;
case (L'V'):
- gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_LIGHTGREEN, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)));
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGREEN, ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)));
break;
default:
//
// Print a simple '%' symbol
//
- Status = InternalPrintTo(L"%");
- if (EFI_ERROR(Status)) {
+ Status = InternalPrintTo (L"%");
+ if (EFI_ERROR (Status)) {
break;
}
+
ResumeLocation = ResumeLocation - 1;
break;
}
@@ -2920,10 +3065,10 @@ InternalShellPrintWorker( FormatWalker = ResumeLocation + 2;
}
- gST->ConOut->SetAttribute(gST->ConOut, OriginalAttribute);
+ gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
- SHELL_FREE_NON_NULL(mPostReplaceFormat);
- SHELL_FREE_NON_NULL(mPostReplaceFormat2);
+ SHELL_FREE_NON_NULL (mPostReplaceFormat);
+ SHELL_FREE_NON_NULL (mPostReplaceFormat2);
return (Status);
}
@@ -2958,22 +3103,24 @@ InternalShellPrintWorker( **/
EFI_STATUS
EFIAPI
-ShellPrintEx(
- IN INT32 Col OPTIONAL,
- IN INT32 Row OPTIONAL,
- IN CONST CHAR16 *Format,
+ShellPrintEx (
+ IN INT32 Col OPTIONAL,
+ IN INT32 Row OPTIONAL,
+ IN CONST CHAR16 *Format,
...
)
{
- VA_LIST Marker;
- EFI_STATUS RetVal;
+ VA_LIST Marker;
+ EFI_STATUS RetVal;
+
if (Format == NULL) {
return (EFI_INVALID_PARAMETER);
}
+
VA_START (Marker, Format);
- RetVal = InternalShellPrintWorker(Col, Row, Format, Marker);
- VA_END(Marker);
- return(RetVal);
+ RetVal = InternalShellPrintWorker (Col, Row, Format, Marker);
+ VA_END (Marker);
+ return (RetVal);
}
/**
@@ -3010,28 +3157,29 @@ ShellPrintEx( **/
EFI_STATUS
EFIAPI
-ShellPrintHiiEx(
- IN INT32 Col OPTIONAL,
- IN INT32 Row OPTIONAL,
- IN CONST CHAR8 *Language OPTIONAL,
- IN CONST EFI_STRING_ID HiiFormatStringId,
- IN CONST EFI_HII_HANDLE HiiFormatHandle,
+ShellPrintHiiEx (
+ IN INT32 Col OPTIONAL,
+ IN INT32 Row OPTIONAL,
+ IN CONST CHAR8 *Language OPTIONAL,
+ IN CONST EFI_STRING_ID HiiFormatStringId,
+ IN CONST EFI_HII_HANDLE HiiFormatHandle,
...
)
{
- VA_LIST Marker;
- CHAR16 *HiiFormatString;
- EFI_STATUS RetVal;
+ VA_LIST Marker;
+ CHAR16 *HiiFormatString;
+ EFI_STATUS RetVal;
RetVal = EFI_DEVICE_ERROR;
VA_START (Marker, HiiFormatHandle);
- HiiFormatString = HiiGetString(HiiFormatHandle, HiiFormatStringId, Language);
+ HiiFormatString = HiiGetString (HiiFormatHandle, HiiFormatStringId, Language);
if (HiiFormatString != NULL) {
RetVal = InternalShellPrintWorker (Col, Row, HiiFormatString, Marker);
SHELL_FREE_NON_NULL (HiiFormatString);
}
- VA_END(Marker);
+
+ VA_END (Marker);
return (RetVal);
}
@@ -3048,57 +3196,62 @@ ShellPrintHiiEx( **/
EFI_STATUS
EFIAPI
-ShellIsDirectory(
- IN CONST CHAR16 *DirName
+ShellIsDirectory (
+ IN CONST CHAR16 *DirName
)
{
- EFI_STATUS Status;
- SHELL_FILE_HANDLE Handle;
- CHAR16 *TempLocation;
- CHAR16 *TempLocation2;
+ EFI_STATUS Status;
+ SHELL_FILE_HANDLE Handle;
+ CHAR16 *TempLocation;
+ CHAR16 *TempLocation2;
- ASSERT(DirName != NULL);
+ ASSERT (DirName != NULL);
- Handle = NULL;
- TempLocation = NULL;
+ Handle = NULL;
+ TempLocation = NULL;
- Status = ShellOpenFileByName(DirName, &Handle, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR(Status)) {
+ Status = ShellOpenFileByName (DirName, &Handle, EFI_FILE_MODE_READ, 0);
+ if (EFI_ERROR (Status)) {
//
// try good logic first.
//
if (gEfiShellProtocol != NULL) {
- TempLocation = StrnCatGrow(&TempLocation, NULL, DirName, 0);
+ TempLocation = StrnCatGrow (&TempLocation, NULL, DirName, 0);
if (TempLocation == NULL) {
- ShellCloseFile(&Handle);
+ ShellCloseFile (&Handle);
return (EFI_OUT_OF_RESOURCES);
}
- TempLocation2 = StrStr(TempLocation, L":");
- if (TempLocation2 != NULL && StrLen(StrStr(TempLocation, L":")) == 2) {
+
+ TempLocation2 = StrStr (TempLocation, L":");
+ if ((TempLocation2 != NULL) && (StrLen (StrStr (TempLocation, L":")) == 2)) {
*(TempLocation2+1) = CHAR_NULL;
}
- if (gEfiShellProtocol->GetDevicePathFromMap(TempLocation) != NULL) {
- FreePool(TempLocation);
+
+ if (gEfiShellProtocol->GetDevicePathFromMap (TempLocation) != NULL) {
+ FreePool (TempLocation);
return (EFI_SUCCESS);
}
- FreePool(TempLocation);
+
+ FreePool (TempLocation);
} else {
//
// probably a map name?!?!!?
//
- TempLocation = StrStr(DirName, L"\\");
- if (TempLocation != NULL && *(TempLocation+1) == CHAR_NULL) {
+ TempLocation = StrStr (DirName, L"\\");
+ if ((TempLocation != NULL) && (*(TempLocation+1) == CHAR_NULL)) {
return (EFI_SUCCESS);
}
}
+
return (Status);
}
- if (FileHandleIsDirectory(Handle) == EFI_SUCCESS) {
- ShellCloseFile(&Handle);
+ if (FileHandleIsDirectory (Handle) == EFI_SUCCESS) {
+ ShellCloseFile (&Handle);
return (EFI_SUCCESS);
}
- ShellCloseFile(&Handle);
+
+ ShellCloseFile (&Handle);
return (EFI_NOT_FOUND);
}
@@ -3113,27 +3266,28 @@ ShellIsDirectory( **/
EFI_STATUS
EFIAPI
-ShellIsFile(
- IN CONST CHAR16 *Name
+ShellIsFile (
+ IN CONST CHAR16 *Name
)
{
- EFI_STATUS Status;
- SHELL_FILE_HANDLE Handle;
+ EFI_STATUS Status;
+ SHELL_FILE_HANDLE Handle;
- ASSERT(Name != NULL);
+ ASSERT (Name != NULL);
Handle = NULL;
- Status = ShellOpenFileByName(Name, &Handle, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR(Status)) {
+ Status = ShellOpenFileByName (Name, &Handle, EFI_FILE_MODE_READ, 0);
+ if (EFI_ERROR (Status)) {
return (Status);
}
- if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) {
- ShellCloseFile(&Handle);
+ if (FileHandleIsDirectory (Handle) != EFI_SUCCESS) {
+ ShellCloseFile (&Handle);
return (EFI_SUCCESS);
}
- ShellCloseFile(&Handle);
+
+ ShellCloseFile (&Handle);
return (EFI_NOT_FOUND);
}
@@ -3152,23 +3306,24 @@ ShellIsFile( **/
EFI_STATUS
EFIAPI
-ShellIsFileInPath(
- IN CONST CHAR16 *Name
+ShellIsFileInPath (
+ IN CONST CHAR16 *Name
)
{
CHAR16 *NewName;
EFI_STATUS Status;
- if (!EFI_ERROR(ShellIsFile(Name))) {
+ if (!EFI_ERROR (ShellIsFile (Name))) {
return (EFI_SUCCESS);
}
- NewName = ShellFindFilePath(Name);
+ NewName = ShellFindFilePath (Name);
if (NewName == NULL) {
return (EFI_NOT_FOUND);
}
- Status = ShellIsFile(NewName);
- FreePool(NewName);
+
+ Status = ShellIsFile (NewName);
+ FreePool (NewName);
return (Status);
}
@@ -3185,13 +3340,13 @@ ShellIsFileInPath( **/
UINTN
EFIAPI
-ShellHexStrToUintn(
- IN CONST CHAR16 *String
+ShellHexStrToUintn (
+ IN CONST CHAR16 *String
)
{
- UINT64 RetVal;
+ UINT64 RetVal;
- if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, TRUE, TRUE))) {
+ if (!EFI_ERROR (ShellConvertStringToUint64 (String, &RetVal, TRUE, TRUE))) {
return ((UINTN)RetVal);
}
@@ -3209,22 +3364,23 @@ ShellHexStrToUintn( **/
UINTN
EFIAPI
-ShellStrToUintn(
- IN CONST CHAR16 *String
+ShellStrToUintn (
+ IN CONST CHAR16 *String
)
{
- UINT64 RetVal;
- BOOLEAN Hex;
+ UINT64 RetVal;
+ BOOLEAN Hex;
Hex = FALSE;
- if (!InternalShellIsHexOrDecimalNumber(String, Hex, TRUE, FALSE)) {
+ if (!InternalShellIsHexOrDecimalNumber (String, Hex, TRUE, FALSE)) {
Hex = TRUE;
}
- if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, Hex, TRUE))) {
+ if (!EFI_ERROR (ShellConvertStringToUint64 (String, &RetVal, Hex, TRUE))) {
return ((UINTN)RetVal);
}
+
return ((UINTN)(-1));
}
@@ -3260,22 +3416,22 @@ ShellStrToUintn( @return Destination return the resultant string.
**/
-CHAR16*
+CHAR16 *
EFIAPI
StrnCatGrow (
- IN OUT CHAR16 **Destination,
- IN OUT UINTN *CurrentSize,
- IN CONST CHAR16 *Source,
- IN UINTN Count
+ IN OUT CHAR16 **Destination,
+ IN OUT UINTN *CurrentSize,
+ IN CONST CHAR16 *Source,
+ IN UINTN Count
)
{
- UINTN DestinationStartSize;
- UINTN NewSize;
+ UINTN DestinationStartSize;
+ UINTN NewSize;
//
// ASSERTs
//
- ASSERT(Destination != NULL);
+ ASSERT (Destination != NULL);
//
// If there's nothing to do then just return Destination
@@ -3287,7 +3443,7 @@ StrnCatGrow ( //
// allow for un-initialized pointers, based on size being 0
//
- if (CurrentSize != NULL && *CurrentSize == 0) {
+ if ((CurrentSize != NULL) && (*CurrentSize == 0)) {
*Destination = NULL;
}
@@ -3295,19 +3451,19 @@ StrnCatGrow ( // allow for NULL pointers address as Destination
//
if (*Destination != NULL) {
- ASSERT(CurrentSize != 0);
- DestinationStartSize = StrSize(*Destination);
- ASSERT(DestinationStartSize <= *CurrentSize);
+ ASSERT (CurrentSize != 0);
+ DestinationStartSize = StrSize (*Destination);
+ ASSERT (DestinationStartSize <= *CurrentSize);
} else {
DestinationStartSize = 0;
-// ASSERT(*CurrentSize == 0);
+ // ASSERT(*CurrentSize == 0);
}
//
// Append all of Source?
//
if (Count == 0) {
- Count = StrLen(Source);
+ Count = StrLen (Source);
}
//
@@ -3315,16 +3471,17 @@ StrnCatGrow ( //
if (CurrentSize != NULL) {
NewSize = *CurrentSize;
- if (NewSize < DestinationStartSize + (Count * sizeof(CHAR16))) {
- while (NewSize < (DestinationStartSize + (Count*sizeof(CHAR16)))) {
- NewSize += 2 * Count * sizeof(CHAR16);
+ if (NewSize < DestinationStartSize + (Count * sizeof (CHAR16))) {
+ while (NewSize < (DestinationStartSize + (Count*sizeof (CHAR16)))) {
+ NewSize += 2 * Count * sizeof (CHAR16);
}
- *Destination = ReallocatePool(*CurrentSize, NewSize, *Destination);
+
+ *Destination = ReallocatePool (*CurrentSize, NewSize, *Destination);
*CurrentSize = NewSize;
}
} else {
- NewSize = (Count+1)*sizeof(CHAR16);
- *Destination = AllocateZeroPool(NewSize);
+ NewSize = (Count+1)*sizeof (CHAR16);
+ *Destination = AllocateZeroPool (NewSize);
}
//
@@ -3334,7 +3491,7 @@ StrnCatGrow ( return (NULL);
}
- StrnCatS(*Destination, NewSize/sizeof(CHAR16), Source, Count);
+ StrnCatS (*Destination, NewSize/sizeof (CHAR16), Source, Count);
return *Destination;
}
@@ -3365,71 +3522,78 @@ StrnCatGrow ( EFI_STATUS
EFIAPI
ShellPromptForResponse (
- IN SHELL_PROMPT_REQUEST_TYPE Type,
- IN CHAR16 *Prompt OPTIONAL,
- IN OUT VOID **Response OPTIONAL
+ IN SHELL_PROMPT_REQUEST_TYPE Type,
+ IN CHAR16 *Prompt OPTIONAL,
+ IN OUT VOID **Response OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- UINTN EventIndex;
- SHELL_PROMPT_RESPONSE *Resp;
- UINTN Size;
- CHAR16 *Buffer;
-
- Status = EFI_UNSUPPORTED;
- Resp = NULL;
- Buffer = NULL;
- Size = 0;
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ UINTN EventIndex;
+ SHELL_PROMPT_RESPONSE *Resp;
+ UINTN Size;
+ CHAR16 *Buffer;
+
+ Status = EFI_UNSUPPORTED;
+ Resp = NULL;
+ Buffer = NULL;
+ Size = 0;
if (Type != ShellPromptResponseTypeFreeform) {
- Resp = (SHELL_PROMPT_RESPONSE*)AllocateZeroPool(sizeof(SHELL_PROMPT_RESPONSE));
+ Resp = (SHELL_PROMPT_RESPONSE *)AllocateZeroPool (sizeof (SHELL_PROMPT_RESPONSE));
if (Resp == NULL) {
if (Response != NULL) {
*Response = NULL;
}
+
return (EFI_OUT_OF_RESOURCES);
}
}
- switch(Type) {
+ switch (Type) {
case ShellPromptResponseTypeQuitContinue:
if (Prompt != NULL) {
- ShellPrintEx(-1, -1, L"%s", Prompt);
+ ShellPrintEx (-1, -1, L"%s", Prompt);
}
+
//
// wait for valid response
//
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
break;
}
- ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);
- if (Key.UnicodeChar == L'Q' || Key.UnicodeChar ==L'q') {
+
+ ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar);
+ if ((Key.UnicodeChar == L'Q') || (Key.UnicodeChar == L'q')) {
*Resp = ShellPromptResponseQuit;
} else {
*Resp = ShellPromptResponseContinue;
}
+
break;
case ShellPromptResponseTypeYesNoCancel:
- if (Prompt != NULL) {
- ShellPrintEx(-1, -1, L"%s", Prompt);
+ if (Prompt != NULL) {
+ ShellPrintEx (-1, -1, L"%s", Prompt);
}
+
//
// wait for valid response
//
*Resp = ShellPromptResponseMax;
while (*Resp == ShellPromptResponseMax) {
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
break;
}
+
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
break;
}
- ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);
+
+ ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar);
switch (Key.UnicodeChar) {
case L'Y':
case L'y':
@@ -3445,27 +3609,30 @@ ShellPromptForResponse ( break;
}
}
+
break;
- case ShellPromptResponseTypeYesNoAllCancel:
- if (Prompt != NULL) {
- ShellPrintEx(-1, -1, L"%s", Prompt);
+ case ShellPromptResponseTypeYesNoAllCancel:
+ if (Prompt != NULL) {
+ ShellPrintEx (-1, -1, L"%s", Prompt);
}
+
//
// wait for valid response
//
*Resp = ShellPromptResponseMax;
while (*Resp == ShellPromptResponseMax) {
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
break;
}
+
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
break;
}
- if (Key.UnicodeChar <= 127 && Key.UnicodeChar >= 32) {
+ if ((Key.UnicodeChar <= 127) && (Key.UnicodeChar >= 32)) {
ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar);
}
@@ -3488,60 +3655,69 @@ ShellPromptForResponse ( break;
}
}
+
break;
case ShellPromptResponseTypeEnterContinue:
case ShellPromptResponseTypeAnyKeyContinue:
if (Prompt != NULL) {
- ShellPrintEx(-1, -1, L"%s", Prompt);
+ ShellPrintEx (-1, -1, L"%s", Prompt);
}
+
//
// wait for valid response
//
*Resp = ShellPromptResponseMax;
while (*Resp == ShellPromptResponseMax) {
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
break;
}
+
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
if (Type == ShellPromptResponseTypeEnterContinue) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
break;
}
- ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);
+
+ ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar);
if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
*Resp = ShellPromptResponseContinue;
break;
}
}
+
if (Type == ShellPromptResponseTypeAnyKeyContinue) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
*Resp = ShellPromptResponseContinue;
break;
}
}
+
break;
case ShellPromptResponseTypeYesNo:
- if (Prompt != NULL) {
- ShellPrintEx(-1, -1, L"%s", Prompt);
+ if (Prompt != NULL) {
+ ShellPrintEx (-1, -1, L"%s", Prompt);
}
+
//
// wait for valid response
//
*Resp = ShellPromptResponseMax;
while (*Resp == ShellPromptResponseMax) {
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
break;
}
+
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
break;
}
- ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);
+
+ ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar);
switch (Key.UnicodeChar) {
case L'Y':
case L'y':
@@ -3553,35 +3729,41 @@ ShellPromptForResponse ( break;
}
}
+
break;
case ShellPromptResponseTypeFreeform:
if (Prompt != NULL) {
- ShellPrintEx(-1, -1, L"%s", Prompt);
+ ShellPrintEx (-1, -1, L"%s", Prompt);
}
- while(1) {
- if (ShellGetExecutionBreakFlag()) {
+
+ while (1) {
+ if (ShellGetExecutionBreakFlag ()) {
Status = EFI_ABORTED;
break;
}
+
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
break;
}
- ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);
+
+ ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar);
if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
break;
}
- ASSERT((Buffer == NULL && Size == 0) || (Buffer != NULL));
- StrnCatGrow(&Buffer, &Size, &Key.UnicodeChar, 1);
+
+ ASSERT ((Buffer == NULL && Size == 0) || (Buffer != NULL));
+ StrnCatGrow (&Buffer, &Size, &Key.UnicodeChar, 1);
}
+
break;
//
// This is the location to add new prompt types.
// If your new type loops remember to add ExecutionBreak support.
//
default:
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
if (Response != NULL) {
@@ -3594,14 +3776,15 @@ ShellPromptForResponse ( }
} else {
if (Resp != NULL) {
- FreePool(Resp);
+ FreePool (Resp);
}
+
if (Buffer != NULL) {
- FreePool(Buffer);
+ FreePool (Buffer);
}
}
- ShellPrintEx(-1, -1, L"\r\n");
+ ShellPrintEx (-1, -1, L"\r\n");
return (Status);
}
@@ -3625,18 +3808,18 @@ ShellPromptForResponse ( EFI_STATUS
EFIAPI
ShellPromptForResponseHii (
- IN SHELL_PROMPT_REQUEST_TYPE Type,
- IN CONST EFI_STRING_ID HiiFormatStringId,
- IN CONST EFI_HII_HANDLE HiiFormatHandle,
- IN OUT VOID **Response
+ IN SHELL_PROMPT_REQUEST_TYPE Type,
+ IN CONST EFI_STRING_ID HiiFormatStringId,
+ IN CONST EFI_HII_HANDLE HiiFormatHandle,
+ IN OUT VOID **Response
)
{
CHAR16 *Prompt;
EFI_STATUS Status;
- Prompt = HiiGetString(HiiFormatHandle, HiiFormatStringId, NULL);
- Status = ShellPromptForResponse(Type, Prompt, Response);
- FreePool(Prompt);
+ Prompt = HiiGetString (HiiFormatHandle, HiiFormatStringId, NULL);
+ Status = ShellPromptForResponse (Type, Prompt, Response);
+ FreePool (Prompt);
return (Status);
}
@@ -3661,8 +3844,8 @@ InternalShellIsHexOrDecimalNumber ( IN CONST BOOLEAN TimeNumbers
)
{
- BOOLEAN Hex;
- BOOLEAN LeadingZero;
+ BOOLEAN Hex;
+ BOOLEAN LeadingZero;
if (String == NULL) {
return FALSE;
@@ -3683,20 +3866,22 @@ InternalShellIsHexOrDecimalNumber ( // chop leading zeroes
//
LeadingZero = FALSE;
- while(*String == L'0'){
+ while (*String == L'0') {
String++;
LeadingZero = TRUE;
}
+
//
// allow '0x' or '0X', but not 'x' or 'X'
//
- if (*String == L'x' || *String == L'X') {
+ if ((*String == L'x') || (*String == L'X')) {
if (!LeadingZero) {
//
// we got an x without a preceeding 0
//
return (FALSE);
}
+
String++;
Hex = TRUE;
} else if (ForceHex) {
@@ -3708,16 +3893,17 @@ InternalShellIsHexOrDecimalNumber ( //
// loop through the remaining characters and use the lib function
//
- for ( ; *String != CHAR_NULL && !(StopAtSpace && *String == L' ') ; String++){
+ for ( ; *String != CHAR_NULL && !(StopAtSpace && *String == L' '); String++) {
if (TimeNumbers && (String[0] == L':')) {
continue;
}
+
if (Hex) {
- if (!ShellIsHexaDecimalDigitCharacter(*String)) {
+ if (!ShellIsHexaDecimalDigitCharacter (*String)) {
return (FALSE);
}
} else {
- if (!ShellIsDecimalDigitCharacter(*String)) {
+ if (!ShellIsDecimalDigitCharacter (*String)) {
return (FALSE);
}
}
@@ -3737,22 +3923,22 @@ InternalShellIsHexOrDecimalNumber ( **/
EFI_STATUS
EFIAPI
-ShellFileExists(
- IN CONST CHAR16 *Name
+ShellFileExists (
+ IN CONST CHAR16 *Name
)
{
- EFI_STATUS Status;
- EFI_SHELL_FILE_INFO *List;
+ EFI_STATUS Status;
+ EFI_SHELL_FILE_INFO *List;
- ASSERT(Name != NULL);
+ ASSERT (Name != NULL);
- List = NULL;
- Status = ShellOpenFileMetaArg((CHAR16*)Name, EFI_FILE_MODE_READ, &List);
- if (EFI_ERROR(Status)) {
+ List = NULL;
+ Status = ShellOpenFileMetaArg ((CHAR16 *)Name, EFI_FILE_MODE_READ, &List);
+ if (EFI_ERROR (Status)) {
return (Status);
}
- ShellCloseFileMetaArg(&List);
+ ShellCloseFileMetaArg (&List);
return (EFI_SUCCESS);
}
@@ -3772,7 +3958,7 @@ ShellFileExists( **/
UINTN
InternalShellHexCharToUintn (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
if (ShellIsDecimalDigitCharacter (Char)) {
@@ -3815,13 +4001,13 @@ InternalShellHexCharToUintn ( EFI_STATUS
InternalShellStrHexToUint64 (
IN CONST CHAR16 *String,
- OUT UINT64 *Value,
+ OUT UINT64 *Value,
IN CONST BOOLEAN StopAtSpace
)
{
- UINT64 Result;
+ UINT64 Result;
- if (String == NULL || StrSize(String) == 0 || Value == NULL) {
+ if ((String == NULL) || (StrSize (String) == 0) || (Value == NULL)) {
return (EFI_INVALID_PARAMETER);
}
@@ -3843,6 +4029,7 @@ InternalShellStrHexToUint64 ( if (*(String - 1) != L'0') {
return 0;
}
+
//
// Skip the 'X'
//
@@ -3863,19 +4050,19 @@ InternalShellStrHexToUint64 ( // If the Hex Number represented by String overflows according
// to the range defined by UINT64, then return EFI_DEVICE_ERROR.
//
- if (!(Result <= (RShiftU64((((UINT64) ~0) - InternalShellHexCharToUintn (*String)), 4)))) {
-// if (!(Result <= ((((UINT64) ~0) - InternalShellHexCharToUintn (*String)) >> 4))) {
+ if (!(Result <= (RShiftU64 ((((UINT64) ~0) - InternalShellHexCharToUintn (*String)), 4)))) {
+ // if (!(Result <= ((((UINT64) ~0) - InternalShellHexCharToUintn (*String)) >> 4))) {
return (EFI_DEVICE_ERROR);
}
- Result = (LShiftU64(Result, 4));
+ Result = (LShiftU64 (Result, 4));
Result += InternalShellHexCharToUintn (*String);
String++;
//
// stop at spaces if requested
//
- if (StopAtSpace && *String == L' ') {
+ if (StopAtSpace && (*String == L' ')) {
break;
}
}
@@ -3915,14 +4102,14 @@ InternalShellStrHexToUint64 ( **/
EFI_STATUS
InternalShellStrDecimalToUint64 (
- IN CONST CHAR16 *String,
- OUT UINT64 *Value,
+ IN CONST CHAR16 *String,
+ OUT UINT64 *Value,
IN CONST BOOLEAN StopAtSpace
)
{
- UINT64 Result;
+ UINT64 Result;
- if (String == NULL || StrSize (String) == 0 || Value == NULL) {
+ if ((String == NULL) || (StrSize (String) == 0) || (Value == NULL)) {
return (EFI_INVALID_PARAMETER);
}
@@ -3946,7 +4133,7 @@ InternalShellStrDecimalToUint64 ( // Stop upon space if requested
// (if the whole value was 0)
//
- if (StopAtSpace && *String == L' ') {
+ if (StopAtSpace && (*String == L' ')) {
*Value = Result;
return (EFI_SUCCESS);
}
@@ -3957,17 +4144,17 @@ InternalShellStrDecimalToUint64 ( // to the range defined by UINT64, then return EFI_DEVICE_ERROR.
//
- if (!(Result <= (DivU64x32((((UINT64) ~0) - (*String - L'0')),10)))) {
+ if (!(Result <= (DivU64x32 ((((UINT64) ~0) - (*String - L'0')), 10)))) {
return (EFI_DEVICE_ERROR);
}
- Result = MultU64x32(Result, 10) + (*String - L'0');
+ Result = MultU64x32 (Result, 10) + (*String - L'0');
String++;
//
// Stop at spaces if requested
//
- if (StopAtSpace && *String == L' ') {
+ if (StopAtSpace && (*String == L' ')) {
break;
}
}
@@ -3993,9 +4180,9 @@ InternalShellStrDecimalToUint64 ( **/
EFI_STATUS
EFIAPI
-ShellConvertStringToUint64(
+ShellConvertStringToUint64 (
IN CONST CHAR16 *String,
- OUT UINT64 *Value,
+ OUT UINT64 *Value,
IN CONST BOOLEAN ForceHex,
IN CONST BOOLEAN StopAtSpace
)
@@ -4007,10 +4194,10 @@ ShellConvertStringToUint64( Hex = ForceHex;
- if (!InternalShellIsHexOrDecimalNumber(String, Hex, StopAtSpace, FALSE)) {
+ if (!InternalShellIsHexOrDecimalNumber (String, Hex, StopAtSpace, FALSE)) {
if (!Hex) {
Hex = TRUE;
- if (!InternalShellIsHexOrDecimalNumber(String, Hex, StopAtSpace, FALSE)) {
+ if (!InternalShellIsHexOrDecimalNumber (String, Hex, StopAtSpace, FALSE)) {
return (EFI_INVALID_PARAMETER);
}
} else {
@@ -4021,25 +4208,26 @@ ShellConvertStringToUint64( //
// Chop off leading spaces
//
- for (Walker = String; Walker != NULL && *Walker != CHAR_NULL && *Walker == L' '; Walker++);
+ for (Walker = String; Walker != NULL && *Walker != CHAR_NULL && *Walker == L' '; Walker++) {
+ }
//
// make sure we have something left that is numeric.
//
- if (Walker == NULL || *Walker == CHAR_NULL || !InternalShellIsHexOrDecimalNumber(Walker, Hex, StopAtSpace, FALSE)) {
+ if ((Walker == NULL) || (*Walker == CHAR_NULL) || !InternalShellIsHexOrDecimalNumber (Walker, Hex, StopAtSpace, FALSE)) {
return (EFI_INVALID_PARAMETER);
}
//
// do the conversion.
//
- if (Hex || StrnCmp(Walker, L"0x", 2) == 0 || StrnCmp(Walker, L"0X", 2) == 0){
- Status = InternalShellStrHexToUint64(Walker, &RetVal, StopAtSpace);
+ if (Hex || (StrnCmp (Walker, L"0x", 2) == 0) || (StrnCmp (Walker, L"0X", 2) == 0)) {
+ Status = InternalShellStrHexToUint64 (Walker, &RetVal, StopAtSpace);
} else {
- Status = InternalShellStrDecimalToUint64(Walker, &RetVal, StopAtSpace);
+ Status = InternalShellStrDecimalToUint64 (Walker, &RetVal, StopAtSpace);
}
- if (Value == NULL && !EFI_ERROR(Status)) {
+ if ((Value == NULL) && !EFI_ERROR (Status)) {
return (EFI_NOT_FOUND);
}
@@ -4070,9 +4258,10 @@ ShellIsHexOrDecimalNumber ( IN CONST BOOLEAN StopAtSpace
)
{
- if (ShellConvertStringToUint64(String, NULL, ForceHex, StopAtSpace) == EFI_NOT_FOUND) {
+ if (ShellConvertStringToUint64 (String, NULL, ForceHex, StopAtSpace) == EFI_NOT_FOUND) {
return (TRUE);
}
+
return (FALSE);
}
@@ -4092,36 +4281,39 @@ ShellIsHexOrDecimalNumber ( @sa ShellFileHandleReadLine
**/
-CHAR16*
+CHAR16 *
EFIAPI
-ShellFileHandleReturnLine(
- IN SHELL_FILE_HANDLE Handle,
- IN OUT BOOLEAN *Ascii
+ShellFileHandleReturnLine (
+ IN SHELL_FILE_HANDLE Handle,
+ IN OUT BOOLEAN *Ascii
)
{
- CHAR16 *RetVal;
- UINTN Size;
- EFI_STATUS Status;
+ CHAR16 *RetVal;
+ UINTN Size;
+ EFI_STATUS Status;
- Size = 0;
+ Size = 0;
RetVal = NULL;
- Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);
+ Status = ShellFileHandleReadLine (Handle, RetVal, &Size, FALSE, Ascii);
if (Status == EFI_BUFFER_TOO_SMALL) {
- RetVal = AllocateZeroPool(Size);
+ RetVal = AllocateZeroPool (Size);
if (RetVal == NULL) {
return (NULL);
}
- Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);
+ Status = ShellFileHandleReadLine (Handle, RetVal, &Size, FALSE, Ascii);
}
- if (Status == EFI_END_OF_FILE && RetVal != NULL && *RetVal != CHAR_NULL) {
+
+ if ((Status == EFI_END_OF_FILE) && (RetVal != NULL) && (*RetVal != CHAR_NULL)) {
Status = EFI_SUCCESS;
}
- if (EFI_ERROR(Status) && (RetVal != NULL)) {
- FreePool(RetVal);
+
+ if (EFI_ERROR (Status) && (RetVal != NULL)) {
+ FreePool (RetVal);
RetVal = NULL;
}
+
return (RetVal);
}
@@ -4164,12 +4356,12 @@ ShellFileHandleReturnLine( **/
EFI_STATUS
EFIAPI
-ShellFileHandleReadLine(
- IN SHELL_FILE_HANDLE Handle,
- IN OUT CHAR16 *Buffer,
- IN OUT UINTN *Size,
- IN BOOLEAN Truncate,
- IN OUT BOOLEAN *Ascii
+ShellFileHandleReadLine (
+ IN SHELL_FILE_HANDLE Handle,
+ IN OUT CHAR16 *Buffer,
+ IN OUT UINTN *Size,
+ IN BOOLEAN Truncate,
+ IN OUT BOOLEAN *Ascii
)
{
EFI_STATUS Status;
@@ -4178,72 +4370,80 @@ ShellFileHandleReadLine( UINTN CountSoFar;
UINT64 OriginalFilePosition;
-
- if (Handle == NULL
- ||Size == NULL
- ){
+ if ( (Handle == NULL)
+ || (Size == NULL)
+ )
+ {
return (EFI_INVALID_PARAMETER);
}
+
if (Buffer == NULL) {
- ASSERT(*Size == 0);
+ ASSERT (*Size == 0);
} else {
*Buffer = CHAR_NULL;
}
- gEfiShellProtocol->GetFilePosition(Handle, &OriginalFilePosition);
+
+ gEfiShellProtocol->GetFilePosition (Handle, &OriginalFilePosition);
if (OriginalFilePosition == 0) {
- CharSize = sizeof(CHAR16);
- Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer);
- ASSERT_EFI_ERROR(Status);
+ CharSize = sizeof (CHAR16);
+ Status = gEfiShellProtocol->ReadFile (Handle, &CharSize, &CharBuffer);
+ ASSERT_EFI_ERROR (Status);
if (CharBuffer == gUnicodeFileTag) {
*Ascii = FALSE;
} else {
*Ascii = TRUE;
- gEfiShellProtocol->SetFilePosition(Handle, OriginalFilePosition);
+ gEfiShellProtocol->SetFilePosition (Handle, OriginalFilePosition);
}
}
if (*Ascii) {
- CharSize = sizeof(CHAR8);
+ CharSize = sizeof (CHAR8);
} else {
- CharSize = sizeof(CHAR16);
+ CharSize = sizeof (CHAR16);
}
- for (CountSoFar = 0;;CountSoFar++){
+
+ for (CountSoFar = 0; ; CountSoFar++) {
CharBuffer = 0;
- Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer);
- if ( EFI_ERROR(Status)
- || CharSize == 0
- || (CharBuffer == L'\n' && !(*Ascii))
- || (CharBuffer == '\n' && *Ascii)
- ){
+ Status = gEfiShellProtocol->ReadFile (Handle, &CharSize, &CharBuffer);
+ if ( EFI_ERROR (Status)
+ || (CharSize == 0)
+ || ((CharBuffer == L'\n') && !(*Ascii))
+ || ((CharBuffer == '\n') && *Ascii)
+ )
+ {
if (CharSize == 0) {
Status = EFI_END_OF_FILE;
}
+
break;
}
+
//
// if we have space save it...
//
- if ((CountSoFar+1)*sizeof(CHAR16) < *Size){
- ASSERT(Buffer != NULL);
- ((CHAR16*)Buffer)[CountSoFar] = CharBuffer;
- ((CHAR16*)Buffer)[CountSoFar+1] = CHAR_NULL;
+ if ((CountSoFar+1)*sizeof (CHAR16) < *Size) {
+ ASSERT (Buffer != NULL);
+ ((CHAR16 *)Buffer)[CountSoFar] = CharBuffer;
+ ((CHAR16 *)Buffer)[CountSoFar+1] = CHAR_NULL;
}
}
//
// if we ran out of space tell when...
//
- if ((CountSoFar+1)*sizeof(CHAR16) > *Size){
- *Size = (CountSoFar+1)*sizeof(CHAR16);
+ if ((CountSoFar+1)*sizeof (CHAR16) > *Size) {
+ *Size = (CountSoFar+1)*sizeof (CHAR16);
if (!Truncate) {
- gEfiShellProtocol->SetFilePosition(Handle, OriginalFilePosition);
+ gEfiShellProtocol->SetFilePosition (Handle, OriginalFilePosition);
} else {
- DEBUG((DEBUG_WARN, "The line was truncated in ShellFileHandleReadLine"));
+ DEBUG ((DEBUG_WARN, "The line was truncated in ShellFileHandleReadLine"));
}
+
return (EFI_BUFFER_TOO_SMALL);
}
- while(Buffer[StrLen(Buffer)-1] == L'\r') {
- Buffer[StrLen(Buffer)-1] = CHAR_NULL;
+
+ while (Buffer[StrLen (Buffer)-1] == L'\r') {
+ Buffer[StrLen (Buffer)-1] = CHAR_NULL;
}
return (Status);
@@ -4263,13 +4463,13 @@ ShellFileHandleReadLine( EFI_STATUS
EFIAPI
ShellPrintHelp (
- IN CONST CHAR16 *CommandToGetHelpOn,
- IN CONST CHAR16 *SectionToGetHelpOn,
- IN BOOLEAN PrintCommandText
+ IN CONST CHAR16 *CommandToGetHelpOn,
+ IN CONST CHAR16 *SectionToGetHelpOn,
+ IN BOOLEAN PrintCommandText
)
{
- EFI_STATUS Status;
- CHAR16 *OutText;
+ EFI_STATUS Status;
+ CHAR16 *OutText;
OutText = NULL;
@@ -4281,30 +4481,31 @@ ShellPrintHelp ( //
// make sure we got a valid string
//
- if (EFI_ERROR(Status)){
+ if (EFI_ERROR (Status)) {
return Status;
}
- if (OutText == NULL || StrLen(OutText) == 0) {
+
+ if ((OutText == NULL) || (StrLen (OutText) == 0)) {
return EFI_NOT_FOUND;
}
//
// Chop off trailing stuff we dont need
//
- while (OutText[StrLen(OutText)-1] == L'\r' || OutText[StrLen(OutText)-1] == L'\n' || OutText[StrLen(OutText)-1] == L' ') {
- OutText[StrLen(OutText)-1] = CHAR_NULL;
+ while (OutText[StrLen (OutText)-1] == L'\r' || OutText[StrLen (OutText)-1] == L'\n' || OutText[StrLen (OutText)-1] == L' ') {
+ OutText[StrLen (OutText)-1] = CHAR_NULL;
}
//
// Print this out to the console
//
if (PrintCommandText) {
- ShellPrintEx(-1, -1, L"%H%-14s%N- %s\r\n", CommandToGetHelpOn, OutText);
+ ShellPrintEx (-1, -1, L"%H%-14s%N- %s\r\n", CommandToGetHelpOn, OutText);
} else {
- ShellPrintEx(-1, -1, L"%N%s\r\n", OutText);
+ ShellPrintEx (-1, -1, L"%N%s\r\n", OutText);
}
- SHELL_FREE_NON_NULL(OutText);
+ SHELL_FREE_NON_NULL (OutText);
return EFI_SUCCESS;
}
@@ -4334,24 +4535,23 @@ ShellPrintHelp ( **/
EFI_STATUS
EFIAPI
-ShellDeleteFileByName(
- IN CONST CHAR16 *FileName
+ShellDeleteFileByName (
+ IN CONST CHAR16 *FileName
)
{
- EFI_STATUS Status;
- SHELL_FILE_HANDLE FileHandle;
+ EFI_STATUS Status;
+ SHELL_FILE_HANDLE FileHandle;
- Status = ShellFileExists(FileName);
+ Status = ShellFileExists (FileName);
- if (Status == EFI_SUCCESS){
- Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0x0);
- if (Status == EFI_SUCCESS){
- Status = ShellDeleteFile(&FileHandle);
+ if (Status == EFI_SUCCESS) {
+ Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0x0);
+ if (Status == EFI_SUCCESS) {
+ Status = ShellDeleteFile (&FileHandle);
}
}
- return(Status);
-
+ return (Status);
}
/**
@@ -4366,13 +4566,13 @@ ShellDeleteFileByName( **/
EFI_STATUS
InternalShellStripQuotes (
- IN CONST CHAR16 *OriginalString,
- OUT CHAR16 **CleanString
+ IN CONST CHAR16 *OriginalString,
+ OUT CHAR16 **CleanString
)
{
- CHAR16 *Walker;
+ CHAR16 *Walker;
- if (OriginalString == NULL || CleanString == NULL) {
+ if ((OriginalString == NULL) || (CleanString == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -4381,12 +4581,11 @@ InternalShellStripQuotes ( return EFI_OUT_OF_RESOURCES;
}
- for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL ; Walker++) {
+ for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL; Walker++) {
if (*Walker == L'\"') {
- CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0]));
+ CopyMem (Walker, Walker+1, StrSize (Walker) - sizeof (Walker[0]));
}
}
return EFI_SUCCESS;
}
-
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.h b/ShellPkg/Library/UefiShellLib/UefiShellLib.h index 919ae83e13..3015188a01 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.h +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.h @@ -36,16 +36,16 @@ #include <Library/ShellLib.h>
typedef struct {
- EFI_SHELL_GET_FILE_INFO GetFileInfo;
- EFI_SHELL_SET_FILE_INFO SetFileInfo;
- EFI_SHELL_READ_FILE ReadFile;
- EFI_SHELL_WRITE_FILE WriteFile;
- EFI_SHELL_CLOSE_FILE CloseFile;
- EFI_SHELL_DELETE_FILE DeleteFile;
- EFI_SHELL_GET_FILE_POSITION GetFilePosition;
- EFI_SHELL_SET_FILE_POSITION SetFilePosition;
- EFI_SHELL_FLUSH_FILE FlushFile;
- EFI_SHELL_GET_FILE_SIZE GetFileSize;
+ EFI_SHELL_GET_FILE_INFO GetFileInfo;
+ EFI_SHELL_SET_FILE_INFO SetFileInfo;
+ EFI_SHELL_READ_FILE ReadFile;
+ EFI_SHELL_WRITE_FILE WriteFile;
+ EFI_SHELL_CLOSE_FILE CloseFile;
+ EFI_SHELL_DELETE_FILE DeleteFile;
+ EFI_SHELL_GET_FILE_POSITION GetFilePosition;
+ EFI_SHELL_SET_FILE_POSITION SetFilePosition;
+ EFI_SHELL_FLUSH_FILE FlushFile;
+ EFI_SHELL_GET_FILE_SIZE GetFileSize;
} FILE_HANDLE_FUNCTION_MAP;
/**
@@ -81,10 +81,8 @@ InternalShellIsHexOrDecimalNumber ( **/
EFI_STATUS
InternalShellStripQuotes (
- IN CONST CHAR16 *OriginalString,
- OUT CHAR16 **CleanString
+ IN CONST CHAR16 *OriginalString,
+ OUT CHAR16 **CleanString
);
-
#endif
-
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c index 267217cf3c..71b08bdff1 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c @@ -11,14 +11,14 @@ #include "UefiShellNetwork1CommandsLib.h"
typedef enum {
- IfConfigOpList = 1,
- IfConfigOpSet = 2,
- IfConfigOpClear = 3
+ IfConfigOpList = 1,
+ IfConfigOpSet = 2,
+ IfConfigOpClear = 3
} IFCONFIG_OPCODE;
typedef enum {
- VarCheckReserved = -1,
- VarCheckOk = 0,
+ VarCheckReserved = -1,
+ VarCheckOk = 0,
VarCheckDuplicate,
VarCheckConflict,
VarCheckUnknown,
@@ -27,22 +27,22 @@ typedef enum { } VAR_CHECK_CODE;
typedef enum {
- FlagTypeSingle = 0,
+ FlagTypeSingle = 0,
FlagTypeNeedVar,
FlagTypeNeedSet,
FlagTypeSkipUnknown
} VAR_CHECK_FLAG_TYPE;
-#define MACADDRMAXSIZE 32
+#define MACADDRMAXSIZE 32
typedef struct _IFCONFIG_INTERFACE_CB {
- EFI_HANDLE NicHandle;
- LIST_ENTRY Link;
- EFI_IP4_CONFIG2_PROTOCOL *IfCfg;
- EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
- EFI_IP4_CONFIG2_POLICY Policy;
- UINT32 DnsCnt;
- EFI_IPv4_ADDRESS DnsAddr[1];
+ EFI_HANDLE NicHandle;
+ LIST_ENTRY Link;
+ EFI_IP4_CONFIG2_PROTOCOL *IfCfg;
+ EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
+ EFI_IP4_CONFIG2_POLICY Policy;
+ UINT32 DnsCnt;
+ EFI_IPv4_ADDRESS DnsAddr[1];
} IFCONFIG_INTERFACE_CB;
typedef struct _ARG_LIST ARG_LIST;
@@ -53,21 +53,21 @@ struct _ARG_LIST { };
typedef struct _IFCONFIG4_PRIVATE_DATA {
- LIST_ENTRY IfList;
+ LIST_ENTRY IfList;
- UINT32 OpCode;
- CHAR16 *IfName;
- ARG_LIST *VarArg;
+ UINT32 OpCode;
+ CHAR16 *IfName;
+ ARG_LIST *VarArg;
} IFCONFIG_PRIVATE_DATA;
-typedef struct _VAR_CHECK_ITEM{
+typedef struct _VAR_CHECK_ITEM {
CHAR16 *FlagStr;
UINT32 FlagID;
UINT32 ConflictMask;
VAR_CHECK_FLAG_TYPE FlagType;
} VAR_CHECK_ITEM;
-SHELL_PARAM_ITEM mIfConfigCheckList[] = {
+SHELL_PARAM_ITEM mIfConfigCheckList[] = {
{
L"-b",
TypeFlag
@@ -96,7 +96,7 @@ SHELL_PARAM_ITEM mIfConfigCheckList[] = { VAR_CHECK_ITEM mSetCheckList[] = {
{
- L"static",
+ L"static",
0x00000001,
0x00000001,
FlagTypeSingle
@@ -121,7 +121,7 @@ VAR_CHECK_ITEM mSetCheckList[] = { },
};
-STATIC CONST CHAR16 PermanentString[10] = L"PERMANENT";
+STATIC CONST CHAR16 PermanentString[10] = L"PERMANENT";
/**
Free the ARG_LIST.
@@ -130,10 +130,11 @@ STATIC CONST CHAR16 PermanentString[10] = L"PERMANENT"; **/
VOID
FreeArgList (
- ARG_LIST *List
-)
+ ARG_LIST *List
+ )
{
- ARG_LIST *Next;
+ ARG_LIST *Next;
+
while (List->Next != NULL) {
Next = List->Next;
FreePool (List);
@@ -154,14 +155,14 @@ FreeArgList ( **/
ARG_LIST *
SplitStrToList (
- IN CONST CHAR16 *String,
- IN CHAR16 Separator
+ IN CONST CHAR16 *String,
+ IN CHAR16 Separator
)
{
- CHAR16 *Str;
- CHAR16 *ArgStr;
- ARG_LIST *ArgList;
- ARG_LIST *ArgNode;
+ CHAR16 *Str;
+ CHAR16 *ArgStr;
+ ARG_LIST *ArgList;
+ ARG_LIST *ArgNode;
if (*String == L'\0') {
return NULL;
@@ -174,15 +175,17 @@ SplitStrToList ( if (Str == NULL) {
return NULL;
}
- ArgStr = Str;
+
+ ArgStr = Str;
//
// init a node for the list head.
//
- ArgNode = (ARG_LIST *) AllocateZeroPool (sizeof (ARG_LIST));
+ ArgNode = (ARG_LIST *)AllocateZeroPool (sizeof (ARG_LIST));
if (ArgNode == NULL) {
return NULL;
}
+
ArgList = ArgNode;
//
@@ -193,7 +196,7 @@ SplitStrToList ( *Str = L'\0';
ArgNode->Arg = ArgStr;
ArgStr = Str + 1;
- ArgNode->Next = (ARG_LIST *) AllocateZeroPool (sizeof (ARG_LIST));
+ ArgNode->Next = (ARG_LIST *)AllocateZeroPool (sizeof (ARG_LIST));
if (ArgNode->Next == NULL) {
//
// Free the local copy of string stored in the first node
@@ -202,6 +205,7 @@ SplitStrToList ( FreeArgList (ArgList);
return NULL;
}
+
ArgNode = ArgNode->Next;
}
@@ -228,17 +232,17 @@ SplitStrToList ( **/
VAR_CHECK_CODE
-IfConfigRetriveCheckListByName(
- IN VAR_CHECK_ITEM *CheckList,
- IN CHAR16 *Name,
- IN BOOLEAN Init
-)
+IfConfigRetriveCheckListByName (
+ IN VAR_CHECK_ITEM *CheckList,
+ IN CHAR16 *Name,
+ IN BOOLEAN Init
+ )
{
- STATIC UINT32 CheckDuplicate;
- STATIC UINT32 CheckConflict;
- VAR_CHECK_CODE RtCode;
- UINT32 Index;
- VAR_CHECK_ITEM Arg;
+ STATIC UINT32 CheckDuplicate;
+ STATIC UINT32 CheckConflict;
+ VAR_CHECK_CODE RtCode;
+ UINT32 Index;
+ VAR_CHECK_ITEM Arg;
if (Init) {
CheckDuplicate = 0;
@@ -246,16 +250,15 @@ IfConfigRetriveCheckListByName( return VarCheckOk;
}
- RtCode = VarCheckOk;
- Index = 0;
- Arg = CheckList[Index];
+ RtCode = VarCheckOk;
+ Index = 0;
+ Arg = CheckList[Index];
//
// Check the Duplicated/Conflicted/Unknown input Args.
//
while (Arg.FlagStr != NULL) {
if (StrCmp (Arg.FlagStr, Name) == 0) {
-
if (CheckDuplicate & Arg.FlagID) {
RtCode = VarCheckDuplicate;
break;
@@ -291,11 +294,11 @@ IfConfigRetriveCheckListByName( VOID
EFIAPI
IfConfigManualAddressNotify (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- *((BOOLEAN *) Context) = TRUE;
+ *((BOOLEAN *)Context) = TRUE;
}
/**
@@ -307,11 +310,11 @@ IfConfigManualAddressNotify ( **/
VOID
IfConfigPrintMacAddr (
- IN UINT8 *Node,
- IN UINT32 Size
+ IN UINT8 *Node,
+ IN UINT32 Size
)
{
- UINTN Index;
+ UINTN Index;
ASSERT (Size <= MACADDRMAXSIZE);
@@ -325,7 +328,6 @@ IfConfigPrintMacAddr ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_NEWLINE), gShellNetwork1HiiHandle);
}
-
/**
The get current status of all handles.
@@ -338,24 +340,24 @@ IfConfigPrintMacAddr ( **/
EFI_STATUS
IfConfigGetInterfaceInfo (
- IN CHAR16 *IfName,
- IN LIST_ENTRY *IfList
+ IN CHAR16 *IfName,
+ IN LIST_ENTRY *IfList
)
{
- EFI_STATUS Status;
- UINTN HandleIndex;
- UINTN HandleNum;
- EFI_HANDLE *HandleBuffer;
- EFI_IP4_CONFIG2_PROTOCOL *Ip4Cfg2;
- EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
- IFCONFIG_INTERFACE_CB *IfCb;
- UINTN DataSize;
+ EFI_STATUS Status;
+ UINTN HandleIndex;
+ UINTN HandleNum;
+ EFI_HANDLE *HandleBuffer;
+ EFI_IP4_CONFIG2_PROTOCOL *Ip4Cfg2;
+ EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
+ IFCONFIG_INTERFACE_CB *IfCb;
+ UINTN DataSize;
HandleBuffer = NULL;
HandleNum = 0;
- IfInfo = NULL;
- IfCb = NULL;
+ IfInfo = NULL;
+ IfCb = NULL;
//
// Locate all the handles with ip4 service binding protocol.
@@ -366,7 +368,7 @@ IfConfigGetInterfaceInfo ( NULL,
&HandleNum,
&HandleBuffer
- );
+ );
if (EFI_ERROR (Status) || (HandleNum == 0)) {
return Status;
}
@@ -375,9 +377,9 @@ IfConfigGetInterfaceInfo ( // Enumerate all handles that installed with ip4 service binding protocol.
//
for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
- IfCb = NULL;
- IfInfo = NULL;
- DataSize = 0;
+ IfCb = NULL;
+ IfInfo = NULL;
+ DataSize = 0;
//
// Ip4config protocol and ip4 service binding protocol are installed
@@ -387,7 +389,7 @@ IfConfigGetInterfaceInfo ( Status = gBS->HandleProtocol (
HandleBuffer[HandleIndex],
&gEfiIp4Config2ProtocolGuid,
- (VOID **) &Ip4Cfg2
+ (VOID **)&Ip4Cfg2
);
if (EFI_ERROR (Status)) {
@@ -398,11 +400,11 @@ IfConfigGetInterfaceInfo ( // Get the interface information size.
//
Status = Ip4Cfg2->GetData (
- Ip4Cfg2,
- Ip4Config2DataTypeInterfaceInfo,
- &DataSize,
- NULL
- );
+ Ip4Cfg2,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ NULL
+ );
if (Status != EFI_BUFFER_TOO_SMALL) {
goto ON_ERROR;
@@ -419,11 +421,11 @@ IfConfigGetInterfaceInfo ( // Get the interface info.
//
Status = Ip4Cfg2->GetData (
- Ip4Cfg2,
- Ip4Config2DataTypeInterfaceInfo,
- &DataSize,
- IfInfo
- );
+ Ip4Cfg2,
+ Ip4Config2DataTypeInterfaceInfo,
+ &DataSize,
+ IfInfo
+ );
if (EFI_ERROR (Status)) {
goto ON_ERROR;
@@ -443,11 +445,11 @@ IfConfigGetInterfaceInfo ( // Get the size of dns server list.
//
Status = Ip4Cfg2->GetData (
- Ip4Cfg2,
- Ip4Config2DataTypeDnsServer,
- &DataSize,
- NULL
- );
+ Ip4Cfg2,
+ Ip4Config2DataTypeDnsServer,
+ &DataSize,
+ NULL
+ );
if ((Status != EFI_BUFFER_TOO_SMALL) && (Status != EFI_NOT_FOUND)) {
goto ON_ERROR;
@@ -463,18 +465,18 @@ IfConfigGetInterfaceInfo ( IfCb->NicHandle = HandleBuffer[HandleIndex];
IfCb->IfInfo = IfInfo;
IfCb->IfCfg = Ip4Cfg2;
- IfCb->DnsCnt = (UINT32) (DataSize / sizeof (EFI_IPv4_ADDRESS));
+ IfCb->DnsCnt = (UINT32)(DataSize / sizeof (EFI_IPv4_ADDRESS));
//
// Get the dns server list if has.
//
if (DataSize > 0) {
Status = Ip4Cfg2->GetData (
- Ip4Cfg2,
- Ip4Config2DataTypeDnsServer,
- &DataSize,
- IfCb->DnsAddr
- );
+ Ip4Cfg2,
+ Ip4Config2DataTypeDnsServer,
+ &DataSize,
+ IfCb->DnsAddr
+ );
if (EFI_ERROR (Status)) {
goto ON_ERROR;
@@ -486,11 +488,11 @@ IfConfigGetInterfaceInfo ( //
DataSize = sizeof (EFI_IP4_CONFIG2_POLICY);
Status = Ip4Cfg2->GetData (
- Ip4Cfg2,
- Ip4Config2DataTypePolicy,
- &DataSize,
- &IfCb->Policy
- );
+ Ip4Cfg2,
+ Ip4Config2DataTypePolicy,
+ &DataSize,
+ &IfCb->Policy
+ );
if (EFI_ERROR (Status)) {
goto ON_ERROR;
@@ -538,15 +540,15 @@ ON_ERROR: **/
SHELL_STATUS
IfConfigShowInterfaceInfo (
- IN LIST_ENTRY *IfList
+ IN LIST_ENTRY *IfList
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *Next;
- IFCONFIG_INTERFACE_CB *IfCb;
- EFI_STATUS MediaStatus;
- EFI_IPv4_ADDRESS Gateway;
- UINT32 Index;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *Next;
+ IFCONFIG_INTERFACE_CB *IfCb;
+ EFI_STATUS MediaStatus;
+ EFI_IPv4_ADDRESS Gateway;
+ UINT32 Index;
MediaStatus = EFI_SUCCESS;
@@ -604,7 +606,7 @@ IfConfigShowInterfaceInfo ( //
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_HEAD), gShellNetwork1HiiHandle);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -621,7 +623,7 @@ IfConfigShowInterfaceInfo ( //
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_SUBNET_MASK_HEAD), gShellNetwork1HiiHandle);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -642,12 +644,13 @@ IfConfigShowInterfaceInfo ( for (Index = 0; Index < IfCb->IfInfo->RouteTableSize; Index++) {
if ((CompareMem (&IfCb->IfInfo->RouteTable[Index].SubnetAddress, &mZeroIp4Addr, sizeof (EFI_IPv4_ADDRESS)) == 0) &&
- (CompareMem (&IfCb->IfInfo->RouteTable[Index].SubnetMask , &mZeroIp4Addr, sizeof (EFI_IPv4_ADDRESS)) == 0) ){
+ (CompareMem (&IfCb->IfInfo->RouteTable[Index].SubnetMask, &mZeroIp4Addr, sizeof (EFI_IPv4_ADDRESS)) == 0))
+ {
CopyMem (&Gateway, &IfCb->IfInfo->RouteTable[Index].GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
}
}
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -662,12 +665,12 @@ IfConfigShowInterfaceInfo ( //
// Print route table entry.
//
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_ROUTES_SIZE), gShellNetwork1HiiHandle, IfCb->IfInfo->RouteTableSize);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_ROUTES_SIZE), gShellNetwork1HiiHandle, IfCb->IfInfo->RouteTableSize);
for (Index = 0; Index < IfCb->IfInfo->RouteTableSize; Index++) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_ROUTES_ENTRY_INDEX), gShellNetwork1HiiHandle, Index);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_ROUTES_ENTRY_INDEX), gShellNetwork1HiiHandle, Index);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -680,7 +683,7 @@ IfConfigShowInterfaceInfo ( (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[3]
);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -693,7 +696,7 @@ IfConfigShowInterfaceInfo ( (UINTN)IfCb->IfInfo->RouteTable[Index].SubnetMask.Addr[3]
);
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
@@ -713,16 +716,16 @@ IfConfigShowInterfaceInfo ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_DNS_ADDR_HEAD), gShellNetwork1HiiHandle);
for (Index = 0; Index < IfCb->DnsCnt; Index++) {
- ShellPrintHiiEx(
+ ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_IFCONFIG_INFO_DNS_ADDR_BODY),
gShellNetwork1HiiHandle,
- (UINTN) IfCb->DnsAddr[Index].Addr[0],
- (UINTN) IfCb->DnsAddr[Index].Addr[1],
- (UINTN) IfCb->DnsAddr[Index].Addr[2],
- (UINTN) IfCb->DnsAddr[Index].Addr[3]
+ (UINTN)IfCb->DnsAddr[Index].Addr[0],
+ (UINTN)IfCb->DnsAddr[Index].Addr[1],
+ (UINTN)IfCb->DnsAddr[Index].Addr[2],
+ (UINTN)IfCb->DnsAddr[Index].Addr[3]
);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_NEWLINE), gShellNetwork1HiiHandle);
@@ -746,18 +749,18 @@ IfConfigShowInterfaceInfo ( **/
SHELL_STATUS
IfConfigClearInterfaceInfo (
- IN LIST_ENTRY *IfList,
- IN CHAR16 *IfName
+ IN LIST_ENTRY *IfList,
+ IN CHAR16 *IfName
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- LIST_ENTRY *Entry;
- LIST_ENTRY *Next;
- IFCONFIG_INTERFACE_CB *IfCb;
- EFI_IP4_CONFIG2_POLICY Policy;
-
- Status = EFI_SUCCESS;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *Next;
+ IFCONFIG_INTERFACE_CB *IfCb;
+ EFI_IP4_CONFIG2_POLICY Policy;
+
+ Status = EFI_SUCCESS;
ShellStatus = SHELL_SUCCESS;
if (IsListEmpty (IfList)) {
@@ -818,29 +821,29 @@ IfConfigClearInterfaceInfo ( **/
SHELL_STATUS
IfConfigSetInterfaceInfo (
- IN LIST_ENTRY *IfList,
- IN ARG_LIST *VarArg
+ IN LIST_ENTRY *IfList,
+ IN ARG_LIST *VarArg
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- IFCONFIG_INTERFACE_CB *IfCb;
- VAR_CHECK_CODE CheckCode;
- EFI_EVENT TimeOutEvt;
- EFI_EVENT MappedEvt;
- BOOLEAN IsAddressOk;
-
- EFI_IP4_CONFIG2_POLICY Policy;
- EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress;
- UINTN DataSize;
- EFI_IPv4_ADDRESS Gateway;
- IP4_ADDR SubnetMask;
- IP4_ADDR TempGateway;
- EFI_IPv4_ADDRESS *Dns;
- ARG_LIST *Tmp;
- UINTN Index;
-
- CONST CHAR16* TempString;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ IFCONFIG_INTERFACE_CB *IfCb;
+ VAR_CHECK_CODE CheckCode;
+ EFI_EVENT TimeOutEvt;
+ EFI_EVENT MappedEvt;
+ BOOLEAN IsAddressOk;
+
+ EFI_IP4_CONFIG2_POLICY Policy;
+ EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress;
+ UINTN DataSize;
+ EFI_IPv4_ADDRESS Gateway;
+ IP4_ADDR SubnetMask;
+ IP4_ADDR TempGateway;
+ EFI_IPv4_ADDRESS *Dns;
+ ARG_LIST *Tmp;
+ UINTN Index;
+
+ CONST CHAR16 *TempString;
Dns = NULL;
@@ -852,14 +855,14 @@ IfConfigSetInterfaceInfo ( //
// Make sure to set only one interface each time.
//
- IfCb = NET_LIST_USER_STRUCT (IfList->ForwardLink, IFCONFIG_INTERFACE_CB, Link);
- Status = EFI_SUCCESS;
+ IfCb = NET_LIST_USER_STRUCT (IfList->ForwardLink, IFCONFIG_INTERFACE_CB, Link);
+ Status = EFI_SUCCESS;
ShellStatus = SHELL_SUCCESS;
//
// Initialize check list mechanism.
//
- CheckCode = IfConfigRetriveCheckListByName(
+ CheckCode = IfConfigRetriveCheckListByName (
NULL,
NULL,
TRUE
@@ -901,7 +904,7 @@ IfConfigSetInterfaceInfo ( //
// Check invalid parameters (duplication & unknown & conflict).
//
- CheckCode = IfConfigRetriveCheckListByName(
+ CheckCode = IfConfigRetriveCheckListByName (
mSetCheckList,
VarArg->Arg,
FALSE
@@ -922,8 +925,8 @@ IfConfigSetInterfaceInfo ( // To handle unsupported option.
//
TempString = PermanentString;
- if (StringNoCaseCompare(&VarArg->Arg, &TempString) == 0) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_UNSUPPORTED_OPTION), gShellNetwork1HiiHandle, PermanentString);
+ if (StringNoCaseCompare (&VarArg->Arg, &TempString) == 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_UNSUPPORTED_OPTION), gShellNetwork1HiiHandle, PermanentString);
goto ON_EXIT;
}
@@ -944,7 +947,7 @@ IfConfigSetInterfaceInfo ( //
// Process valid variables.
//
- if (StrCmp(VarArg->Arg, L"dhcp") == 0) {
+ if (StrCmp (VarArg->Arg, L"dhcp") == 0) {
//
// Set dhcp config policy
//
@@ -955,16 +958,15 @@ IfConfigSetInterfaceInfo ( sizeof (EFI_IP4_CONFIG2_POLICY),
&Policy
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig");
ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
- VarArg= VarArg->Next;
-
+ VarArg = VarArg->Next;
} else if (StrCmp (VarArg->Arg, L"static") == 0) {
- VarArg= VarArg->Next;
+ VarArg = VarArg->Next;
if (VarArg == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_COMMAND), gShellNetwork1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -977,8 +979,8 @@ IfConfigSetInterfaceInfo ( // Get manual IP address.
//
Status = NetLibStrToIp4 (VarArg->Arg, &ManualAddress.Address);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
@@ -994,8 +996,8 @@ IfConfigSetInterfaceInfo ( }
Status = NetLibStrToIp4 (VarArg->Arg, &ManualAddress.SubnetMask);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
@@ -1011,8 +1013,8 @@ IfConfigSetInterfaceInfo ( }
Status = NetLibStrToIp4 (VarArg->Arg, &Gateway);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
@@ -1027,7 +1029,8 @@ IfConfigSetInterfaceInfo ( TempGateway = NTOHL (TempGateway);
if ((SubnetMask != 0) &&
(SubnetMask != 0xFFFFFFFFu) &&
- !NetIp4IsUnicast (TempGateway, SubnetMask)) {
+ !NetIp4IsUnicast (TempGateway, SubnetMask))
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_GATEWAY), gShellNetwork1HiiHandle, VarArg->Arg);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
@@ -1043,7 +1046,7 @@ IfConfigSetInterfaceInfo ( sizeof (EFI_IP4_CONFIG2_POLICY),
&Policy
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig");
ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
@@ -1115,7 +1118,6 @@ IfConfigSetInterfaceInfo ( }
VarArg = VarArg->Next;
-
} else if (StrCmp (VarArg->Arg, L"dns") == 0) {
//
// Get DNS addresses.
@@ -1124,26 +1126,28 @@ IfConfigSetInterfaceInfo ( Tmp = VarArg;
Index = 0;
while (Tmp != NULL) {
- Index ++;
+ Index++;
Tmp = Tmp->Next;
}
- Dns = AllocatePool (Index * sizeof (EFI_IPv4_ADDRESS));
+ Dns = AllocatePool (Index * sizeof (EFI_IPv4_ADDRESS));
if (Dns == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork1HiiHandle, L"ifconfig");
ShellStatus = SHELL_OUT_OF_RESOURCES;
goto ON_EXIT;
}
+
Tmp = VarArg;
Index = 0;
while (Tmp != NULL) {
Status = NetLibStrToIp4 (Tmp->Arg, Dns + Index);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, Tmp->Arg);
+ if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, Tmp->Arg);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
- Index ++;
+
+ Index++;
Tmp = Tmp->Next;
}
@@ -1174,7 +1178,6 @@ ON_EXIT: }
return ShellStatus;
-
}
/**
@@ -1188,7 +1191,7 @@ ON_EXIT: **/
SHELL_STATUS
IfConfig (
- IN IFCONFIG_PRIVATE_DATA *Private
+ IN IFCONFIG_PRIVATE_DATA *Private
)
{
EFI_STATUS Status;
@@ -1209,20 +1212,20 @@ IfConfig ( }
switch (Private->OpCode) {
- case IfConfigOpList:
- ShellStatus = IfConfigShowInterfaceInfo (&Private->IfList);
- break;
+ case IfConfigOpList:
+ ShellStatus = IfConfigShowInterfaceInfo (&Private->IfList);
+ break;
- case IfConfigOpClear:
- ShellStatus = IfConfigClearInterfaceInfo (&Private->IfList, Private->IfName);
- break;
+ case IfConfigOpClear:
+ ShellStatus = IfConfigClearInterfaceInfo (&Private->IfList, Private->IfName);
+ break;
- case IfConfigOpSet:
- ShellStatus = IfConfigSetInterfaceInfo (&Private->IfList, Private->VarArg);
- break;
+ case IfConfigOpSet:
+ ShellStatus = IfConfigSetInterfaceInfo (&Private->IfList, Private->VarArg);
+ break;
- default:
- ShellStatus = SHELL_UNSUPPORTED;
+ default:
+ ShellStatus = SHELL_UNSUPPORTED;
}
ON_EXIT:
@@ -1240,9 +1243,9 @@ IfConfigCleanup ( IN IFCONFIG_PRIVATE_DATA *Private
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- IFCONFIG_INTERFACE_CB *IfCb;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ IFCONFIG_INTERFACE_CB *IfCb;
ASSERT (Private != NULL);
@@ -1266,7 +1269,6 @@ IfConfigCleanup ( RemoveEntryList (&IfCb->Link);
if (IfCb->IfInfo != NULL) {
-
FreePool (IfCb->IfInfo);
}
@@ -1293,27 +1295,27 @@ ShellCommandRunIfconfig ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- IFCONFIG_PRIVATE_DATA *Private;
- LIST_ENTRY *ParamPackage;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *ValueStr;
- ARG_LIST *ArgList;
- CHAR16 *ProblemParam;
- CHAR16 *Str;
-
- Status = EFI_INVALID_PARAMETER;
- Private = NULL;
+ EFI_STATUS Status;
+ IFCONFIG_PRIVATE_DATA *Private;
+ LIST_ENTRY *ParamPackage;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *ValueStr;
+ ARG_LIST *ArgList;
+ CHAR16 *ProblemParam;
+ CHAR16 *Str;
+
+ Status = EFI_INVALID_PARAMETER;
+ Private = NULL;
ShellStatus = SHELL_SUCCESS;
Status = ShellCommandLineParseEx (mIfConfigCheckList, &ParamPackage, &ProblemParam, TRUE, FALSE);
if (EFI_ERROR (Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ifconfig", ProblemParam);
- FreePool(ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
goto ON_EXIT;
@@ -1323,7 +1325,7 @@ ShellCommandRunIfconfig ( // To handle unsupported option.
//
if (ShellCommandLineGetFlag (ParamPackage, L"-c")) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_UNSUPPORTED_OPTION), gShellNetwork1HiiHandle,L"-c");
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_UNSUPPORTED_OPTION), gShellNetwork1HiiHandle, L"-c");
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
@@ -1332,7 +1334,8 @@ ShellCommandRunIfconfig ( // To handle no option.
//
if (!ShellCommandLineGetFlag (ParamPackage, L"-r") && !ShellCommandLineGetFlag (ParamPackage, L"-s") &&
- !ShellCommandLineGetFlag (ParamPackage, L"-l")) {
+ !ShellCommandLineGetFlag (ParamPackage, L"-l"))
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_OPTION), gShellNetwork1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
@@ -1343,7 +1346,8 @@ ShellCommandRunIfconfig ( //
if (((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-s"))) ||
((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) ||
- ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l")))) {
+ ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))))
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellNetwork1HiiHandle, L"ifconfig");
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
@@ -1362,7 +1366,7 @@ ShellCommandRunIfconfig ( //
if (ShellCommandLineGetFlag (ParamPackage, L"-l")) {
Private->OpCode = IfConfigOpList;
- ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l");
+ ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l");
if (ValueStr != NULL) {
Str = AllocateCopyPool (StrSize (ValueStr), ValueStr);
if (Str == NULL) {
@@ -1370,6 +1374,7 @@ ShellCommandRunIfconfig ( ShellStatus = SHELL_OUT_OF_RESOURCES;
goto ON_EXIT;
}
+
Private->IfName = Str;
}
}
@@ -1379,7 +1384,7 @@ ShellCommandRunIfconfig ( //
if (ShellCommandLineGetFlag (ParamPackage, L"-r")) {
Private->OpCode = IfConfigOpClear;
- ValueStr = ShellCommandLineGetValue (ParamPackage, L"-r");
+ ValueStr = ShellCommandLineGetValue (ParamPackage, L"-r");
if (ValueStr != NULL) {
Str = AllocateCopyPool (StrSize (ValueStr), ValueStr);
if (Str == NULL) {
@@ -1387,6 +1392,7 @@ ShellCommandRunIfconfig ( ShellStatus = SHELL_OUT_OF_RESOURCES;
goto ON_EXIT;
}
+
Private->IfName = Str;
}
}
@@ -1417,7 +1423,7 @@ ShellCommandRunIfconfig ( Private->VarArg = ArgList->Next;
- if (Private->IfName == NULL || Private->VarArg == NULL) {
+ if ((Private->IfName == NULL) || (Private->VarArg == NULL)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_COMMAND), gShellNetwork1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c index a3fa325151..ec1e0a188b 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c @@ -11,9 +11,9 @@ #include "UefiShellNetwork1CommandsLib.h"
-#define PING_IP4_COPY_ADDRESS(Dest, Src) (CopyMem ((Dest), (Src), sizeof (EFI_IPv4_ADDRESS)))
+#define PING_IP4_COPY_ADDRESS(Dest, Src) (CopyMem ((Dest), (Src), sizeof (EFI_IPv4_ADDRESS)))
-UINT64 mCurrentTick = 0;
+UINT64 mCurrentTick = 0;
//
// Function templates to match the IPv4 and IPv6 commands that we use.
@@ -50,16 +50,15 @@ EFI_STATUS /// Unknown which one to the ping command.
///
typedef struct {
- PING_IPX_TRANSMIT Transmit;
- PING_IPX_RECEIVE Receive;
- PING_IPX_CANCEL Cancel;
- PING_IPX_POLL Poll;
-}PING_IPX_PROTOCOL;
-
+ PING_IPX_TRANSMIT Transmit;
+ PING_IPX_RECEIVE Receive;
+ PING_IPX_CANCEL Cancel;
+ PING_IPX_POLL Poll;
+} PING_IPX_PROTOCOL;
typedef union {
- VOID *RxData;
- VOID *TxData;
+ VOID *RxData;
+ VOID *TxData;
} PING_PACKET;
//
@@ -68,28 +67,28 @@ typedef union { // This version is IP-unaware.
//
typedef struct {
- EFI_EVENT Event;
- EFI_STATUS Status;
- PING_PACKET Packet;
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ PING_PACKET Packet;
} PING_IPX_COMPLETION_TOKEN;
#pragma pack(1)
typedef struct _ICMPX_ECHO_REQUEST_REPLY {
- UINT8 Type;
- UINT8 Code;
- UINT16 Checksum;
- UINT16 Identifier;
- UINT16 SequenceNum;
- UINT32 TimeStamp;
- UINT8 Data[1];
+ UINT8 Type;
+ UINT8 Code;
+ UINT16 Checksum;
+ UINT16 Identifier;
+ UINT16 SequenceNum;
+ UINT32 TimeStamp;
+ UINT8 Data[1];
} ICMPX_ECHO_REQUEST_REPLY;
#pragma pack()
typedef struct _PING_ICMP_TX_INFO {
- LIST_ENTRY Link;
- UINT16 SequenceNum;
- UINT32 TimeStamp;
- PING_IPX_COMPLETION_TOKEN *Token;
+ LIST_ENTRY Link;
+ UINT16 SequenceNum;
+ UINT32 TimeStamp;
+ PING_IPX_COMPLETION_TOKEN *Token;
} PING_ICMPX_TX_INFO;
#define DEFAULT_TIMEOUT 5000
@@ -107,34 +106,34 @@ typedef struct _PING_ICMP_TX_INFO { #define PING_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'i', 'n', 'g')
typedef struct _PING_PRIVATE_DATA {
- UINT32 Signature;
- EFI_HANDLE NicHandle;
- EFI_HANDLE IpChildHandle;
- EFI_EVENT Timer;
-
- UINT32 TimerPeriod;
- UINT32 RttTimerTick;
- EFI_EVENT RttTimer;
-
- EFI_STATUS Status;
- LIST_ENTRY TxList;
- UINT16 RxCount;
- UINT16 TxCount;
- UINT64 RttSum;
- UINT64 RttMin;
- UINT64 RttMax;
- UINT32 SequenceNum;
-
- UINT32 SendNum;
- UINT32 BufferSize;
- UINT32 IpChoice;
-
- PING_IPX_PROTOCOL ProtocolPointers;
- VOID *IpProtocol;
- UINT8 SrcAddress[MAX(sizeof(EFI_IPv6_ADDRESS) , sizeof(EFI_IPv4_ADDRESS) )];
- UINT8 DstAddress[MAX(sizeof(EFI_IPv6_ADDRESS) , sizeof(EFI_IPv4_ADDRESS) )];
- PING_IPX_COMPLETION_TOKEN RxToken;
- UINT16 FailedCount;
+ UINT32 Signature;
+ EFI_HANDLE NicHandle;
+ EFI_HANDLE IpChildHandle;
+ EFI_EVENT Timer;
+
+ UINT32 TimerPeriod;
+ UINT32 RttTimerTick;
+ EFI_EVENT RttTimer;
+
+ EFI_STATUS Status;
+ LIST_ENTRY TxList;
+ UINT16 RxCount;
+ UINT16 TxCount;
+ UINT64 RttSum;
+ UINT64 RttMin;
+ UINT64 RttMax;
+ UINT32 SequenceNum;
+
+ UINT32 SendNum;
+ UINT32 BufferSize;
+ UINT32 IpChoice;
+
+ PING_IPX_PROTOCOL ProtocolPointers;
+ VOID *IpProtocol;
+ UINT8 SrcAddress[MAX (sizeof (EFI_IPv6_ADDRESS), sizeof (EFI_IPv4_ADDRESS))];
+ UINT8 DstAddress[MAX (sizeof (EFI_IPv6_ADDRESS), sizeof (EFI_IPv4_ADDRESS))];
+ PING_IPX_COMPLETION_TOKEN RxToken;
+ UINT16 FailedCount;
} PING_PRIVATE_DATA;
/**
@@ -156,17 +155,17 @@ NetChecksum ( UINT8 Odd;
UINT16 *Packet;
- Packet = (UINT16 *) Buffer;
+ Packet = (UINT16 *)Buffer;
- Sum = 0;
- Odd = (UINT8) (Length & 1);
+ Sum = 0;
+ Odd = (UINT8)(Length & 1);
Length >>= 1;
while ((Length--) != 0) {
Sum += *Packet++;
}
if (Odd != 0) {
- Sum += *(UINT8 *) Packet;
+ Sum += *(UINT8 *)Packet;
}
Sum = (Sum & 0xffff) + (Sum >> 16);
@@ -176,7 +175,7 @@ NetChecksum ( //
Sum += Sum >> 16;
- return (UINT16) Sum;
+ return (UINT16)Sum;
}
/**
@@ -188,7 +187,7 @@ NetChecksum ( **/
-STATIC CONST SHELL_PARAM_ITEM PingParamList[] = {
+STATIC CONST SHELL_PARAM_ITEM PingParamList[] = {
{
L"-l",
TypeValue
@@ -218,8 +217,8 @@ STATIC CONST SHELL_PARAM_ITEM PingParamList[] = { //
// Global Variables in Ping command.
//
-STATIC CONST CHAR16 *mDstString;
-STATIC CONST CHAR16 *mSrcString;
+STATIC CONST CHAR16 *mDstString;
+STATIC CONST CHAR16 *mSrcString;
/**
RTT timer tick routine.
@@ -231,13 +230,13 @@ STATIC CONST CHAR16 *mSrcString; VOID
EFIAPI
RttTimerTickRoutine (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- UINT32 *RttTimerTick;
+ UINT32 *RttTimerTick;
- RttTimerTick = (UINT32*) Context;
+ RttTimerTick = (UINT32 *)Context;
(*RttTimerTick)++;
}
@@ -251,18 +250,18 @@ RttTimerTickRoutine ( **/
UINT32
-GetTimerPeriod(
+GetTimerPeriod (
VOID
)
{
- EFI_STATUS Status;
- UINT32 RttTimerTick;
- EFI_EVENT TimerEvent;
- UINT32 StallCounter;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ UINT32 RttTimerTick;
+ EFI_EVENT TimerEvent;
+ UINT32 StallCounter;
+ EFI_TPL OldTpl;
RttTimerTick = 0;
- StallCounter = 0;
+ StallCounter = 0;
Status = gBS->CreateEvent (
EVT_TIMER | EVT_NOTIFY_SIGNAL,
@@ -310,10 +309,10 @@ GetTimerPeriod( **/
EFI_STATUS
PingInitRttTimer (
- PING_PRIVATE_DATA *Private
+ PING_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Private->TimerPeriod = GetTimerPeriod ();
if (Private->TimerPeriod == 0) {
@@ -321,13 +320,13 @@ PingInitRttTimer ( }
Private->RttTimerTick = 0;
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- RttTimerTickRoutine,
- &Private->RttTimerTick,
- &Private->RttTimer
- );
+ Status = gBS->CreateEvent (
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ RttTimerTickRoutine,
+ &Private->RttTimerTick,
+ &Private->RttTimer
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -353,7 +352,7 @@ PingInitRttTimer ( **/
VOID
PingFreeRttTimer (
- PING_PRIVATE_DATA *Private
+ PING_PRIVATE_DATA *Private
)
{
if (Private->RttTimer != NULL) {
@@ -371,7 +370,7 @@ PingFreeRttTimer ( **/
UINT32
ReadTime (
- PING_PRIVATE_DATA *Private
+ PING_PRIVATE_DATA *Private
)
{
return Private->RttTimerTick;
@@ -389,9 +388,9 @@ ReadTime ( **/
UINT32
CalculateTick (
- PING_PRIVATE_DATA *Private,
- IN UINT32 Begin,
- IN UINT32 End
+ PING_PRIVATE_DATA *Private,
+ IN UINT32 Begin,
+ IN UINT32 End
)
{
if (End < Begin) {
@@ -409,21 +408,20 @@ CalculateTick ( **/
VOID
PingDestroyTxInfo (
- IN PING_ICMPX_TX_INFO *TxInfo,
- IN UINT32 IpChoice
+ IN PING_ICMPX_TX_INFO *TxInfo,
+ IN UINT32 IpChoice
)
{
- EFI_IP6_TRANSMIT_DATA *Ip6TxData;
- EFI_IP4_TRANSMIT_DATA *Ip4TxData;
- EFI_IP6_FRAGMENT_DATA *FragData;
- UINTN Index;
+ EFI_IP6_TRANSMIT_DATA *Ip6TxData;
+ EFI_IP4_TRANSMIT_DATA *Ip4TxData;
+ EFI_IP6_FRAGMENT_DATA *FragData;
+ UINTN Index;
if (TxInfo == NULL) {
return;
}
if (TxInfo->Token != NULL) {
-
if (TxInfo->Token->Event != NULL) {
gBS->CloseEvent (TxInfo->Token->Event);
}
@@ -480,13 +478,13 @@ PingDestroyTxInfo ( **/
EFI_STATUS
Ping6MatchEchoReply (
- IN PING_PRIVATE_DATA *Private,
- IN ICMPX_ECHO_REQUEST_REPLY *Packet
+ IN PING_PRIVATE_DATA *Private,
+ IN ICMPX_ECHO_REQUEST_REPLY *Packet
)
{
- PING_ICMPX_TX_INFO *TxInfo;
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
+ PING_ICMPX_TX_INFO *TxInfo;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) {
TxInfo = BASE_CR (Entry, PING_ICMPX_TX_INFO, Link);
@@ -515,8 +513,8 @@ Ping6MatchEchoReply ( VOID
EFIAPI
Ping6OnEchoRequestSent (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
}
@@ -531,19 +529,19 @@ Ping6OnEchoRequestSent ( VOID
EFIAPI
Ping6OnEchoReplyReceived (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- PING_PRIVATE_DATA *Private;
- ICMPX_ECHO_REQUEST_REPLY *Reply;
- UINT32 PayLoad;
- UINT32 Rtt;
+ EFI_STATUS Status;
+ PING_PRIVATE_DATA *Private;
+ ICMPX_ECHO_REQUEST_REPLY *Reply;
+ UINT32 PayLoad;
+ UINT32 Rtt;
- Private = (PING_PRIVATE_DATA *) Context;
+ Private = (PING_PRIVATE_DATA *)Context;
- if (Private == NULL || Private->Status == EFI_ABORTED || Private->Signature != PING_PRIVATE_DATA_SIGNATURE) {
+ if ((Private == NULL) || (Private->Status == EFI_ABORTED) || (Private->Signature != PING_PRIVATE_DATA_SIGNATURE)) {
return;
}
@@ -552,13 +550,15 @@ Ping6OnEchoReplyReceived ( }
if (Private->IpChoice == PING_IP_CHOICE_IP6) {
- Reply = ((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->FragmentTable[0].FragmentBuffer;
- PayLoad = ((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->DataLength;
- if (((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->NextHeader != IP6_ICMP) {
+ Reply = ((EFI_IP6_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->FragmentTable[0].FragmentBuffer;
+ PayLoad = ((EFI_IP6_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->DataLength;
+ if (((EFI_IP6_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->Header->NextHeader != IP6_ICMP) {
goto ON_EXIT;
}
- if (!IP6_IS_MULTICAST ((EFI_IPv6_ADDRESS*)&Private->DstAddress) &&
- !EFI_IP6_EQUAL (&((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->SourceAddress, (EFI_IPv6_ADDRESS*)&Private->DstAddress)) {
+
+ if (!IP6_IS_MULTICAST ((EFI_IPv6_ADDRESS *)&Private->DstAddress) &&
+ !EFI_IP6_EQUAL (&((EFI_IP6_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->Header->SourceAddress, (EFI_IPv6_ADDRESS *)&Private->DstAddress))
+ {
goto ON_EXIT;
}
@@ -566,10 +566,11 @@ Ping6OnEchoReplyReceived ( goto ON_EXIT;
}
} else {
- Reply = ((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->FragmentTable[0].FragmentBuffer;
- PayLoad = ((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->DataLength;
- if (!IP4_IS_MULTICAST (EFI_IP4(*(EFI_IPv4_ADDRESS*)Private->DstAddress)) &&
- !EFI_IP4_EQUAL (&((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->SourceAddress, (EFI_IPv4_ADDRESS*)&Private->DstAddress)) {
+ Reply = ((EFI_IP4_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->FragmentTable[0].FragmentBuffer;
+ PayLoad = ((EFI_IP4_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->DataLength;
+ if (!IP4_IS_MULTICAST (EFI_IP4 (*(EFI_IPv4_ADDRESS *)Private->DstAddress)) &&
+ !EFI_IP4_EQUAL (&((EFI_IP4_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->Header->SourceAddress, (EFI_IPv4_ADDRESS *)&Private->DstAddress))
+ {
goto ON_EXIT;
}
@@ -578,21 +579,22 @@ Ping6OnEchoReplyReceived ( }
}
-
if (PayLoad != Private->BufferSize) {
goto ON_EXIT;
}
+
//
// Check whether the reply matches the sent request before.
//
Status = Ping6MatchEchoReply (Private, Reply);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
+
//
// Display statistics on this icmp6 echo reply packet.
//
- Rtt = CalculateTick (Private, Reply->TimeStamp, ReadTime (Private));
+ Rtt = CalculateTick (Private, Reply->TimeStamp, ReadTime (Private));
Private->RttSum += Rtt;
Private->RttMin = Private->RttMin > Rtt ? Rtt : Private->RttMin;
@@ -607,7 +609,7 @@ Ping6OnEchoReplyReceived ( PayLoad,
mDstString,
Reply->SequenceNum,
- Private->IpChoice == PING_IP_CHOICE_IP6?((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->HopLimit:0,
+ Private->IpChoice == PING_IP_CHOICE_IP6 ? ((EFI_IP6_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->Header->HopLimit : 0,
Rtt,
Rtt + Private->TimerPeriod
);
@@ -617,7 +619,7 @@ ON_EXIT: //
// Recycle the packet before reusing RxToken
//
- gBS->SignalEvent (Private->IpChoice == PING_IP_CHOICE_IP6?((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->RecycleSignal:((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->RecycleSignal);
+ gBS->SignalEvent (Private->IpChoice == PING_IP_CHOICE_IP6 ? ((EFI_IP6_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->RecycleSignal : ((EFI_IP4_RECEIVE_DATA *)Private->RxToken.Packet.RxData)->RecycleSignal);
if (Private->RxCount < Private->SendNum) {
//
@@ -651,27 +653,29 @@ ON_EXIT: **/
PING_IPX_COMPLETION_TOKEN *
PingGenerateToken (
- IN PING_PRIVATE_DATA *Private,
- IN UINT32 TimeStamp,
- IN UINT16 SequenceNum
+ IN PING_PRIVATE_DATA *Private,
+ IN UINT32 TimeStamp,
+ IN UINT16 SequenceNum
)
{
- EFI_STATUS Status;
- PING_IPX_COMPLETION_TOKEN *Token;
- VOID *TxData;
- ICMPX_ECHO_REQUEST_REPLY *Request;
- UINT16 HeadSum;
- UINT16 TempChecksum;
+ EFI_STATUS Status;
+ PING_IPX_COMPLETION_TOKEN *Token;
+ VOID *TxData;
+ ICMPX_ECHO_REQUEST_REPLY *Request;
+ UINT16 HeadSum;
+ UINT16 TempChecksum;
Request = AllocateZeroPool (Private->BufferSize);
if (Request == NULL) {
return NULL;
}
- TxData = AllocateZeroPool (Private->IpChoice==PING_IP_CHOICE_IP6?sizeof (EFI_IP6_TRANSMIT_DATA):sizeof (EFI_IP4_TRANSMIT_DATA));
+
+ TxData = AllocateZeroPool (Private->IpChoice == PING_IP_CHOICE_IP6 ? sizeof (EFI_IP6_TRANSMIT_DATA) : sizeof (EFI_IP4_TRANSMIT_DATA));
if (TxData == NULL) {
FreePool (Request);
return NULL;
}
+
Token = AllocateZeroPool (sizeof (PING_IPX_COMPLETION_TOKEN));
if (Token == NULL) {
FreePool (Request);
@@ -682,7 +686,7 @@ PingGenerateToken ( //
// Assembly echo request packet.
//
- Request->Type = (UINT8)(Private->IpChoice==PING_IP_CHOICE_IP6?ICMP_V6_ECHO_REQUEST:ICMP_V4_ECHO_REQUEST);
+ Request->Type = (UINT8)(Private->IpChoice == PING_IP_CHOICE_IP6 ? ICMP_V6_ECHO_REQUEST : ICMP_V4_ECHO_REQUEST);
Request->Code = 0;
Request->SequenceNum = SequenceNum;
Request->Identifier = 0;
@@ -691,37 +695,36 @@ PingGenerateToken ( //
// Assembly token for transmit.
//
- if (Private->IpChoice==PING_IP_CHOICE_IP6) {
- Request->TimeStamp = TimeStamp;
- ((EFI_IP6_TRANSMIT_DATA*)TxData)->ExtHdrsLength = 0;
- ((EFI_IP6_TRANSMIT_DATA*)TxData)->ExtHdrs = NULL;
- ((EFI_IP6_TRANSMIT_DATA*)TxData)->OverrideData = 0;
- ((EFI_IP6_TRANSMIT_DATA*)TxData)->DataLength = Private->BufferSize;
- ((EFI_IP6_TRANSMIT_DATA*)TxData)->FragmentCount = 1;
- ((EFI_IP6_TRANSMIT_DATA*)TxData)->FragmentTable[0].FragmentBuffer = (VOID *) Request;
- ((EFI_IP6_TRANSMIT_DATA*)TxData)->FragmentTable[0].FragmentLength = Private->BufferSize;
+ if (Private->IpChoice == PING_IP_CHOICE_IP6) {
+ Request->TimeStamp = TimeStamp;
+ ((EFI_IP6_TRANSMIT_DATA *)TxData)->ExtHdrsLength = 0;
+ ((EFI_IP6_TRANSMIT_DATA *)TxData)->ExtHdrs = NULL;
+ ((EFI_IP6_TRANSMIT_DATA *)TxData)->OverrideData = 0;
+ ((EFI_IP6_TRANSMIT_DATA *)TxData)->DataLength = Private->BufferSize;
+ ((EFI_IP6_TRANSMIT_DATA *)TxData)->FragmentCount = 1;
+ ((EFI_IP6_TRANSMIT_DATA *)TxData)->FragmentTable[0].FragmentBuffer = (VOID *)Request;
+ ((EFI_IP6_TRANSMIT_DATA *)TxData)->FragmentTable[0].FragmentLength = Private->BufferSize;
} else {
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->OptionsLength = 0;
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->OptionsBuffer = NULL;
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->OverrideData = 0;
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->TotalDataLength = Private->BufferSize;
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->FragmentCount = 1;
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->FragmentTable[0].FragmentBuffer = (VOID *) Request;
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->FragmentTable[0].FragmentLength = Private->BufferSize;
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[0] = Private->DstAddress[0];
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[1] = Private->DstAddress[1];
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[2] = Private->DstAddress[2];
- ((EFI_IP4_TRANSMIT_DATA*)TxData)->DestinationAddress.Addr[3] = Private->DstAddress[3];
-
- HeadSum = NetChecksum ((UINT8 *) Request, Private->BufferSize);
- Request->TimeStamp = TimeStamp;
- TempChecksum = NetChecksum ((UINT8 *) &Request->TimeStamp, sizeof (UINT64));
- Request->Checksum = (UINT16)(~NetAddChecksum (HeadSum, TempChecksum));
- }
-
-
- Token->Status = EFI_ABORTED;
- Token->Packet.TxData = TxData;
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->OptionsLength = 0;
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->OptionsBuffer = NULL;
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->OverrideData = 0;
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->TotalDataLength = Private->BufferSize;
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->FragmentCount = 1;
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->FragmentTable[0].FragmentBuffer = (VOID *)Request;
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->FragmentTable[0].FragmentLength = Private->BufferSize;
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->DestinationAddress.Addr[0] = Private->DstAddress[0];
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->DestinationAddress.Addr[1] = Private->DstAddress[1];
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->DestinationAddress.Addr[2] = Private->DstAddress[2];
+ ((EFI_IP4_TRANSMIT_DATA *)TxData)->DestinationAddress.Addr[3] = Private->DstAddress[3];
+
+ HeadSum = NetChecksum ((UINT8 *)Request, Private->BufferSize);
+ Request->TimeStamp = TimeStamp;
+ TempChecksum = NetChecksum ((UINT8 *)&Request->TimeStamp, sizeof (UINT64));
+ Request->Checksum = (UINT16)(~NetAddChecksum (HeadSum, TempChecksum));
+ }
+
+ Token->Status = EFI_ABORTED;
+ Token->Packet.TxData = TxData;
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
@@ -753,11 +756,11 @@ PingGenerateToken ( **/
EFI_STATUS
PingSendEchoRequest (
- IN PING_PRIVATE_DATA *Private
+ IN PING_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- PING_ICMPX_TX_INFO *TxInfo;
+ EFI_STATUS Status;
+ PING_ICMPX_TX_INFO *TxInfo;
TxInfo = AllocateZeroPool (sizeof (PING_ICMPX_TX_INFO));
@@ -766,7 +769,7 @@ PingSendEchoRequest ( }
TxInfo->TimeStamp = ReadTime (Private);
- TxInfo->SequenceNum = (UINT16) (Private->TxCount + 1);
+ TxInfo->SequenceNum = (UINT16)(Private->TxCount + 1);
TxInfo->Token = PingGenerateToken (
Private,
TxInfo->TimeStamp,
@@ -778,7 +781,7 @@ PingSendEchoRequest ( return EFI_OUT_OF_RESOURCES;
}
- ASSERT(Private->ProtocolPointers.Transmit != NULL);
+ ASSERT (Private->ProtocolPointers.Transmit != NULL);
InsertTailList (&Private->TxList, &TxInfo->Link);
@@ -806,10 +809,10 @@ PingSendEchoRequest ( **/
EFI_STATUS
Ping6ReceiveEchoReply (
- IN PING_PRIVATE_DATA *Private
+ IN PING_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
ZeroMem (&Private->RxToken, sizeof (PING_IPX_COMPLETION_TOKEN));
@@ -831,6 +834,7 @@ Ping6ReceiveEchoReply ( if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_RECEIVE), gShellNetwork1HiiHandle, Status);
}
+
return Status;
}
@@ -844,18 +848,18 @@ Ping6ReceiveEchoReply ( VOID
EFIAPI
Ping6OnTimerRoutine (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- PING_PRIVATE_DATA *Private;
- PING_ICMPX_TX_INFO *TxInfo;
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- UINT64 Time;
-
- Private = (PING_PRIVATE_DATA *) Context;
+ EFI_STATUS Status;
+ PING_PRIVATE_DATA *Private;
+ PING_ICMPX_TX_INFO *TxInfo;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ UINT64 Time;
+
+ Private = (PING_PRIVATE_DATA *)Context;
if (Private->Signature != PING_PRIVATE_DATA_SIGNATURE) {
Private->Status = EFI_NOT_FOUND;
return;
@@ -865,14 +869,14 @@ Ping6OnTimerRoutine ( // Retransmit icmp6 echo request packets per second in sendnumber times.
//
if (Private->TxCount < Private->SendNum) {
-
Status = PingSendEchoRequest (Private);
- if (Private->TxCount != 0){
+ if (Private->TxCount != 0) {
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_SEND_REQUEST), gShellNetwork1HiiHandle, Private->TxCount + 1);
}
}
}
+
//
// Check whether any icmp6 echo request in the list timeout.
//
@@ -884,10 +888,10 @@ Ping6OnTimerRoutine ( // Remove the timeout echo request from txlist.
//
if (Time > DEFAULT_TIMEOUT) {
-
if (EFI_ERROR (TxInfo->Token->Status)) {
Private->ProtocolPointers.Cancel (Private->IpProtocol, TxInfo->Token);
}
+
//
// Remove the timeout icmp6 echo request from list.
//
@@ -921,7 +925,7 @@ Ping6OnTimerRoutine ( **/
BOOLEAN
PingNetIp4IsLinkLocalAddr (
- IN CONST EFI_IPv4_ADDRESS *Address
+ IN CONST EFI_IPv4_ADDRESS *Address
)
{
return ((BOOLEAN)(Address->Addr[0] == 169 && Address->Addr[1] == 254 && Address->Addr[2] >= 1 && Address->Addr[2] <= 254));
@@ -937,10 +941,10 @@ PingNetIp4IsLinkLocalAddr ( **/
BOOLEAN
PingNetIp4IsUnspecifiedAddr (
- IN CONST EFI_IPv4_ADDRESS *Address
+ IN CONST EFI_IPv4_ADDRESS *Address
)
{
- return ((BOOLEAN)((ReadUnaligned32 ((UINT32*)&Address->Addr[0])) == 0x00000000));
+ return ((BOOLEAN)((ReadUnaligned32 ((UINT32 *)&Address->Addr[0])) == 0x00000000));
}
/**
@@ -956,37 +960,37 @@ PingNetIp4IsUnspecifiedAddr ( **/
EFI_STATUS
PingCreateIpInstance (
- IN PING_PRIVATE_DATA *Private
+ IN PING_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- UINTN HandleIndex;
- UINTN HandleNum;
- EFI_HANDLE *HandleBuffer;
- BOOLEAN UnspecifiedSrc;
- EFI_STATUS MediaStatus;
- EFI_SERVICE_BINDING_PROTOCOL *EfiSb;
- VOID *IpXCfg;
- EFI_IP6_CONFIG_DATA Ip6Config;
- EFI_IP4_CONFIG_DATA Ip4Config;
- VOID *IpXInterfaceInfo;
- UINTN IfInfoSize;
- EFI_IPv6_ADDRESS *Addr;
- UINTN AddrIndex;
-
- HandleBuffer = NULL;
- UnspecifiedSrc = FALSE;
- MediaStatus = EFI_SUCCESS;
- EfiSb = NULL;
- IpXInterfaceInfo = NULL;
- IfInfoSize = 0;
+ EFI_STATUS Status;
+ UINTN HandleIndex;
+ UINTN HandleNum;
+ EFI_HANDLE *HandleBuffer;
+ BOOLEAN UnspecifiedSrc;
+ EFI_STATUS MediaStatus;
+ EFI_SERVICE_BINDING_PROTOCOL *EfiSb;
+ VOID *IpXCfg;
+ EFI_IP6_CONFIG_DATA Ip6Config;
+ EFI_IP4_CONFIG_DATA Ip4Config;
+ VOID *IpXInterfaceInfo;
+ UINTN IfInfoSize;
+ EFI_IPv6_ADDRESS *Addr;
+ UINTN AddrIndex;
+
+ HandleBuffer = NULL;
+ UnspecifiedSrc = FALSE;
+ MediaStatus = EFI_SUCCESS;
+ EfiSb = NULL;
+ IpXInterfaceInfo = NULL;
+ IfInfoSize = 0;
//
// Locate all the handles with ip6 service binding protocol.
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
- Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ServiceBindingProtocolGuid:&gEfiIp4ServiceBindingProtocolGuid,
+ Private->IpChoice == PING_IP_CHOICE_IP6 ? &gEfiIp6ServiceBindingProtocolGuid : &gEfiIp4ServiceBindingProtocolGuid,
NULL,
&HandleNum,
&HandleBuffer
@@ -995,8 +999,9 @@ PingCreateIpInstance ( return EFI_ABORTED;
}
- if (Private->IpChoice == PING_IP_CHOICE_IP6 ? NetIp6IsUnspecifiedAddr ((EFI_IPv6_ADDRESS*)&Private->SrcAddress) : \
- PingNetIp4IsUnspecifiedAddr ((EFI_IPv4_ADDRESS*)&Private->SrcAddress)) {
+ if ((Private->IpChoice == PING_IP_CHOICE_IP6) ? NetIp6IsUnspecifiedAddr ((EFI_IPv6_ADDRESS *)&Private->SrcAddress) : \
+ PingNetIp4IsUnspecifiedAddr ((EFI_IPv4_ADDRESS *)&Private->SrcAddress))
+ {
//
// SrcAddress is unspecified. So, both connected and configured interface will be automatic selected.
//
@@ -1007,14 +1012,14 @@ PingCreateIpInstance ( // Source address is required when pinging a link-local address.
//
if (Private->IpChoice == PING_IP_CHOICE_IP6) {
- if (NetIp6IsLinkLocalAddr ((EFI_IPv6_ADDRESS*)&Private->DstAddress) && UnspecifiedSrc) {
+ if (NetIp6IsLinkLocalAddr ((EFI_IPv6_ADDRESS *)&Private->DstAddress) && UnspecifiedSrc) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_INVALID_SOURCE), gShellNetwork1HiiHandle);
Status = EFI_INVALID_PARAMETER;
goto ON_ERROR;
}
} else {
- ASSERT(Private->IpChoice == PING_IP_CHOICE_IP4);
- if (PingNetIp4IsLinkLocalAddr ((EFI_IPv4_ADDRESS*)&Private->DstAddress) && UnspecifiedSrc) {
+ ASSERT (Private->IpChoice == PING_IP_CHOICE_IP4);
+ if (PingNetIp4IsLinkLocalAddr ((EFI_IPv4_ADDRESS *)&Private->DstAddress) && UnspecifiedSrc) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_INVALID_SOURCE), gShellNetwork1HiiHandle);
Status = EFI_INVALID_PARAMETER;
goto ON_ERROR;
@@ -1025,9 +1030,9 @@ PingCreateIpInstance ( // For each ip6 protocol, check interface addresses list.
//
for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
- EfiSb = NULL;
- IpXInterfaceInfo = NULL;
- IfInfoSize = 0;
+ EfiSb = NULL;
+ IpXInterfaceInfo = NULL;
+ IfInfoSize = 0;
if (UnspecifiedSrc) {
//
@@ -1044,8 +1049,8 @@ PingCreateIpInstance ( Status = gBS->HandleProtocol (
HandleBuffer[HandleIndex],
- Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ServiceBindingProtocolGuid:&gEfiIp4ServiceBindingProtocolGuid,
- (VOID **) &EfiSb
+ Private->IpChoice == PING_IP_CHOICE_IP6 ? &gEfiIp6ServiceBindingProtocolGuid : &gEfiIp4ServiceBindingProtocolGuid,
+ (VOID **)&EfiSb
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
@@ -1057,30 +1062,31 @@ PingCreateIpInstance ( //
Status = gBS->HandleProtocol (
HandleBuffer[HandleIndex],
- Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ConfigProtocolGuid:&gEfiIp4Config2ProtocolGuid,
- (VOID **) &IpXCfg
+ Private->IpChoice == PING_IP_CHOICE_IP6 ? &gEfiIp6ConfigProtocolGuid : &gEfiIp4Config2ProtocolGuid,
+ (VOID **)&IpXCfg
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
+
//
// Get the interface information size.
//
if (Private->IpChoice == PING_IP_CHOICE_IP6) {
- Status = ((EFI_IP6_CONFIG_PROTOCOL*)IpXCfg)->GetData (
- IpXCfg,
- Ip6ConfigDataTypeInterfaceInfo,
- &IfInfoSize,
- NULL
- );
+ Status = ((EFI_IP6_CONFIG_PROTOCOL *)IpXCfg)->GetData (
+ IpXCfg,
+ Ip6ConfigDataTypeInterfaceInfo,
+ &IfInfoSize,
+ NULL
+ );
} else {
- Status = ((EFI_IP4_CONFIG2_PROTOCOL*)IpXCfg)->GetData (
- IpXCfg,
- Ip4Config2DataTypeInterfaceInfo,
- &IfInfoSize,
- NULL
- );
+ Status = ((EFI_IP4_CONFIG2_PROTOCOL *)IpXCfg)->GetData (
+ IpXCfg,
+ Ip4Config2DataTypeInterfaceInfo,
+ &IfInfoSize,
+ NULL
+ );
}
//
@@ -1101,42 +1107,44 @@ PingCreateIpInstance ( Status = EFI_OUT_OF_RESOURCES;
goto ON_ERROR;
}
+
//
// Get the interface info.
//
if (Private->IpChoice == PING_IP_CHOICE_IP6) {
- Status = ((EFI_IP6_CONFIG_PROTOCOL*)IpXCfg)->GetData (
- IpXCfg,
- Ip6ConfigDataTypeInterfaceInfo,
- &IfInfoSize,
- IpXInterfaceInfo
- );
+ Status = ((EFI_IP6_CONFIG_PROTOCOL *)IpXCfg)->GetData (
+ IpXCfg,
+ Ip6ConfigDataTypeInterfaceInfo,
+ &IfInfoSize,
+ IpXInterfaceInfo
+ );
} else {
- Status = ((EFI_IP4_CONFIG2_PROTOCOL*)IpXCfg)->GetData (
- IpXCfg,
- Ip4Config2DataTypeInterfaceInfo,
- &IfInfoSize,
- IpXInterfaceInfo
- );
+ Status = ((EFI_IP4_CONFIG2_PROTOCOL *)IpXCfg)->GetData (
+ IpXCfg,
+ Ip4Config2DataTypeInterfaceInfo,
+ &IfInfoSize,
+ IpXInterfaceInfo
+ );
}
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_GETDATA), gShellNetwork1HiiHandle, Status);
goto ON_ERROR;
}
+
//
// Check whether the source address is one of the interface addresses.
//
if (Private->IpChoice == PING_IP_CHOICE_IP6) {
- for (AddrIndex = 0; AddrIndex < ((EFI_IP6_CONFIG_INTERFACE_INFO*)IpXInterfaceInfo)->AddressInfoCount; AddrIndex++) {
- Addr = &(((EFI_IP6_CONFIG_INTERFACE_INFO*)IpXInterfaceInfo)->AddressInfo[AddrIndex].Address);
+ for (AddrIndex = 0; AddrIndex < ((EFI_IP6_CONFIG_INTERFACE_INFO *)IpXInterfaceInfo)->AddressInfoCount; AddrIndex++) {
+ Addr = &(((EFI_IP6_CONFIG_INTERFACE_INFO *)IpXInterfaceInfo)->AddressInfo[AddrIndex].Address);
if (UnspecifiedSrc) {
if (!NetIp6IsUnspecifiedAddr (Addr) && !NetIp6IsLinkLocalAddr (Addr)) {
//
// Select the interface automatically.
//
- CopyMem(&Private->SrcAddress, Addr, sizeof(Private->SrcAddress));
+ CopyMem (&Private->SrcAddress, Addr, sizeof (Private->SrcAddress));
break;
}
} else if (EFI_IP6_EQUAL (&Private->SrcAddress, Addr)) {
@@ -1147,7 +1155,7 @@ PingCreateIpInstance ( }
}
- if (AddrIndex < ((EFI_IP6_CONFIG_INTERFACE_INFO*)IpXInterfaceInfo)->AddressInfoCount) {
+ if (AddrIndex < ((EFI_IP6_CONFIG_INTERFACE_INFO *)IpXInterfaceInfo)->AddressInfoCount) {
//
// Found a nic handle with right interface address.
//
@@ -1155,14 +1163,15 @@ PingCreateIpInstance ( }
} else {
if (UnspecifiedSrc) {
- if (!PingNetIp4IsUnspecifiedAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress) &&
- !PingNetIp4IsLinkLocalAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress)) {
+ if (!PingNetIp4IsUnspecifiedAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO *)IpXInterfaceInfo)->StationAddress) &&
+ !PingNetIp4IsLinkLocalAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO *)IpXInterfaceInfo)->StationAddress))
+ {
//
// Select the interface automatically.
//
break;
}
- } else if (EFI_IP4_EQUAL (&Private->SrcAddress, &((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress)) {
+ } else if (EFI_IP4_EQUAL (&Private->SrcAddress, &((EFI_IP4_CONFIG2_INTERFACE_INFO *)IpXInterfaceInfo)->StationAddress)) {
//
// Match a certain interface address.
//
@@ -1173,6 +1182,7 @@ PingCreateIpInstance ( FreePool (IpXInterfaceInfo);
IpXInterfaceInfo = NULL;
}
+
//
// No exact interface address matched.
//
@@ -1191,6 +1201,7 @@ PingCreateIpInstance ( if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
+
if (Private->IpChoice == PING_IP_CHOICE_IP6) {
Status = gBS->OpenProtocol (
Private->IpChildHandle,
@@ -1204,7 +1215,6 @@ PingCreateIpInstance ( goto ON_ERROR;
}
-
ZeroMem (&Ip6Config, sizeof (EFI_IP6_CONFIG_DATA));
//
@@ -1220,20 +1230,20 @@ PingCreateIpInstance ( Ip6Config.ReceiveTimeout = 0;
Ip6Config.TransmitTimeout = 0;
- IP6_COPY_ADDRESS (&Ip6Config.StationAddress, &Private->SrcAddress);
+ IP6_COPY_ADDRESS (&Ip6Config.StationAddress, &Private->SrcAddress);
IP6_COPY_ADDRESS (&Ip6Config.DestinationAddress, &Private->DstAddress);
- Status = ((EFI_IP6_PROTOCOL*)(Private->IpProtocol))->Configure (Private->IpProtocol, &Ip6Config);
+ Status = ((EFI_IP6_PROTOCOL *)(Private->IpProtocol))->Configure (Private->IpProtocol, &Ip6Config);
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_CONFIG), gShellNetwork1HiiHandle, Status);
goto ON_ERROR;
}
- Private->ProtocolPointers.Transmit = (PING_IPX_TRANSMIT )((EFI_IP6_PROTOCOL*)Private->IpProtocol)->Transmit;
- Private->ProtocolPointers.Receive = (PING_IPX_RECEIVE )((EFI_IP6_PROTOCOL*)Private->IpProtocol)->Receive;
- Private->ProtocolPointers.Cancel = (PING_IPX_CANCEL )((EFI_IP6_PROTOCOL*)Private->IpProtocol)->Cancel;
- Private->ProtocolPointers.Poll = (PING_IPX_POLL )((EFI_IP6_PROTOCOL*)Private->IpProtocol)->Poll;
+ Private->ProtocolPointers.Transmit = (PING_IPX_TRANSMIT)((EFI_IP6_PROTOCOL *)Private->IpProtocol)->Transmit;
+ Private->ProtocolPointers.Receive = (PING_IPX_RECEIVE)((EFI_IP6_PROTOCOL *)Private->IpProtocol)->Receive;
+ Private->ProtocolPointers.Cancel = (PING_IPX_CANCEL)((EFI_IP6_PROTOCOL *)Private->IpProtocol)->Cancel;
+ Private->ProtocolPointers.Poll = (PING_IPX_POLL)((EFI_IP6_PROTOCOL *)Private->IpProtocol)->Poll;
} else {
Status = gBS->OpenProtocol (
Private->IpChildHandle,
@@ -1247,7 +1257,6 @@ PingCreateIpInstance ( goto ON_ERROR;
}
-
ZeroMem (&Ip4Config, sizeof (EFI_IP4_CONFIG_DATA));
//
@@ -1266,17 +1275,17 @@ PingCreateIpInstance ( Ip4Config.TimeToLive = 128;
Ip4Config.TypeOfService = 0;
- Status = ((EFI_IP4_PROTOCOL*)(Private->IpProtocol))->Configure (Private->IpProtocol, &Ip4Config);
+ Status = ((EFI_IP4_PROTOCOL *)(Private->IpProtocol))->Configure (Private->IpProtocol, &Ip4Config);
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_CONFIG), gShellNetwork1HiiHandle, Status);
goto ON_ERROR;
}
- Private->ProtocolPointers.Transmit = (PING_IPX_TRANSMIT )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Transmit;
- Private->ProtocolPointers.Receive = (PING_IPX_RECEIVE )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Receive;
- Private->ProtocolPointers.Cancel = (PING_IPX_CANCEL )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Cancel;
- Private->ProtocolPointers.Poll = (PING_IPX_POLL )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Poll;
+ Private->ProtocolPointers.Transmit = (PING_IPX_TRANSMIT)((EFI_IP4_PROTOCOL *)Private->IpProtocol)->Transmit;
+ Private->ProtocolPointers.Receive = (PING_IPX_RECEIVE)((EFI_IP4_PROTOCOL *)Private->IpProtocol)->Receive;
+ Private->ProtocolPointers.Cancel = (PING_IPX_CANCEL)((EFI_IP4_PROTOCOL *)Private->IpProtocol)->Cancel;
+ Private->ProtocolPointers.Poll = (PING_IPX_POLL)((EFI_IP4_PROTOCOL *)Private->IpProtocol)->Poll;
}
if (HandleBuffer != NULL) {
@@ -1309,31 +1318,30 @@ ON_ERROR: **/
VOID
Ping6DestroyIp6Instance (
- IN PING_PRIVATE_DATA *Private
+ IN PING_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- EFI_SERVICE_BINDING_PROTOCOL *IpSb;
+ EFI_STATUS Status;
+ EFI_SERVICE_BINDING_PROTOCOL *IpSb;
gBS->CloseProtocol (
Private->IpChildHandle,
- Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ProtocolGuid:&gEfiIp4ProtocolGuid,
+ Private->IpChoice == PING_IP_CHOICE_IP6 ? &gEfiIp6ProtocolGuid : &gEfiIp4ProtocolGuid,
gImageHandle,
Private->IpChildHandle
);
Status = gBS->HandleProtocol (
Private->NicHandle,
- Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ServiceBindingProtocolGuid:&gEfiIp4ServiceBindingProtocolGuid,
- (VOID **) &IpSb
+ Private->IpChoice == PING_IP_CHOICE_IP6 ? &gEfiIp6ServiceBindingProtocolGuid : &gEfiIp4ServiceBindingProtocolGuid,
+ (VOID **)&IpSb
);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
IpSb->DestroyChild (IpSb, Private->IpChildHandle);
}
}
-
/**
The Ping Process.
@@ -1348,19 +1356,19 @@ Ping6DestroyIp6Instance ( **/
SHELL_STATUS
ShellPing (
- IN UINT32 SendNumber,
- IN UINT32 BufferSize,
- IN EFI_IPv6_ADDRESS *SrcAddress,
- IN EFI_IPv6_ADDRESS *DstAddress,
- IN UINT32 IpChoice
+ IN UINT32 SendNumber,
+ IN UINT32 BufferSize,
+ IN EFI_IPv6_ADDRESS *SrcAddress,
+ IN EFI_IPv6_ADDRESS *DstAddress,
+ IN UINT32 IpChoice
)
{
- EFI_STATUS Status;
- PING_PRIVATE_DATA *Private;
- PING_ICMPX_TX_INFO *TxInfo;
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+ PING_PRIVATE_DATA *Private;
+ PING_ICMPX_TX_INFO *TxInfo;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ SHELL_STATUS ShellStatus;
ShellStatus = SHELL_SUCCESS;
Private = AllocateZeroPool (sizeof (PING_PRIVATE_DATA));
@@ -1369,15 +1377,15 @@ ShellPing ( return (SHELL_OUT_OF_RESOURCES);
}
- Private->IpChoice = IpChoice;
- Private->Signature = PING_PRIVATE_DATA_SIGNATURE;
- Private->SendNum = SendNumber;
- Private->BufferSize = BufferSize;
- Private->RttMin = ~((UINT64 )(0x0));
- Private->Status = EFI_NOT_READY;
+ Private->IpChoice = IpChoice;
+ Private->Signature = PING_PRIVATE_DATA_SIGNATURE;
+ Private->SendNum = SendNumber;
+ Private->BufferSize = BufferSize;
+ Private->RttMin = ~((UINT64)(0x0));
+ Private->Status = EFI_NOT_READY;
- CopyMem(&Private->SrcAddress, SrcAddress, sizeof(Private->SrcAddress));
- CopyMem(&Private->DstAddress, DstAddress, sizeof(Private->DstAddress));
+ CopyMem (&Private->SrcAddress, SrcAddress, sizeof (Private->SrcAddress));
+ CopyMem (&Private->DstAddress, DstAddress, sizeof (Private->DstAddress));
InitializeListHead (&Private->TxList);
@@ -1390,6 +1398,7 @@ ShellPing ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
+
//
// Print the command line itself.
//
@@ -1403,6 +1412,7 @@ ShellPing ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
+
//
// Create and start timer to send icmp6 echo request packet per second.
//
@@ -1437,7 +1447,7 @@ ShellPing ( //
if (EFI_ERROR (Status) && (Status != EFI_NOT_READY)) {
ShellStatus = SHELL_ACCESS_DENIED;
- if(Status == EFI_NOT_FOUND) {
+ if (Status == EFI_NOT_FOUND) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NOSOURCE_INDO), gShellNetwork1HiiHandle, mDstString);
} else if (Status == RETURN_NO_MAPPING) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NOROUTE_FOUND), gShellNetwork1HiiHandle, mDstString, mSrcString);
@@ -1458,6 +1468,7 @@ ShellPing ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
+
//
// Control the ping6 process by two factors:
// 1. Hot key
@@ -1468,7 +1479,7 @@ ShellPing ( //
while (Private->Status == EFI_NOT_READY) {
Status = Private->ProtocolPointers.Poll (Private->IpProtocol);
- if (ShellGetExecutionBreakFlag()) {
+ if (ShellGetExecutionBreakFlag ()) {
Private->Status = EFI_ABORTED;
goto ON_STAT;
}
@@ -1513,11 +1524,10 @@ ON_STAT: ON_EXIT:
if (Private != NULL) {
-
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) {
TxInfo = BASE_CR (Entry, PING_ICMPX_TX_INFO, Link);
- if (Private->IpProtocol != NULL && Private->ProtocolPointers.Cancel != NULL) {
+ if ((Private->IpProtocol != NULL) && (Private->ProtocolPointers.Cancel != NULL)) {
Status = Private->ProtocolPointers.Cancel (Private->IpProtocol, TxInfo->Token);
}
@@ -1531,7 +1541,7 @@ ON_EXIT: gBS->CloseEvent (Private->Timer);
}
- if (Private->IpProtocol != NULL && Private->ProtocolPointers.Cancel != NULL) {
+ if ((Private->IpProtocol != NULL) && (Private->ProtocolPointers.Cancel != NULL)) {
Status = Private->ProtocolPointers.Cancel (Private->IpProtocol, &Private->RxToken);
}
@@ -1566,32 +1576,32 @@ ShellCommandRunPing ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- EFI_IPv6_ADDRESS DstAddress;
- EFI_IPv6_ADDRESS SrcAddress;
- UINT64 BufferSize;
- UINTN SendNumber;
- LIST_ENTRY *ParamPackage;
- CONST CHAR16 *ValueStr;
- UINTN NonOptionCount;
- UINT32 IpChoice;
- CHAR16 *ProblemParam;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ EFI_IPv6_ADDRESS DstAddress;
+ EFI_IPv6_ADDRESS SrcAddress;
+ UINT64 BufferSize;
+ UINTN SendNumber;
+ LIST_ENTRY *ParamPackage;
+ CONST CHAR16 *ValueStr;
+ UINTN NonOptionCount;
+ UINT32 IpChoice;
+ CHAR16 *ProblemParam;
//
// we use IPv6 buffers to hold items...
// make sure this is enough space!
//
- ASSERT(sizeof(EFI_IPv4_ADDRESS ) <= sizeof(EFI_IPv6_ADDRESS ));
- ASSERT(sizeof(EFI_IP4_COMPLETION_TOKEN) <= sizeof(EFI_IP6_COMPLETION_TOKEN ));
+ ASSERT (sizeof (EFI_IPv4_ADDRESS) <= sizeof (EFI_IPv6_ADDRESS));
+ ASSERT (sizeof (EFI_IP4_COMPLETION_TOKEN) <= sizeof (EFI_IP6_COMPLETION_TOKEN));
IpChoice = PING_IP_CHOICE_IP4;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
ProblemParam = NULL;
Status = ShellCommandLineParseEx (PingParamList, &ParamPackage, &ProblemParam, TRUE, FALSE);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
@@ -1619,6 +1629,7 @@ ShellCommandRunPing ( } else {
SendNumber = DEFAULT_SEND_COUNT;
}
+
//
// Parse the parameter of buffer size.
//
@@ -1654,36 +1665,41 @@ ShellCommandRunPing ( if (IpChoice == PING_IP_CHOICE_IP6) {
Status = NetLibStrToIp6 (ValueStr, &SrcAddress);
} else {
- Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS*)&SrcAddress);
+ Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS *)&SrcAddress);
}
+
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
}
+
//
// Parse the parameter of destination ip address.
//
- NonOptionCount = ShellCommandLineGetCount(ParamPackage);
+ NonOptionCount = ShellCommandLineGetCount (ParamPackage);
if (NonOptionCount < 2) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle, L"ping");
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
+
if (NonOptionCount > 2) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellNetwork1HiiHandle, L"ping");
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
+
ValueStr = ShellCommandLineGetRawValue (ParamPackage, 1);
if (ValueStr != NULL) {
mDstString = ValueStr;
if (IpChoice == PING_IP_CHOICE_IP6) {
Status = NetLibStrToIp6 (ValueStr, &DstAddress);
} else {
- Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS*)&DstAddress);
+ Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS *)&DstAddress);
}
+
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -1695,12 +1711,12 @@ ShellCommandRunPing ( // Enter into ping process.
//
ShellStatus = ShellPing (
- (UINT32)SendNumber,
- (UINT32)BufferSize,
- &SrcAddress,
- &DstAddress,
- IpChoice
- );
+ (UINT32)SendNumber,
+ (UINT32)BufferSize,
+ &SrcAddress,
+ &DstAddress,
+ IpChoice
+ );
ON_EXIT:
ShellCommandLineFreeVarList (ParamPackage);
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c index 9a2b23fdc5..c614c26c0c 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.c @@ -7,15 +7,15 @@ **/
#include "UefiShellNetwork1CommandsLib.h"
-CONST CHAR16 gShellNetwork1FileName[] = L"ShellCommands";
-EFI_HII_HANDLE gShellNetwork1HiiHandle = NULL;
+CONST CHAR16 gShellNetwork1FileName[] = L"ShellCommands";
+EFI_HII_HANDLE gShellNetwork1HiiHandle = NULL;
/**
return the file name of the help text file if not using HII.
@return The string pointer to the file name.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameNetwork1 (
VOID
@@ -47,7 +47,7 @@ ShellNetwork1CommandsLibConstructor ( //
// check our bit of the profiles mask
//
- if ((PcdGet8(PcdShellProfileMask) & BIT3) == 0) {
+ if ((PcdGet8 (PcdShellProfileMask) & BIT3) == 0) {
return (EFI_SUCCESS);
}
@@ -55,11 +55,12 @@ ShellNetwork1CommandsLibConstructor ( if (gShellNetwork1HiiHandle == NULL) {
return (EFI_DEVICE_ERROR);
}
+
//
// install our shell command handlers
//
- ShellCommandRegisterCommandName(L"ping", ShellCommandRunPing , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_PING));
- ShellCommandRegisterCommandName(L"ifconfig",ShellCommandRunIfconfig , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_IFCONFIG));
+ ShellCommandRegisterCommandName (L"ping", ShellCommandRunPing, ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE, gShellNetwork1HiiHandle, STRING_TOKEN (STR_GET_HELP_PING));
+ ShellCommandRegisterCommandName (L"ifconfig", ShellCommandRunIfconfig, ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE, gShellNetwork1HiiHandle, STRING_TOKEN (STR_GET_HELP_IFCONFIG));
return (EFI_SUCCESS);
}
@@ -78,7 +79,8 @@ ShellNetwork1CommandsLibDestructor ( )
{
if (gShellNetwork1HiiHandle != NULL) {
- HiiRemovePackages(gShellNetwork1HiiHandle);
+ HiiRemovePackages (gShellNetwork1HiiHandle);
}
+
return (EFI_SUCCESS);
}
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h index fddada2efa..4c16efa37a 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.h @@ -38,7 +38,7 @@ #include <Library/DevicePathLib.h>
#include <Library/PrintLib.h>
-extern EFI_HII_HANDLE gShellNetwork1HiiHandle;
+extern EFI_HII_HANDLE gShellNetwork1HiiHandle;
/**
Function for 'ping' command.
@@ -67,4 +67,3 @@ ShellCommandRunIfconfig ( );
#endif
-
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c index 55b4dc6852..7c80bba465 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c @@ -10,14 +10,14 @@ #include "UefiShellNetwork2CommandsLib.h"
enum {
- IfConfig6OpList = 1,
- IfConfig6OpSet = 2,
- IfConfig6OpClear = 3
+ IfConfig6OpList = 1,
+ IfConfig6OpSet = 2,
+ IfConfig6OpClear = 3
};
typedef enum {
- VarCheckReserved = -1,
- VarCheckOk = 0,
+ VarCheckReserved = -1,
+ VarCheckOk = 0,
VarCheckDuplicate,
VarCheckConflict,
VarCheckUnknown,
@@ -26,14 +26,14 @@ typedef enum { } VAR_CHECK_CODE;
typedef enum {
- FlagTypeSingle = 0,
+ FlagTypeSingle = 0,
FlagTypeNeedVar,
FlagTypeNeedSet,
FlagTypeSkipUnknown
} VAR_CHECK_FLAG_TYPE;
-#define MACADDRMAXSIZE 32
-#define PREFIXMAXLEN 16
+#define MACADDRMAXSIZE 32
+#define PREFIXMAXLEN 16
typedef struct _IFCONFIG6_INTERFACE_CB {
EFI_HANDLE NicHandle;
@@ -55,23 +55,22 @@ struct _ARG_LIST { };
typedef struct _IFCONFIG6_PRIVATE_DATA {
- EFI_HANDLE ImageHandle;
- LIST_ENTRY IfList;
+ EFI_HANDLE ImageHandle;
+ LIST_ENTRY IfList;
- UINT32 OpCode;
- CHAR16 *IfName;
- ARG_LIST *VarArg;
+ UINT32 OpCode;
+ CHAR16 *IfName;
+ ARG_LIST *VarArg;
} IFCONFIG6_PRIVATE_DATA;
-typedef struct _VAR_CHECK_ITEM{
+typedef struct _VAR_CHECK_ITEM {
CHAR16 *FlagStr;
UINT32 FlagID;
UINT32 ConflictMask;
VAR_CHECK_FLAG_TYPE FlagType;
} VAR_CHECK_ITEM;
-
-SHELL_PARAM_ITEM mIfConfig6CheckList[] = {
+SHELL_PARAM_ITEM mIfConfig6CheckList[] = {
{
L"-b",
TypeFlag
@@ -100,7 +99,7 @@ SHELL_PARAM_ITEM mIfConfig6CheckList[] = { VAR_CHECK_ITEM mIfConfig6SetCheckList[] = {
{
- L"auto",
+ L"auto",
0x00000001,
0x00000001,
FlagTypeSingle
@@ -156,10 +155,11 @@ VAR_CHECK_ITEM mIfConfig6SetCheckList[] = { **/
VOID
IfConfig6FreeArgList (
- ARG_LIST *List
-)
+ ARG_LIST *List
+ )
{
- ARG_LIST *Next;
+ ARG_LIST *Next;
+
while (List->Next != NULL) {
Next = List->Next;
FreePool (List);
@@ -180,16 +180,16 @@ IfConfig6FreeArgList ( **/
ARG_LIST *
IfConfig6SplitStrToList (
- IN CONST CHAR16 *String,
- IN CHAR16 Separator
+ IN CONST CHAR16 *String,
+ IN CHAR16 Separator
)
{
- CHAR16 *Str;
- CHAR16 *ArgStr;
- ARG_LIST *ArgList;
- ARG_LIST *ArgNode;
+ CHAR16 *Str;
+ CHAR16 *ArgStr;
+ ARG_LIST *ArgList;
+ ARG_LIST *ArgNode;
- if (String == NULL || *String == L'\0') {
+ if ((String == NULL) || (*String == L'\0')) {
return NULL;
}
@@ -200,15 +200,17 @@ IfConfig6SplitStrToList ( if (Str == NULL) {
return NULL;
}
- ArgStr = Str;
+
+ ArgStr = Str;
//
// init a node for the list head.
//
- ArgNode = (ARG_LIST *) AllocateZeroPool (sizeof (ARG_LIST));
+ ArgNode = (ARG_LIST *)AllocateZeroPool (sizeof (ARG_LIST));
if (ArgNode == NULL) {
return NULL;
}
+
ArgList = ArgNode;
//
@@ -219,7 +221,7 @@ IfConfig6SplitStrToList ( *Str = L'\0';
ArgNode->Arg = ArgStr;
ArgStr = Str + 1;
- ArgNode->Next = (ARG_LIST *) AllocateZeroPool (sizeof (ARG_LIST));
+ ArgNode->Next = (ARG_LIST *)AllocateZeroPool (sizeof (ARG_LIST));
if (ArgNode->Next == NULL) {
//
// Free the local copy of string stored in the first node
@@ -228,6 +230,7 @@ IfConfig6SplitStrToList ( IfConfig6FreeArgList (ArgList);
return NULL;
}
+
ArgNode = ArgNode->Next;
}
@@ -251,17 +254,17 @@ IfConfig6SplitStrToList ( **/
VAR_CHECK_CODE
-IfConfig6RetriveCheckListByName(
- IN VAR_CHECK_ITEM *CheckList,
- IN CHAR16 *Name,
- IN BOOLEAN Init
-)
+IfConfig6RetriveCheckListByName (
+ IN VAR_CHECK_ITEM *CheckList,
+ IN CHAR16 *Name,
+ IN BOOLEAN Init
+ )
{
- STATIC UINT32 CheckDuplicate;
- STATIC UINT32 CheckConflict;
- VAR_CHECK_CODE RtCode;
- UINT32 Index;
- VAR_CHECK_ITEM Arg;
+ STATIC UINT32 CheckDuplicate;
+ STATIC UINT32 CheckConflict;
+ VAR_CHECK_CODE RtCode;
+ UINT32 Index;
+ VAR_CHECK_ITEM Arg;
if (Init) {
CheckDuplicate = 0;
@@ -269,16 +272,15 @@ IfConfig6RetriveCheckListByName( return VarCheckOk;
}
- RtCode = VarCheckOk;
- Index = 0;
- Arg = CheckList[Index];
+ RtCode = VarCheckOk;
+ Index = 0;
+ Arg = CheckList[Index];
//
// Check the Duplicated/Conflicted/Unknown input Args.
//
while (Arg.FlagStr != NULL) {
if (StrCmp (Arg.FlagStr, Name) == 0) {
-
if (CheckDuplicate & Arg.FlagID) {
RtCode = VarCheckDuplicate;
break;
@@ -314,11 +316,11 @@ IfConfig6RetriveCheckListByName( VOID
EFIAPI
IfConfig6ManualAddressNotify (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- *((BOOLEAN *) Context) = TRUE;
+ *((BOOLEAN *)Context) = TRUE;
}
/**
@@ -330,11 +332,11 @@ IfConfig6ManualAddressNotify ( **/
VOID
IfConfig6PrintMacAddr (
- IN UINT8 *Node,
- IN UINT32 Size
+ IN UINT8 *Node,
+ IN UINT32 Size
)
{
- UINTN Index;
+ UINTN Index;
ASSERT (Size <= MACADDRMAXSIZE);
@@ -357,17 +359,16 @@ IfConfig6PrintMacAddr ( **/
VOID
IfConfig6PrintIpAddr (
- IN EFI_IPv6_ADDRESS *Ip,
- IN UINT8 *PrefixLen
+ IN EFI_IPv6_ADDRESS *Ip,
+ IN UINT8 *PrefixLen
)
{
- UINTN Index;
- BOOLEAN Short;
+ UINTN Index;
+ BOOLEAN Short;
Short = FALSE;
for (Index = 0; Index < PREFIXMAXLEN; Index = Index + 2) {
-
if (!Short && (Index + 1 < PREFIXMAXLEN) && (Index % 2 == 0) && (Ip->Addr[Index] == 0) && (Ip->Addr[Index + 1] == 0)) {
//
// Deal with the case of ::.
@@ -378,6 +379,7 @@ IfConfig6PrintIpAddr ( //
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_COLON), gShellNetwork2HiiHandle);
}
+
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_COLON), gShellNetwork2HiiHandle);
while ((Ip->Addr[Index] == 0) && (Ip->Addr[Index + 1] == 0) && (Index < PREFIXMAXLEN)) {
@@ -425,17 +427,17 @@ IfConfig6PrintIpAddr ( **/
EFI_STATUS
IfConfig6ParseManualAddressList (
- IN OUT ARG_LIST **Arg,
- OUT EFI_IP6_CONFIG_MANUAL_ADDRESS **Buf,
- OUT UINTN *BufSize
+ IN OUT ARG_LIST **Arg,
+ OUT EFI_IP6_CONFIG_MANUAL_ADDRESS **Buf,
+ OUT UINTN *BufSize
)
{
- EFI_STATUS Status;
- EFI_IP6_CONFIG_MANUAL_ADDRESS *AddrBuf;
- ARG_LIST *VarArg;
- EFI_IPv6_ADDRESS Address;
- UINT8 Prefix;
- UINT8 AddrCnt;
+ EFI_STATUS Status;
+ EFI_IP6_CONFIG_MANUAL_ADDRESS *AddrBuf;
+ ARG_LIST *VarArg;
+ EFI_IPv6_ADDRESS Address;
+ UINT8 Prefix;
+ UINT8 AddrCnt;
Prefix = 0;
AddrCnt = 0;
@@ -448,7 +450,6 @@ IfConfig6ParseManualAddressList ( // Go through the list to check the correctness of input host ip6 address.
//
while ((!EFI_ERROR (Status)) && (VarArg != NULL)) {
-
Status = NetLibStrToIp6andPrefix (VarArg->Arg, &Address, &Prefix);
if (EFI_ERROR (Status)) {
@@ -477,7 +478,6 @@ IfConfig6ParseManualAddressList ( // Go through the list to fill in the EFI_IP6_CONFIG_MANUAL_ADDRESS structure.
//
while ((!EFI_ERROR (Status)) && (VarArg != NULL)) {
-
Status = NetLibStrToIp6andPrefix (VarArg->Arg, &Address, &Prefix);
if (EFI_ERROR (Status)) {
@@ -491,6 +491,7 @@ IfConfig6ParseManualAddressList ( if (Prefix == 0xFF) {
Prefix = 0;
}
+
AddrBuf[AddrCnt].IsAnycast = FALSE;
AddrBuf[AddrCnt].PrefixLength = Prefix;
IP6_COPY_ADDRESS (&AddrBuf[AddrCnt].Address, &Address);
@@ -528,17 +529,17 @@ ON_ERROR: **/
EFI_STATUS
IfConfig6ParseGwDnsAddressList (
- IN OUT ARG_LIST **Arg,
- OUT EFI_IPv6_ADDRESS **Buf,
- OUT UINTN *BufSize
+ IN OUT ARG_LIST **Arg,
+ OUT EFI_IPv6_ADDRESS **Buf,
+ OUT UINTN *BufSize
)
{
- EFI_STATUS Status;
- EFI_IPv6_ADDRESS *AddrBuf;
- ARG_LIST *VarArg;
- EFI_IPv6_ADDRESS Address;
- UINT8 Prefix;
- UINT8 AddrCnt;
+ EFI_STATUS Status;
+ EFI_IPv6_ADDRESS *AddrBuf;
+ ARG_LIST *VarArg;
+ EFI_IPv6_ADDRESS Address;
+ UINT8 Prefix;
+ UINT8 AddrCnt;
AddrCnt = 0;
*BufSize = 0;
@@ -550,7 +551,6 @@ IfConfig6ParseGwDnsAddressList ( // Go through the list to check the correctness of input gw/dns address.
//
while ((!EFI_ERROR (Status)) && (VarArg != NULL)) {
-
Status = NetLibStrToIp6andPrefix (VarArg->Arg, &Address, &Prefix);
if (EFI_ERROR (Status)) {
@@ -579,7 +579,6 @@ IfConfig6ParseGwDnsAddressList ( // Go through the list to fill in the EFI_IPv6_ADDRESS structure.
//
while ((!EFI_ERROR (Status)) && (VarArg != NULL)) {
-
Status = NetLibStrToIp6andPrefix (VarArg->Arg, &Address, &Prefix);
if (EFI_ERROR (Status)) {
@@ -595,7 +594,7 @@ IfConfig6ParseGwDnsAddressList ( *Arg = VarArg;
if (EFI_ERROR (Status) && (Status != EFI_INVALID_PARAMETER)) {
- goto ON_ERROR;
+ goto ON_ERROR;
}
*Buf = AddrBuf;
@@ -621,13 +620,13 @@ ON_ERROR: **/
EFI_STATUS
IfConfig6ParseInterfaceId (
- IN OUT ARG_LIST **Arg,
- OUT EFI_IP6_CONFIG_INTERFACE_ID **IfId
+ IN OUT ARG_LIST **Arg,
+ OUT EFI_IP6_CONFIG_INTERFACE_ID **IfId
)
{
- UINT8 Index;
- UINT8 NodeVal;
- CHAR16 *IdStr;
+ UINT8 Index;
+ UINT8 NodeVal;
+ CHAR16 *IdStr;
if (*Arg == NULL) {
return EFI_INVALID_PARAMETER;
@@ -640,10 +639,8 @@ IfConfig6ParseInterfaceId ( ASSERT (*IfId != NULL);
while ((*IdStr != L'\0') && (Index < 8)) {
-
NodeVal = 0;
while ((*IdStr != L':') && (*IdStr != L'\0')) {
-
if ((*IdStr <= L'F') && (*IdStr >= L'A')) {
NodeVal = (UINT8)((NodeVal << 4) + *IdStr - L'A' + 10);
} else if ((*IdStr <= L'f') && (*IdStr >= L'a')) {
@@ -681,11 +678,11 @@ IfConfig6ParseInterfaceId ( **/
EFI_STATUS
IfConfig6ParseDadXmits (
- IN OUT ARG_LIST **Arg,
- OUT UINT32 *Xmits
+ IN OUT ARG_LIST **Arg,
+ OUT UINT32 *Xmits
)
{
- CHAR16 *ValStr;
+ CHAR16 *ValStr;
if (*Arg == NULL) {
return EFI_INVALID_PARAMETER;
@@ -695,13 +692,9 @@ IfConfig6ParseDadXmits ( *Xmits = 0;
while (*ValStr != L'\0') {
-
if ((*ValStr <= L'9') && (*ValStr >= L'0')) {
-
*Xmits = (*Xmits * 10) + (*ValStr - L'0');
-
} else {
-
return EFI_INVALID_PARAMETER;
}
@@ -725,25 +718,25 @@ IfConfig6ParseDadXmits ( **/
EFI_STATUS
IfConfig6GetInterfaceInfo (
- IN EFI_HANDLE ImageHandle,
- IN CHAR16 *IfName,
- IN LIST_ENTRY *IfList
+ IN EFI_HANDLE ImageHandle,
+ IN CHAR16 *IfName,
+ IN LIST_ENTRY *IfList
)
{
- EFI_STATUS Status;
- UINTN HandleIndex;
- UINTN HandleNum;
- EFI_HANDLE *HandleBuffer;
- EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
- EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;
- IFCONFIG6_INTERFACE_CB *IfCb;
- UINTN DataSize;
+ EFI_STATUS Status;
+ UINTN HandleIndex;
+ UINTN HandleNum;
+ EFI_HANDLE *HandleBuffer;
+ EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
+ EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;
+ IFCONFIG6_INTERFACE_CB *IfCb;
+ UINTN DataSize;
HandleBuffer = NULL;
HandleNum = 0;
- IfInfo = NULL;
- IfCb = NULL;
+ IfInfo = NULL;
+ IfCb = NULL;
//
// Locate all the handles with ip6 service binding protocol.
@@ -754,7 +747,7 @@ IfConfig6GetInterfaceInfo ( NULL,
&HandleNum,
&HandleBuffer
- );
+ );
if (EFI_ERROR (Status) || (HandleNum == 0)) {
return Status;
}
@@ -763,9 +756,9 @@ IfConfig6GetInterfaceInfo ( // Enumerate all handles that installed with ip6 service binding protocol.
//
for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
- IfCb = NULL;
- IfInfo = NULL;
- DataSize = 0;
+ IfCb = NULL;
+ IfInfo = NULL;
+ DataSize = 0;
//
// Ip6config protocol and ip6 service binding protocol are installed
@@ -775,12 +768,13 @@ IfConfig6GetInterfaceInfo ( Status = gBS->HandleProtocol (
HandleBuffer[HandleIndex],
&gEfiIp6ConfigProtocolGuid,
- (VOID **) &Ip6Cfg
+ (VOID **)&Ip6Cfg
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
+
//
// Get the interface information size.
//
@@ -802,6 +796,7 @@ IfConfig6GetInterfaceInfo ( Status = EFI_OUT_OF_RESOURCES;
goto ON_ERROR;
}
+
//
// Get the interface info.
//
@@ -816,6 +811,7 @@ IfConfig6GetInterfaceInfo ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status);
goto ON_ERROR;
}
+
//
// Check the interface name if required.
//
@@ -850,13 +846,12 @@ IfConfig6GetInterfaceInfo ( IfCb->NicHandle = HandleBuffer[HandleIndex];
IfCb->IfInfo = IfInfo;
IfCb->IfCfg = Ip6Cfg;
- IfCb->DnsCnt = (UINT32) (DataSize / sizeof (EFI_IPv6_ADDRESS));
+ IfCb->DnsCnt = (UINT32)(DataSize / sizeof (EFI_IPv6_ADDRESS));
//
// Get the dns server list if has.
//
if (DataSize > 0) {
-
Status = Ip6Cfg->GetData (
Ip6Cfg,
Ip6ConfigDataTypeDnsServer,
@@ -869,6 +864,7 @@ IfConfig6GetInterfaceInfo ( goto ON_ERROR;
}
}
+
//
// Get the interface id if has.
//
@@ -895,6 +891,7 @@ IfConfig6GetInterfaceInfo ( FreePool (IfCb->IfId);
IfCb->IfId = NULL;
}
+
//
// Get the config policy.
//
@@ -910,6 +907,7 @@ IfConfig6GetInterfaceInfo ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status);
goto ON_ERROR;
}
+
//
// Get the dad transmits.
//
@@ -972,14 +970,14 @@ ON_ERROR: **/
SHELL_STATUS
IfConfig6ShowInterfaceInfo (
- IN LIST_ENTRY *IfList
+ IN LIST_ENTRY *IfList
)
{
- LIST_ENTRY *Entry;
- IFCONFIG6_INTERFACE_CB *IfCb;
- UINTN Index;
+ LIST_ENTRY *Entry;
+ IFCONFIG6_INTERFACE_CB *IfCb;
+ UINTN Index;
- Entry = IfList->ForwardLink;
+ Entry = IfList->ForwardLink;
if (IsListEmpty (IfList)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_INTERFACE), gShellNetwork2HiiHandle);
@@ -989,7 +987,6 @@ IfConfig6ShowInterfaceInfo ( // Go through the interface list.
//
while (Entry != IfList) {
-
IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_BREAK), gShellNetwork2HiiHandle);
@@ -1024,6 +1021,7 @@ IfConfig6ShowInterfaceInfo ( 8
);
}
+
//
// Print mac address of the interface.
//
@@ -1100,18 +1098,18 @@ IfConfig6ShowInterfaceInfo ( **/
SHELL_STATUS
IfConfig6ClearInterfaceInfo (
- IN LIST_ENTRY *IfList,
- IN CHAR16 *IfName
+ IN LIST_ENTRY *IfList,
+ IN CHAR16 *IfName
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- LIST_ENTRY *Entry;
- IFCONFIG6_INTERFACE_CB *IfCb;
- EFI_IP6_CONFIG_POLICY Policy;
-
- Entry = IfList->ForwardLink;
- Status = EFI_SUCCESS;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ LIST_ENTRY *Entry;
+ IFCONFIG6_INTERFACE_CB *IfCb;
+ EFI_IP6_CONFIG_POLICY Policy;
+
+ Entry = IfList->ForwardLink;
+ Status = EFI_SUCCESS;
ShellStatus = SHELL_SUCCESS;
if (IsListEmpty (IfList)) {
@@ -1123,7 +1121,6 @@ IfConfig6ClearInterfaceInfo ( // need to refresh the configuration.
//
while (Entry != IfList) {
-
IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link);
if ((IfName != NULL) && (StrCmp (IfName, IfCb->IfInfo->Name) == 0)) {
@@ -1157,7 +1154,7 @@ IfConfig6ClearInterfaceInfo ( break;
}
- Entry = Entry->ForwardLink;
+ Entry = Entry->ForwardLink;
}
return ShellStatus;
@@ -1175,32 +1172,32 @@ IfConfig6ClearInterfaceInfo ( **/
SHELL_STATUS
IfConfig6SetInterfaceInfo (
- IN LIST_ENTRY *IfList,
- IN ARG_LIST *VarArg
+ IN LIST_ENTRY *IfList,
+ IN ARG_LIST *VarArg
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- IFCONFIG6_INTERFACE_CB *IfCb;
- EFI_IP6_CONFIG_MANUAL_ADDRESS *CfgManAddr;
- EFI_IPv6_ADDRESS *CfgAddr;
- UINTN AddrSize;
- EFI_IP6_CONFIG_INTERFACE_ID *InterfaceId;
- UINT32 DadXmits;
- UINT32 CurDadXmits;
- UINTN CurDadXmitsLen;
- EFI_IP6_CONFIG_POLICY Policy;
-
- VAR_CHECK_CODE CheckCode;
- EFI_EVENT TimeOutEvt;
- EFI_EVENT MappedEvt;
- BOOLEAN IsAddressOk;
-
- UINTN DataSize;
- UINT32 Index;
- UINT32 Index2;
- BOOLEAN IsAddressSet;
- EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ IFCONFIG6_INTERFACE_CB *IfCb;
+ EFI_IP6_CONFIG_MANUAL_ADDRESS *CfgManAddr;
+ EFI_IPv6_ADDRESS *CfgAddr;
+ UINTN AddrSize;
+ EFI_IP6_CONFIG_INTERFACE_ID *InterfaceId;
+ UINT32 DadXmits;
+ UINT32 CurDadXmits;
+ UINTN CurDadXmitsLen;
+ EFI_IP6_CONFIG_POLICY Policy;
+
+ VAR_CHECK_CODE CheckCode;
+ EFI_EVENT TimeOutEvt;
+ EFI_EVENT MappedEvt;
+ BOOLEAN IsAddressOk;
+
+ UINTN DataSize;
+ UINT32 Index;
+ UINT32 Index2;
+ BOOLEAN IsAddressSet;
+ EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;
CfgManAddr = NULL;
CfgAddr = NULL;
@@ -1214,17 +1211,18 @@ IfConfig6SetInterfaceInfo ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_INTERFACE), gShellNetwork2HiiHandle);
return SHELL_INVALID_PARAMETER;
}
+
//
// Make sure to set only one interface each time.
//
- IfCb = BASE_CR (IfList->ForwardLink, IFCONFIG6_INTERFACE_CB, Link);
- Status = EFI_SUCCESS;
+ IfCb = BASE_CR (IfList->ForwardLink, IFCONFIG6_INTERFACE_CB, Link);
+ Status = EFI_SUCCESS;
ShellStatus = SHELL_SUCCESS;
//
// Initialize check list mechanism.
//
- CheckCode = IfConfig6RetriveCheckListByName(
+ CheckCode = IfConfig6RetriveCheckListByName (
NULL,
NULL,
TRUE
@@ -1256,14 +1254,15 @@ IfConfig6SetInterfaceInfo ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
+
//
// Parse the setting variables.
//
while (VarArg != NULL) {
- //
- // Check invalid parameters (duplication & unknown & conflict).
- //
- CheckCode = IfConfig6RetriveCheckListByName(
+ //
+ // Check invalid parameters (duplication & unknown & conflict).
+ //
+ CheckCode = IfConfig6RetriveCheckListByName (
mIfConfig6SetCheckList,
VarArg->Arg,
FALSE
@@ -1290,10 +1289,11 @@ IfConfig6SetInterfaceInfo ( VarArg = VarArg->Next;
continue;
}
+
//
// Process valid variables.
//
- if (StrCmp(VarArg->Arg, L"auto") == 0) {
+ if (StrCmp (VarArg->Arg, L"auto") == 0) {
//
// Set automaic config policy
//
@@ -1305,12 +1305,12 @@ IfConfig6SetInterfaceInfo ( &Policy
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
- VarArg= VarArg->Next;
+ VarArg = VarArg->Next;
if (VarArg != NULL) {
if (StrCmp (VarArg->Arg, L"host") == 0) {
@@ -1339,13 +1339,12 @@ IfConfig6SetInterfaceInfo ( &Policy
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
- VarArg= VarArg->Next;
-
+ VarArg = VarArg->Next;
} else if (StrCmp (VarArg->Arg, L"host") == 0) {
//
// Parse till the next tag or the end of command line.
@@ -1367,6 +1366,7 @@ IfConfig6SetInterfaceInfo ( goto ON_EXIT;
}
}
+
//
// Set static host ip6 address list.
// This is a asynchronous process.
@@ -1462,7 +1462,7 @@ IfConfig6SetInterfaceInfo ( goto ON_EXIT;
}
- for ( Index = 0; Index < (UINTN) (AddrSize / sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS)); Index++) {
+ for ( Index = 0; Index < (UINTN)(AddrSize / sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS)); Index++) {
IsAddressSet = FALSE;
//
// By default, the prefix length 0 is regarded as 64.
@@ -1473,7 +1473,8 @@ IfConfig6SetInterfaceInfo ( for (Index2 = 0; Index2 < IfInfo->AddressInfoCount; Index2++) {
if (EFI_IP6_EQUAL (&IfInfo->AddressInfo[Index2].Address, &CfgManAddr[Index].Address) &&
- (IfInfo->AddressInfo[Index2].PrefixLength == CfgManAddr[Index].PrefixLength)) {
+ (IfInfo->AddressInfo[Index2].PrefixLength == CfgManAddr[Index].PrefixLength))
+ {
IsAddressSet = TRUE;
break;
}
@@ -1488,7 +1489,6 @@ IfConfig6SetInterfaceInfo ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_NEWLINE), gShellNetwork2HiiHandle);
}
}
-
} else if (StrCmp (VarArg->Arg, L"gw") == 0) {
//
// Parse till the next tag or the end of command line.
@@ -1510,6 +1510,7 @@ IfConfig6SetInterfaceInfo ( goto ON_EXIT;
}
}
+
//
// Set static gateway ip6 address list.
//
@@ -1525,7 +1526,6 @@ IfConfig6SetInterfaceInfo ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_MAN_GW), gShellNetwork2HiiHandle, Status);
goto ON_EXIT;
}
-
} else if (StrCmp (VarArg->Arg, L"dns") == 0) {
//
// Parse till the next tag or the end of command line.
@@ -1547,6 +1547,7 @@ IfConfig6SetInterfaceInfo ( goto ON_EXIT;
}
}
+
//
// Set static DNS server ip6 address list.
//
@@ -1561,7 +1562,6 @@ IfConfig6SetInterfaceInfo ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
-
} else if (StrCmp (VarArg->Arg, L"id") == 0) {
//
// Parse till the next tag or the end of command line.
@@ -1573,6 +1573,7 @@ IfConfig6SetInterfaceInfo ( ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
+
//
// Set alternative interface id.
//
@@ -1587,7 +1588,6 @@ IfConfig6SetInterfaceInfo ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
-
} else if (StrCmp (VarArg->Arg, L"dad") == 0) {
//
// Parse till the next tag or the end of command line.
@@ -1599,6 +1599,7 @@ IfConfig6SetInterfaceInfo ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
+
//
// Set dad transmits count.
//
@@ -1609,7 +1610,7 @@ IfConfig6SetInterfaceInfo ( &DadXmits
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
@@ -1639,7 +1640,6 @@ ON_EXIT: }
return ShellStatus;
-
}
/**
@@ -1653,7 +1653,7 @@ ON_EXIT: **/
SHELL_STATUS
IfConfig6 (
- IN IFCONFIG6_PRIVATE_DATA *Private
+ IN IFCONFIG6_PRIVATE_DATA *Private
)
{
EFI_STATUS Status;
@@ -1676,20 +1676,20 @@ IfConfig6 ( }
switch (Private->OpCode) {
- case IfConfig6OpList:
- ShellStatus = IfConfig6ShowInterfaceInfo (&Private->IfList);
- break;
+ case IfConfig6OpList:
+ ShellStatus = IfConfig6ShowInterfaceInfo (&Private->IfList);
+ break;
- case IfConfig6OpClear:
- ShellStatus = IfConfig6ClearInterfaceInfo (&Private->IfList, Private->IfName);
- break;
+ case IfConfig6OpClear:
+ ShellStatus = IfConfig6ClearInterfaceInfo (&Private->IfList, Private->IfName);
+ break;
- case IfConfig6OpSet:
- ShellStatus = IfConfig6SetInterfaceInfo (&Private->IfList, Private->VarArg);
- break;
+ case IfConfig6OpSet:
+ ShellStatus = IfConfig6SetInterfaceInfo (&Private->IfList, Private->VarArg);
+ break;
- default:
- ShellStatus = SHELL_UNSUPPORTED;
+ default:
+ ShellStatus = SHELL_UNSUPPORTED;
}
ON_EXIT:
@@ -1705,12 +1705,12 @@ ON_EXIT: **/
VOID
IfConfig6Cleanup (
- IN IFCONFIG6_PRIVATE_DATA *Private
+ IN IFCONFIG6_PRIVATE_DATA *Private
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- IFCONFIG6_INTERFACE_CB *IfCb;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ IFCONFIG6_INTERFACE_CB *IfCb;
ASSERT (Private != NULL);
@@ -1721,9 +1721,9 @@ IfConfig6Cleanup ( IfConfig6FreeArgList (Private->VarArg);
}
- if (Private->IfName != NULL)
+ if (Private->IfName != NULL) {
FreePool (Private->IfName);
-
+ }
//
// Clean the IFCONFIG6_INTERFACE_CB list.
@@ -1732,18 +1732,15 @@ IfConfig6Cleanup ( NextEntry = Entry->ForwardLink;
while (Entry != &Private->IfList) {
-
IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link);
RemoveEntryList (&IfCb->Link);
if (IfCb->IfId != NULL) {
-
FreePool (IfCb->IfId);
}
if (IfCb->IfInfo != NULL) {
-
FreePool (IfCb->IfInfo);
}
@@ -1773,17 +1770,17 @@ ShellCommandRunIfconfig6 ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- IFCONFIG6_PRIVATE_DATA *Private;
- LIST_ENTRY *ParamPackage;
- CONST CHAR16 *ValueStr;
- ARG_LIST *ArgList;
- CHAR16 *ProblemParam;
- CHAR16 *Str;
-
- Private = NULL;
- Status = EFI_INVALID_PARAMETER;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ IFCONFIG6_PRIVATE_DATA *Private;
+ LIST_ENTRY *ParamPackage;
+ CONST CHAR16 *ValueStr;
+ ARG_LIST *ArgList;
+ CHAR16 *ProblemParam;
+ CHAR16 *Str;
+
+ Private = NULL;
+ Status = EFI_INVALID_PARAMETER;
ShellStatus = SHELL_SUCCESS;
Status = ShellCommandLineParseEx (mIfConfig6CheckList, &ParamPackage, &ProblemParam, TRUE, FALSE);
@@ -1797,11 +1794,13 @@ ShellCommandRunIfconfig6 ( // To handle no option.
//
if (!ShellCommandLineGetFlag (ParamPackage, L"-r") && !ShellCommandLineGetFlag (ParamPackage, L"-s") &&
- !ShellCommandLineGetFlag (ParamPackage, L"-?") && !ShellCommandLineGetFlag (ParamPackage, L"-l")) {
+ !ShellCommandLineGetFlag (ParamPackage, L"-?") && !ShellCommandLineGetFlag (ParamPackage, L"-l"))
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_LACK_OPTION), gShellNetwork2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
+
//
// To handle conflict options.
//
@@ -1810,7 +1809,8 @@ ShellCommandRunIfconfig6 ( ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) ||
((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) ||
((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) ||
- ((ShellCommandLineGetFlag (ParamPackage, L"-l")) && (ShellCommandLineGetFlag (ParamPackage, L"-?")))) {
+ ((ShellCommandLineGetFlag (ParamPackage, L"-l")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))))
+ {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_CONFLICT_OPTIONS), gShellNetwork2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
@@ -1830,7 +1830,7 @@ ShellCommandRunIfconfig6 ( //
if (ShellCommandLineGetFlag (ParamPackage, L"-l")) {
Private->OpCode = IfConfig6OpList;
- ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l");
+ ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l");
if (ValueStr != NULL) {
Str = AllocateCopyPool (StrSize (ValueStr), ValueStr);
if (Str == NULL) {
@@ -1838,15 +1838,17 @@ ShellCommandRunIfconfig6 ( ShellStatus = SHELL_OUT_OF_RESOURCES;
goto ON_EXIT;
}
+
Private->IfName = Str;
}
}
+
//
// To get interface name for the clear option.
//
if (ShellCommandLineGetFlag (ParamPackage, L"-r")) {
Private->OpCode = IfConfig6OpClear;
- ValueStr = ShellCommandLineGetValue (ParamPackage, L"-r");
+ ValueStr = ShellCommandLineGetValue (ParamPackage, L"-r");
if (ValueStr != NULL) {
Str = AllocateCopyPool (StrSize (ValueStr), ValueStr);
if (Str == NULL) {
@@ -1854,20 +1856,22 @@ ShellCommandRunIfconfig6 ( ShellStatus = SHELL_OUT_OF_RESOURCES;
goto ON_EXIT;
}
+
Private->IfName = Str;
}
}
+
//
// To get interface name and corresponding Args for the set option.
//
if (ShellCommandLineGetFlag (ParamPackage, L"-s")) {
-
ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s");
if (ValueStr == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_INTERFACE), gShellNetwork2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
+
//
// To split the configuration into multi-section.
//
@@ -1883,12 +1887,13 @@ ShellCommandRunIfconfig6 ( Private->VarArg = ArgList->Next;
- if (Private->IfName == NULL || Private->VarArg == NULL) {
+ if ((Private->IfName == NULL) || (Private->VarArg == NULL)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_COMMAND), gShellNetwork2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
}
+
//
// Main process of ifconfig6.
//
@@ -1900,7 +1905,6 @@ ON_EXIT: if (Private != NULL) {
IfConfig6Cleanup (Private);
}
- return ShellStatus;
+ return ShellStatus;
}
-
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c index f173b84ecc..e0b58d4b85 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c @@ -9,22 +9,22 @@ #include "UefiShellNetwork2CommandsLib.h"
-#define PING6_DEFAULT_TIMEOUT 5000
-#define PING6_MAX_SEND_NUMBER 10000
-#define PING6_MAX_BUFFER_SIZE 32768
-#define PING6_ONE_SECOND 10000000
-#define STALL_1_MILLI_SECOND 1000
+#define PING6_DEFAULT_TIMEOUT 5000
+#define PING6_MAX_SEND_NUMBER 10000
+#define PING6_MAX_BUFFER_SIZE 32768
+#define PING6_ONE_SECOND 10000000
+#define STALL_1_MILLI_SECOND 1000
#pragma pack(1)
typedef struct _ICMP6_ECHO_REQUEST_REPLY {
- UINT8 Type;
- UINT8 Code;
- UINT16 Checksum;
- UINT16 Identifier;
- UINT16 SequenceNum;
- UINT32 TimeStamp;
- UINT8 Data[1];
+ UINT8 Type;
+ UINT8 Code;
+ UINT16 Checksum;
+ UINT16 Identifier;
+ UINT16 SequenceNum;
+ UINT32 TimeStamp;
+ UINT8 Data[1];
} ICMP6_ECHO_REQUEST_REPLY;
#pragma pack()
@@ -63,8 +63,7 @@ typedef struct _PING6_PRIVATE_DATA { UINT32 BufferSize;
} PING6_PRIVATE_DATA;
-
-SHELL_PARAM_ITEM Ping6ParamList[] = {
+SHELL_PARAM_ITEM Ping6ParamList[] = {
{
L"-l",
TypeValue
@@ -90,9 +89,9 @@ SHELL_PARAM_ITEM Ping6ParamList[] = { //
// Global Variables in Ping6 application.
//
-CONST CHAR16 *mIp6DstString;
-CONST CHAR16 *mIp6SrcString;
-EFI_CPU_ARCH_PROTOCOL *Cpu = NULL;
+CONST CHAR16 *mIp6DstString;
+CONST CHAR16 *mIp6SrcString;
+EFI_CPU_ARCH_PROTOCOL *Cpu = NULL;
/**
RTT timer tick routine.
@@ -104,13 +103,13 @@ EFI_CPU_ARCH_PROTOCOL *Cpu = NULL; VOID
EFIAPI
Ping6RttTimerTickRoutine (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- UINT32 *RttTimerTick;
+ UINT32 *RttTimerTick;
- RttTimerTick = (UINT32*) Context;
+ RttTimerTick = (UINT32 *)Context;
(*RttTimerTick)++;
}
@@ -124,18 +123,18 @@ Ping6RttTimerTickRoutine ( **/
UINT32
-Ping6GetTimerPeriod(
+Ping6GetTimerPeriod (
VOID
)
{
- EFI_STATUS Status;
- UINT32 RttTimerTick;
- EFI_EVENT TimerEvent;
- UINT32 StallCounter;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ UINT32 RttTimerTick;
+ EFI_EVENT TimerEvent;
+ UINT32 StallCounter;
+ EFI_TPL OldTpl;
RttTimerTick = 0;
- StallCounter = 0;
+ StallCounter = 0;
Status = gBS->CreateEvent (
EVT_TIMER | EVT_NOTIFY_SIGNAL,
@@ -172,7 +171,6 @@ Ping6GetTimerPeriod( return StallCounter / RttTimerTick;
}
-
/**
Initialize the timer event for RTT (round trip time).
@@ -184,10 +182,10 @@ Ping6GetTimerPeriod( **/
EFI_STATUS
Ping6InitRttTimer (
- IN PING6_PRIVATE_DATA *Private
+ IN PING6_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Private->TimerPeriod = Ping6GetTimerPeriod ();
if (Private->TimerPeriod == 0) {
@@ -195,13 +193,13 @@ Ping6InitRttTimer ( }
Private->RttTimerTick = 0;
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- Ping6RttTimerTickRoutine,
- &Private->RttTimerTick,
- &Private->RttTimer
- );
+ Status = gBS->CreateEvent (
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ Ping6RttTimerTickRoutine,
+ &Private->RttTimerTick,
+ &Private->RttTimer
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -217,7 +215,6 @@ Ping6InitRttTimer ( }
return EFI_SUCCESS;
-
}
/**
@@ -228,7 +225,7 @@ Ping6InitRttTimer ( **/
VOID
Ping6FreeRttTimer (
- IN PING6_PRIVATE_DATA *Private
+ IN PING6_PRIVATE_DATA *Private
)
{
if (Private->RttTimer != NULL) {
@@ -246,7 +243,7 @@ Ping6FreeRttTimer ( **/
UINT32
Ping6ReadTime (
- IN PING6_PRIVATE_DATA *Private
+ IN PING6_PRIVATE_DATA *Private
)
{
return Private->RttTimerTick;
@@ -264,9 +261,9 @@ Ping6ReadTime ( **/
UINT32
Ping6CalculateTick (
- IN PING6_PRIVATE_DATA *Private,
- IN UINT32 Begin,
- IN UINT32 End
+ IN PING6_PRIVATE_DATA *Private,
+ IN UINT32 Begin,
+ IN UINT32 End
)
{
if (End < Begin) {
@@ -274,7 +271,6 @@ Ping6CalculateTick ( }
return (End - Begin) * Private->TimerPeriod;
-
}
/**
@@ -285,24 +281,22 @@ Ping6CalculateTick ( **/
VOID
Ping6DestroyTxInfo (
- IN PING6_ICMP6_TX_INFO *TxInfo
+ IN PING6_ICMP6_TX_INFO *TxInfo
)
{
- EFI_IP6_TRANSMIT_DATA *TxData;
- EFI_IP6_FRAGMENT_DATA *FragData;
- UINTN Index;
+ EFI_IP6_TRANSMIT_DATA *TxData;
+ EFI_IP6_FRAGMENT_DATA *FragData;
+ UINTN Index;
ASSERT (TxInfo != NULL);
if (TxInfo->Token != NULL) {
-
if (TxInfo->Token->Event != NULL) {
gBS->CloseEvent (TxInfo->Token->Event);
}
TxData = TxInfo->Token->Packet.TxData;
if (TxData != NULL) {
-
if (TxData->OverrideData != NULL) {
FreePool (TxData->OverrideData);
}
@@ -337,13 +331,13 @@ Ping6DestroyTxInfo ( **/
EFI_STATUS
Ping6OnMatchEchoReply (
- IN PING6_PRIVATE_DATA *Private,
- IN ICMP6_ECHO_REQUEST_REPLY *Packet
+ IN PING6_PRIVATE_DATA *Private,
+ IN ICMP6_ECHO_REQUEST_REPLY *Packet
)
{
- PING6_ICMP6_TX_INFO *TxInfo;
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
+ PING6_ICMP6_TX_INFO *TxInfo;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->TxList) {
TxInfo = BASE_CR (Entry, PING6_ICMP6_TX_INFO, Link);
@@ -372,8 +366,8 @@ Ping6OnMatchEchoReply ( VOID
EFIAPI
Ping6OnEchoRequestSent6 (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
}
@@ -388,19 +382,19 @@ Ping6OnEchoRequestSent6 ( VOID
EFIAPI
Ping6OnEchoReplyReceived6 (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- PING6_PRIVATE_DATA *Private;
- EFI_IP6_COMPLETION_TOKEN *RxToken;
- EFI_IP6_RECEIVE_DATA *RxData;
- ICMP6_ECHO_REQUEST_REPLY *Reply;
- UINT32 PayLoad;
- UINT32 Rtt;
+ EFI_STATUS Status;
+ PING6_PRIVATE_DATA *Private;
+ EFI_IP6_COMPLETION_TOKEN *RxToken;
+ EFI_IP6_RECEIVE_DATA *RxData;
+ ICMP6_ECHO_REQUEST_REPLY *Reply;
+ UINT32 PayLoad;
+ UINT32 Rtt;
- Private = (PING6_PRIVATE_DATA *) Context;
+ Private = (PING6_PRIVATE_DATA *)Context;
if (Private->Status == EFI_ABORTED) {
return;
@@ -416,7 +410,8 @@ Ping6OnEchoReplyReceived6 ( }
if (!IP6_IS_MULTICAST (&Private->DstAddress) &&
- !EFI_IP6_EQUAL (&RxData->Header->SourceAddress, &Private->DstAddress)) {
+ !EFI_IP6_EQUAL (&RxData->Header->SourceAddress, &Private->DstAddress))
+ {
goto ON_EXIT;
}
@@ -427,17 +422,19 @@ Ping6OnEchoReplyReceived6 ( if (PayLoad != Private->BufferSize) {
goto ON_EXIT;
}
+
//
// Check whether the reply matches the sent request before.
//
Status = Ping6OnMatchEchoReply (Private, Reply);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
+
//
// Display statistics on this icmp6 echo reply packet.
//
- Rtt = Ping6CalculateTick (Private, Reply->TimeStamp, Ping6ReadTime (Private));
+ Rtt = Ping6CalculateTick (Private, Reply->TimeStamp, Ping6ReadTime (Private));
Private->RttSum += Rtt;
Private->RttMin = Private->RttMin > Rtt ? Rtt : Private->RttMin;
@@ -477,6 +474,7 @@ ON_EXIT: //
Private->Status = EFI_SUCCESS;
}
+
//
// Singal to recycle the each rxdata here, not at the end of process.
//
@@ -495,21 +493,22 @@ ON_EXIT: **/
EFI_IP6_COMPLETION_TOKEN *
Ping6GenerateToken (
- IN PING6_PRIVATE_DATA *Private,
- IN UINT32 TimeStamp,
- IN UINT16 SequenceNum
+ IN PING6_PRIVATE_DATA *Private,
+ IN UINT32 TimeStamp,
+ IN UINT16 SequenceNum
)
{
- EFI_STATUS Status;
- EFI_IP6_COMPLETION_TOKEN *Token;
- EFI_IP6_TRANSMIT_DATA *TxData;
- ICMP6_ECHO_REQUEST_REPLY *Request;
+ EFI_STATUS Status;
+ EFI_IP6_COMPLETION_TOKEN *Token;
+ EFI_IP6_TRANSMIT_DATA *TxData;
+ ICMP6_ECHO_REQUEST_REPLY *Request;
Request = AllocateZeroPool (Private->BufferSize);
if (Request == NULL) {
return NULL;
}
+
//
// Assembly icmp6 echo request packet.
//
@@ -522,7 +521,7 @@ Ping6GenerateToken ( // Leave check sum to ip6 layer, since it has no idea of source address
// selection.
//
- Request->Checksum = 0;
+ Request->Checksum = 0;
TxData = AllocateZeroPool (sizeof (EFI_IP6_TRANSMIT_DATA));
@@ -530,15 +529,16 @@ Ping6GenerateToken ( FreePool (Request);
return NULL;
}
+
//
// Assembly ipv6 token for transmit.
//
- TxData->OverrideData = 0;
- TxData->ExtHdrsLength = 0;
- TxData->ExtHdrs = NULL;
- TxData->DataLength = Private->BufferSize;
- TxData->FragmentCount = 1;
- TxData->FragmentTable[0].FragmentBuffer = (VOID *) Request;
+ TxData->OverrideData = 0;
+ TxData->ExtHdrsLength = 0;
+ TxData->ExtHdrs = NULL;
+ TxData->DataLength = Private->BufferSize;
+ TxData->FragmentCount = 1;
+ TxData->FragmentTable[0].FragmentBuffer = (VOID *)Request;
TxData->FragmentTable[0].FragmentLength = Private->BufferSize;
Token = AllocateZeroPool (sizeof (EFI_IP6_COMPLETION_TOKEN));
@@ -549,8 +549,8 @@ Ping6GenerateToken ( return NULL;
}
- Token->Status = EFI_ABORTED;
- Token->Packet.TxData = TxData;
+ Token->Status = EFI_ABORTED;
+ Token->Packet.TxData = TxData;
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
@@ -582,11 +582,11 @@ Ping6GenerateToken ( **/
EFI_STATUS
Ping6SendEchoRequest (
- IN PING6_PRIVATE_DATA *Private
+ IN PING6_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- PING6_ICMP6_TX_INFO *TxInfo;
+ EFI_STATUS Status;
+ PING6_ICMP6_TX_INFO *TxInfo;
TxInfo = AllocateZeroPool (sizeof (PING6_ICMP6_TX_INFO));
@@ -595,13 +595,13 @@ Ping6SendEchoRequest ( }
TxInfo->TimeStamp = Ping6ReadTime (Private);
- TxInfo->SequenceNum = (UINT16) (Private->TxCount + 1);
+ TxInfo->SequenceNum = (UINT16)(Private->TxCount + 1);
- TxInfo->Token = Ping6GenerateToken (
- Private,
- TxInfo->TimeStamp,
- TxInfo->SequenceNum
- );
+ TxInfo->Token = Ping6GenerateToken (
+ Private,
+ TxInfo->TimeStamp,
+ TxInfo->SequenceNum
+ );
if (TxInfo->Token == NULL) {
Ping6DestroyTxInfo (TxInfo);
@@ -632,10 +632,10 @@ Ping6SendEchoRequest ( **/
EFI_STATUS
Ping6OnReceiveEchoReply (
- IN PING6_PRIVATE_DATA *Private
+ IN PING6_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
ZeroMem (&Private->RxToken, sizeof (EFI_IP6_COMPLETION_TOKEN));
@@ -657,6 +657,7 @@ Ping6OnReceiveEchoReply ( if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_IP6_RECEIVE), gShellNetwork2HiiHandle, Status);
}
+
return Status;
}
@@ -670,31 +671,31 @@ Ping6OnReceiveEchoReply ( VOID
EFIAPI
Ping6OnTimerRoutine6 (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- PING6_PRIVATE_DATA *Private;
- PING6_ICMP6_TX_INFO *TxInfo;
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- UINT64 Time;
+ EFI_STATUS Status;
+ PING6_PRIVATE_DATA *Private;
+ PING6_ICMP6_TX_INFO *TxInfo;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ UINT64 Time;
- Private = (PING6_PRIVATE_DATA *) Context;
+ Private = (PING6_PRIVATE_DATA *)Context;
//
// Retransmit icmp6 echo request packets per second in sendnumber times.
//
if (Private->TxCount < Private->SendNum) {
-
Status = Ping6SendEchoRequest (Private);
- if (Private->TxCount != 0){
+ if (Private->TxCount != 0) {
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_SEND_REQUEST), gShellNetwork2HiiHandle, Private->TxCount + 1);
}
}
}
+
//
// Check whether any icmp6 echo request in the list timeout.
//
@@ -706,10 +707,10 @@ Ping6OnTimerRoutine6 ( // Remove the timeout echo request from txlist.
//
if (Time > PING6_DEFAULT_TIMEOUT) {
-
if (EFI_ERROR (TxInfo->Token->Status)) {
Private->Ip6->Cancel (Private->Ip6, TxInfo->Token);
}
+
//
// Remove the timeout icmp6 echo request from list.
//
@@ -741,29 +742,29 @@ Ping6OnTimerRoutine6 ( **/
EFI_STATUS
Ping6CreateIpInstance (
- IN PING6_PRIVATE_DATA *Private
+ IN PING6_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- UINTN HandleIndex;
- UINTN HandleNum;
- EFI_HANDLE *HandleBuffer;
- BOOLEAN UnspecifiedSrc;
- EFI_STATUS MediaStatus;
- EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb;
- EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
- EFI_IP6_CONFIG_DATA Ip6Config;
- EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;
- UINTN IfInfoSize;
- EFI_IPv6_ADDRESS *Addr;
- UINTN AddrIndex;
-
- HandleBuffer = NULL;
- UnspecifiedSrc = FALSE;
- MediaStatus = EFI_SUCCESS;
- Ip6Sb = NULL;
- IfInfo = NULL;
- IfInfoSize = 0;
+ EFI_STATUS Status;
+ UINTN HandleIndex;
+ UINTN HandleNum;
+ EFI_HANDLE *HandleBuffer;
+ BOOLEAN UnspecifiedSrc;
+ EFI_STATUS MediaStatus;
+ EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb;
+ EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
+ EFI_IP6_CONFIG_DATA Ip6Config;
+ EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;
+ UINTN IfInfoSize;
+ EFI_IPv6_ADDRESS *Addr;
+ UINTN AddrIndex;
+
+ HandleBuffer = NULL;
+ UnspecifiedSrc = FALSE;
+ MediaStatus = EFI_SUCCESS;
+ Ip6Sb = NULL;
+ IfInfo = NULL;
+ IfInfoSize = 0;
//
// Locate all the handles with ip6 service binding protocol.
@@ -799,7 +800,6 @@ Ping6CreateIpInstance ( // For each ip6 protocol, check interface addresses list.
//
for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
-
Ip6Sb = NULL;
IfInfo = NULL;
IfInfoSize = 0;
@@ -820,7 +820,7 @@ Ping6CreateIpInstance ( Status = gBS->HandleProtocol (
HandleBuffer[HandleIndex],
&gEfiIp6ServiceBindingProtocolGuid,
- (VOID **) &Ip6Sb
+ (VOID **)&Ip6Sb
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
@@ -833,12 +833,13 @@ Ping6CreateIpInstance ( Status = gBS->HandleProtocol (
HandleBuffer[HandleIndex],
&gEfiIp6ConfigProtocolGuid,
- (VOID **) &Ip6Cfg
+ (VOID **)&Ip6Cfg
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
+
//
// Get the interface information size.
//
@@ -860,6 +861,7 @@ Ping6CreateIpInstance ( Status = EFI_OUT_OF_RESOURCES;
goto ON_ERROR;
}
+
//
// Get the interface info.
//
@@ -874,6 +876,7 @@ Ping6CreateIpInstance ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_IP6CFG_GETDATA), gShellNetwork2HiiHandle, Status);
goto ON_ERROR;
}
+
//
// Check whether the source address is one of the interface addresses.
//
@@ -885,7 +888,7 @@ Ping6CreateIpInstance ( //
// Select the interface automatically.
//
- CopyMem(&Private->SrcAddress, Addr, sizeof(Private->SrcAddress));
+ CopyMem (&Private->SrcAddress, Addr, sizeof (Private->SrcAddress));
break;
}
} else if (EFI_IP6_EQUAL (&Private->SrcAddress, Addr)) {
@@ -906,6 +909,7 @@ Ping6CreateIpInstance ( FreePool (IfInfo);
IfInfo = NULL;
}
+
//
// No exact interface address matched.
//
@@ -928,7 +932,7 @@ Ping6CreateIpInstance ( Status = gBS->OpenProtocol (
Private->Ip6ChildHandle,
&gEfiIp6ProtocolGuid,
- (VOID **) &Private->Ip6,
+ (VOID **)&Private->Ip6,
Private->ImageHandle,
Private->Ip6ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -989,11 +993,11 @@ ON_ERROR: **/
VOID
Ping6DestroyIpInstance (
- IN PING6_PRIVATE_DATA *Private
+ IN PING6_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb;
+ EFI_STATUS Status;
+ EFI_SERVICE_BINDING_PROTOCOL *Ip6Sb;
gBS->CloseProtocol (
Private->Ip6ChildHandle,
@@ -1005,10 +1009,10 @@ Ping6DestroyIpInstance ( Status = gBS->HandleProtocol (
Private->NicHandle,
&gEfiIp6ServiceBindingProtocolGuid,
- (VOID **) &Ip6Sb
+ (VOID **)&Ip6Sb
);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Ip6Sb->DestroyChild (Ip6Sb, Private->Ip6ChildHandle);
}
}
@@ -1028,23 +1032,23 @@ Ping6DestroyIpInstance ( **/
SHELL_STATUS
ShellPing6 (
- IN EFI_HANDLE ImageHandle,
- IN UINT32 SendNumber,
- IN UINT32 BufferSize,
- IN EFI_IPv6_ADDRESS *SrcAddress,
- IN EFI_IPv6_ADDRESS *DstAddress
+ IN EFI_HANDLE ImageHandle,
+ IN UINT32 SendNumber,
+ IN UINT32 BufferSize,
+ IN EFI_IPv6_ADDRESS *SrcAddress,
+ IN EFI_IPv6_ADDRESS *DstAddress
)
{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- PING6_PRIVATE_DATA *Private;
- PING6_ICMP6_TX_INFO *TxInfo;
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ PING6_PRIVATE_DATA *Private;
+ PING6_ICMP6_TX_INFO *TxInfo;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ SHELL_STATUS ShellStatus;
ShellStatus = SHELL_SUCCESS;
- Private = AllocateZeroPool (sizeof (PING6_PRIVATE_DATA));
+ Private = AllocateZeroPool (sizeof (PING6_PRIVATE_DATA));
if (Private == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellNetwork2HiiHandle, L"Ping6");
@@ -1055,7 +1059,7 @@ ShellPing6 ( Private->ImageHandle = ImageHandle;
Private->SendNum = SendNumber;
Private->BufferSize = BufferSize;
- Private->RttMin = ~((UINT64 )(0x0));
+ Private->RttMin = ~((UINT64)(0x0));
Private->Status = EFI_NOT_READY;
InitializeListHead (&Private->TxList);
@@ -1072,6 +1076,7 @@ ShellPing6 ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
+
//
// Print the command line itself.
//
@@ -1085,6 +1090,7 @@ ShellPing6 ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
+
//
// Create and start timer to send icmp6 echo request packet per second.
//
@@ -1119,7 +1125,7 @@ ShellPing6 ( //
if (EFI_ERROR (Status) && (Status != EFI_NOT_READY)) {
ShellStatus = SHELL_ACCESS_DENIED;
- if(Status == EFI_NOT_FOUND) {
+ if (Status == EFI_NOT_FOUND) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_NOSOURCE_INDOMAIN), gShellNetwork2HiiHandle, mIp6DstString);
}
@@ -1136,6 +1142,7 @@ ShellPing6 ( ShellStatus = SHELL_ACCESS_DENIED;
goto ON_EXIT;
}
+
//
// Control the ping6 process by two factors:
// 1. Hot key
@@ -1152,9 +1159,10 @@ ShellPing6 ( //
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
if ((Key.UnicodeChar == 0x1b) || (Key.UnicodeChar == 0x03) ||
- ((Key.UnicodeChar == 0) && (Key.ScanCode == SCAN_ESC))) {
+ ((Key.UnicodeChar == 0) && (Key.ScanCode == SCAN_ESC)))
+ {
goto ON_STAT;
}
}
@@ -1251,23 +1259,23 @@ ShellCommandRunPing6 ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- SHELL_STATUS ShellStatus;
- EFI_IPv6_ADDRESS DstAddress;
- EFI_IPv6_ADDRESS SrcAddress;
- UINT64 BufferSize;
- UINTN SendNumber;
- LIST_ENTRY *ParamPackage;
- CONST CHAR16 *ValueStr;
- CONST CHAR16 *ValueStrPtr;
- UINTN NonOptionCount;
- CHAR16 *ProblemParam;
+ EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ EFI_IPv6_ADDRESS DstAddress;
+ EFI_IPv6_ADDRESS SrcAddress;
+ UINT64 BufferSize;
+ UINTN SendNumber;
+ LIST_ENTRY *ParamPackage;
+ CONST CHAR16 *ValueStr;
+ CONST CHAR16 *ValueStrPtr;
+ UINTN NonOptionCount;
+ CHAR16 *ProblemParam;
ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
Status = ShellCommandLineParseEx (Ping6ParamList, &ParamPackage, &ProblemParam, TRUE, FALSE);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_INPUT), gShellNetwork2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
@@ -1279,7 +1287,7 @@ ShellCommandRunPing6 ( //
// Parse the parameter of count number.
//
- ValueStr = ShellCommandLineGetValue (ParamPackage, L"-n");
+ ValueStr = ShellCommandLineGetValue (ParamPackage, L"-n");
ValueStrPtr = ValueStr;
if (ValueStr != NULL) {
SendNumber = ShellStrToUintn (ValueStrPtr);
@@ -1293,10 +1301,11 @@ ShellCommandRunPing6 ( goto ON_EXIT;
}
}
+
//
// Parse the parameter of buffer size.
//
- ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l");
+ ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l");
ValueStrPtr = ValueStr;
if (ValueStr != NULL) {
BufferSize = ShellStrToUintn (ValueStrPtr);
@@ -1317,31 +1326,33 @@ ShellCommandRunPing6 ( //
// Parse the parameter of source ip address.
//
- ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s");
+ ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s");
ValueStrPtr = ValueStr;
if (ValueStr != NULL) {
mIp6SrcString = ValueStr;
- Status = NetLibStrToIp6 (ValueStrPtr, &SrcAddress);
+ Status = NetLibStrToIp6 (ValueStrPtr, &SrcAddress);
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_IP), gShellNetwork2HiiHandle, ValueStr);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
}
+
//
// Parse the parameter of destination ip address.
//
- NonOptionCount = ShellCommandLineGetCount(ParamPackage);
- ValueStr = ShellCommandLineGetRawValue (ParamPackage, (UINT32)(NonOptionCount-1));
+ NonOptionCount = ShellCommandLineGetCount (ParamPackage);
+ ValueStr = ShellCommandLineGetRawValue (ParamPackage, (UINT32)(NonOptionCount-1));
if (NonOptionCount != 2) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_INPUT), gShellNetwork2HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
goto ON_EXIT;
}
+
ValueStrPtr = ValueStr;
if (ValueStr != NULL) {
mIp6DstString = ValueStr;
- Status = NetLibStrToIp6 (ValueStrPtr, &DstAddress);
+ Status = NetLibStrToIp6 (ValueStrPtr, &DstAddress);
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_IP), gShellNetwork2HiiHandle, ValueStr);
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -1353,15 +1364,14 @@ ShellCommandRunPing6 ( // Enter into ping6 process.
//
ShellStatus = ShellPing6 (
- ImageHandle,
- (UINT32)SendNumber,
- (UINT32)BufferSize,
- &SrcAddress,
- &DstAddress
- );
+ ImageHandle,
+ (UINT32)SendNumber,
+ (UINT32)BufferSize,
+ &SrcAddress,
+ &DstAddress
+ );
ON_EXIT:
ShellCommandLineFreeVarList (ParamPackage);
return ShellStatus;
}
-
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c index 4aab4295c1..29c82450b7 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c @@ -7,15 +7,15 @@ **/
#include "UefiShellNetwork2CommandsLib.h"
-CONST CHAR16 gShellNetwork2FileName[] = L"ShellCommands";
-EFI_HII_HANDLE gShellNetwork2HiiHandle = NULL;
+CONST CHAR16 gShellNetwork2FileName[] = L"ShellCommands";
+EFI_HII_HANDLE gShellNetwork2HiiHandle = NULL;
/**
return the file name of the help text file if not using HII.
@return The string pointer to the file name.
**/
-CONST CHAR16*
+CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameNetwork2 (
VOID
@@ -47,7 +47,7 @@ ShellNetwork2CommandsLibConstructor ( //
// check our bit of the profiles mask
//
- if ((PcdGet8(PcdShellProfileMask) & BIT4) == 0) {
+ if ((PcdGet8 (PcdShellProfileMask) & BIT4) == 0) {
return (EFI_SUCCESS);
}
@@ -55,14 +55,14 @@ ShellNetwork2CommandsLibConstructor ( if (gShellNetwork2HiiHandle == NULL) {
return (EFI_DEVICE_ERROR);
}
+
//
// install our shell command handlers
//
- ShellCommandRegisterCommandName(L"ping6", ShellCommandRunPing6 , ShellCommandGetManFileNameNetwork2, 0, L"network2", TRUE , gShellNetwork2HiiHandle, STRING_TOKEN(STR_GET_HELP_PING6));
- ShellCommandRegisterCommandName(L"ifconfig6",ShellCommandRunIfconfig6 , ShellCommandGetManFileNameNetwork2, 0, L"network2", TRUE , gShellNetwork2HiiHandle, STRING_TOKEN(STR_GET_HELP_IFCONFIG6));
+ ShellCommandRegisterCommandName (L"ping6", ShellCommandRunPing6, ShellCommandGetManFileNameNetwork2, 0, L"network2", TRUE, gShellNetwork2HiiHandle, STRING_TOKEN (STR_GET_HELP_PING6));
+ ShellCommandRegisterCommandName (L"ifconfig6", ShellCommandRunIfconfig6, ShellCommandGetManFileNameNetwork2, 0, L"network2", TRUE, gShellNetwork2HiiHandle, STRING_TOKEN (STR_GET_HELP_IFCONFIG6));
return EFI_SUCCESS;
-
}
/**
@@ -79,8 +79,8 @@ ShellNetwork2CommandsLibDestructor ( )
{
if (gShellNetwork2HiiHandle != NULL) {
- HiiRemovePackages(gShellNetwork2HiiHandle);
+ HiiRemovePackages (gShellNetwork2HiiHandle);
}
+
return EFI_SUCCESS;
}
-
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h index 9ea42cf26d..9feab2578d 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.h @@ -27,7 +27,7 @@ #include <Library/HiiLib.h>
#include <Library/NetLib.h>
-extern EFI_HII_HANDLE gShellNetwork2HiiHandle;
+extern EFI_HII_HANDLE gShellNetwork2HiiHandle;
/**
Function for 'ping6' command.
@@ -64,4 +64,3 @@ ShellCommandRunIfconfig6 ( );
#endif
-
|