3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/hal/halx86/generic/processor.c
5 * PURPOSE: HAL Processor Routines
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
9 /* INCLUDES ******************************************************************/
15 /* GLOBALS *******************************************************************/
17 PVOID HalpZeroPageMapping
= NULL
;
19 BOOLEAN HalpPciLockSettings
;
21 /* PRIVATE FUNCTIONS *********************************************************/
25 HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
29 /* Make sure we have a loader block and command line */
30 if ((LoaderBlock
) && (LoaderBlock
->LoadOptions
))
32 /* Read the command line */
33 CommandLine
= LoaderBlock
->LoadOptions
;
35 /* Check if PCI is locked */
36 if (strstr(CommandLine
, "PCILOCK")) HalpPciLockSettings
= TRUE
;
38 /* Check for initial breakpoint */
39 if (strstr(CommandLine
, "BREAK")) DbgBreakPoint();
43 /* FUNCTIONS *****************************************************************/
50 HalInitSystem(IN ULONG BootPhase
,
51 IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
53 PHYSICAL_ADDRESS Null
= {{0}};
54 PKPRCB Prcb
= KeGetCurrentPrcb();
56 /* Check the boot phase */
59 /* Phase 0... save bus type */
60 HalpBusType
= LoaderBlock
->u
.I386
.MachineType
& 0xFF;
62 /* Get command-line parameters */
63 HalpGetParameters(LoaderBlock
);
65 /* Checked HAL requires checked kernel */
67 if (!(Prcb
->BuildType
& PRCB_BUILD_DEBUG
))
69 /* No match, bugcheck */
70 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 1, 0);
73 /* Release build requires release HAL */
74 if (Prcb
->BuildType
& PRCB_BUILD_DEBUG
)
76 /* No match, bugcheck */
77 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 0, 0);
82 /* SMP HAL requires SMP kernel */
83 if (Prcb
->BuildType
& PRCB_BUILD_UNIPROCESSOR
)
85 /* No match, bugcheck */
86 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 0, 0);
90 /* Validate the PRCB */
91 if (Prcb
->MajorVersion
!= PRCB_MAJOR_VERSION
)
93 /* Validation failed, bugcheck */
94 KeBugCheckEx(MISMATCHED_HAL
, 1, Prcb
->MajorVersion
, 1, 0);
97 /* Continue with HAL-specific initialization */
98 HalpInitPhase0(LoaderBlock
);
100 /* Fill out the dispatch tables */
101 HalQuerySystemInformation
= HaliQuerySystemInformation
;
102 HalSetSystemInformation
= HaliSetSystemInformation
;
103 HalInitPnpDriver
= NULL
; // FIXME: TODO
104 HalGetDmaAdapter
= HalpGetDmaAdapter
;
105 HalGetInterruptTranslator
= NULL
; // FIXME: TODO
107 /* Initialize the hardware lock (CMOS) */
108 KeInitializeSpinLock(&HalpSystemHardwareLock
);
110 else if (BootPhase
== 1)
112 /* Initialize the default HAL stubs for bus handling functions */
113 HalpInitNonBusHandler();
115 /* Initialize the clock interrupt */
118 /* Initialize DMA. NT does this in Phase 0 */
121 else if (BootPhase
== 2)
123 HalpZeroPageMapping
= MmMapIoSpace(Null
, PAGE_SIZE
, MmNonCached
);
126 /* All done, return */
135 HalReportResourceUsage(VOID
)
137 /* Initialize PCI bus. */
138 HalpInitializePciBus();
140 /* FIXME: This is done in ReactOS MP HAL only*/
141 //HaliReconfigurePciInterrupts();
143 /* FIXME: Report HAL Usage to kernel */