Support UEFI shell execution break.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Samer EL-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
timer information to calculate elapsed time for each measurement.\r
\r
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.\r
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+ (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
@param[in] ImageHandle The image handle.\r
@param[in] SystemTable The system table.\r
\r
- @retval EFI_SUCCESS Command completed successfully.\r
- @retval EFI_INVALID_PARAMETER Command usage error.\r
- @retval value Unknown error.\r
- \r
+ @retval SHELL_SUCCESS Command completed successfully.\r
+ @retval SHELL_INVALID_PARAMETER Command usage error.\r
+ @retval SHELL_ABORTED The user aborts the operation.\r
+ @retval value Unknown error.\r
**/\r
SHELL_STATUS\r
EFIAPI\r
BOOLEAN CumulativeMode;\r
CONST CHAR16 *CustomCumulativeToken;\r
PERF_CUM_DATA *CustomCumulativeData;\r
+ SHELL_STATUS ShellStatus;\r
\r
StringPtr = NULL;\r
SummaryMode = FALSE;\r
ExcludeMode = FALSE;\r
CumulativeMode = FALSE;\r
CustomCumulativeData = NULL;\r
+ ShellStatus = SHELL_SUCCESS;\r
\r
// Get DP's entry time as soon as possible.\r
// This is used as the Shell-Phase end time.\r
ProcessCumulative (CustomCumulativeData);\r
} else if (AllMode) {\r
if (TraceMode) {\r
- DumpAllTrace( Number2Display, ExcludeMode);\r
+ Status = DumpAllTrace( Number2Display, ExcludeMode);\r
+ if (Status == EFI_ABORTED) {\r
+ ShellStatus = SHELL_ABORTED;\r
+ goto Done;\r
+ }\r
}\r
if (ProfileMode) {\r
DumpAllProfile( Number2Display, ExcludeMode);\r
}\r
} else if (RawMode) {\r
if (TraceMode) {\r
- DumpRawTrace( Number2Display, ExcludeMode);\r
+ Status = DumpRawTrace( Number2Display, ExcludeMode);\r
+ if (Status == EFI_ABORTED) {\r
+ ShellStatus = SHELL_ABORTED;\r
+ goto Done;\r
+ }\r
}\r
if (ProfileMode) {\r
DumpRawProfile( Number2Display, ExcludeMode);\r
ProcessPhases ( Ticker );\r
if ( ! SummaryMode) {\r
Status = ProcessHandles ( ExcludeMode);\r
- if ( ! EFI_ERROR( Status)) {\r
- ProcessPeims ();\r
- ProcessGlobal ();\r
- ProcessCumulative (NULL);\r
+ if (Status == EFI_ABORTED) {\r
+ ShellStatus = SHELL_ABORTED;\r
+ goto Done;\r
+ }\r
+\r
+ Status = ProcessPeims ();\r
+ if (Status == EFI_ABORTED) {\r
+ ShellStatus = SHELL_ABORTED;\r
+ goto Done;\r
+ }\r
+\r
+ Status = ProcessGlobal ();\r
+ if (Status == EFI_ABORTED) {\r
+ ShellStatus = SHELL_ABORTED;\r
+ goto Done;\r
}\r
+\r
+ ProcessCumulative (NULL);\r
}\r
}\r
if (ProfileMode) {\r
DumpStatistics();\r
}\r
\r
+Done:\r
SHELL_FREE_NON_NULL (StringPtr);\r
if (CustomCumulativeData != NULL) {\r
SHELL_FREE_NON_NULL (CustomCumulativeData->Name);\r
}\r
SHELL_FREE_NON_NULL (CustomCumulativeData);\r
\r
- return SHELL_SUCCESS;\r
+ return ShellStatus;\r
}\r
DpUtilities.c, DpTrace.c, and DpProfile.c are included here.\r
\r
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.\r
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+ (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
@param[in] Limit The number of records to print. Zero is ALL.\r
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
+ @return Others from a call to gBS->LocateHandleBuffer().\r
**/\r
-VOID\r
+EFI_STATUS\r
DumpAllTrace(\r
IN UINTN Limit,\r
IN BOOLEAN ExcludeFlag\r
\r
@param[in] Limit The number of records to print. Zero is ALL.\r
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
- \r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
**/\r
-VOID\r
+EFI_STATUS\r
DumpRawTrace(\r
IN UINTN Limit,\r
IN BOOLEAN ExcludeFlag\r
\r
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
\r
- @return Status from a call to gBS->LocateHandle().\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
+ @return Others from a call to gBS->LocateHandleBuffer().\r
**/\r
EFI_STATUS\r
ProcessHandles(\r
\r
Only prints complete PEIM records\r
\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
**/\r
-VOID\r
+EFI_STATUS\r
ProcessPeims(\r
VOID\r
);\r
Increment TIndex for every record, even skipped ones, so that we have an\r
indication of every measurement record taken.\r
\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
**/\r
-VOID\r
+EFI_STATUS\r
ProcessGlobal(\r
VOID\r
);\r
@param[in] Limit The number of records to print. Zero is ALL.\r
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
+ @return Others from a call to gBS->LocateHandleBuffer().\r
**/\r
-VOID\r
+EFI_STATUS\r
DumpAllTrace(\r
IN UINTN Limit,\r
IN BOOLEAN ExcludeFlag\r
ElapsedTime\r
);\r
}\r
+ if (ShellGetExecutionBreakFlag ()) {\r
+ Status = EFI_ABORTED;\r
+ break;\r
+ }\r
}\r
}\r
if (HandleBuffer != NULL) {\r
FreePool (HandleBuffer);\r
}\r
SHELL_FREE_NON_NULL (IncFlag);\r
+\r
+ return Status;\r
}\r
\r
/** \r
\r
@param[in] Limit The number of records to print. Zero is ALL.\r
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
- \r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
**/\r
-VOID\r
+EFI_STATUS\r
DumpRawTrace(\r
IN UINTN Limit,\r
IN BOOLEAN ExcludeFlag\r
\r
EFI_STRING StringPtr;\r
EFI_STRING StringPtrUnknown;\r
+ EFI_STATUS Status;\r
+\r
+ Status = EFI_SUCCESS;\r
\r
StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);\r
Measurement.Module\r
);\r
}\r
+ if (ShellGetExecutionBreakFlag ()) {\r
+ Status = EFI_ABORTED;\r
+ break;\r
+ }\r
}\r
+ return Status;\r
}\r
\r
/** \r
\r
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
\r
- @return Status from a call to gBS->LocateHandle().\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
+ @return Others from a call to gBS->LocateHandleBuffer().\r
**/\r
EFI_STATUS\r
ProcessHandles(\r
);\r
}\r
}\r
+ if (ShellGetExecutionBreakFlag ()) {\r
+ Status = EFI_ABORTED;\r
+ break;\r
+ }\r
}\r
}\r
if (HandleBuffer != NULL) {\r
\r
Only prints complete PEIM records\r
\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
**/\r
-VOID\r
+EFI_STATUS\r
ProcessPeims(\r
VOID\r
)\r
UINTN LogEntryKey;\r
UINTN TIndex;\r
EFI_STRING StringPtrUnknown;\r
+ EFI_STATUS Status;\r
+\r
+ Status = EFI_SUCCESS;\r
\r
StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);\r
);\r
}\r
}\r
+ if (ShellGetExecutionBreakFlag ()) {\r
+ Status = EFI_ABORTED;\r
+ break;\r
+ }\r
}\r
+ return Status;\r
}\r
\r
/** \r
Increment TIndex for every record, even skipped ones, so that we have an\r
indication of every measurement record taken.\r
\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_ABORTED The user aborts the operation.\r
**/\r
-VOID\r
+EFI_STATUS\r
ProcessGlobal(\r
VOID\r
)\r
UINTN LogEntryKey;\r
UINTN Index; // Index, or number, of the measurement record being processed\r
EFI_STRING StringPtrUnknown;\r
+ EFI_STATUS Status;\r
+\r
+ Status = EFI_SUCCESS;\r
\r
StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);\r
}\r
}\r
}\r
+ if (ShellGetExecutionBreakFlag ()) {\r
+ Status = EFI_ABORTED;\r
+ break;\r
+ }\r
Index++;\r
}\r
+ return Status; //*HP_ISS_EDK2_CONTRIUTION\r
}\r
\r
/** \r
Main file for NULL named library for dp command functions.\r
\r
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
@param[in] ImageHandle Handle to the Image (NULL if Internal).\r
@param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+\r
+ @retval SHELL_SUCCESS Command completed successfully.\r
+ @retval SHELL_INVALID_PARAMETER Command usage error.\r
+ @retval SHELL_ABORTED The user aborts the operation.\r
+ @retval value Unknown error.\r
**/\r
SHELL_STATUS\r
EFIAPI\r