ReactOS 0.4.15-dev-7670-g69b08be
smp.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PROCESSOR_IDENTITY
 
struct  _HALP_APIC_INFO_TABLE
 

Typedefs

typedef struct _PROCESSOR_IDENTITY PROCESSOR_IDENTITY
 
typedef struct _PROCESSOR_IDENTITYPPROCESSOR_IDENTITY
 
typedef struct _HALP_APIC_INFO_TABLE HALP_APIC_INFO_TABLE
 
typedef struct _HALP_APIC_INFO_TABLEPHALP_APIC_INFO_TABLE
 

Functions

VOID HalpParseApicTables (_In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID HalpSetupProcessorsTable (_In_ UINT32 NTProcessorNumber)
 
VOID HalpPrintApicTables (VOID)
 
VOID ApicStartApplicationProcessor (_In_ ULONG NTProcessorNumber, _In_ PHYSICAL_ADDRESS StartupLoc)
 
VOID NTAPI HalpRequestIpi (_In_ KAFFINITY TargetProcessors)
 Requests an IPI interrupt on the specified processors.
 
VOID NTAPI HalpBroadcastIpiSpecifyVector (_In_ UCHAR Vector, _In_ BOOLEAN IncludeSelf)
 Broadcasts an IPI with a specified vector to all processors.
 
VOID NTAPI HalRequestIpiSpecifyVector (_In_ KAFFINITY TargetSet, _In_ UCHAR Vector)
 Requests an IPI with a specified vector on the specified processors.
 

Typedef Documentation

◆ HALP_APIC_INFO_TABLE

◆ PHALP_APIC_INFO_TABLE

◆ PPROCESSOR_IDENTITY

◆ PROCESSOR_IDENTITY

Function Documentation

◆ ApicStartApplicationProcessor()

VOID ApicStartApplicationProcessor ( _In_ ULONG  NTProcessorNumber,
_In_ PHYSICAL_ADDRESS  StartupLoc 
)

Definition at line 110 of file apicsmp.c.

113{
114 ASSERT(StartupLoc.HighPart == 0);
115 ASSERT((StartupLoc.QuadPart & 0xFFF) == 0);
116 ASSERT((StartupLoc.QuadPart & 0xFFF00FFF) == 0);
117
118 /* Init IPI */
119 ApicRequestGlobalInterrupt(HalpProcessorIdentity[NTProcessorNumber].LapicId, 0,
121
122 /* De-Assert Init IPI */
123 ApicRequestGlobalInterrupt(HalpProcessorIdentity[NTProcessorNumber].LapicId, 0,
125
126 /* Stall execution for a bit to give APIC time: MPS Spec - B.4 */
128
129 /* Startup IPI */
130 ApicRequestGlobalInterrupt(HalpProcessorIdentity[NTProcessorNumber].LapicId, (StartupLoc.LowPart) >> 12,
132}
@ APIC_DSH_Destination
Definition: apicp.h:151
@ APIC_MT_INIT
Definition: apicp.h:129
@ APIC_MT_Startup
Definition: apicp.h:130
@ APIC_TGM_Level
Definition: apicp.h:138
@ APIC_TGM_Edge
Definition: apicp.h:137
FORCEINLINE VOID ApicRequestGlobalInterrupt(_In_ UCHAR DestinationProcessor, _In_ UCHAR Vector, _In_ APIC_MT MessageType, _In_ APIC_TGM TriggerMode, _In_ APIC_DSH DestinationShortHand)
Definition: apicsmp.c:63
PPROCESSOR_IDENTITY HalpProcessorIdentity
Definition: madt.c:21
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:81
#define ASSERT(a)
Definition: mode.c:44

Referenced by HalStartNextProcessor().

◆ HalpBroadcastIpiSpecifyVector()

VOID NTAPI HalpBroadcastIpiSpecifyVector ( _In_ UCHAR  Vector,
_In_ BOOLEAN  IncludeSelf 
)

Broadcasts an IPI with a specified vector to all processors.

Parameters
Vector- Specifies the interrupt vector to be delivered.
IncludeSelf- Specifies whether to include the current processor.

Definition at line 144 of file apicsmp.c.

147{
148 APIC_DSH DestinationShortHand = IncludeSelf ?
150
151 /* Request the interrupt targeted at all processors */
152 ApicRequestGlobalInterrupt(0, // Ignored
153 Vector,
156 DestinationShortHand);
157}
@ APIC_DSH_AllIncludingSelf
Definition: apicp.h:153
@ APIC_DSH_AllExcludingSelf
Definition: apicp.h:154
@ APIC_MT_Fixed
Definition: apicp.h:124
enum _APIC_DSH APIC_DSH

Referenced by HalRequestIpiSpecifyVector().

◆ HalpParseApicTables()

VOID HalpParseApicTables ( _In_ PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 30 of file madt.c.

32{
33 ULONG_PTR TableEnd;
34 ULONG ValidProcessorCount;
35
36 /* We only support legacy APIC for now, this will be updated in the future */
38 MadtTable = HalAcpiGetTable(LoaderBlock, 'CIPA');
39
43
46
50
51 while ((ULONG_PTR)AcpiHeader <= TableEnd)
52 {
54
57 {
58 ValidProcessorCount = HalpApicInfoTable.ProcessorCount;
59
60 HalpProcessorIdentity[ValidProcessorCount].LapicId = LocalApic->Id;
62
64
66 }
67 else
68 {
69 /* End the parsing early if we don't use the currently selected table */
71 }
72 }
73}
@ ACPI_MADT_TYPE_LOCAL_APIC
Definition: actbl2.h:1005
struct acpi_table_madt ACPI_TABLE_MADT
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
#define ULONG_PTR
Definition: config.h:101
PVOID NTAPI HalAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG Signature)
Definition: halacpi.c:446
ACPI_MADT_LOCAL_APIC * LocalApic
Definition: madt.c:25
ACPI_TABLE_MADT * MadtTable
Definition: madt.c:23
HALP_APIC_INFO_TABLE HalpApicInfoTable
Definition: madt.c:22
PROCESSOR_IDENTITY HalpStaticProcessorIdentity[MAXIMUM_PROCESSORS]
Definition: madt.c:20
PPROCESSOR_IDENTITY HalpProcessorIdentity
Definition: madt.c:21
ACPI_SUBTABLE_HEADER * AcpiHeader
Definition: madt.c:24
ULONG ProcessorCount
Definition: smp.h:25
ULONG ApicMode
Definition: smp.h:24
UCHAR ProcessorId
Definition: smp.h:13
UCHAR LapicId
Definition: smp.h:14
ACPI_SUBTABLE_HEADER Header
Definition: actbl2.h:1042
UINT32 Length
Definition: actbl.h:109
ACPI_TABLE_HEADER Header
Definition: actbl2.h:985
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59

Referenced by HalpInitProcessor().

◆ HalpPrintApicTables()

VOID HalpPrintApicTables ( VOID  )

Definition at line 76 of file madt.c.

77{
78 UINT32 i;
79
80 DPRINT1("HAL has detected a physical processor count of: %d\n", HalpApicInfoTable.ProcessorCount);
81 for (i = 0; i < HalpApicInfoTable.ProcessorCount; i++)
82 {
83 DPRINT1("Information about the following processor is for processors number: %d\n"
84 " The BSPCheck is set to: %X\n"
85 " The LapicID is set to: %X\n",
86 i, HalpProcessorIdentity[i].BSPCheck, HalpProcessorIdentity[i].LapicId);
87 }
88}
unsigned int UINT32
#define DPRINT1
Definition: precomp.h:8
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by HalpInitPhase0().

◆ HalpRequestIpi()

VOID NTAPI HalpRequestIpi ( _In_ KAFFINITY  TargetSet)

Requests an IPI interrupt on the specified processors.

Parameters
TargetSet- Specifies the set of processors to send the IPI to.

Definition at line 223 of file apicsmp.c.

225{
226 /* Request the IPI vector */
228}
#define APIC_IPI_VECTOR
Definition: apicp.h:46
VOID NTAPI HalRequestIpiSpecifyVector(_In_ KAFFINITY TargetSet, _In_ UCHAR Vector)
Requests an IPI with a specified vector on the specified processors.
Definition: apicsmp.c:169

Referenced by HalRequestIpi().

◆ HalpSetupProcessorsTable()

VOID HalpSetupProcessorsTable ( _In_ UINT32  NTProcessorNumber)

Definition at line 37 of file up.c.

39{
40 NOTHING;
41}
#define NOTHING
Definition: input_list.c:10

Referenced by HalpInitProcessor().

◆ HalRequestIpiSpecifyVector()

VOID NTAPI HalRequestIpiSpecifyVector ( _In_ KAFFINITY  TargetSet,
_In_ UCHAR  Vector 
)

Requests an IPI with a specified vector on the specified processors.

Parameters
TargetSet- Specifies the set of processors to send the IPI to.
Vector- Specifies the interrupt vector to be delivered.
Remarks
This function is exported on Windows 10.

Definition at line 169 of file apicsmp.c.

172{
173 KAFFINITY ActiveProcessors = HalpActiveProcessors;
174 KAFFINITY RemainingSet, SetMember;
175 ULONG ProcessorIndex;
176 ULONG LApicId;
177
178 /* Sanitize the target set */
179 TargetSet &= ActiveProcessors;
180
181 /* Check if all processors are requested */
182 if (TargetSet == ActiveProcessors)
183 {
184 /* Send an IPI to all processors, including this processor */
186 return;
187 }
188
189 /* Check if all processors except the current one are requested */
190 if (TargetSet == (ActiveProcessors & ~KeGetCurrentPrcb()->SetMember))
191 {
192 /* Send an IPI to all processors, excluding this processor */
194 return;
195 }
196
197 /* Loop while we have more processors */
198 RemainingSet = TargetSet;
199 while (RemainingSet != 0)
200 {
201 NT_VERIFY(BitScanForwardAffinity(&ProcessorIndex, RemainingSet) != 0);
202 ASSERT(ProcessorIndex < KeNumberProcessors);
203 SetMember = AFFINITY_MASK(ProcessorIndex);
204 RemainingSet &= ~SetMember;
205
206 /* Send the interrupt to the target processor */
207 LApicId = HalpProcessorIdentity[ProcessorIndex].LapicId;
209 Vector,
213 }
214}
VOID NTAPI HalpBroadcastIpiSpecifyVector(_In_ UCHAR Vector, _In_ BOOLEAN IncludeSelf)
Broadcasts an IPI with a specified vector to all processors.
Definition: apicsmp.c:144
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG_PTR KAFFINITY
Definition: compat.h:85
KAFFINITY HalpActiveProcessors
Definition: processor.c:17
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1148
FORCEINLINE KAFFINITY AFFINITY_MASK(ULONG Index)
Definition: kefuncs.h:39
FORCEINLINE BOOLEAN BitScanForwardAffinity(PULONG Index, KAFFINITY Mask)
Definition: kefuncs.h:45
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3287

Referenced by HalpRequestIpi().