Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenhalinit.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS HAL 00003 * LICENSE: GPL - See COPYING in the top level directory 00004 * FILE: hal/halx86/generic/halinit.c 00005 * PURPOSE: HAL Entrypoint and Initialization 00006 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) 00007 */ 00008 00009 /* INCLUDES ******************************************************************/ 00010 00011 #include <hal.h> 00012 #define NDEBUG 00013 #include <debug.h> 00014 00015 /* GLOBALS *******************************************************************/ 00016 00017 HALP_HOOKS HalpHooks; 00018 BOOLEAN HalpPciLockSettings; 00019 00020 /* PRIVATE FUNCTIONS *********************************************************/ 00021 00022 VOID 00023 NTAPI 00024 HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock) 00025 { 00026 PCHAR CommandLine; 00027 00028 /* Make sure we have a loader block and command line */ 00029 if ((LoaderBlock) && (LoaderBlock->LoadOptions)) 00030 { 00031 /* Read the command line */ 00032 CommandLine = LoaderBlock->LoadOptions; 00033 00034 /* Check if PCI is locked */ 00035 if (strstr(CommandLine, "PCILOCK")) HalpPciLockSettings = TRUE; 00036 00037 /* Check for initial breakpoint */ 00038 if (strstr(CommandLine, "BREAK")) DbgBreakPoint(); 00039 } 00040 } 00041 00042 /* FUNCTIONS *****************************************************************/ 00043 00044 /* 00045 * @implemented 00046 */ 00047 BOOLEAN 00048 NTAPI 00049 HalInitSystem(IN ULONG BootPhase, 00050 IN PLOADER_PARAMETER_BLOCK LoaderBlock) 00051 { 00052 KIRQL CurIrql; 00053 PKPRCB Prcb = KeGetCurrentPrcb(); 00054 00055 DbgPrint("Prcb: %x BuildType %x\n", Prcb, Prcb->BuildType); 00056 00057 /* Check the boot phase */ 00058 if (!BootPhase) 00059 { 00060 /* Phase 0... save bus type */ 00061 HalpBusType = LoaderBlock->u.I386.MachineType & 0xFF; 00062 00063 /* Get command-line parameters */ 00064 HalpGetParameters(LoaderBlock); 00065 00066 /* Checked HAL requires checked kernel */ 00067 #if DBG 00068 if (!(Prcb->BuildType & PRCB_BUILD_DEBUG)) 00069 { 00070 /* No match, bugcheck */ 00071 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 1, 0); 00072 } 00073 #else 00074 /* Release build requires release HAL */ 00075 if (Prcb->BuildType & PRCB_BUILD_DEBUG) 00076 { 00077 /* No match, bugcheck */ 00078 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0); 00079 } 00080 #endif 00081 00082 #ifdef CONFIG_SMP 00083 /* SMP HAL requires SMP kernel */ 00084 if (Prcb->BuildType & PRCB_BUILD_UNIPROCESSOR) 00085 { 00086 /* No match, bugcheck */ 00087 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0); 00088 } 00089 #endif 00090 00091 /* Validate the PRCB */ 00092 if (Prcb->MajorVersion != PRCB_MAJOR_VERSION) 00093 { 00094 /* Validation failed, bugcheck */ 00095 KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, 1, 0); 00096 } 00097 00098 /* Initialize the PICs */ 00099 HalpInitPICs(); 00100 00101 /* Force initial PIC state */ 00102 KeRaiseIrql(KeGetCurrentIrql(), &CurIrql); 00103 00104 /* Initialize the clock */ 00105 HalpInitializeClock(); 00106 00107 /* Setup busy waiting */ 00108 //HalpCalibrateStallExecution(); 00109 00110 /* Fill out the dispatch tables */ 00111 HalQuerySystemInformation = HaliQuerySystemInformation; 00112 HalSetSystemInformation = HaliSetSystemInformation; 00113 HalInitPnpDriver = NULL; // FIXME: TODO 00114 HalGetDmaAdapter = HalpGetDmaAdapter; 00115 HalGetInterruptTranslator = NULL; // FIXME: TODO 00116 00117 /* Initialize the hardware lock (CMOS) */ 00118 KeInitializeSpinLock(&HalpSystemHardwareLock); 00119 } 00120 else if (BootPhase == 1) 00121 { 00122 /* Initialize the default HAL stubs for bus handling functions */ 00123 HalpInitNonBusHandler(); 00124 00125 #if 0 00126 /* Enable the clock interrupt */ 00127 ((PKIPCR)KeGetPcr())->IDT[0x30].ExtendedOffset = 00128 (USHORT)(((ULONG_PTR)HalpClockInterrupt >> 16) & 0xFFFF); 00129 ((PKIPCR)KeGetPcr())->IDT[0x30].Offset = 00130 (USHORT)((ULONG_PTR)HalpClockInterrupt); 00131 #endif 00132 HalEnableSystemInterrupt(0x30, CLOCK2_LEVEL, Latched); 00133 00134 /* Initialize DMA. NT does this in Phase 0 */ 00135 HalpInitDma(); 00136 } 00137 00138 /* All done, return */ 00139 return TRUE; 00140 } 00141 00142 /* 00143 * @unimplemented 00144 */ 00145 VOID 00146 NTAPI 00147 HalReportResourceUsage(VOID) 00148 { 00149 /* Initialize PCI bus. */ 00150 HalpInitializePciBus(); 00151 00152 /* FIXME: This is done in ReactOS MP HAL only*/ 00153 //HaliReconfigurePciInterrupts(); 00154 00155 /* FIXME: Report HAL Usage to kernel */ 00156 } 00157 00158 /* EOF */ Generated on Sun May 27 2012 04:28:40 for ReactOS by
1.7.6.1
|