ReactOS  0.4.14-dev-1332-g6db3d88
processor_mp.c File Reference
#include <hal.h>
#include <debug.h>
Include dependency graph for processor_mp.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI HaliHaltSystem (VOID)
 
VOID NTAPI HalInitializeProcessor (ULONG ProcessorNumber, PLOADER_PARAMETER_BLOCK LoaderBlock)
 
BOOLEAN NTAPI HalAllProcessorsStarted (VOID)
 
BOOLEAN NTAPI HalStartNextProcessor (IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock, IN PKPROCESSOR_STATE ProcessorState)
 
VOID NTAPI HalProcessorIdle (VOID)
 

Variables

KAFFINITY HalpActiveProcessors
 
KAFFINITY HalpDefaultInterruptAffinity
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 17 of file processor_mp.c.

Function Documentation

◆ HalAllProcessorsStarted()

BOOLEAN NTAPI HalAllProcessorsStarted ( VOID  )

Definition at line 71 of file processor_mp.c.

72 {
73  ULONG CPUs = 0, i;
74 
75  DPRINT("HalAllProcessorsStarted()\n");
76  for (i = 0; i < 32; i++)
77  {
78  if (OnlineCPUs & (1 << i))
79  {
80  CPUs++;
81  }
82  }
83  if (CPUs > CPUCount)
84  {
85  ASSERT(FALSE);
86  }
87  else if (CPUs == CPUCount)
88  {
89 
90  IOAPICEnable();
92  if (CPUCount > 1)
93  {
95  }
97 
98  return TRUE;
99  }
100  return FALSE;
101 }
VOID IOAPICSetupIrqs(VOID)
Definition: ioapic.c:296
#define TRUE
Definition: types.h:120
VOID APICSyncArbIDs(VOID)
ULONG OnlineCPUs
Definition: apic.c:39
VOID IOAPICEnable(VOID)
Definition: ioapic.c:409
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
void DPRINT(...)
Definition: polytest.cpp:61
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG CPUCount
Definition: apic.c:37
unsigned int ULONG
Definition: retypes.h:1
VOID IOAPICSetupIds(VOID)
Definition: ioapic.c:432

◆ HaliHaltSystem()

VOID NTAPI HaliHaltSystem ( VOID  )

Definition at line 26 of file processor_mp.c.

27 {
28  /* Disable interrupts and halt the CPU */
29  _disable();
30  __halt();
31 }
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1595
void __cdecl _disable(void)
Definition: intrin_arm.h:365

◆ HalInitializeProcessor()

VOID NTAPI HalInitializeProcessor ( ULONG  ProcessorNumber,
PLOADER_PARAMETER_BLOCK  LoaderBlock 
)

Definition at line 36 of file processor_mp.c.

38 {
39  ULONG CPU;
40 
41  DPRINT("HalInitializeProcessor(%x %x)\n", ProcessorNumber, LoaderBlock);
42 
43  CPU = ThisCPU();
44  if (OnlineCPUs & (1 << CPU))
45  {
46  ASSERT(FALSE);
47  }
48 
49  if (ProcessorNumber == 0)
50  {
51  HaliInitBSP();
52  }
53  else
54  {
55  APICSetup();
56 
57  DPRINT("CPU %d says it is now booted.\n", CPU);
58 
59  APICCalibrateTimer(CPU);
60  }
61 
62  /* This processor is now booted */
63  CPUMap[CPU].Flags |= CPU_ENABLED;
64  OnlineCPUs |= (1 << CPU);
65 
66  /* Setup busy waiting */
67  //HalpCalibrateStallExecution();
68 }
VOID HaliInitBSP(VOID)
Definition: apic.c:886
#define CPU_ENABLED
Definition: apic.h:171
CPU_INFO CPUMap[MAX_CPU]
Definition: apic.c:40
ULONG OnlineCPUs
Definition: apic.c:39
VOID APICCalibrateTimer(ULONG CPU)
Definition: apic.c:794
void DPRINT(...)
Definition: polytest.cpp:61
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static __inline ULONG ThisCPU(VOID)
Definition: apic.h:203
UCHAR Flags
Definition: apic.h:177
unsigned int ULONG
Definition: retypes.h:1
VOID APICSetup(VOID)
Definition: apic.c:482

◆ HalProcessorIdle()

VOID NTAPI HalProcessorIdle ( VOID  )

Definition at line 135 of file processor_mp.c.

136 {
138 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HalStartNextProcessor()

BOOLEAN NTAPI HalStartNextProcessor ( IN struct _LOADER_PARAMETER_BLOCK LoaderBlock,
IN PKPROCESSOR_STATE  ProcessorState 
)

Definition at line 105 of file processor_mp.c.

108 {
109  ULONG CPU;
110 
111  DPRINT("HalStartNextProcessor(%x %x)\n", LoaderBlock, ProcessorState);
112 
113  for (CPU = 0; CPU < CPUCount; CPU++)
114  {
115  if (!(OnlineCPUs & (1<<CPU)))
116  {
117  break;
118  }
119  }
120 
121  if (CPU >= CPUCount)
122  {
123  ASSERT(FALSE);
124  }
125 
126  DPRINT1("Attempting to boot CPU %d\n", CPU);
127 
128  HaliStartApplicationProcessor(CPU, (ULONG)ProcessorState);
129 
130  return TRUE;
131 }
#define TRUE
Definition: types.h:120
ULONG OnlineCPUs
Definition: apic.c:39
VOID HaliStartApplicationProcessor(ULONG Cpu, ULONG Stack)
void DPRINT(...)
Definition: polytest.cpp:61
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DPRINT1
Definition: precomp.h:8
ULONG CPUCount
Definition: apic.c:37
unsigned int ULONG
Definition: retypes.h:1

Variable Documentation

◆ HalpActiveProcessors

KAFFINITY HalpActiveProcessors

Definition at line 20 of file processor_mp.c.

◆ HalpDefaultInterruptAffinity

KAFFINITY HalpDefaultInterruptAffinity

Definition at line 20 of file processor_mp.c.