ReactOS 0.4.16-dev-981-g80eb313
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
19static
20CODE_SEG("INIT")
21VOID
23 _In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
24{
25 /* Make sure we have a loader block and command line */
26 if (LoaderBlock && LoaderBlock->LoadOptions)
27 {
28 /* Read the command line */
29 PCSTR CommandLine = LoaderBlock->LoadOptions;
30
31 /* Check for initial breakpoint */
32 if (strstr(CommandLine, "BREAK"))
34 }
35}
36
37/* FUNCTIONS ******************************************************************/
38
39/*
40 * @implemented
41 */
42CODE_SEG("INIT")
46 _In_ ULONG BootPhase,
47 _In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
48{
49 PKPRCB Prcb = KeGetCurrentPrcb();
50
51 /* Check the boot phase */
52 if (BootPhase == 0)
53 {
54 /* Get command-line parameters */
55 HalpGetParameters(LoaderBlock);
56
57 /* Checked HAL requires checked kernel */
58#if DBG
59 if (!(Prcb->BuildType & PRCB_BUILD_DEBUG))
60 {
61 /* No match, bugcheck */
62 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, PRCB_BUILD_DEBUG, 0);
63 }
64#else
65 /* Release build requires release HAL */
66 if (Prcb->BuildType & PRCB_BUILD_DEBUG)
67 {
68 /* No match, bugcheck */
69 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
70 }
71#endif
72
73#ifdef CONFIG_SMP
74 /* SMP HAL requires SMP kernel */
76 {
77 /* No match, bugcheck */
78 KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
79 }
80#endif
81
82 /* Validate the PRCB */
84 {
85 /* Validation failed, bugcheck */
86 KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, PRCB_MAJOR_VERSION, 0);
87 }
88
89 /* Initialize interrupts */
91
92 /* Force initial PIC state */
94
95 /* Fill out the dispatch tables */
96 //HalQuerySystemInformation = NULL; // FIXME: TODO;
97 //HalSetSystemInformation = NULL; // FIXME: TODO;
98 //HalInitPnpDriver = NULL; // FIXME: TODO
99 //HalGetDmaAdapter = NULL; // FIXME: TODO;
100 //HalGetInterruptTranslator = NULL; // FIXME: TODO
101 //HalResetDisplay = NULL; // FIXME: TODO;
102 //HalHaltSystem = NULL; // FIXME: TODO;
103
104 /* Setup I/O space */
105 //HalpDefaultIoSpace.Next = HalpAddressUsageList;
106 //HalpAddressUsageList = &HalpDefaultIoSpace;
107
108 /* Setup busy waiting */
109 //HalpCalibrateStallExecution();
110
111 /* Initialize the clock */
113
114 /* Setup time increments to 10ms and 1ms */
116 HalpNextTimeIncrement = 100000;
118 KeSetTimeIncrement(100000, 10000);
119
120 /*
121 * We could be rebooting with a pending profile interrupt,
122 * so clear it here before interrupts are enabled
123 */
125
126 /* Do some HAL-specific initialization */
127 HalpInitPhase0(LoaderBlock);
128 }
129 else if (BootPhase == 1)
130 {
131 /* Enable timer interrupt */
133 0,
137 Latched);
138#if 0
139 /* Enable IRQ 8 */
141 0,
145 Latched);
146#endif
147 /* Initialize DMA. NT does this in Phase 0 */
148 //HalpInitDma();
149
150 /* Do some HAL-specific initialization */
152 }
153
154 /* All done, return */
155 return TRUE;
156}
157
158#include <internal/kd.h>
159ULONG
160DbgPrintEarly(const char *fmt, ...)
161{
163 unsigned int i;
164 char Buffer[1024];
166
167 va_start(args, fmt);
168 i = vsprintf(Buffer, fmt, args);
169 va_end(args);
170
171 /* Output the message */
172 while (*String != 0)
173 {
174 if (*String == '\n')
175 {
176 KdPortPutByteEx(NULL, '\r');
177 }
179 String++;
180 }
181
182 return STATUS_SUCCESS;
183}
184
185/* EOF */
#define CODE_SEG(...)
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:32
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:45
ULONG DbgPrintEarly(const char *fmt,...)
Definition: halinit.c:160
static VOID HalpGetParameters(_In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: halinit.c:22
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:1182
#define PRCB_MAJOR_VERSION
Definition: ketypes.h:326
#define PRCB_BUILD_UNIPROCESSOR
Definition: ketypes.h:328
#define PRCB_BUILD_DEBUG
Definition: ketypes.h:327
#define _In_
Definition: no_sal2.h:158
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:692
USHORT MajorVersion
Definition: ketypes.h:691
Definition: match.c:390
Definition: dsound.c:943
#define NTAPI
Definition: typedefs.h:36
const char * PCSTR
Definition: typedefs.h:52
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