TianoCore EDK2 master
Loading...
Searching...
No Matches
MpServicesInternal.h
Go to the documentation of this file.
1
11#ifndef MP_SERVICES_INTERNAL_H_
12#define MP_SERVICES_INTERNAL_H_
13
14#include <Protocol/Cpu.h>
15#include <Protocol/MpService.h>
16
17#include <Library/BaseLib.h>
18#include <Library/UefiLib.h>
19
20#define AP_STACK_SIZE 0x1000
21
22//
23// Internal Data Structures
24//
25
26//
27// AP state
28//
29// The state transitions for an AP when it processes a procedure are:
30// Idle ----> Ready ----> Busy ----> Finished ----> Idle
31// [BSP] [BSP] [AP] [BSP]
32//
33typedef enum {
34 CpuStateIdle,
35 CpuStateReady,
36 CpuStateBlocked,
37 CpuStateBusy,
38 CpuStateFinished,
39 CpuStateDisabled
40} CPU_STATE;
41
42//
43// Define Individual Processor Data block.
44//
45typedef struct {
47 EFI_AP_PROCEDURE Procedure;
48 VOID *Parameter;
49 CPU_STATE State;
50 EFI_EVENT CheckThisAPEvent;
51 EFI_EVENT WaitEvent;
52 UINTN Timeout;
53 UINTN TimeTaken;
54 BOOLEAN TimeoutActive;
55 BOOLEAN *SingleApFinished;
57
58//
59// Define MP data block which consumes individual processor block.
60//
61typedef struct {
62 UINTN NumberOfProcessors;
63 UINTN NumberOfEnabledProcessors;
64 EFI_EVENT CheckAllAPsEvent;
65 EFI_EVENT AllWaitEvent;
66 UINTN FinishCount;
67 UINTN StartCount;
68 EFI_AP_PROCEDURE Procedure;
69 VOID *ProcedureArgument;
70 BOOLEAN SingleThread;
71 UINTN StartedNumber;
72 CPU_AP_DATA *CpuData;
73 UINTN *FailedList;
74 UINTN FailedListIndex;
75 UINTN AllTimeout;
76 UINTN AllTimeTaken;
77 BOOLEAN AllTimeoutActive;
79
83VOID
85 VOID
86 );
87
91VOID
93 VOID
94 );
95
105STATIC
107EFIAPI
109 IN UINTN ProcessorIndex
110 );
111
118STATIC
119BOOLEAN
121 UINTN ProcessorIndex
122 );
123
128STATIC
129BOOLEAN
131 VOID
132 );
133
140STATIC
141BOOLEAN
143 UINTN ProcessorIndex
144 );
145
154STATIC
155VOID
157 IN CPU_AP_DATA *CpuData,
158 IN EFI_AP_PROCEDURE Procedure,
159 IN VOID *ProcedureArgument
160 );
161
169CPU_STATE
171 IN CPU_AP_DATA *CpuData
172 );
173
182STATIC
185 OUT UINTN *NextNumber
186 );
187
195STATIC
196UINTN
198 IN UINTN Timeout
199 );
200
206STATIC
207VOID
209 IN BOOLEAN SingleThread
210 );
211
225STATIC
228 IN EFI_AP_PROCEDURE Procedure,
229 IN VOID *ProcedureArgument,
230 IN EFI_EVENT WaitEvent,
231 IN UINTN TimeoutInMicroseconds,
232 IN BOOLEAN SingleThread,
233 IN UINTN **FailedCpuList
234 );
235
247STATIC
250 IN EFI_AP_PROCEDURE Procedure,
251 IN VOID *ProcedureArgument,
252 IN UINTN TimeoutInMicroseconds,
253 IN BOOLEAN SingleThread,
254 IN UINTN **FailedCpuList
255 );
256
263STATIC
264VOID
266 UINTN ProcessorIndex,
267 CPU_STATE ApState
268 );
269
273STATIC
274VOID
276 VOID
277 );
278
286STATIC
287VOID
288EFIAPI
290 IN EFI_EVENT Event,
291 IN VOID *Context
292 );
293
300STATIC
301VOID
302EFIAPI
304 IN EFI_EVENT Event,
305 IN VOID *Context
306 );
307
320STATIC
323 IN BOOLEAN BSP,
324 IN UINTN Mpidr,
325 IN UINTN ProcessorIndex
326 );
327
337STATIC
338VOID
339EFIAPI
341 IN EFI_EVENT Event,
342 IN VOID *Context
343 );
344
345#endif /* MP_SERVICES_INTERNAL_H_ */
UINT64 UINTN
#define STATIC
Definition: Base.h:264
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
CPU_STATE GetApState(IN CPU_AP_DATA *CpuData)
STATIC EFI_STATUS FillInProcessorInformation(IN BOOLEAN BSP, IN UINTN Mpidr, IN UINTN ProcessorIndex)
STATIC EFI_STATUS EFIAPI DispatchCpu(IN UINTN ProcessorIndex)
STATIC EFI_STATUS StartupAllAPsWithWaitEvent(IN EFI_AP_PROCEDURE Procedure, IN VOID *ProcedureArgument, IN EFI_EVENT WaitEvent, IN UINTN TimeoutInMicroseconds, IN BOOLEAN SingleThread, IN UINTN **FailedCpuList)
STATIC BOOLEAN IsProcessorBSP(UINTN ProcessorIndex)
STATIC VOID StartupAllAPsPrepareState(IN BOOLEAN SingleThread)
VOID ApEntryPoint(VOID)
VOID ApProcedure(VOID)
STATIC BOOLEAN IsProcessorEnabled(UINTN ProcessorIndex)
STATIC UINTN CalculateAndStallInterval(IN UINTN Timeout)
STATIC VOID EFIAPI CheckAllAPsStatus(IN EFI_EVENT Event, IN VOID *Context)
STATIC VOID EFIAPI ReadyToBootSignaled(IN EFI_EVENT Event, IN VOID *Context)
STATIC EFI_STATUS StartupAllAPsNoWaitEvent(IN EFI_AP_PROCEDURE Procedure, IN VOID *ProcedureArgument, IN UINTN TimeoutInMicroseconds, IN BOOLEAN SingleThread, IN UINTN **FailedCpuList)
STATIC VOID SetApProcedure(IN CPU_AP_DATA *CpuData, IN EFI_AP_PROCEDURE Procedure, IN VOID *ProcedureArgument)
STATIC VOID AddProcessorToFailedList(UINTN ProcessorIndex, CPU_STATE ApState)
STATIC VOID EFIAPI CheckThisAPStatus(IN EFI_EVENT Event, IN VOID *Context)
STATIC BOOLEAN IsCurrentProcessorBSP(VOID)
STATIC VOID ProcessStartupAllAPsTimeout(VOID)
STATIC EFI_STATUS GetNextBlockedNumber(OUT UINTN *NextNumber)
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
Definition: PiMultiPhase.h:198
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37