2 Header file for Multi-Processor support.
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #define DEBUG_CPU_MAX_COUNT 256
21 UINT32 CpuCount
; ///< Processor count
22 UINT16 ApicID
[DEBUG_CPU_MAX_COUNT
]; ///< Record the local apic id for each processor
26 SPIN_LOCK MpContextSpinLock
; ///< Lock for writting MP context
27 SPIN_LOCK DebugPortSpinLock
; ///< Lock for access debug port
28 UINT8 CpuBreakMask
[DEBUG_CPU_MAX_COUNT
/8]; ///< Bitmask of all breaking CPUs
29 UINT8 CpuStopStatusMask
[DEBUG_CPU_MAX_COUNT
/8]; ///< Bitmask of CPU stop status
30 UINT32 ViewPointIndex
; ///< Current view point to be debugged
31 UINT32 BspIndex
; ///< Processor index value of BSP
32 UINT32 BreakAtCpuIndex
; ///< Processor index value of the current breaking CPU
33 UINT32 DebugTimerInitCount
; ///< Record BSP's init timer count
34 BOOLEAN IpiSentByAp
; ///< TRUR: IPI is sent by AP. TALSE: IPI is sent by BSP
35 BOOLEAN RunCommandSet
; ///< TRUE: RUN commmand is not executed. FALSE : RUN command is executed.
38 extern CONST BOOLEAN MultiProcessorDebugSupport
;
39 extern DEBUG_MP_CONTEXT
volatile mDebugMpContext
;
40 extern DEBUG_CPU_DATA
volatile mDebugCpuData
;
43 Break the other processor by send IPI.
45 @param[in] CurrentProcessorIndex Current processor index value.
50 IN UINT32 CurrentProcessorIndex
54 Get the current processor's index.
56 @return Processor index value.
65 Acquire access control on MP context.
67 It will block in the function if cannot get the access control.
71 AcquireMpContextControl (
76 Release access control on MP context.
80 ReleaseMpContextControl (
85 Acquire access control on debug port.
87 It will block in the function if cannot get the access control.
91 AcquireDebugPortControl (
96 Release access control on debug port.
100 ReleaseDebugPortControl (
105 Check if the specified processor is BSP or not.
107 @param[in] ProcessorIndex Processor index value.
109 @retval TRUE It is BSP.
110 @retval FALSE It isn't BSP.
115 IN UINT32 ProcessorIndex
119 Set processor stop flag bitmask in MP context.
121 @param[in] ProcessorIndex Processor index value.
122 @param[in] StopFlag TRUE means set stop flag.
123 FALSE means clean break flag.
127 SetCpuStopFlagByIndex (
128 IN UINT32 ProcessorIndex
,
133 Set processor break flag bitmask in MP context.
135 @param[in] ProcessorIndex Processor index value.
136 @param[in] BreakFlag TRUE means set break flag.
137 FALSE means clean break flag.
141 SetCpuBreakFlagByIndex (
142 IN UINT32 ProcessorIndex
,
147 Check if processor is stopped already.
149 @param[in] ProcessorIndex Processor index value.
151 @retval TRUE Processor is stopped already.
152 @retval FALSE Processor isn't stopped.
157 IN UINT32 ProcessorIndex
161 Set the run command flag.
163 @param[in] RunningFlag TRUE means run command flag is set.
164 FALSE means run command flag is cleared.
169 IN BOOLEAN RunningFlag
173 Set the current view point to be debugged.
175 @param[in] ProcessorIndex Processor index value.
180 IN UINT32 ProcessorIndex
184 Initialize debug timer.
186 @param[in] IpiSentByApFlag TRUE means this IPI is sent by AP.
187 FALSE means this IPI is sent by BSP.
192 IN BOOLEAN IpiSentByApFlag
196 Check if any processor breaks.
198 @retval others There is at least one processor broken, the minimum
199 index number of Processor returned.
200 @retval -1 No any processor broken.
209 Check if all processors are in running status.
211 @retval TRUE All processors run.
212 @retval FALSE At least one processor does not run.