mirror of https://github.com/acidanthera/audk.git
ShellPkg/UefiDpLib: Support execution break
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>
This commit is contained in:
parent
3e9de670ec
commit
196ccda08f
|
@ -14,7 +14,7 @@
|
|||
timer information to calculate elapsed time for each measurement.
|
||||
|
||||
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
|
||||
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
|
||||
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -137,10 +137,10 @@ InitCumulativeData (
|
|||
@param[in] ImageHandle The image handle.
|
||||
@param[in] SystemTable The system table.
|
||||
|
||||
@retval EFI_SUCCESS Command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Command usage error.
|
||||
@retval value Unknown error.
|
||||
|
||||
@retval SHELL_SUCCESS Command completed successfully.
|
||||
@retval SHELL_INVALID_PARAMETER Command usage error.
|
||||
@retval SHELL_ABORTED The user aborts the operation.
|
||||
@retval value Unknown error.
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
|
@ -168,6 +168,7 @@ ShellCommandRunDp (
|
|||
BOOLEAN CumulativeMode;
|
||||
CONST CHAR16 *CustomCumulativeToken;
|
||||
PERF_CUM_DATA *CustomCumulativeData;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
StringPtr = NULL;
|
||||
SummaryMode = FALSE;
|
||||
|
@ -179,6 +180,7 @@ ShellCommandRunDp (
|
|||
ExcludeMode = FALSE;
|
||||
CumulativeMode = FALSE;
|
||||
CustomCumulativeData = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
// Get DP's entry time as soon as possible.
|
||||
// This is used as the Shell-Phase end time.
|
||||
|
@ -329,14 +331,22 @@ ShellCommandRunDp (
|
|||
ProcessCumulative (CustomCumulativeData);
|
||||
} else if (AllMode) {
|
||||
if (TraceMode) {
|
||||
DumpAllTrace( Number2Display, ExcludeMode);
|
||||
Status = DumpAllTrace( Number2Display, ExcludeMode);
|
||||
if (Status == EFI_ABORTED) {
|
||||
ShellStatus = SHELL_ABORTED;
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
if (ProfileMode) {
|
||||
DumpAllProfile( Number2Display, ExcludeMode);
|
||||
}
|
||||
} else if (RawMode) {
|
||||
if (TraceMode) {
|
||||
DumpRawTrace( Number2Display, ExcludeMode);
|
||||
Status = DumpRawTrace( Number2Display, ExcludeMode);
|
||||
if (Status == EFI_ABORTED) {
|
||||
ShellStatus = SHELL_ABORTED;
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
if (ProfileMode) {
|
||||
DumpRawProfile( Number2Display, ExcludeMode);
|
||||
|
@ -347,11 +357,24 @@ ShellCommandRunDp (
|
|||
ProcessPhases ( Ticker );
|
||||
if ( ! SummaryMode) {
|
||||
Status = ProcessHandles ( ExcludeMode);
|
||||
if ( ! EFI_ERROR( Status)) {
|
||||
ProcessPeims ();
|
||||
ProcessGlobal ();
|
||||
ProcessCumulative (NULL);
|
||||
if (Status == EFI_ABORTED) {
|
||||
ShellStatus = SHELL_ABORTED;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Status = ProcessPeims ();
|
||||
if (Status == EFI_ABORTED) {
|
||||
ShellStatus = SHELL_ABORTED;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Status = ProcessGlobal ();
|
||||
if (Status == EFI_ABORTED) {
|
||||
ShellStatus = SHELL_ABORTED;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
ProcessCumulative (NULL);
|
||||
}
|
||||
}
|
||||
if (ProfileMode) {
|
||||
|
@ -362,11 +385,12 @@ ShellCommandRunDp (
|
|||
DumpStatistics();
|
||||
}
|
||||
|
||||
Done:
|
||||
SHELL_FREE_NON_NULL (StringPtr);
|
||||
if (CustomCumulativeData != NULL) {
|
||||
SHELL_FREE_NON_NULL (CustomCumulativeData->Name);
|
||||
}
|
||||
SHELL_FREE_NON_NULL (CustomCumulativeData);
|
||||
|
||||
return SHELL_SUCCESS;
|
||||
return ShellStatus;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
|
||||
|
||||
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
|
||||
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
|
||||
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -198,8 +198,11 @@ GatherStatistics(
|
|||
@param[in] Limit The number of records to print. Zero is ALL.
|
||||
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
@return Others from a call to gBS->LocateHandleBuffer().
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
DumpAllTrace(
|
||||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
|
@ -221,9 +224,10 @@ DumpAllTrace(
|
|||
|
||||
@param[in] Limit The number of records to print. Zero is ALL.
|
||||
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
DumpRawTrace(
|
||||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
|
@ -246,7 +250,9 @@ ProcessPhases(
|
|||
|
||||
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
||||
|
||||
@return Status from a call to gBS->LocateHandle().
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
@return Others from a call to gBS->LocateHandleBuffer().
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessHandles(
|
||||
|
@ -259,8 +265,10 @@ ProcessHandles(
|
|||
|
||||
Only prints complete PEIM records
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
ProcessPeims(
|
||||
VOID
|
||||
);
|
||||
|
@ -273,8 +281,10 @@ ProcessPeims(
|
|||
Increment TIndex for every record, even skipped ones, so that we have an
|
||||
indication of every measurement record taken.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
ProcessGlobal(
|
||||
VOID
|
||||
);
|
||||
|
|
|
@ -136,8 +136,11 @@ GatherStatistics(
|
|||
@param[in] Limit The number of records to print. Zero is ALL.
|
||||
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
@return Others from a call to gBS->LocateHandleBuffer().
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
DumpAllTrace(
|
||||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
|
@ -257,12 +260,18 @@ DumpAllTrace(
|
|||
ElapsedTime
|
||||
);
|
||||
}
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
SHELL_FREE_NON_NULL (IncFlag);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,8 +291,10 @@ DumpAllTrace(
|
|||
@param[in] Limit The number of records to print. Zero is ALL.
|
||||
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
DumpRawTrace(
|
||||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
|
@ -298,6 +309,9 @@ DumpRawTrace(
|
|||
|
||||
EFI_STRING StringPtr;
|
||||
EFI_STRING StringPtrUnknown;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);
|
||||
|
@ -361,7 +375,12 @@ DumpRawTrace(
|
|||
Measurement.Module
|
||||
);
|
||||
}
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -510,7 +529,9 @@ ProcessPhases(
|
|||
|
||||
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
||||
|
||||
@return Status from a call to gBS->LocateHandle().
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
@return Others from a call to gBS->LocateHandleBuffer().
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessHandles(
|
||||
|
@ -606,6 +627,10 @@ ProcessHandles(
|
|||
);
|
||||
}
|
||||
}
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (HandleBuffer != NULL) {
|
||||
|
@ -619,8 +644,10 @@ ProcessHandles(
|
|||
|
||||
Only prints complete PEIM records
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
ProcessPeims(
|
||||
VOID
|
||||
)
|
||||
|
@ -632,6 +659,9 @@ ProcessPeims(
|
|||
UINTN LogEntryKey;
|
||||
UINTN TIndex;
|
||||
EFI_STRING StringPtrUnknown;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);
|
||||
|
@ -685,7 +715,12 @@ ProcessPeims(
|
|||
);
|
||||
}
|
||||
}
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -696,8 +731,10 @@ ProcessPeims(
|
|||
Increment TIndex for every record, even skipped ones, so that we have an
|
||||
indication of every measurement record taken.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
VOID
|
||||
EFI_STATUS
|
||||
ProcessGlobal(
|
||||
VOID
|
||||
)
|
||||
|
@ -709,6 +746,9 @@ ProcessGlobal(
|
|||
UINTN LogEntryKey;
|
||||
UINTN Index; // Index, or number, of the measurement record being processed
|
||||
EFI_STRING StringPtrUnknown;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);
|
||||
|
@ -766,8 +806,13 @@ ProcessGlobal(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
return Status; //*HP_ISS_EDK2_CONTRIUTION
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
Main file for NULL named library for dp command functions.
|
||||
|
||||
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -47,6 +48,11 @@ extern EFI_HANDLE gDpHiiHandle;
|
|||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
|
||||
@retval SHELL_SUCCESS Command completed successfully.
|
||||
@retval SHELL_INVALID_PARAMETER Command usage error.
|
||||
@retval SHELL_ABORTED The user aborts the operation.
|
||||
@retval value Unknown error.
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
|
|
Loading…
Reference in New Issue