3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: hal/halarm/generic/halinit.c
5 * PURPOSE: HAL Entrypoint and Initialization
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES *******************************************************************/
15 /* GLOBALS ********************************************************************/
17 /* PRIVATE FUNCTIONS **********************************************************/
21 HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
25 /* Make sure we have a loader block and command line */
26 if ((LoaderBlock
) && (LoaderBlock
->LoadOptions
))
28 /* Read the command line */
29 CommandLine
= LoaderBlock
->LoadOptions
;
31 /* Check for initial breakpoint */
32 if (strstr(CommandLine
, "BREAK")) DbgBreakPoint();
36 /* FUNCTIONS ******************************************************************/
43 HalInitSystem(IN ULONG BootPhase
,
44 IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
46 PKPRCB Prcb
= KeGetCurrentPrcb();
48 /* Check the boot phase */
51 /* Get command-line parameters */
52 HalpGetParameters(LoaderBlock
);
54 /* Checked HAL requires checked kernel */
56 if (!(Prcb
->BuildType
& PRCB_BUILD_DEBUG
))
58 /* No match, bugcheck */
59 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 1, 0);
62 /* Release build requires release HAL */
63 if (Prcb
->BuildType
& PRCB_BUILD_DEBUG
)
65 /* No match, bugcheck */
66 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 0, 0);
71 /* SMP HAL requires SMP kernel */
72 if (Prcb
->BuildType
& PRCB_BUILD_UNIPROCESSOR
)
74 /* No match, bugcheck */
75 KeBugCheckEx(MISMATCHED_HAL
, 2, Prcb
->BuildType
, 0, 0);
79 /* Validate the PRCB */
80 if (Prcb
->MajorVersion
!= PRCB_MAJOR_VERSION
)
82 /* Validation failed, bugcheck */
83 KeBugCheckEx(MISMATCHED_HAL
, 1, Prcb
->MajorVersion
, 1, 0);
86 /* Initialize interrupts */
87 HalpInitializeInterrupts();
89 /* Force initial PIC state */
90 KfRaiseIrql(KeGetCurrentIrql());
92 /* Fill out the dispatch tables */
93 //HalQuerySystemInformation = NULL; // FIXME: TODO;
94 //HalSetSystemInformation = NULL; // FIXME: TODO;
95 //HalInitPnpDriver = NULL; // FIXME: TODO
96 //HalGetDmaAdapter = NULL; // FIXME: TODO;
97 //HalGetInterruptTranslator = NULL; // FIXME: TODO
98 //HalResetDisplay = NULL; // FIXME: TODO;
99 //HalHaltSystem = NULL; // FIXME: TODO;
101 /* Setup I/O space */
102 //HalpDefaultIoSpace.Next = HalpAddressUsageList;
103 //HalpAddressUsageList = &HalpDefaultIoSpace;
105 /* Setup busy waiting */
106 //HalpCalibrateStallExecution();
108 /* Initialize the clock */
109 HalpInitializeClock();
111 /* Setup time increments to 10ms and 1ms */
112 HalpCurrentTimeIncrement
= 100000;
113 HalpNextTimeIncrement
= 100000;
114 HalpNextIntervalCount
= 0;
115 KeSetTimeIncrement(100000, 10000);
118 * We could be rebooting with a pending profile interrupt,
119 * so clear it here before interrupts are enabled
121 HalStopProfileInterrupt(ProfileTime
);
123 /* Do some HAL-specific initialization */
124 HalpInitPhase0(LoaderBlock
);
126 else if (BootPhase
== 1)
128 /* Enable timer interrupt */
129 HalpEnableInterruptHandler(IDT_DEVICE
,
137 HalpEnableInterruptHandler(IDT_DEVICE
,
139 PRIMARY_VECTOR_BASE
+ 8,
141 HalpProfileInterrupt
,
144 /* Initialize DMA. NT does this in Phase 0 */
147 /* Do some HAL-specific initialization */
151 /* All done, return */
155 #include <internal/kd.h>
157 DbgPrintEarly(const char *fmt
, ...)
162 PCHAR String
= Buffer
;
165 i
= vsprintf(Buffer
, fmt
, args
);
168 /* Output the message */
173 KdPortPutByteEx(NULL
, '\r');
175 KdPortPutByteEx(NULL
, *String
);
179 return STATUS_SUCCESS
;