Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenprocessor_mp.c
Go to the documentation of this file.
00001 /* $Id: processor_mp.c 47674 2010-06-07 20:37:19Z sir_richard $ 00002 * 00003 * COPYRIGHT: See COPYING in the top level directory 00004 * PROJECT: ReactOS kernel 00005 * FILE: hal/halx86/mp/processor_mp.c 00006 * PURPOSE: Intel MultiProcessor specification support 00007 * PROGRAMMER: David Welch (welch@cwcom.net) 00008 * Casper S. Hornstrup (chorns@users.sourceforge.net) 00009 * NOTES: Parts adapted from linux SMP code 00010 * UPDATE HISTORY: 00011 * 22/05/1998 DW Created 00012 * 12/04/2001 CSH Added MultiProcessor specification support 00013 */ 00014 00015 /* INCLUDES *****************************************************************/ 00016 00017 #include <hal.h> 00018 #define NDEBUG 00019 #include <debug.h> 00020 00021 KAFFINITY HalpActiveProcessors, HalpDefaultInterruptAffinity; 00022 00023 /* PRIVATE FUNCTIONS *********************************************************/ 00024 00025 VOID 00026 NTAPI 00027 HaliHaltSystem(VOID) 00028 { 00029 /* Disable interrupts and halt the CPU */ 00030 _disable(); 00031 __halt(); 00032 } 00033 00034 /* FUNCTIONS *****************************************************************/ 00035 00036 VOID NTAPI 00037 HalInitializeProcessor(ULONG ProcessorNumber, 00038 PLOADER_PARAMETER_BLOCK LoaderBlock) 00039 { 00040 ULONG CPU; 00041 00042 DPRINT("HalInitializeProcessor(%x %x)\n", ProcessorNumber, LoaderBlock); 00043 00044 CPU = ThisCPU(); 00045 if (OnlineCPUs & (1 << CPU)) 00046 { 00047 ASSERT(FALSE); 00048 } 00049 00050 if (ProcessorNumber == 0) 00051 { 00052 HaliInitBSP(); 00053 } 00054 else 00055 { 00056 APICSetup(); 00057 00058 DPRINT("CPU %d says it is now booted.\n", CPU); 00059 00060 APICCalibrateTimer(CPU); 00061 } 00062 00063 /* This processor is now booted */ 00064 CPUMap[CPU].Flags |= CPU_ENABLED; 00065 OnlineCPUs |= (1 << CPU); 00066 00067 /* Setup busy waiting */ 00068 //HalpCalibrateStallExecution(); 00069 } 00070 00071 BOOLEAN NTAPI 00072 HalAllProcessorsStarted (VOID) 00073 { 00074 ULONG CPUs = 0, i; 00075 00076 DPRINT("HalAllProcessorsStarted()\n"); 00077 for (i = 0; i < 32; i++) 00078 { 00079 if (OnlineCPUs & (1 << i)) 00080 { 00081 CPUs++; 00082 } 00083 } 00084 if (CPUs > CPUCount) 00085 { 00086 ASSERT(FALSE); 00087 } 00088 else if (CPUs == CPUCount) 00089 { 00090 00091 IOAPICEnable(); 00092 IOAPICSetupIds(); 00093 if (CPUCount > 1) 00094 { 00095 APICSyncArbIDs(); 00096 } 00097 IOAPICSetupIrqs(); 00098 00099 return TRUE; 00100 } 00101 return FALSE; 00102 } 00103 00104 BOOLEAN 00105 NTAPI 00106 HalStartNextProcessor( 00107 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock, 00108 IN PKPROCESSOR_STATE ProcessorState) 00109 { 00110 ULONG CPU; 00111 00112 DPRINT("HalStartNextProcessor(%x %x)\n", LoaderBlock, ProcessorState); 00113 00114 for (CPU = 0; CPU < CPUCount; CPU++) 00115 { 00116 if (!(OnlineCPUs & (1<<CPU))) 00117 { 00118 break; 00119 } 00120 } 00121 00122 if (CPU >= CPUCount) 00123 { 00124 ASSERT(FALSE); 00125 } 00126 00127 DPRINT1("Attempting to boot CPU %d\n", CPU); 00128 00129 HaliStartApplicationProcessor(CPU, (ULONG)ProcessorState); 00130 00131 return TRUE; 00132 } 00133 00134 VOID 00135 NTAPI 00136 HalProcessorIdle(VOID) 00137 { 00138 UNIMPLEMENTED; 00139 } 00140 00141 /* EOF */ Generated on Sat May 26 2012 04:27:24 for ReactOS by
1.7.6.1
|