3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: hal/halx86/generic/halinit.c
5 * PURPOSE: HAL Entrypoint and Initialization
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
9 /* INCLUDES ******************************************************************/
15 /* GLOBALS *******************************************************************/
17 BOOLEAN HalpPciLockSettings
;
19 /* PRIVATE FUNCTIONS *********************************************************/
23 HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
27 /* Make sure we have a loader block and command line */
28 if ((LoaderBlock
) && (LoaderBlock
->LoadOptions
))
30 /* Read the command line */
31 CommandLine
= LoaderBlock
->LoadOptions
;
33 /* Check if PCI is locked */
34 if (strstr(CommandLine
, "PCILOCK")) HalpPciLockSettings
= TRUE
;
36 /* Check for initial breakpoint */
37 if (strstr(CommandLine
, "BREAK")) DbgBreakPoint();
41 /* FUNCTIONS *****************************************************************/
46 PDRIVER_OBJECT DriverObject
,
47 PUNICODE_STRING RegistryPath
)
51 return STATUS_SUCCESS
;
59 HalInitSystem(IN ULONG BootPhase
,
60 IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
62 PKPRCB Prcb
= KeGetCurrentPrcb();
64 /* Check the boot phase */
67 /* Phase 0... save bus type */
68 HalpBusType
= LoaderBlock
->u
.I386
.MachineType
& 0xFF;
70 /* Get command-line parameters */
71 HalpGetParameters(LoaderBlock
);
74 /* Checked HAL requires checked kernel */
75 if (!(Prcb
->BuildType
& PRCB_BUILD_DEBUG
))
77 /* No match, bugcheck */
78 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 1, 0);
81 /* Release build requires release HAL */
82 if (Prcb
->BuildType
& PRCB_BUILD_DEBUG
)
84 /* No match, bugcheck */
85 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 0, 0);
90 /* SMP HAL requires SMP kernel */
91 if (Prcb
->BuildType
& PRCB_BUILD_UNIPROCESSOR
)
93 /* No match, bugcheck */
94 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 0, 0);
98 /* Validate the PRCB */
99 if (Prcb
->MajorVersion
!= PRCB_MAJOR_VERSION
)
101 /* Validation failed, bugcheck */
102 KeBugCheckEx(MISMATCHED_HAL
, 1, Prcb
->MajorVersion
, 1, 0);
105 DPRINT1("HalInitSystem 1\n");
107 /* Initialize the PICs */
110 DPRINT1("HalInitSystem 2\n");
112 /* Initialize the clock */
113 HalpInitializeClock();
115 DPRINT1("HalInitSystem 3\n");
117 /* Calibrate counters */
118 // HalpCalibrateCounters();
120 /* Fill out the dispatch tables */
121 HalQuerySystemInformation
= HaliQuerySystemInformation
;
122 HalSetSystemInformation
= HaliSetSystemInformation
;
123 HalInitPnpDriver
= NULL
; // FIXME: TODO
124 // HalGetDmaAdapter = HalpGetDmaAdapter;
125 HalGetInterruptTranslator
= NULL
; // FIXME: TODO
126 // HalResetDisplay = HalpBiosDisplayReset;
128 DPRINT1("HalInitSystem 4\n");
130 /* Initialize the hardware lock (CMOS) */
131 KeInitializeSpinLock(&HalpSystemHardwareLock
);
133 /* Do some HAL-specific initialization */
134 HalpInitPhase0(LoaderBlock
);
136 else if (BootPhase
== 1)
138 /* Initialize bus handlers */
139 //HalpInitBusHandler();
141 /* Enable the clock interrupt */
142 HalpSetInterruptGate(0x30, HalpClockInterrupt
);
143 HalEnableSystemInterrupt(0x30, CLOCK_LEVEL
, Latched
);
145 /* Initialize DMA. NT does this in Phase 0 */
148 /* Do some HAL-specific initialization */
152 /* All done, return */
161 HalReportResourceUsage(VOID
)
163 /* Initialize PCI bus. */
164 HalpInitializePciBus();
166 /* FIXME: This is done in ReactOS MP HAL only*/
167 //HaliReconfigurePciInterrupts();
169 /* FIXME: Report HAL Usage to kernel */