MdePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdePkg 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: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
1436aea4d5
commit
2f88bd3a12
@@ -38,104 +38,104 @@ typedef struct {
|
||||
///
|
||||
/// Signature value that must be set to PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_SIGNATURE
|
||||
///
|
||||
UINT32 Signature;
|
||||
UINT32 Signature;
|
||||
///
|
||||
/// The link entry to be inserted to the list of periodic SMI handlers.
|
||||
///
|
||||
LIST_ENTRY Link;
|
||||
LIST_ENTRY Link;
|
||||
///
|
||||
/// The dispatch function to called to invoke an enabled periodic SMI handler.
|
||||
///
|
||||
PERIODIC_SMI_LIBRARY_HANDLER DispatchFunction;
|
||||
PERIODIC_SMI_LIBRARY_HANDLER DispatchFunction;
|
||||
///
|
||||
/// The context to pass into DispatchFunction
|
||||
///
|
||||
VOID *Context;
|
||||
VOID *Context;
|
||||
///
|
||||
/// The tick period in 100 ns units that DispatchFunction should be called.
|
||||
///
|
||||
UINT64 TickPeriod;
|
||||
UINT64 TickPeriod;
|
||||
///
|
||||
/// The Cpu number that is required to execute DispatchFunction. If Cpu is
|
||||
/// set to PERIODIC_SMI_LIBRARY_ANY_CPU, then DispatchFunction may be executed
|
||||
/// on any CPU.
|
||||
///
|
||||
UINTN Cpu;
|
||||
UINTN Cpu;
|
||||
///
|
||||
/// The size, in bytes, of the stack allocated for a periodic SMI handler.
|
||||
/// This value must be a multiple of EFI_PAGE_SIZE.
|
||||
///
|
||||
UINTN StackSize;
|
||||
UINTN StackSize;
|
||||
///
|
||||
/// A pointer to the stack allocated using AllocatePages(). This field will
|
||||
/// be NULL if StackSize is 0.
|
||||
///
|
||||
VOID *Stack;
|
||||
VOID *Stack;
|
||||
///
|
||||
/// Spin lock used to wait for an AP to complete the execution of a periodic SMI handler
|
||||
///
|
||||
SPIN_LOCK DispatchLock;
|
||||
SPIN_LOCK DispatchLock;
|
||||
///
|
||||
/// The rate in Hz of the performance counter that is used to measure the
|
||||
/// amount of time that a periodic SMI handler executes.
|
||||
///
|
||||
UINT64 PerfomanceCounterRate;
|
||||
UINT64 PerfomanceCounterRate;
|
||||
///
|
||||
/// The start count value of the performance counter that is used to measure
|
||||
/// the amount of time that a periodic SMI handler executes.
|
||||
///
|
||||
UINT64 PerfomanceCounterStartValue;
|
||||
UINT64 PerfomanceCounterStartValue;
|
||||
///
|
||||
/// The end count value of the performance counter that is used to measure
|
||||
/// the amount of time that a periodic SMI handler executes.
|
||||
///
|
||||
UINT64 PerfomanceCounterEndValue;
|
||||
UINT64 PerfomanceCounterEndValue;
|
||||
///
|
||||
/// The context record passed into the Register() function of the SMM Periodic
|
||||
/// Timer Dispatch Protocol when a periodic SMI handler is enabled.
|
||||
///
|
||||
EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT RegisterContext;
|
||||
EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT RegisterContext;
|
||||
///
|
||||
/// The handle returned from the Register() function of the SMM Periodic
|
||||
/// Timer Dispatch Protocol when a periodic SMI handler is enabled.
|
||||
///
|
||||
EFI_HANDLE DispatchHandle;
|
||||
EFI_HANDLE DispatchHandle;
|
||||
///
|
||||
/// The total number of performance counter ticks that the periodic SMI handler
|
||||
/// has been executing in its current invocation.
|
||||
///
|
||||
UINT64 DispatchTotalTime;
|
||||
UINT64 DispatchTotalTime;
|
||||
///
|
||||
/// The performance counter value that was captured the last time that the
|
||||
/// periodic SMI handler called PeriodicSmiExecutionTime(). This allows the
|
||||
/// time value returned by PeriodicSmiExecutionTime() to be accurate even when
|
||||
/// the performance counter rolls over.
|
||||
///
|
||||
UINT64 DispatchCheckPointTime;
|
||||
UINT64 DispatchCheckPointTime;
|
||||
///
|
||||
/// Buffer used to save the context when control is transfer from this library
|
||||
/// to an enabled periodic SMI handler. This saved context is used when the
|
||||
/// periodic SMI handler exits or yields.
|
||||
///
|
||||
BASE_LIBRARY_JUMP_BUFFER DispatchJumpBuffer;
|
||||
BASE_LIBRARY_JUMP_BUFFER DispatchJumpBuffer;
|
||||
///
|
||||
/// Flag that is set to TRUE when a periodic SMI handler requests to yield
|
||||
/// using PeriodicSmiYield(). When this flag IS TRUE, YieldJumpBuffer is
|
||||
/// valid. When this flag is FALSE, YieldJumpBuffer is not valid.
|
||||
///
|
||||
BOOLEAN YieldFlag;
|
||||
BOOLEAN YieldFlag;
|
||||
///
|
||||
/// Buffer used to save the context when a periodic SMI handler requests to
|
||||
/// yield using PeriodicSmiYield(). This context is used to resume the
|
||||
/// execution of a periodic SMI handler the next time control is transferred
|
||||
/// to the periodic SMI handler that yielded.
|
||||
///
|
||||
BASE_LIBRARY_JUMP_BUFFER YieldJumpBuffer;
|
||||
BASE_LIBRARY_JUMP_BUFFER YieldJumpBuffer;
|
||||
///
|
||||
/// The amount of time, in 100 ns units, that have elapsed since the last
|
||||
/// time the periodic SMI handler was invoked.
|
||||
///
|
||||
UINT64 ElapsedTime;
|
||||
UINT64 ElapsedTime;
|
||||
} PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT;
|
||||
|
||||
/**
|
||||
@@ -154,7 +154,7 @@ typedef struct {
|
||||
///
|
||||
/// Pointer to the SMM Periodic Timer Dispatch Protocol that was located in the constructor.
|
||||
///
|
||||
EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *gSmmPeriodicTimerDispatch2 = NULL;
|
||||
EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *gSmmPeriodicTimerDispatch2 = NULL;
|
||||
|
||||
///
|
||||
/// Pointer to a table of supported periodic SMI tick periods in 100 ns units
|
||||
@@ -163,25 +163,25 @@ EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL *gSmmPeriodicTimerDispatch2
|
||||
/// in based on the values returned from the SMM Periodic Timer Dispatch 2 Protocol
|
||||
/// function GetNextShorterInterval().
|
||||
///
|
||||
UINT64 *gSmiTickPeriodTable = NULL;
|
||||
UINT64 *gSmiTickPeriodTable = NULL;
|
||||
|
||||
///
|
||||
/// Linked list of free periodic SMI handlers that this library can use.
|
||||
///
|
||||
LIST_ENTRY gFreePeriodicSmiLibraryHandlers =
|
||||
INITIALIZE_LIST_HEAD_VARIABLE (gFreePeriodicSmiLibraryHandlers);
|
||||
LIST_ENTRY gFreePeriodicSmiLibraryHandlers =
|
||||
INITIALIZE_LIST_HEAD_VARIABLE (gFreePeriodicSmiLibraryHandlers);
|
||||
|
||||
///
|
||||
/// Linked list of periodic SMI handlers that this library is currently managing.
|
||||
///
|
||||
LIST_ENTRY gPeriodicSmiLibraryHandlers =
|
||||
INITIALIZE_LIST_HEAD_VARIABLE (gPeriodicSmiLibraryHandlers);
|
||||
LIST_ENTRY gPeriodicSmiLibraryHandlers =
|
||||
INITIALIZE_LIST_HEAD_VARIABLE (gPeriodicSmiLibraryHandlers);
|
||||
|
||||
///
|
||||
/// Pointer to the periodic SMI handler that is currently being executed.
|
||||
/// Is set to NULL if no periodic SMI handler is currently being executed.
|
||||
///
|
||||
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *gActivePeriodicSmiLibraryHandler = NULL;
|
||||
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *gActivePeriodicSmiLibraryHandler = NULL;
|
||||
|
||||
/**
|
||||
Internal worker function that returns a pointer to the
|
||||
@@ -226,7 +226,7 @@ GetActivePeriodicSmiLibraryHandler (
|
||||
**/
|
||||
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *
|
||||
LookupPeriodicSmiLibraryHandler (
|
||||
IN EFI_HANDLE DispatchHandle OPTIONAL
|
||||
IN EFI_HANDLE DispatchHandle OPTIONAL
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
@@ -243,9 +243,10 @@ LookupPeriodicSmiLibraryHandler (
|
||||
// Search the periodic SMI handler entries for a a matching DispatchHandle
|
||||
//
|
||||
for ( Link = GetFirstNode (&gPeriodicSmiLibraryHandlers)
|
||||
; !IsNull (&gPeriodicSmiLibraryHandlers, Link)
|
||||
; Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link)
|
||||
) {
|
||||
; !IsNull (&gPeriodicSmiLibraryHandlers, Link)
|
||||
; Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link)
|
||||
)
|
||||
{
|
||||
PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);
|
||||
|
||||
if (PeriodicSmiLibraryHandler->DispatchHandle == DispatchHandle) {
|
||||
@@ -279,7 +280,7 @@ LookupPeriodicSmiLibraryHandler (
|
||||
**/
|
||||
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *
|
||||
SetActivePeriodicSmiLibraryHandler (
|
||||
IN EFI_HANDLE DispatchHandle OPTIONAL
|
||||
IN EFI_HANDLE DispatchHandle OPTIONAL
|
||||
)
|
||||
{
|
||||
if (DispatchHandle == NULL) {
|
||||
@@ -287,6 +288,7 @@ SetActivePeriodicSmiLibraryHandler (
|
||||
} else {
|
||||
gActivePeriodicSmiLibraryHandler = LookupPeriodicSmiLibraryHandler (DispatchHandle);
|
||||
}
|
||||
|
||||
return gActivePeriodicSmiLibraryHandler;
|
||||
}
|
||||
|
||||
@@ -298,7 +300,7 @@ SetActivePeriodicSmiLibraryHandler (
|
||||
**/
|
||||
VOID
|
||||
ReclaimPeriodicSmiLibraryHandler (
|
||||
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler
|
||||
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler
|
||||
)
|
||||
{
|
||||
ASSERT (PeriodicSmiLibraryHandler->DispatchHandle == NULL);
|
||||
@@ -309,6 +311,7 @@ ReclaimPeriodicSmiLibraryHandler (
|
||||
);
|
||||
PeriodicSmiLibraryHandler->Stack = NULL;
|
||||
}
|
||||
|
||||
RemoveEntryList (&PeriodicSmiLibraryHandler->Link);
|
||||
InsertHeadList (&gFreePeriodicSmiLibraryHandlers, &PeriodicSmiLibraryHandler->Link);
|
||||
}
|
||||
@@ -337,11 +340,12 @@ EnlargeFreePeriodicSmiLibraryHandlerList (
|
||||
if (PeriodicSmiLibraryHandler == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
PeriodicSmiLibraryHandler->Signature = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_SIGNATURE;
|
||||
InsertHeadList (&gFreePeriodicSmiLibraryHandlers, &PeriodicSmiLibraryHandler->Link);
|
||||
}
|
||||
|
||||
return (BOOLEAN) (Index > 0);
|
||||
return (BOOLEAN)(Index > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,7 +519,7 @@ PeriodicSmiExit (
|
||||
// Must never return
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop();
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -623,9 +627,9 @@ PeriodicSmiDispatchFunctionSwitchStack (
|
||||
// periodic SMI handler was dispatched.
|
||||
//
|
||||
PeriodicSmiLibraryHandler->DispatchFunction (
|
||||
PeriodicSmiLibraryHandler->Context,
|
||||
PeriodicSmiLibraryHandler->ElapsedTime
|
||||
);
|
||||
PeriodicSmiLibraryHandler->Context,
|
||||
PeriodicSmiLibraryHandler->ElapsedTime
|
||||
);
|
||||
|
||||
//
|
||||
// If this DispatchFunction() returns, then unconditionally call PeriodicSmiExit()
|
||||
@@ -667,7 +671,7 @@ PeriodicSmiDispatchFunctionOnCpu (
|
||||
// calculated.
|
||||
//
|
||||
PeriodicSmiLibraryHandler->DispatchTotalTime = 0;
|
||||
PeriodicSmiLibraryHandler->DispatchCheckPointTime = GetPerformanceCounter();
|
||||
PeriodicSmiLibraryHandler->DispatchCheckPointTime = GetPerformanceCounter ();
|
||||
|
||||
if (PeriodicSmiLibraryHandler->YieldFlag) {
|
||||
//
|
||||
@@ -682,9 +686,9 @@ PeriodicSmiDispatchFunctionOnCpu (
|
||||
// elapsed since the previous time this periodic SMI handler was dispatched.
|
||||
//
|
||||
PeriodicSmiLibraryHandler->DispatchFunction (
|
||||
PeriodicSmiLibraryHandler->Context,
|
||||
PeriodicSmiLibraryHandler->ElapsedTime
|
||||
);
|
||||
PeriodicSmiLibraryHandler->Context,
|
||||
PeriodicSmiLibraryHandler->ElapsedTime
|
||||
);
|
||||
|
||||
//
|
||||
// If this DispatchFunction() returns, then unconditionally call PeriodicSmiExit()
|
||||
@@ -707,7 +711,7 @@ PeriodicSmiDispatchFunctionOnCpu (
|
||||
// Must never return
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop();
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -794,7 +798,7 @@ PeriodicSmiDispatchFunction (
|
||||
//
|
||||
PeriodicSmiLibraryHandler->ElapsedTime = 0;
|
||||
if (CommBuffer != NULL) {
|
||||
TimerContext = (EFI_SMM_PERIODIC_TIMER_CONTEXT *)CommBuffer;
|
||||
TimerContext = (EFI_SMM_PERIODIC_TIMER_CONTEXT *)CommBuffer;
|
||||
PeriodicSmiLibraryHandler->ElapsedTime = TimerContext->ElapsedTime;
|
||||
}
|
||||
|
||||
@@ -802,7 +806,8 @@ PeriodicSmiDispatchFunction (
|
||||
// Dispatch the periodic SMI handler
|
||||
//
|
||||
if ((PeriodicSmiLibraryHandler->Cpu == PERIODIC_SMI_LIBRARY_ANY_CPU) ||
|
||||
(PeriodicSmiLibraryHandler->Cpu == gSmst->CurrentlyExecutingCpu) ) {
|
||||
(PeriodicSmiLibraryHandler->Cpu == gSmst->CurrentlyExecutingCpu))
|
||||
{
|
||||
//
|
||||
// Dispatch on the currently execution CPU if the CPU specified in PeriodicSmiEnable()
|
||||
// was PERIODIC_SMI_LIBRARY_ANY_CPU or the currently executing CPU matches the CPU
|
||||
@@ -922,18 +927,19 @@ PeriodicSmiEnable (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gSmiTickPeriodTable[Index] == 0) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (Cpu != PERIODIC_SMI_LIBRARY_ANY_CPU && Cpu >= gSmst->NumberOfCpus) {
|
||||
if ((Cpu != PERIODIC_SMI_LIBRARY_ANY_CPU) && (Cpu >= gSmst->NumberOfCpus)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Find a free periodic SMI handler entry
|
||||
//
|
||||
PeriodicSmiLibraryHandler = FindFreePeriodicSmiLibraryHandler();
|
||||
PeriodicSmiLibraryHandler = FindFreePeriodicSmiLibraryHandler ();
|
||||
if (PeriodicSmiLibraryHandler == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -952,10 +958,12 @@ PeriodicSmiEnable (
|
||||
if (PeriodicSmiLibraryHandler->Stack == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
ZeroMem (PeriodicSmiLibraryHandler->Stack, PeriodicSmiLibraryHandler->StackSize);
|
||||
} else {
|
||||
PeriodicSmiLibraryHandler->Stack = NULL;
|
||||
}
|
||||
|
||||
InitializeSpinLock (&PeriodicSmiLibraryHandler->DispatchLock);
|
||||
PeriodicSmiLibraryHandler->PerfomanceCounterRate = GetPerformanceCounterProperties (
|
||||
&PeriodicSmiLibraryHandler->PerfomanceCounterStartValue,
|
||||
@@ -963,12 +971,12 @@ PeriodicSmiEnable (
|
||||
);
|
||||
PeriodicSmiLibraryHandler->RegisterContext.Period = TickPeriod;
|
||||
PeriodicSmiLibraryHandler->RegisterContext.SmiTickInterval = TickPeriod;
|
||||
Status = gSmmPeriodicTimerDispatch2->Register (
|
||||
gSmmPeriodicTimerDispatch2,
|
||||
PeriodicSmiDispatchFunction,
|
||||
&PeriodicSmiLibraryHandler->RegisterContext,
|
||||
&PeriodicSmiLibraryHandler->DispatchHandle
|
||||
);
|
||||
Status = gSmmPeriodicTimerDispatch2->Register (
|
||||
gSmmPeriodicTimerDispatch2,
|
||||
PeriodicSmiDispatchFunction,
|
||||
&PeriodicSmiLibraryHandler->RegisterContext,
|
||||
&PeriodicSmiLibraryHandler->DispatchHandle
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
PeriodicSmiLibraryHandler->DispatchHandle = NULL;
|
||||
ReclaimPeriodicSmiLibraryHandler (PeriodicSmiLibraryHandler);
|
||||
@@ -981,6 +989,7 @@ PeriodicSmiEnable (
|
||||
if (DispatchHandle != NULL) {
|
||||
*DispatchHandle = PeriodicSmiLibraryHandler->DispatchHandle;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1080,7 +1089,7 @@ SmmPeriodicSmiLibConstructor (
|
||||
// Dispatch 2 Protocol supports.
|
||||
//
|
||||
SmiTickInterval = NULL;
|
||||
Count = 0;
|
||||
Count = 0;
|
||||
do {
|
||||
Status = gSmmPeriodicTimerDispatch2->GetNextShorterInterval (
|
||||
gSmmPeriodicTimerDispatch2,
|
||||
@@ -1099,16 +1108,17 @@ SmmPeriodicSmiLibConstructor (
|
||||
// Fill in the table of supported periodic SMI tick periods.
|
||||
//
|
||||
SmiTickInterval = NULL;
|
||||
Count = 0;
|
||||
Count = 0;
|
||||
do {
|
||||
gSmiTickPeriodTable[Count] = 0;
|
||||
Status = gSmmPeriodicTimerDispatch2->GetNextShorterInterval (
|
||||
gSmmPeriodicTimerDispatch2,
|
||||
&SmiTickInterval
|
||||
);
|
||||
Status = gSmmPeriodicTimerDispatch2->GetNextShorterInterval (
|
||||
gSmmPeriodicTimerDispatch2,
|
||||
&SmiTickInterval
|
||||
);
|
||||
if (SmiTickInterval != NULL) {
|
||||
gSmiTickPeriodTable[Count] = *SmiTickInterval;
|
||||
}
|
||||
|
||||
Count++;
|
||||
} while (SmiTickInterval != NULL);
|
||||
|
||||
@@ -1152,7 +1162,7 @@ SmmPeriodicSmiLibDestructor (
|
||||
//
|
||||
for (Link = GetFirstNode (&gPeriodicSmiLibraryHandlers); !IsNull (&gPeriodicSmiLibraryHandlers, Link);) {
|
||||
PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);
|
||||
Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link);
|
||||
Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link);
|
||||
PeriodicSmiDisable (PeriodicSmiLibraryHandler->DispatchHandle);
|
||||
}
|
||||
|
||||
@@ -1161,7 +1171,7 @@ SmmPeriodicSmiLibDestructor (
|
||||
//
|
||||
for (Link = GetFirstNode (&gFreePeriodicSmiLibraryHandlers); !IsNull (&gFreePeriodicSmiLibraryHandlers, Link);) {
|
||||
PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);
|
||||
Link = RemoveEntryList (Link);
|
||||
Link = RemoveEntryList (Link);
|
||||
FreePool (PeriodicSmiLibraryHandler);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user