ReactOS 0.4.15-dev-8227-g32d615f
halinit.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS HAL
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
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include <hal.h>
12#define NDEBUG
13#include <debug.h>
14
15/* GLOBALS ********************************************************************/
16
17/* PRIVATE FUNCTIONS **********************************************************/
18
19VOID
22{
23 PCHAR CommandLine;
24
25 /* Make sure we have a loader block and command line */
26 if ((LoaderBlock) && (LoaderBlock->LoadOptions))
27 {
28 /* Read the command line */
29 CommandLine = LoaderBlock->LoadOptions;
30
31 /* Check for initial breakpoint */
32 if (strstr(CommandLine, "BREAK")) DbgBreakPoint();
33 }
34}
35
36/* FUNCTIONS ******************************************************************/
37
38/*
39 * @implemented
40 */
44 IN PLOADER_PARAMETER_BLOCK LoaderBlock)
45{
46 PKPRCB Prcb = KeGetCurrentPrcb();
47
48 /* Check the boot phase */
49 if (!BootPhase)
50 {
51 /* Get command-line parameters */
52 HalpGetParameters(LoaderBlock);
53
54 /* Checked HAL requires checked kernel */
55#if DBG
56 if (!(Prcb->BuildType & PRCB_BUILD_DEBUG))
57 {
58 /* No match, bugcheck */
59 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, PRCB_BUILD_DEBUG, 0);
60 }
61#else
62 /* Release build requires release HAL */
63 if (Prcb->BuildType & PRCB_BUILD_DEBUG)
64 {
65 /* No match, bugcheck */
66 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
67 }
68#endif
69
70#ifdef CONFIG_SMP
71 /* SMP HAL requires SMP kernel */
73 {
74 /* No match, bugcheck */
75 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
76 }
77#endif
78
79 /* Validate the PRCB */
81 {
82 /* Validation failed, bugcheck */
83 KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, PRCB_MAJOR_VERSION, 0);
84 }
85
86 /* Initialize interrupts */
88
89 /* Force initial PIC state */
91
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;
100
101 /* Setup I/O space */
102 //HalpDefaultIoSpace.Next = HalpAddressUsageList;
103 //HalpAddressUsageList = &HalpDefaultIoSpace;
104
105 /* Setup busy waiting */
106 //HalpCalibrateStallExecution();
107
108 /* Initialize the clock */
110
111 /* Setup time increments to 10ms and 1ms */
113 HalpNextTimeIncrement = 100000;
115 KeSetTimeIncrement(100000, 10000);
116
117 /*
118 * We could be rebooting with a pending profile interrupt,
119 * so clear it here before interrupts are enabled
120 */
122
123 /* Do some HAL-specific initialization */
124 HalpInitPhase0(LoaderBlock);
125 }
126 else if (BootPhase == 1)
127 {
128 /* Enable timer interrupt */
130 0,
134 Latched);
135#if 0
136 /* Enable IRQ 8 */
138 0,
142 Latched);
143#endif
144 /* Initialize DMA. NT does this in Phase 0 */
145 //HalpInitDma();
146
147 /* Do some HAL-specific initialization */
149 }
150
151 /* All done, return */
152 return TRUE;
153}
154
155#include <internal/kd.h>
156ULONG
157DbgPrintEarly(const char *fmt, ...)
158{
160 unsigned int i;
161 char Buffer[1024];
163
164 va_start(args, fmt);
165 i = vsprintf(Buffer, fmt, args);
166 va_end(args);
167
168 /* Output the message */
169 while (*String != 0)
170 {
171 if (*String == '\n')
172 {
173 KdPortPutByteEx(NULL, '\r');
174 }
176 String++;
177 }
178
179 return STATUS_SUCCESS;
180}
181
182/* EOF */
unsigned char BOOLEAN
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
VOID NTAPI KeSetTimeIncrement(IN ULONG MaxIncrement, IN ULONG MinIncrement)
Definition: ntoskrnl.c:28
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define CLOCK2_LEVEL
Definition: env_spec_w32.h:700
#define PROFILE_LEVEL
Definition: env_spec_w32.h:698
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID HalpInitializeInterrupts(VOID)
Definition: pic.c:93
KIRQL FASTCALL KfRaiseIrql(IN KIRQL NewIrql)
Definition: pic.c:187
VOID HalpClockInterrupt(VOID)
Definition: timer.c:30
VOID HalpInitializeClock(VOID)
Definition: timer.c:54
ULONG HalpNextIntervalCount
Definition: timer.c:25
ULONG HalpNextTimeIncrement
Definition: timer.c:25
ULONG HalpCurrentTimeIncrement
Definition: timer.c:25
VOID NTAPI HalpEnableInterruptHandler(IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql, IN PVOID Handler, IN KINTERRUPT_MODE Mode)
Definition: usage.c:49
BOOLEAN NTAPI HalInitSystem(IN ULONG BootPhase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: halinit.c:43
VOID NTAPI HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: halinit.c:21
ULONG DbgPrintEarly(const char *fmt,...)
Definition: halinit.c:157
VOID NTAPI HalStopProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
Definition: profil.c:22
VOID HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: halinit_mp.c:30
#define PRIMARY_VECTOR_BASE
Definition: halp.h:16
VOID HalpProfileInterrupt(VOID)
VOID HalpInitPhase1(VOID)
Definition: halinit_up.c:26
#define IDT_DEVICE
Definition: halp.h:22
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
VOID NTAPI KdPortPutByteEx(PCPPORT PortInformation, UCHAR ByteToSend)
NTSYSAPI void WINAPI DbgBreakPoint(void)
@ ProfileTime
Definition: winternl.h:2123
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1161
#define PRCB_MAJOR_VERSION
Definition: ketypes.h:322
#define PRCB_BUILD_UNIPROCESSOR
Definition: ketypes.h:324
#define PRCB_BUILD_DEBUG
Definition: ketypes.h:323
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108
@ Latched
Definition: miniport.h:81
#define args
Definition: format.c:66
#define STATUS_SUCCESS
Definition: shellext.h:65
UCHAR BuildType
Definition: ketypes.h:683
USHORT MajorVersion
Definition: ketypes.h:682
Definition: match.c:390
Definition: dsound.c:943
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433