xref: /reactos/sdk/include/ndk/halfuncs.h (revision c8d07514)
1 /*++ NDK Version: 0098
2 
3 Copyright (c) Alex Ionescu.  All rights reserved.
4 
5 Header Name:
6 
7     halfuncs.h
8 
9 Abstract:
10 
11     Function definitions for the HAL.
12 
13 Author:
14 
15     Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16 
17 --*/
18 
19 #ifndef _HALFUNCS_H
20 #define _HALFUNCS_H
21 
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <haltypes.h>
27 #include <ketypes.h>
28 #include <section_attribs.h>
29 
30 #ifndef NTOS_MODE_USER
31 
32 //
33 // Private HAL Callbacks
34 //
35 #define HalHandlerForBus                HALPRIVATEDISPATCH->HalHandlerForBus
36 #define HalHandlerForConfigSpace        HALPRIVATEDISPATCH->HalHandlerForConfigSpace
37 #define HalLocateHiberRanges            HALPRIVATEDISPATCH->HalLocateHiberRanges
38 #define HalRegisterBusHandler           HALPRIVATEDISPATCH->HalRegisterBusHandler
39 #define HalSetWakeEnable                HALPRIVATEDISPATCH->HalSetWakeEnable
40 #define HalSetWakeAlarm                 HALPRIVATEDISPATCH->HalSetWakeAlarm
41 #define HalPciTranslateBusAddress       HALPRIVATEDISPATCH->HalPciTranslateBusAddress
42 #define HalPciAssignSlotResources       HALPRIVATEDISPATCH->HalPciAssignSlotResources
43 #define HalHaltSystem                   HALPRIVATEDISPATCH->HalHaltSystem
44 #define HalFindBusAddressTranslation    HALPRIVATEDISPATCH->HalFindBusAddressTranslation
45 #define HalResetDisplay                 HALPRIVATEDISPATCH->HalResetDisplay
46 #define HalAllocateMapRegisters         HALPRIVATEDISPATCH->HalAllocateMapRegisters
47 #define KdSetupPciDeviceForDebugging    HALPRIVATEDISPATCH->KdSetupPciDeviceForDebugging
48 #define KdReleasePciDeviceforDebugging  HALPRIVATEDISPATCH->KdReleasePciDeviceforDebugging
49 #define KdGetAcpiTablePhase0            HALPRIVATEDISPATCH->KdGetAcpiTablePhase0
50 #define KdCheckPowerButton              HALPRIVATEDISPATCH->KdCheckPowerButton
51 #define HalVectorToIDTEntry             HALPRIVATEDISPATCH->HalVectorToIDTEntry
52 #define KdMapPhysicalMemory64           HALPRIVATEDISPATCH->KdMapPhysicalMemory64
53 #define KdUnmapVirtualAddress           HALPRIVATEDISPATCH->KdUnmapVirtualAddress
54 
55 //
56 // Display Functions
57 //
58 NTHALAPI
59 VOID
60 NTAPI
61 HalDisplayString(
62     _In_ PCHAR String
63 );
64 
65 //
66 // Initialization Functions
67 //
68 NTHALAPI
69 BOOLEAN
70 NTAPI
71 HalAllProcessorsStarted(
72     VOID
73 );
74 
75 #ifdef _ARC_
76 NTHALAPI
77 VOID
78 NTAPI
79 HalInitializeProcessor(
80     _In_ ULONG ProcessorNumber,
81     _In_ struct _LOADER_PARAMETER_BLOCK *LoaderBlock
82 );
83 
84 NTHALAPI
85 BOOLEAN
86 NTAPI
87 HalInitSystem(
88     _In_ ULONG BootPhase,
89     _In_ struct _LOADER_PARAMETER_BLOCK *LoaderBlock
90 );
91 
92 NTHALAPI
93 BOOLEAN
94 NTAPI
95 HalStartNextProcessor(
96     _In_ struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
97     _In_ PKPROCESSOR_STATE ProcessorState
98 );
99 
100 #endif
101 
102 NTHALAPI
103 VOID
104 NTAPI
105 HalReturnToFirmware(
106     _In_ FIRMWARE_REENTRY Action
107 );
108 
109 //
110 // CPU Routines
111 //
112 NTHALAPI
113 VOID
114 NTAPI
115 HalProcessorIdle(
116     VOID
117 );
118 
119 //
120 // Interrupt Functions
121 //
122 NTHALAPI
123 BOOLEAN
124 NTAPI
125 HalBeginSystemInterrupt(
126     _In_ KIRQL Irql,
127     _In_ ULONG Vector,
128     _Out_ PKIRQL OldIrql
129 );
130 
131 VOID
132 FASTCALL
133 HalClearSoftwareInterrupt(
134     _In_ KIRQL Request
135 );
136 
137 NTHALAPI
138 VOID
139 NTAPI
140 HalDisableSystemInterrupt(
141     _In_ ULONG Vector,
142     _In_ KIRQL Irql
143 );
144 
145 NTHALAPI
146 BOOLEAN
147 NTAPI
148 HalEnableSystemInterrupt(
149     _In_ ULONG Vector,
150     _In_ KIRQL Irql,
151     _In_ KINTERRUPT_MODE InterruptMode
152 );
153 
154 #ifdef __REACTOS__
155 NTHALAPI
156 VOID
157 NTAPI
158 HalEndSystemInterrupt(
159     _In_ KIRQL Irql,
160     _In_ PKTRAP_FRAME TrapFrame
161 );
162 #else
163 NTHALAPI
164 VOID
165 NTAPI
166 HalEndSystemInterrupt(
167     _In_ KIRQL Irql,
168     _In_ UCHAR Vector
169 );
170 #endif
171 
172 #ifdef _ARM_ // FIXME: ndk/arm? armddk.h?
173 ULONG
174 HalGetInterruptSource(
175     VOID
176 );
177 #endif
178 
179 NTHALAPI
180 VOID
181 NTAPI
182 HalReportResourceUsage(
183     VOID
184 );
185 
186 NTHALAPI
187 VOID
188 FASTCALL
189 HalRequestSoftwareInterrupt(
190     _In_ KIRQL SoftwareInterruptRequested
191 );
192 
193 NTHALAPI
194 VOID
195 NTAPI
196 HalRequestIpi(
197     _In_ KAFFINITY TargetSet
198 );
199 
200 NTHALAPI
201 VOID
202 NTAPI
203 HalHandleNMI(
204     PVOID NmiInfo
205 );
206 
207 NTHALAPI
208 UCHAR
209 FASTCALL
210 HalSystemVectorDispatchEntry(
211     _In_ ULONG Vector,
212     _Out_ PKINTERRUPT_ROUTINE **FlatDispatch,
213     _Out_ PKINTERRUPT_ROUTINE *NoConnection
214 );
215 
216 //
217 // Bus Functions
218 //
219 NTHALAPI
220 NTSTATUS
221 NTAPI
222 HalAdjustResourceList(
223     _Inout_ PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList
224 );
225 
226 //
227 // Environment Functions
228 //
229 #ifdef _ARC_
230 NTHALAPI
231 ARC_STATUS
232 NTAPI
233 HalSetEnvironmentVariable(
234     _In_ PCH Name,
235     _In_ PCH Value
236 );
237 
238 NTHALAPI
239 ARC_STATUS
240 NTAPI
241 HalGetEnvironmentVariable(
242     _In_ PCH Variable,
243     _In_ USHORT Length,
244     _Out_ PCH Buffer
245 );
246 #endif
247 
248 //
249 // Profiling Functions
250 //
251 VOID
252 NTAPI
253 HalStartProfileInterrupt(
254     _In_ KPROFILE_SOURCE ProfileSource
255 );
256 
257 NTHALAPI
258 VOID
259 NTAPI
260 HalStopProfileInterrupt(
261     _In_ KPROFILE_SOURCE ProfileSource
262 );
263 
264 NTHALAPI
265 ULONG_PTR
266 NTAPI
267 HalSetProfileInterval(
268     _In_ ULONG_PTR Interval
269 );
270 
271 //
272 // Time Functions
273 //
274 NTHALAPI
275 BOOLEAN
276 NTAPI
277 HalQueryRealTimeClock(
278     _In_ PTIME_FIELDS RtcTime
279 );
280 
281 NTHALAPI
282 BOOLEAN
283 NTAPI
284 HalSetRealTimeClock(
285     _In_ PTIME_FIELDS RtcTime
286 );
287 
288 NTHALAPI
289 ULONG
290 NTAPI
291 HalSetTimeIncrement(
292     _In_ ULONG Increment
293 );
294 
295 
296 //
297 // BIOS call API
298 //
299 #ifdef _M_AMD64
300 
301 NTSTATUS
302 NTAPI
303 x86BiosAllocateBuffer(
304     _In_ ULONG *Size,
305     _In_ USHORT *Segment,
306     _In_ USHORT *Offset);
307 
308 NTSTATUS
309 NTAPI
310 x86BiosFreeBuffer(
311     _In_ USHORT Segment,
312     _In_ USHORT Offset);
313 
314 NTSTATUS
315 NTAPI
316 x86BiosReadMemory(
317     _In_ USHORT Segment,
318     _In_ USHORT Offset,
319     _Out_writes_bytes_(Size) PVOID Buffer,
320     _In_ ULONG Size);
321 
322 NTSTATUS
323 NTAPI
324 x86BiosWriteMemory(
325     _In_ USHORT Segment,
326     _In_ USHORT Offset,
327     _In_reads_bytes_(Size) PVOID Buffer,
328     _In_ ULONG Size);
329 
330 BOOLEAN
331 NTAPI
332 x86BiosCall(
333     _In_ ULONG InterruptNumber,
334     _Inout_ PX86_BIOS_REGISTERS Registers);
335 
336 #endif // _M_AMD64
337 
338 #endif // NTOS_MODE_USER
339 #endif // _HALFUNCS_H
340