ReactOS  r75907
halfuncs.h
Go to the documentation of this file.
1 /* Hardware Abstraction Layer Functions */
2 
3 #if (NTDDI_VERSION >= NTDDI_WIN2K)
4 
5 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
6 
8 __drv_preferredFunction("AllocateCommonBuffer","Obsolete")
10 PVOID
11 NTAPI
13  _In_ PDMA_ADAPTER DmaAdapter,
15  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
16  _In_ BOOLEAN CacheEnabled)
17 {
18  PALLOCATE_COMMON_BUFFER allocateCommonBuffer;
19  PVOID commonBuffer;
20 
21  allocateCommonBuffer = *(DmaAdapter)->DmaOperations->AllocateCommonBuffer;
22  ASSERT( allocateCommonBuffer != NULL );
23  commonBuffer = allocateCommonBuffer( DmaAdapter, Length, LogicalAddress, CacheEnabled );
24  return commonBuffer;
25 }
26 
27 __drv_preferredFunction("FreeCommonBuffer","Obsolete")
29 VOID
30 NTAPI
32  _In_ PDMA_ADAPTER DmaAdapter,
33  _In_ ULONG Length,
34  _In_ PHYSICAL_ADDRESS LogicalAddress,
36  _In_ BOOLEAN CacheEnabled)
37 {
38  PFREE_COMMON_BUFFER freeCommonBuffer;
39 
40  freeCommonBuffer = *(DmaAdapter)->DmaOperations->FreeCommonBuffer;
41  ASSERT( freeCommonBuffer != NULL );
42  freeCommonBuffer( DmaAdapter, Length, LogicalAddress, VirtualAddress, CacheEnabled );
43 }
44 
45 __drv_preferredFunction("ReadDmaCounter","Obsolete")
47 ULONG
48 NTAPI
50  _In_ PDMA_ADAPTER DmaAdapter)
51 {
52  PREAD_DMA_COUNTER readDmaCounter;
53  ULONG counter;
54 
55  readDmaCounter = *(DmaAdapter)->DmaOperations->ReadDmaCounter;
56  ASSERT( readDmaCounter != NULL );
57  counter = readDmaCounter( DmaAdapter );
58  return counter;
59 }
60 
62 ULONG
63 HalGetDmaAlignment(
64  _In_ PDMA_ADAPTER DmaAdapter)
65 {
66  PGET_DMA_ALIGNMENT getDmaAlignment;
67  ULONG alignment;
68 
69  getDmaAlignment = *(DmaAdapter)->DmaOperations->GetDmaAlignment;
70  ASSERT( getDmaAlignment != NULL );
71  alignment = getDmaAlignment( DmaAdapter );
72  return alignment;
73 }
74 
76 $if (_NTDDK_)
77 /* Nothing here */
78 
79 #else /* USE_DMA_MACROS ... */
80 
81 //DECLSPEC_DEPRECATED_DDK
83 VOID
84 NTAPI
86  _In_ PADAPTER_OBJECT AdapterObject);
87 
88 //DECLSPEC_DEPRECATED_DDK
90 BOOLEAN
91 NTAPI
93  _In_ PADAPTER_OBJECT AdapterObject,
94  _In_ PMDL Mdl,
96  _In_ PVOID CurrentVa,
97  _In_ ULONG Length,
98  _In_ BOOLEAN WriteToDevice);
99 
100 //DECLSPEC_DEPRECATED_DDK
101 NTHALAPI
102 VOID
103 NTAPI
105  _In_ PADAPTER_OBJECT AdapterObject,
108 
109 //DECLSPEC_DEPRECATED_DDK
110 NTHALAPI
111 PVOID
112 NTAPI
114  _In_ PADAPTER_OBJECT AdapterObject,
115  _In_ ULONG Length,
116  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
117  _In_ BOOLEAN CacheEnabled);
118 
119 //DECLSPEC_DEPRECATED_DDK
120 NTHALAPI
121 VOID
122 NTAPI
124  _In_ PADAPTER_OBJECT AdapterObject,
125  _In_ ULONG Length,
126  _In_ PHYSICAL_ADDRESS LogicalAddress,
127  _In_ PVOID VirtualAddress,
128  _In_ BOOLEAN CacheEnabled);
129 
130 //DECLSPEC_DEPRECATED_DDK
131 NTHALAPI
132 ULONG
133 NTAPI
135  _In_ PADAPTER_OBJECT AdapterObject);
136 
137 NTHALAPI
138 NTSTATUS
139 NTAPI
141  _In_ PADAPTER_OBJECT AdapterObject,
145 
146 $endif (_NTDDK_)
147 #endif /* USE_DMA_MACROS ... */
148 
149 $if (_NTDDK_)
150 #if !defined(NO_LEGACY_DRIVERS)
151 NTHALAPI
152 NTSTATUS
153 NTAPI
163 
165 NTHALAPI
166 ULONG
167 NTAPI
173  _Out_ PKIRQL Irql,
175 
176 NTHALAPI
177 ULONG
178 NTAPI
180  _In_ BUS_DATA_TYPE BusDataType,
181  _In_ ULONG BusNumber,
183  _In_reads_bytes_(Length) PVOID Buffer,
184  _In_ ULONG Length);
185 
186 NTHALAPI
187 ULONG
188 NTAPI
190  _In_ BUS_DATA_TYPE BusDataType,
191  _In_ ULONG BusNumber,
192  _In_ ULONG SlotNumber,
193  _Out_writes_bytes_(Length) PVOID Buffer,
194  _In_ ULONG Length);
195 
196 NTHALAPI
197 BOOLEAN
198 NTAPI
201 #endif /* !defined(NO_LEGACY_DRIVERS) */
202 
204 NTHALAPI
206 NTAPI
210 
211 VOID
212 NTAPI
214  _In_ PADAPTER_OBJECT DmaAdapter);
215 
216 NTHALAPI
217 VOID
218 NTAPI
220  _In_ PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters);
221 
222 NTHALAPI
223 ULONG
224 NTAPI
226  _In_ BUS_DATA_TYPE BusDataType,
227  _In_ ULONG BusNumber,
228  _In_ ULONG SlotNumber,
229  _Out_writes_bytes_(Length) PVOID Buffer,
230  _In_ ULONG Offset,
231  _In_ ULONG Length);
232 
233 NTHALAPI
234 ULONG
235 NTAPI
237  _In_ BUS_DATA_TYPE BusDataType,
238  _In_ ULONG BusNumber,
239  _In_ ULONG SlotNumber,
240  _In_reads_bytes_(Length) PVOID Buffer,
241  _In_ ULONG Offset,
242  _In_ ULONG Length);
243 
244 NTHALAPI
245 BOOLEAN
246 NTAPI
248  _In_ INTERFACE_TYPE InterfaceType,
249  _In_ ULONG BusNumber,
253 
254 NTHALAPI
255 PVOID
256 NTAPI
258  _In_ PADAPTER_OBJECT AdapterObject,
259  _Inout_ PULONG NumberOfMapRegisters);
260 
261 NTSTATUS
262 NTAPI
264  _In_ PADAPTER_OBJECT DmaAdapter,
266  _In_ PMDL Mdl,
267  _In_ PVOID CurrentVa,
268  _In_ ULONG Length,
271  _In_ BOOLEAN WriteToDevice);
272 
273 VOID
274 NTAPI
276  _In_ PADAPTER_OBJECT DmaAdapter,
278  _In_ BOOLEAN WriteToDevice);
279 
280 $endif (_NTDDK_)
281 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
282 
283 $if (_NTDDK_)
284 #if (NTDDI_VERSION >= NTDDI_WINXP)
287 VOID
288 FASTCALL
290  _In_ PDEVICE_OBJECT DeviceObject,
293  _Out_ PVOID *Buffer);
294 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
295 
296 #if (NTDDI_VERSION >= NTDDI_WIN7)
297 
298 NTSTATUS
299 NTAPI
301  _In_reads_(GroupCount) PGROUP_AFFINITY GroupAffinty,
302  _In_ ULONG GroupCount,
304  _Out_ PHANDLE CounterSetHandle);
305 
306 NTSTATUS
307 NTAPI
309  _In_ HANDLE CounterSetHandle);
310 
311 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
312 
313 #if defined(_IA64_)
314 #if (NTDDI_VERSION >= NTDDI_WIN2K)
315 NTHALAPI
316 ULONG
317 NTAPI
318 HalGetDmaAlignmentRequirement(VOID);
319 #endif
320 #endif /* defined(_IA64_) */
321 
322 #if defined(_M_IX86) || defined(_M_AMD64)
323 #define HalGetDmaAlignmentRequirement() 1L
324 #endif
325 
326 #if (NTDDI_VERSION >= NTDDI_WIN7)
327 
328 typedef struct _WHEA_ERROR_SOURCE_DESCRIPTOR *PWHEA_ERROR_SOURCE_DESCRIPTOR;
329 typedef struct _WHEA_ERROR_RECORD *PWHEA_ERROR_RECORD;
330 
331 NTHALAPI
332 VOID
333 NTAPI
335  _In_ PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource,
336  _In_ PWHEA_ERROR_RECORD ErrorRecord);
337 
338 #else
339 
340 typedef struct _WHEA_ERROR_RECORD *PWHEA_ERROR_RECORD;
341 
342 NTHALAPI
343 VOID
344 NTAPI
346  _In_ PWHEA_ERROR_RECORD ErrorRecord);
347 
348 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
349 
350 $endif (_NTDDK_)
DWORD *typedef PVOID
Definition: winlogon.h:52
_In_ ULONG _In_ ULONG BusInterruptLevel
Definition: halfuncs.h:170
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2268
NTHALAPI VOID NTAPI IoFreeAdapterChannel(_In_ PADAPTER_OBJECT AdapterObject)
enum _INTERFACE_TYPE INTERFACE_TYPE
_Out_ PULONG NumberOfMapRegisters
Definition: halfuncs.h:209
NTHALAPI BOOLEAN NTAPI IoFlushAdapterBuffers(_In_ PADAPTER_OBJECT AdapterObject, _In_ PMDL Mdl, _In_ PVOID MapRegisterBase, _In_ PVOID CurrentVa, _In_ ULONG Length, _In_ BOOLEAN WriteToDevice)
NTHALAPI ULONG NTAPI HalGetInterruptVector(INTERFACE_TYPE, ULONG, ULONG, ULONG, PKIRQL, PKAFFINITY)
#define NTHALAPI
Definition: ntoskrnl.h:39
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:156
ULONG(NTAPI * PREAD_DMA_COUNTER)(_In_ PDMA_ADAPTER DmaAdapter)
Definition: iotypes.h:2244
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
struct _WHEA_ERROR_SOURCE_DESCRIPTOR * PWHEA_ERROR_SOURCE_DESCRIPTOR
Definition: halfuncs.h:328
enum _BUS_DATA_TYPE BUS_DATA_TYPE
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2268
$if(_WDMDDK_) typedef struct _KFLOATING_SAVE
Definition: ke.h:1
VOID(NTAPI * PFREE_COMMON_BUFFER)(_In_ PDMA_ADAPTER DmaAdapter, _In_ ULONG Length, _In_ PHYSICAL_ADDRESS LogicalAddress, _In_ PVOID VirtualAddress, _In_ BOOLEAN CacheEnabled)
Definition: iotypes.h:2196
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT DriverObject
Definition: halfuncs.h:156
#define _In_reads_(size)
Definition: no_sal2.h:228
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT DeviceObject
Definition: halfuncs.h:156
NTSTATUS NTAPI HalAllocateHardwareCounters(_In_reads_(GroupCount) PGROUP_AFFINITY GroupAffinty, _In_ ULONG GroupCount, _In_ PPHYSICAL_COUNTER_RESOURCE_LIST ResourceList, _Out_ PHANDLE CounterSetHandle)
#define _WDMDDK_
Definition: wdm.template.h:26
_IRQL_requires_max_(PASSIVE_LEVEL) NTHALAPI ULONG NTAPI HalGetInterruptVector(_In_ INTERFACE_TYPE InterfaceType
Definition: Messaging.c:37
_In_ ULONG _In_ ULONG _In_ ULONG BusInterruptVector
Definition: halfuncs.h:170
VOID NTAPI HalPutScatterGatherList(_In_ PADAPTER_OBJECT DmaAdapter, _In_ PSCATTER_GATHER_LIST ScatterGather, _In_ BOOLEAN WriteToDevice)
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2268
PVOID PMDL
Definition: usb.h:39
#define FASTCALL
Definition: nt_native.h:50
_Out_ PKIRQL Irql
Definition: csq.h:179
NTHALAPI ULONG NTAPI HalGetBusDataByOffset(_In_ BUS_DATA_TYPE BusDataType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
#define _In_opt_
Definition: no_sal2.h:213
NTHALAPI ULONG NTAPI HalSetBusData(_In_ BUS_DATA_TYPE BusDataType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
NTHALAPI ULONG NTAPI HalReadDmaCounter(_In_ PADAPTER_OBJECT AdapterObject)
_In_opt_ PUNICODE_STRING DriverClassName
Definition: halfuncs.h:156
NTHALAPI ULONG NTAPI HalSetBusDataByOffset(_In_ BUS_DATA_TYPE BusDataType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
KAFFINITY * PKAFFINITY
Definition: basetsd.h:196
smooth NULL
Definition: ftsmooth.c:513
#define __drv_preferredFunction(func, why)
Definition: driverspecs.h:293
static PUCHAR ResourceList[1+IDB_CLUSTER_SERVER]
Definition: inbv.c:44
#define _Out_writes_bytes_(size)
Definition: no_sal2.h:370
#define FORCEINLINE
Definition: ntbasedef.h:213
#define _Out_
Definition: no_sal2.h:323
#define NTKERNELAPI
NTHALAPI VOID NTAPI HalBugCheckSystem(_In_ PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource, _In_ PWHEA_ERROR_RECORD ErrorRecord)
Definition: bufpool.h:45
GLuint counter
Definition: glext.h:11116
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
unsigned char BOOLEAN
NTSTATUS NTAPI HalFreeHardwareCounters(_In_ HANDLE CounterSetHandle)
ACPI_EFI_GUID ACPI_EFI_INTERFACE_TYPE InterfaceType
Definition: acefiex.h:603
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
ULONG(NTAPI * PGET_DMA_ALIGNMENT)(_In_ PDMA_ADAPTER DmaAdapter)
Definition: iotypes.h:2240
NTHALAPI NTSTATUS NTAPI HalAllocateAdapterChannel(_In_ PADAPTER_OBJECT AdapterObject, _In_ PWAIT_CONTEXT_BLOCK Wcb, _In_ ULONG NumberOfMapRegisters, _In_ PDRIVER_CONTROL ExecutionRoutine)
#define _Inout_
Definition: no_sal2.h:244
VOID NTAPI HalPutDmaAdapter(_In_ PADAPTER_OBJECT DmaAdapter)
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
VOID UINTN Length
Definition: acefiex.h:744
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:411
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
$endif(_NTDDK_)$if(_NTDDK_) NTHALAPI NTSTATUS NTAPI HalAssignSlotResources(_In_ PUNICODE_STRING RegistryPath
Definition: iofuncs.h:2487
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3772
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define _In_reads_bytes_(size)
Definition: no_sal2.h:229
NTHALAPI BOOLEAN NTAPI HalMakeBeep(_In_ ULONG Frequency)
#define _In_
Definition: no_sal2.h:204
NTHALAPI ULONG NTAPI HalGetBusData(_In_ BUS_DATA_TYPE BusDataType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
DWORD *typedef HANDLE
Definition: winlogon.h:52
_Inout_ struct _IRP _In_ PVOID MapRegisterBase
Definition: iotypes.h:189
LONG NTSTATUS
Definition: DriverTester.h:11
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG _Inout_ PCM_RESOURCE_LIST * AllocatedResources
Definition: halfuncs.h:156
_In_ ULONG _In_ ULONG MBRTypeIdentifier
Definition: halfuncs.h:291
DRIVER_LIST_CONTROL * PDRIVER_LIST_CONTROL
Definition: iotypes.h:2255
NTHALAPI PVOID NTAPI HalAllocateCrashDumpRegisters(_In_ PADAPTER_OBJECT AdapterObject, _Inout_ PULONG NumberOfMapRegisters)
NTSTATUS NTAPI HalGetScatterGatherList(_In_ PADAPTER_OBJECT DmaAdapter, _In_ PDEVICE_OBJECT DeviceObject, _In_ PMDL Mdl, _In_ PVOID CurrentVa, _In_ ULONG Length, _In_ PDRIVER_LIST_CONTROL ExecutionRoutine, _In_ PVOID Context, _In_ BOOLEAN WriteToDevice)
unsigned int * PULONG
Definition: retypes.h:1
_In_ struct _IRP _In_ struct _SCATTER_GATHER_LIST * ScatterGather
Definition: iotypes.h:2253
PVOID(NTAPI * PALLOCATE_COMMON_BUFFER)(_In_ PDMA_ADAPTER DmaAdapter, _In_ ULONG Length, _Out_ PPHYSICAL_ADDRESS LogicalAddress, _In_ BOOLEAN CacheEnabled)
Definition: iotypes.h:2189
struct _WHEA_ERROR_RECORD * PWHEA_ERROR_RECORD
Definition: halfuncs.h:329
static LARGE_INTEGER Frequency
Definition: clock.c:41
NTHALAPI VOID NTAPI HalAcquireDisplayOwnership(_In_ PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
NTHALAPI VOID NTAPI HalFreeCommonBuffer(_In_ PADAPTER_OBJECT AdapterObject, _In_ ULONG Length, _In_ PHYSICAL_ADDRESS LogicalAddress, _In_ PVOID VirtualAddress, _In_ BOOLEAN CacheEnabled)
NTHALAPI PVOID NTAPI HalAllocateCommonBuffer(_In_ PADAPTER_OBJECT AdapterObject, _In_ ULONG Length, _Out_ PPHYSICAL_ADDRESS LogicalAddress, _In_ BOOLEAN CacheEnabled)
NTHALAPI VOID NTAPI IoFreeMapRegisters(_In_ PADAPTER_OBJECT AdapterObject, _In_ PVOID MapRegisterBase, _In_ ULONG NumberOfMapRegisters)
_In_ PDEVICE_OBJECT _In_ ULONG _In_ PDRIVER_CONTROL ExecutionRoutine
Definition: iofuncs.h:1393
struct _SCATTER_GATHER_LIST * PSCATTER_GATHER_LIST
Definition: iotypes.h:2090
unsigned int ULONG
Definition: retypes.h:1
VOID FASTCALL HalExamineMBR(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG MbrTypeIdentifier, OUT PVOID *MbrBuffer)
Definition: disksup.c:2289
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
DRIVER_CONTROL * PDRIVER_CONTROL
Definition: iotypes.h:192
NTHALAPI NTSTATUS NTAPI HalAssignSlotResources(PUNICODE_STRING, PUNICODE_STRING, PDRIVER_OBJECT, PDEVICE_OBJECT, INTERFACE_TYPE, ULONG, ULONG, PCM_RESOURCE_LIST *)
_In_ ULONG SectorSize
Definition: halfuncs.h:291
#define _NTDDK_
PADAPTER_OBJECT NTAPI HalGetAdapter(IN PDEVICE_DESCRIPTION DeviceDescription, OUT PULONG NumberOfMapRegisters)
Definition: dma.c:22
NTHALAPI BOOLEAN NTAPI HalTranslateBusAddress(_In_ INTERFACE_TYPE InterfaceType, _In_ ULONG BusNumber, _In_ PHYSICAL_ADDRESS BusAddress, _Inout_ PULONG AddressSpace, _Out_ PPHYSICAL_ADDRESS TranslatedAddress)