1.UEFI 事件服务
UEFI 启动服务提供了很多函数来实现事件的调用:
// Event & Timer Services
//
EFI_CREATE_EVENT CreateEvent;
EFI_SET_TIMER SetTimer;
EFI_WAIT_FOR_EVENT WaitForEvent;
EFI_SIGNAL_EVENT SignalEvent;
EFI_CLOSE_EVENT CloseEvent;
EFI_CHECK_EVENT CheckEvent;
每个流程大致是这样的
2. UEFI回调函数执行
我们可以看到最终把回调事件加入到队列中。队列如何插入数据的我们单独在数据结构的专栏里面说明UEFI event 队列,这里不过多说明。加入到链表之后并没有执行。最后我们发现是在定时器里面执行的。
3. 事件队列初始化
CreateEvent用来创建事件,如果创建成功会把要执行的函数加入到gEventSignalQueue队列中。
//
// The Event's NotifyFunction must be queued whenever the event is signaled
//
InsertHeadList (&gEventSignalQueue, &IEvent->SignalLink);
队列在初始化函数CoreInitializeEventServices中初始化
for (Index=0; Index <= TPL_HIGH_LEVEL; Index++) {
InitializeListHead (&gEventQueue[Index]);
}
进一步可以发现该函数理所当然的在DxeMain函数中调用
//
// Initialize the Event Services
//
Status = CoreInitializeEventServices ();