MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg 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
7c7184e201
commit
1436aea4d5
@@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "DxeMain.h"
|
||||
#include "Event.h"
|
||||
|
||||
@@ -19,27 +18,27 @@ EFI_TPL gEfiCurrentTpl = TPL_APPLICATION;
|
||||
///
|
||||
/// gEventQueueLock - Protects the event queues
|
||||
///
|
||||
EFI_LOCK gEventQueueLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
|
||||
EFI_LOCK gEventQueueLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
|
||||
|
||||
///
|
||||
/// gEventQueue - A list of event's to notify for each priority level
|
||||
///
|
||||
LIST_ENTRY gEventQueue[TPL_HIGH_LEVEL + 1];
|
||||
LIST_ENTRY gEventQueue[TPL_HIGH_LEVEL + 1];
|
||||
|
||||
///
|
||||
/// gEventPending - A bitmask of the EventQueues that are pending
|
||||
///
|
||||
UINTN gEventPending = 0;
|
||||
UINTN gEventPending = 0;
|
||||
|
||||
///
|
||||
/// gEventSignalQueue - A list of events to signal based on EventGroup type
|
||||
///
|
||||
LIST_ENTRY gEventSignalQueue = INITIALIZE_LIST_HEAD_VARIABLE (gEventSignalQueue);
|
||||
LIST_ENTRY gEventSignalQueue = INITIALIZE_LIST_HEAD_VARIABLE (gEventSignalQueue);
|
||||
|
||||
///
|
||||
/// Enumerate the valid types
|
||||
///
|
||||
UINT32 mEventTable[] = {
|
||||
UINT32 mEventTable[] = {
|
||||
///
|
||||
/// 0x80000200 Timer event with a notification function that is
|
||||
/// queue when the event is signaled with SignalEvent()
|
||||
@@ -85,8 +84,7 @@ UINT32 mEventTable[] = {
|
||||
///
|
||||
/// gIdleLoopEvent - Event which is signalled when the core is idle
|
||||
///
|
||||
EFI_EVENT gIdleLoopEvent = NULL;
|
||||
|
||||
EFI_EVENT gIdleLoopEvent = NULL;
|
||||
|
||||
/**
|
||||
Enter critical section by acquiring the lock on gEventQueueLock.
|
||||
@@ -100,7 +98,6 @@ CoreAcquireEventLock (
|
||||
CoreAcquireLock (&gEventQueueLock);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Exit critical section by releasing the lock on gEventQueueLock.
|
||||
|
||||
@@ -113,8 +110,6 @@ CoreReleaseEventLock (
|
||||
CoreReleaseLock (&gEventQueueLock);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initializes "event" support.
|
||||
|
||||
@@ -126,9 +121,9 @@ CoreInitializeEventServices (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index;
|
||||
|
||||
for (Index=0; Index <= TPL_HIGH_LEVEL; Index++) {
|
||||
for (Index = 0; Index <= TPL_HIGH_LEVEL; Index++) {
|
||||
InitializeListHead (&gEventQueue[Index]);
|
||||
}
|
||||
|
||||
@@ -146,8 +141,6 @@ CoreInitializeEventServices (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Dispatches all pending events.
|
||||
|
||||
@@ -157,11 +150,11 @@ CoreInitializeEventServices (
|
||||
**/
|
||||
VOID
|
||||
CoreDispatchEventNotifies (
|
||||
IN EFI_TPL Priority
|
||||
IN EFI_TPL Priority
|
||||
)
|
||||
{
|
||||
IEVENT *Event;
|
||||
LIST_ENTRY *Head;
|
||||
IEVENT *Event;
|
||||
LIST_ENTRY *Head;
|
||||
|
||||
CoreAcquireEventLock ();
|
||||
ASSERT (gEventQueueLock.OwnerTpl == Priority);
|
||||
@@ -171,7 +164,6 @@ CoreDispatchEventNotifies (
|
||||
// Dispatch all the pending notifications
|
||||
//
|
||||
while (!IsListEmpty (Head)) {
|
||||
|
||||
Event = CR (Head->ForwardLink, IEVENT, NotifyLink, EVENT_SIGNATURE);
|
||||
RemoveEntryList (&Event->NotifyLink);
|
||||
|
||||
@@ -203,8 +195,6 @@ CoreDispatchEventNotifies (
|
||||
CoreReleaseEventLock ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Queues the event's notification function to fire.
|
||||
|
||||
@@ -213,10 +203,9 @@ CoreDispatchEventNotifies (
|
||||
**/
|
||||
VOID
|
||||
CoreNotifyEvent (
|
||||
IN IEVENT *Event
|
||||
IN IEVENT *Event
|
||||
)
|
||||
{
|
||||
|
||||
//
|
||||
// Event database must be locked
|
||||
//
|
||||
@@ -239,9 +228,6 @@ CoreNotifyEvent (
|
||||
gEventPending |= (UINTN)(1 << Event->NotifyTpl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Signals all events in the EventGroup.
|
||||
|
||||
@@ -250,12 +236,12 @@ CoreNotifyEvent (
|
||||
**/
|
||||
VOID
|
||||
CoreNotifySignalList (
|
||||
IN EFI_GUID *EventGroup
|
||||
IN EFI_GUID *EventGroup
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *Head;
|
||||
IEVENT *Event;
|
||||
LIST_ENTRY *Link;
|
||||
LIST_ENTRY *Head;
|
||||
IEVENT *Event;
|
||||
|
||||
CoreAcquireEventLock ();
|
||||
|
||||
@@ -270,7 +256,6 @@ CoreNotifySignalList (
|
||||
CoreReleaseEventLock ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Creates an event.
|
||||
|
||||
@@ -292,18 +277,16 @@ CoreNotifySignalList (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreCreateEvent (
|
||||
IN UINT32 Type,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
|
||||
IN VOID *NotifyContext OPTIONAL,
|
||||
OUT EFI_EVENT *Event
|
||||
IN UINT32 Type,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
|
||||
IN VOID *NotifyContext OPTIONAL,
|
||||
OUT EFI_EVENT *Event
|
||||
)
|
||||
{
|
||||
return CoreCreateEventEx (Type, NotifyTpl, NotifyFunction, NotifyContext, NULL, Event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Creates an event in a group.
|
||||
|
||||
@@ -327,21 +310,22 @@ CoreCreateEvent (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreCreateEventEx (
|
||||
IN UINT32 Type,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
|
||||
IN CONST VOID *NotifyContext OPTIONAL,
|
||||
IN CONST EFI_GUID *EventGroup OPTIONAL,
|
||||
OUT EFI_EVENT *Event
|
||||
IN UINT32 Type,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
|
||||
IN CONST VOID *NotifyContext OPTIONAL,
|
||||
IN CONST EFI_GUID *EventGroup OPTIONAL,
|
||||
OUT EFI_EVENT *Event
|
||||
)
|
||||
{
|
||||
//
|
||||
// If it's a notify type of event, check for invalid NotifyTpl
|
||||
//
|
||||
if ((Type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL)) != 0) {
|
||||
if (NotifyTpl != TPL_APPLICATION &&
|
||||
NotifyTpl != TPL_CALLBACK &&
|
||||
NotifyTpl != TPL_NOTIFY) {
|
||||
if ((NotifyTpl != TPL_APPLICATION) &&
|
||||
(NotifyTpl != TPL_CALLBACK) &&
|
||||
(NotifyTpl != TPL_NOTIFY))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
@@ -372,18 +356,17 @@ CoreCreateEventEx (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreCreateEventInternal (
|
||||
IN UINT32 Type,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
|
||||
IN CONST VOID *NotifyContext OPTIONAL,
|
||||
IN CONST EFI_GUID *EventGroup OPTIONAL,
|
||||
OUT EFI_EVENT *Event
|
||||
IN UINT32 Type,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
|
||||
IN CONST VOID *NotifyContext OPTIONAL,
|
||||
IN CONST EFI_GUID *EventGroup OPTIONAL,
|
||||
OUT EFI_EVENT *Event
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
IEVENT *IEvent;
|
||||
INTN Index;
|
||||
|
||||
EFI_STATUS Status;
|
||||
IEVENT *IEvent;
|
||||
INTN Index;
|
||||
|
||||
if (Event == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -394,12 +377,13 @@ CoreCreateEventInternal (
|
||||
//
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
for (Index = 0; Index < (sizeof (mEventTable) / sizeof (UINT32)); Index++) {
|
||||
if (Type == mEventTable[Index]) {
|
||||
Status = EFI_SUCCESS;
|
||||
break;
|
||||
}
|
||||
if (Type == mEventTable[Index]) {
|
||||
Status = EFI_SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(EFI_ERROR (Status)) {
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -414,6 +398,7 @@ CoreCreateEventInternal (
|
||||
if ((Type == EVT_SIGNAL_EXIT_BOOT_SERVICES) || (Type == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (CompareGuid (EventGroup, &gEfiEventExitBootServicesGuid)) {
|
||||
Type = EVT_SIGNAL_EXIT_BOOT_SERVICES;
|
||||
} else if (CompareGuid (EventGroup, &gEfiEventVirtualAddressChangeGuid)) {
|
||||
@@ -439,17 +424,17 @@ CoreCreateEventInternal (
|
||||
//
|
||||
if ((NotifyFunction == NULL) ||
|
||||
(NotifyTpl <= TPL_APPLICATION) ||
|
||||
(NotifyTpl >= TPL_HIGH_LEVEL)) {
|
||||
(NotifyTpl >= TPL_HIGH_LEVEL))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// No notification needed, zero ignored values
|
||||
//
|
||||
NotifyTpl = 0;
|
||||
NotifyTpl = 0;
|
||||
NotifyFunction = NULL;
|
||||
NotifyContext = NULL;
|
||||
NotifyContext = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -460,12 +445,13 @@ CoreCreateEventInternal (
|
||||
} else {
|
||||
IEvent = AllocateZeroPool (sizeof (IEVENT));
|
||||
}
|
||||
|
||||
if (IEvent == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
IEvent->Signature = EVENT_SIGNATURE;
|
||||
IEvent->Type = Type;
|
||||
IEvent->Type = Type;
|
||||
|
||||
IEvent->NotifyTpl = NotifyTpl;
|
||||
IEvent->NotifyFunction = NotifyFunction;
|
||||
@@ -484,7 +470,7 @@ CoreCreateEventInternal (
|
||||
IEvent->RuntimeData.Type = Type;
|
||||
IEvent->RuntimeData.NotifyTpl = NotifyTpl;
|
||||
IEvent->RuntimeData.NotifyFunction = NotifyFunction;
|
||||
IEvent->RuntimeData.NotifyContext = (VOID *) NotifyContext;
|
||||
IEvent->RuntimeData.NotifyContext = (VOID *)NotifyContext;
|
||||
//
|
||||
// Work around the bug in the Platform Init specification (v1.7), reported
|
||||
// as Mantis#2017: "EFI_RUNTIME_EVENT_ENTRY.Event" should have type
|
||||
@@ -493,7 +479,7 @@ CoreCreateEventInternal (
|
||||
// doesn't match the natural language description. Therefore we need an
|
||||
// explicit cast here.
|
||||
//
|
||||
IEvent->RuntimeData.Event = (EFI_EVENT *) IEvent;
|
||||
IEvent->RuntimeData.Event = (EFI_EVENT *)IEvent;
|
||||
InsertTailList (&gRuntime->EventHead, &IEvent->RuntimeData.Link);
|
||||
}
|
||||
|
||||
@@ -514,9 +500,6 @@ CoreCreateEventInternal (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Signals the event. Queues the event to be notified if needed.
|
||||
|
||||
@@ -529,10 +512,10 @@ CoreCreateEventInternal (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreSignalEvent (
|
||||
IN EFI_EVENT UserEvent
|
||||
IN EFI_EVENT UserEvent
|
||||
)
|
||||
{
|
||||
IEVENT *Event;
|
||||
IEVENT *Event;
|
||||
|
||||
Event = UserEvent;
|
||||
|
||||
@@ -565,7 +548,7 @@ CoreSignalEvent (
|
||||
CoreReleaseEventLock ();
|
||||
CoreNotifySignalList (&Event->EventGroup);
|
||||
CoreAcquireEventLock ();
|
||||
} else {
|
||||
} else {
|
||||
CoreNotifyEvent (Event);
|
||||
}
|
||||
}
|
||||
@@ -575,8 +558,6 @@ CoreSignalEvent (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Check the status of an event.
|
||||
|
||||
@@ -590,7 +571,7 @@ CoreSignalEvent (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreCheckEvent (
|
||||
IN EFI_EVENT UserEvent
|
||||
IN EFI_EVENT UserEvent
|
||||
)
|
||||
{
|
||||
IEVENT *Event;
|
||||
@@ -613,7 +594,6 @@ CoreCheckEvent (
|
||||
Status = EFI_NOT_READY;
|
||||
|
||||
if ((Event->SignalCount == 0) && ((Event->Type & EVT_NOTIFY_WAIT) != 0)) {
|
||||
|
||||
//
|
||||
// Queue the wait notify function
|
||||
//
|
||||
@@ -621,6 +601,7 @@ CoreCheckEvent (
|
||||
if (Event->SignalCount == 0) {
|
||||
CoreNotifyEvent (Event);
|
||||
}
|
||||
|
||||
CoreReleaseEventLock ();
|
||||
}
|
||||
|
||||
@@ -633,7 +614,7 @@ CoreCheckEvent (
|
||||
|
||||
if (Event->SignalCount != 0) {
|
||||
Event->SignalCount = 0;
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
CoreReleaseEventLock ();
|
||||
@@ -642,8 +623,6 @@ CoreCheckEvent (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Stops execution until an event is signaled.
|
||||
|
||||
@@ -661,13 +640,13 @@ CoreCheckEvent (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreWaitForEvent (
|
||||
IN UINTN NumberOfEvents,
|
||||
IN EFI_EVENT *UserEvents,
|
||||
OUT UINTN *UserIndex
|
||||
IN UINTN NumberOfEvents,
|
||||
IN EFI_EVENT *UserEvents,
|
||||
OUT UINTN *UserIndex
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// Can only WaitForEvent at TPL_APPLICATION
|
||||
@@ -684,10 +663,8 @@ CoreWaitForEvent (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
for(;;) {
|
||||
|
||||
for(Index = 0; Index < NumberOfEvents; Index++) {
|
||||
|
||||
for ( ; ;) {
|
||||
for (Index = 0; Index < NumberOfEvents; Index++) {
|
||||
Status = CoreCheckEvent (UserEvents[Index]);
|
||||
|
||||
//
|
||||
@@ -697,6 +674,7 @@ CoreWaitForEvent (
|
||||
if (UserIndex != NULL) {
|
||||
*UserIndex = Index;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
@@ -708,7 +686,6 @@ CoreWaitForEvent (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Closes an event and frees the event structure.
|
||||
|
||||
@@ -721,7 +698,7 @@ CoreWaitForEvent (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreCloseEvent (
|
||||
IN EFI_EVENT UserEvent
|
||||
IN EFI_EVENT UserEvent
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -776,7 +753,7 @@ CoreCloseEvent (
|
||||
// clear the Signature of Event before free pool.
|
||||
//
|
||||
Event->Signature = 0;
|
||||
Status = CoreFreePool (Event);
|
||||
Status = CoreFreePool (Event);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
|
@@ -10,18 +10,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef __EVENT_H__
|
||||
#define __EVENT_H__
|
||||
|
||||
|
||||
#define VALID_TPL(a) ((a) <= TPL_HIGH_LEVEL)
|
||||
extern UINTN gEventPending;
|
||||
#define VALID_TPL(a) ((a) <= TPL_HIGH_LEVEL)
|
||||
extern UINTN gEventPending;
|
||||
|
||||
///
|
||||
/// Set if Event is part of an event group
|
||||
///
|
||||
#define EVT_EXFLAG_EVENT_GROUP 0x01
|
||||
#define EVT_EXFLAG_EVENT_GROUP 0x01
|
||||
///
|
||||
/// Set if Event is registered on a protocol notify
|
||||
///
|
||||
#define EVT_EXFLAG_EVENT_PROTOCOL_NOTIFICATION 0x02
|
||||
#define EVT_EXFLAG_EVENT_PROTOCOL_NOTIFICATION 0x02
|
||||
|
||||
//
|
||||
// EFI_EVENT
|
||||
@@ -31,41 +30,40 @@ extern UINTN gEventPending;
|
||||
/// Timer event information
|
||||
///
|
||||
typedef struct {
|
||||
LIST_ENTRY Link;
|
||||
UINT64 TriggerTime;
|
||||
UINT64 Period;
|
||||
LIST_ENTRY Link;
|
||||
UINT64 TriggerTime;
|
||||
UINT64 Period;
|
||||
} TIMER_EVENT_INFO;
|
||||
|
||||
#define EVENT_SIGNATURE SIGNATURE_32('e','v','n','t')
|
||||
#define EVENT_SIGNATURE SIGNATURE_32('e','v','n','t')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
UINT32 Type;
|
||||
UINT32 SignalCount;
|
||||
UINTN Signature;
|
||||
UINT32 Type;
|
||||
UINT32 SignalCount;
|
||||
///
|
||||
/// Entry if the event is registered to be signalled
|
||||
///
|
||||
LIST_ENTRY SignalLink;
|
||||
LIST_ENTRY SignalLink;
|
||||
///
|
||||
/// Notification information for this event
|
||||
///
|
||||
EFI_TPL NotifyTpl;
|
||||
EFI_EVENT_NOTIFY NotifyFunction;
|
||||
VOID *NotifyContext;
|
||||
EFI_GUID EventGroup;
|
||||
LIST_ENTRY NotifyLink;
|
||||
UINT8 ExFlag;
|
||||
EFI_TPL NotifyTpl;
|
||||
EFI_EVENT_NOTIFY NotifyFunction;
|
||||
VOID *NotifyContext;
|
||||
EFI_GUID EventGroup;
|
||||
LIST_ENTRY NotifyLink;
|
||||
UINT8 ExFlag;
|
||||
///
|
||||
/// A list of all runtime events
|
||||
///
|
||||
EFI_RUNTIME_EVENT_ENTRY RuntimeData;
|
||||
TIMER_EVENT_INFO Timer;
|
||||
EFI_RUNTIME_EVENT_ENTRY RuntimeData;
|
||||
TIMER_EVENT_INFO Timer;
|
||||
} IEVENT;
|
||||
|
||||
//
|
||||
// Internal prototypes
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
Dispatches all pending events.
|
||||
|
||||
@@ -75,10 +73,9 @@ typedef struct {
|
||||
**/
|
||||
VOID
|
||||
CoreDispatchEventNotifies (
|
||||
IN EFI_TPL Priority
|
||||
IN EFI_TPL Priority
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Initializes timer support.
|
||||
|
||||
|
@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "DxeMain.h"
|
||||
#include "Event.h"
|
||||
|
||||
@@ -14,16 +13,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
// Internal data
|
||||
//
|
||||
|
||||
LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);
|
||||
EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);
|
||||
EFI_EVENT mEfiCheckTimerEvent = NULL;
|
||||
LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);
|
||||
EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);
|
||||
EFI_EVENT mEfiCheckTimerEvent = NULL;
|
||||
|
||||
EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
|
||||
UINT64 mEfiSystemTime = 0;
|
||||
EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
|
||||
UINT64 mEfiSystemTime = 0;
|
||||
|
||||
//
|
||||
// Timer functions
|
||||
//
|
||||
|
||||
/**
|
||||
Inserts the timer event.
|
||||
|
||||
@@ -33,12 +33,12 @@ UINT64 mEfiSystemTime = 0;
|
||||
**/
|
||||
VOID
|
||||
CoreInsertEventTimer (
|
||||
IN IEVENT *Event
|
||||
IN IEVENT *Event
|
||||
)
|
||||
{
|
||||
UINT64 TriggerTime;
|
||||
LIST_ENTRY *Link;
|
||||
IEVENT *Event2;
|
||||
UINT64 TriggerTime;
|
||||
LIST_ENTRY *Link;
|
||||
IEVENT *Event2;
|
||||
|
||||
ASSERT_LOCKED (&mEfiTimerLock);
|
||||
|
||||
@@ -72,7 +72,7 @@ CoreCurrentSystemTime (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT64 SystemTime;
|
||||
UINT64 SystemTime;
|
||||
|
||||
CoreAcquireLock (&mEfiSystemTimeLock);
|
||||
SystemTime = mEfiSystemTime;
|
||||
@@ -92,12 +92,12 @@ CoreCurrentSystemTime (
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreCheckTimers (
|
||||
IN EFI_EVENT CheckEvent,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT CheckEvent,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT64 SystemTime;
|
||||
IEVENT *Event;
|
||||
UINT64 SystemTime;
|
||||
IEVENT *Event;
|
||||
|
||||
//
|
||||
// Check the timer database for expired timers
|
||||
@@ -154,7 +154,6 @@ CoreCheckTimers (
|
||||
CoreReleaseLock (&mEfiTimerLock);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initializes timer support.
|
||||
|
||||
@@ -177,7 +176,6 @@ CoreInitializeTimer (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Called by the platform code to process a tick.
|
||||
|
||||
@@ -188,10 +186,10 @@ CoreInitializeTimer (
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreTimerTick (
|
||||
IN UINT64 Duration
|
||||
IN UINT64 Duration
|
||||
)
|
||||
{
|
||||
IEVENT *Event;
|
||||
IEVENT *Event;
|
||||
|
||||
//
|
||||
// Check runtiem flag in case there are ticks while exiting boot services
|
||||
@@ -218,8 +216,6 @@ CoreTimerTick (
|
||||
CoreReleaseLock (&mEfiSystemTimeLock);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Sets the type of timer and the trigger time for a timer event.
|
||||
|
||||
@@ -238,12 +234,12 @@ CoreTimerTick (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CoreSetTimer (
|
||||
IN EFI_EVENT UserEvent,
|
||||
IN EFI_TIMER_DELAY Type,
|
||||
IN UINT64 TriggerTime
|
||||
IN EFI_EVENT UserEvent,
|
||||
IN EFI_TIMER_DELAY Type,
|
||||
IN UINT64 TriggerTime
|
||||
)
|
||||
{
|
||||
IEVENT *Event;
|
||||
IEVENT *Event;
|
||||
|
||||
Event = UserEvent;
|
||||
|
||||
@@ -255,7 +251,7 @@ CoreSetTimer (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if ((UINT32)Type > TimerRelative || (Event->Type & EVT_TIMER) == 0) {
|
||||
if (((UINT32)Type > TimerRelative) || ((Event->Type & EVT_TIMER) == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -270,14 +266,14 @@ CoreSetTimer (
|
||||
}
|
||||
|
||||
Event->Timer.TriggerTime = 0;
|
||||
Event->Timer.Period = 0;
|
||||
Event->Timer.Period = 0;
|
||||
|
||||
if (Type != TimerCancel) {
|
||||
|
||||
if (Type == TimerPeriodic) {
|
||||
if (TriggerTime == 0) {
|
||||
gTimer->GetTimerPeriod (gTimer, &TriggerTime);
|
||||
}
|
||||
|
||||
Event->Timer.Period = TriggerTime;
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
VOID
|
||||
CoreSetInterruptState (
|
||||
IN BOOLEAN Enable
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -26,21 +26,23 @@ CoreSetInterruptState (
|
||||
if (gCpu == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enable) {
|
||||
gCpu->DisableInterrupt (gCpu);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gSmmBase2 == NULL) {
|
||||
gCpu->EnableInterrupt (gCpu);
|
||||
return;
|
||||
}
|
||||
|
||||
Status = gSmmBase2->InSmm (gSmmBase2, &InSmm);
|
||||
if (!EFI_ERROR (Status) && !InSmm) {
|
||||
gCpu->EnableInterrupt(gCpu);
|
||||
gCpu->EnableInterrupt (gCpu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Raise the task priority level to the new level.
|
||||
High level is implemented by disabling processor interrupts.
|
||||
@@ -53,22 +55,23 @@ CoreSetInterruptState (
|
||||
EFI_TPL
|
||||
EFIAPI
|
||||
CoreRaiseTpl (
|
||||
IN EFI_TPL NewTpl
|
||||
IN EFI_TPL NewTpl
|
||||
)
|
||||
{
|
||||
EFI_TPL OldTpl;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
OldTpl = gEfiCurrentTpl;
|
||||
if (OldTpl > NewTpl) {
|
||||
DEBUG ((DEBUG_ERROR, "FATAL ERROR - RaiseTpl with OldTpl(0x%x) > NewTpl(0x%x)\n", OldTpl, NewTpl));
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
ASSERT (VALID_TPL (NewTpl));
|
||||
|
||||
//
|
||||
// If raising to high level, disable interrupts
|
||||
//
|
||||
if (NewTpl >= TPL_HIGH_LEVEL && OldTpl < TPL_HIGH_LEVEL) {
|
||||
if ((NewTpl >= TPL_HIGH_LEVEL) && (OldTpl < TPL_HIGH_LEVEL)) {
|
||||
CoreSetInterruptState (FALSE);
|
||||
}
|
||||
|
||||
@@ -80,9 +83,6 @@ CoreRaiseTpl (
|
||||
return OldTpl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Lowers the task priority to the previous value. If the new
|
||||
priority unmasks events at a higher priority, they are dispatched.
|
||||
@@ -93,17 +93,18 @@ CoreRaiseTpl (
|
||||
VOID
|
||||
EFIAPI
|
||||
CoreRestoreTpl (
|
||||
IN EFI_TPL NewTpl
|
||||
IN EFI_TPL NewTpl
|
||||
)
|
||||
{
|
||||
EFI_TPL OldTpl;
|
||||
EFI_TPL PendingTpl;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_TPL PendingTpl;
|
||||
|
||||
OldTpl = gEfiCurrentTpl;
|
||||
if (NewTpl > OldTpl) {
|
||||
DEBUG ((DEBUG_ERROR, "FATAL ERROR - RestoreTpl with NewTpl(0x%x) > OldTpl(0x%x)\n", NewTpl, OldTpl));
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
ASSERT (VALID_TPL (NewTpl));
|
||||
|
||||
//
|
||||
@@ -111,7 +112,7 @@ CoreRestoreTpl (
|
||||
// interrupts are enabled
|
||||
//
|
||||
|
||||
if (OldTpl >= TPL_HIGH_LEVEL && NewTpl < TPL_HIGH_LEVEL) {
|
||||
if ((OldTpl >= TPL_HIGH_LEVEL) && (NewTpl < TPL_HIGH_LEVEL)) {
|
||||
gEfiCurrentTpl = TPL_HIGH_LEVEL;
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ CoreRestoreTpl (
|
||||
// Dispatch any pending events
|
||||
//
|
||||
while (gEventPending != 0) {
|
||||
PendingTpl = (UINTN) HighBitSet64 (gEventPending);
|
||||
PendingTpl = (UINTN)HighBitSet64 (gEventPending);
|
||||
if (PendingTpl <= NewTpl) {
|
||||
break;
|
||||
}
|
||||
@@ -128,6 +129,7 @@ CoreRestoreTpl (
|
||||
if (gEfiCurrentTpl < TPL_HIGH_LEVEL) {
|
||||
CoreSetInterruptState (TRUE);
|
||||
}
|
||||
|
||||
CoreDispatchEventNotifies (gEfiCurrentTpl);
|
||||
}
|
||||
|
||||
@@ -144,5 +146,4 @@ CoreRestoreTpl (
|
||||
if (gEfiCurrentTpl < TPL_HIGH_LEVEL) {
|
||||
CoreSetInterruptState (TRUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user