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 BOOLEAN HalpPciLockSettings; 00018 00019 /* PRIVATE FUNCTIONS *********************************************************/ 00020 00021 VOID 00022 NTAPI 00023 INIT_FUNCTION 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 VOID 00045 NTAPI 00046 HalInitializeProcessor( 00047 IN ULONG ProcessorNumber, 00048 IN PLOADER_PARAMETER_BLOCK LoaderBlock) 00049 { 00050 /* Hal specific initialization for this cpu */ 00051 HalpInitProcessor(ProcessorNumber, LoaderBlock); 00052 00053 /* Set default stall count */ 00054 KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT; 00055 00056 /* Update the interrupt affinity and processor mask */ 00057 InterlockedBitTestAndSet((PLONG)&HalpActiveProcessors, ProcessorNumber); 00058 InterlockedBitTestAndSet((PLONG)&HalpDefaultInterruptAffinity, 00059 ProcessorNumber); 00060 00061 /* Register routines for KDCOM */ 00062 HalpRegisterKdSupportFunctions(); 00063 } 00064 00065 /* 00066 * @implemented 00067 */ 00068 BOOLEAN 00069 NTAPI 00070 INIT_FUNCTION 00071 HalInitSystem(IN ULONG BootPhase, 00072 IN PLOADER_PARAMETER_BLOCK LoaderBlock) 00073 { 00074 PKPRCB Prcb = KeGetCurrentPrcb(); 00075 00076 /* Check the boot phase */ 00077 if (BootPhase == 0) 00078 { 00079 /* Phase 0... save bus type */ 00080 HalpBusType = LoaderBlock->u.I386.MachineType & 0xFF; 00081 00082 /* Get command-line parameters */ 00083 HalpGetParameters(LoaderBlock); 00084 00085 /* Check for PRCB version mismatch */ 00086 if (Prcb->MajorVersion != PRCB_MAJOR_VERSION) 00087 { 00088 /* No match, bugcheck */ 00089 KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, PRCB_MAJOR_VERSION, 0); 00090 } 00091 00092 /* Checked/free HAL requires checked/free kernel */ 00093 if (Prcb->BuildType != HalpBuildType) 00094 { 00095 /* No match, bugcheck */ 00096 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, HalpBuildType, 0); 00097 } 00098 00099 /* Initialize ACPI */ 00100 HalpSetupAcpiPhase0(LoaderBlock); 00101 00102 /* Initialize the PICs */ 00103 HalpInitializePICs(TRUE); 00104 00105 /* Initialize CMOS lock */ 00106 KeInitializeSpinLock(&HalpSystemHardwareLock); 00107 00108 /* Initialize CMOS */ 00109 HalpInitializeCmos(); 00110 00111 /* Fill out the dispatch tables */ 00112 HalQuerySystemInformation = HaliQuerySystemInformation; 00113 HalSetSystemInformation = HaliSetSystemInformation; 00114 HalInitPnpDriver = HaliInitPnpDriver; 00115 HalGetDmaAdapter = HalpGetDmaAdapter; 00116 00117 HalGetInterruptTranslator = NULL; // FIXME: TODO 00118 HalResetDisplay = HalpBiosDisplayReset; 00119 HalHaltSystem = HaliHaltSystem; 00120 00121 /* Setup I/O space */ 00122 HalpDefaultIoSpace.Next = HalpAddressUsageList; 00123 HalpAddressUsageList = &HalpDefaultIoSpace; 00124 00125 /* Setup busy waiting */ 00126 HalpCalibrateStallExecution(); 00127 00128 /* Initialize the clock */ 00129 HalpInitializeClock(); 00130 00131 /* 00132 * We could be rebooting with a pending profile interrupt, 00133 * so clear it here before interrupts are enabled 00134 */ 00135 HalStopProfileInterrupt(ProfileTime); 00136 00137 /* Do some HAL-specific initialization */ 00138 HalpInitPhase0(LoaderBlock); 00139 } 00140 else if (BootPhase == 1) 00141 { 00142 /* Initialize bus handlers */ 00143 HalpInitBusHandlers(); 00144 00145 /* Do some HAL-specific initialization */ 00146 HalpInitPhase1(); 00147 } 00148 00149 /* All done, return */ 00150 return TRUE; 00151 } Generated on Sat May 26 2012 04:27:16 for ReactOS by
1.7.6.1
|