ReactOS 0.4.16-dev-297-gc569aee
processor_mp.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: hal/halx86/mp/processor_mp.c
5 * PURPOSE: Intel MultiProcessor specification support
6 * PROGRAMMER: David Welch (welch@cwcom.net)
7 * Casper S. Hornstrup (chorns@users.sourceforge.net)
8 * NOTES: Parts adapted from linux SMP code
9 * UPDATE HISTORY:
10 * 22/05/1998 DW Created
11 * 12/04/2001 CSH Added MultiProcessor specification support
12 */
13
14/* INCLUDES *****************************************************************/
15
16#include <hal.h>
17#define NDEBUG
18#include <debug.h>
19
21
22/* PRIVATE FUNCTIONS *********************************************************/
23
24VOID
27{
28 /* Disable interrupts and halt the CPU */
29 _disable();
30 __halt();
31}
32
33/* FUNCTIONS *****************************************************************/
34
37 PLOADER_PARAMETER_BLOCK LoaderBlock)
38{
39 ULONG CPU;
40
41 DPRINT("HalInitializeProcessor(%x %x)\n", ProcessorNumber, LoaderBlock);
42
43 CPU = ThisCPU();
44 if (OnlineCPUs & (1 << CPU))
45 {
47 }
48
49 if (ProcessorNumber == 0)
50 {
52 }
53 else
54 {
55 APICSetup();
56
57 DPRINT("CPU %d says it is now booted.\n", CPU);
58
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}
69
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 {
86 }
87 else if (CPUs == CPUCount)
88 {
89
92 if (CPUCount > 1)
93 {
94 APICSyncArbIDs();
95 }
97
98 return TRUE;
99 }
100 return FALSE;
101}
102
104NTAPI
106 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
107 IN PKPROCESSOR_STATE ProcessorState)
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}
132
133VOID
134NTAPI
136{
138}
139
140/* EOF */
unsigned char BOOLEAN
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG_PTR KAFFINITY
Definition: compat.h:85
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 __cdecl _disable(void)
Definition: intrin_arm.h:365
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1714
VOID IOAPICSetupIrqs(VOID)
Definition: ioapic.c:296
VOID IOAPICEnable(VOID)
Definition: ioapic.c:409
VOID IOAPICSetupIds(VOID)
Definition: ioapic.c:432
#define ASSERT(a)
Definition: mode.c:44
VOID APICSetup(VOID)
Definition: apic.c:482
VOID APICCalibrateTimer(ULONG CPU)
Definition: apic.c:794
CPU_INFO CPUMap[MAX_CPU]
Definition: apic.c:40
VOID HaliInitBSP(VOID)
Definition: apic.c:886
ULONG OnlineCPUs
Definition: apic.c:39
ULONG CPUCount
Definition: apic.c:37
KAFFINITY HalpDefaultInterruptAffinity
Definition: processor_mp.c:20
VOID NTAPI HalInitializeProcessor(ULONG ProcessorNumber, PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: processor_mp.c:36
VOID NTAPI HalProcessorIdle(VOID)
Definition: processor_mp.c:135
KAFFINITY HalpActiveProcessors
Definition: processor_mp.c:20
BOOLEAN NTAPI HalAllProcessorsStarted(VOID)
Definition: processor_mp.c:71
BOOLEAN NTAPI HalStartNextProcessor(IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock, IN PKPROCESSOR_STATE ProcessorState)
Definition: processor_mp.c:105
VOID NTAPI HaliHaltSystem(VOID)
Definition: processor_mp.c:26
#define DPRINT
Definition: sndvol32.h:73
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59