1 /* Hardware Abstraction Layer Functions */
3 #if (NTDDI_VERSION >= NTDDI_WIN2K)
5 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
8 __drv_preferredFunction("AllocateCommonBuffer","Obsolete")
12 HalAllocateCommonBuffer(
13 _In_ PDMA_ADAPTER DmaAdapter
,
15 _Out_ PPHYSICAL_ADDRESS LogicalAddress
,
16 _In_ BOOLEAN CacheEnabled
)
18 PALLOCATE_COMMON_BUFFER allocateCommonBuffer
;
21 allocateCommonBuffer
= *(DmaAdapter
)->DmaOperations
->AllocateCommonBuffer
;
22 ASSERT( allocateCommonBuffer
!= NULL
);
23 commonBuffer
= allocateCommonBuffer( DmaAdapter
, Length
, LogicalAddress
, CacheEnabled
);
27 __drv_preferredFunction("FreeCommonBuffer","Obsolete")
32 _In_ PDMA_ADAPTER DmaAdapter
,
34 _In_ PHYSICAL_ADDRESS LogicalAddress
,
35 _In_ PVOID VirtualAddress
,
36 _In_ BOOLEAN CacheEnabled
)
38 PFREE_COMMON_BUFFER freeCommonBuffer
;
40 freeCommonBuffer
= *(DmaAdapter
)->DmaOperations
->FreeCommonBuffer
;
41 ASSERT( freeCommonBuffer
!= NULL
);
42 freeCommonBuffer( DmaAdapter
, Length
, LogicalAddress
, VirtualAddress
, CacheEnabled
);
45 __drv_preferredFunction("ReadDmaCounter","Obsolete")
50 _In_ PDMA_ADAPTER DmaAdapter
)
52 PREAD_DMA_COUNTER readDmaCounter
;
55 readDmaCounter
= *(DmaAdapter
)->DmaOperations
->ReadDmaCounter
;
56 ASSERT( readDmaCounter
!= NULL
);
57 counter
= readDmaCounter( DmaAdapter
);
64 _In_ PDMA_ADAPTER DmaAdapter
)
66 PGET_DMA_ALIGNMENT getDmaAlignment
;
69 getDmaAlignment
= *(DmaAdapter
)->DmaOperations
->GetDmaAlignment
;
70 ASSERT( getDmaAlignment
!= NULL
);
71 alignment
= getDmaAlignment( DmaAdapter
);
79 #else /* USE_DMA_MACROS ... */
81 //DECLSPEC_DEPRECATED_DDK
86 _In_ PADAPTER_OBJECT AdapterObject
);
88 //DECLSPEC_DEPRECATED_DDK
92 IoFlushAdapterBuffers(
93 _In_ PADAPTER_OBJECT AdapterObject
,
95 _In_ PVOID MapRegisterBase
,
98 _In_ BOOLEAN WriteToDevice
);
100 //DECLSPEC_DEPRECATED_DDK
105 _In_ PADAPTER_OBJECT AdapterObject
,
106 _In_ PVOID MapRegisterBase
,
107 _In_ ULONG NumberOfMapRegisters
);
109 //DECLSPEC_DEPRECATED_DDK
113 HalAllocateCommonBuffer(
114 _In_ PADAPTER_OBJECT AdapterObject
,
116 _Out_ PPHYSICAL_ADDRESS LogicalAddress
,
117 _In_ BOOLEAN CacheEnabled
);
119 //DECLSPEC_DEPRECATED_DDK
124 _In_ PADAPTER_OBJECT AdapterObject
,
126 _In_ PHYSICAL_ADDRESS LogicalAddress
,
127 _In_ PVOID VirtualAddress
,
128 _In_ BOOLEAN CacheEnabled
);
130 //DECLSPEC_DEPRECATED_DDK
135 _In_ PADAPTER_OBJECT AdapterObject
);
140 HalAllocateAdapterChannel(
141 _In_ PADAPTER_OBJECT AdapterObject
,
142 _In_ PWAIT_CONTEXT_BLOCK Wcb
,
143 _In_ ULONG NumberOfMapRegisters
,
144 _In_ PDRIVER_CONTROL ExecutionRoutine
);
147 #endif /* USE_DMA_MACROS ... */
150 #if !defined(NO_LEGACY_DRIVERS)
154 HalAssignSlotResources(
155 _In_ PUNICODE_STRING RegistryPath
,
156 _In_opt_ PUNICODE_STRING DriverClassName
,
157 _In_ PDRIVER_OBJECT DriverObject
,
158 _In_ PDEVICE_OBJECT DeviceObject
,
159 _In_ INTERFACE_TYPE BusType
,
160 _In_ ULONG BusNumber
,
161 _In_ ULONG SlotNumber
,
162 _Inout_ PCM_RESOURCE_LIST
*AllocatedResources
);
164 _IRQL_requires_max_(PASSIVE_LEVEL
)
168 HalGetInterruptVector(
169 _In_ INTERFACE_TYPE InterfaceType
,
170 _In_ ULONG BusNumber
,
171 _In_ ULONG BusInterruptLevel
,
172 _In_ ULONG BusInterruptVector
,
174 _Out_ PKAFFINITY Affinity
);
180 _In_ BUS_DATA_TYPE BusDataType
,
181 _In_ ULONG BusNumber
,
182 _In_ ULONG SlotNumber
,
183 _In_reads_bytes_(Length
) PVOID Buffer
,
190 _In_ BUS_DATA_TYPE BusDataType
,
191 _In_ ULONG BusNumber
,
192 _In_ ULONG SlotNumber
,
193 _Out_writes_bytes_(Length
) PVOID Buffer
,
200 _In_ ULONG Frequency
);
201 #endif /* !defined(NO_LEGACY_DRIVERS) */
203 _IRQL_requires_max_(PASSIVE_LEVEL
)
208 _In_ PDEVICE_DESCRIPTION DeviceDescription
,
209 _Out_ PULONG NumberOfMapRegisters
);
214 _In_ PADAPTER_OBJECT DmaAdapter
);
219 HalAcquireDisplayOwnership(
220 _In_ PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters
);
225 HalGetBusDataByOffset(
226 _In_ BUS_DATA_TYPE BusDataType
,
227 _In_ ULONG BusNumber
,
228 _In_ ULONG SlotNumber
,
229 _Out_writes_bytes_(Length
) PVOID Buffer
,
236 HalSetBusDataByOffset(
237 _In_ BUS_DATA_TYPE BusDataType
,
238 _In_ ULONG BusNumber
,
239 _In_ ULONG SlotNumber
,
240 _In_reads_bytes_(Length
) PVOID Buffer
,
247 HalTranslateBusAddress(
248 _In_ INTERFACE_TYPE InterfaceType
,
249 _In_ ULONG BusNumber
,
250 _In_ PHYSICAL_ADDRESS BusAddress
,
251 _Inout_ PULONG AddressSpace
,
252 _Out_ PPHYSICAL_ADDRESS TranslatedAddress
);
257 HalAllocateCrashDumpRegisters(
258 _In_ PADAPTER_OBJECT AdapterObject
,
259 _Inout_ PULONG NumberOfMapRegisters
);
263 HalGetScatterGatherList(
264 _In_ PADAPTER_OBJECT DmaAdapter
,
265 _In_ PDEVICE_OBJECT DeviceObject
,
267 _In_ PVOID CurrentVa
,
269 _In_ PDRIVER_LIST_CONTROL ExecutionRoutine
,
271 _In_ BOOLEAN WriteToDevice
);
275 HalPutScatterGatherList(
276 _In_ PADAPTER_OBJECT DmaAdapter
,
277 _In_ PSCATTER_GATHER_LIST ScatterGather
,
278 _In_ BOOLEAN WriteToDevice
);
281 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
284 #if (NTDDI_VERSION >= NTDDI_WINXP)
285 _IRQL_requires_max_(PASSIVE_LEVEL
)
290 _In_ PDEVICE_OBJECT DeviceObject
,
291 _In_ ULONG SectorSize
,
292 _In_ ULONG MBRTypeIdentifier
,
293 _Out_ PVOID
*Buffer
);
294 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
296 #if (NTDDI_VERSION >= NTDDI_WIN7)
300 HalAllocateHardwareCounters(
301 _In_reads_(GroupCount
) PGROUP_AFFINITY GroupAffinty
,
302 _In_ ULONG GroupCount
,
303 _In_ PPHYSICAL_COUNTER_RESOURCE_LIST ResourceList
,
304 _Out_ PHANDLE CounterSetHandle
);
308 HalFreeHardwareCounters(
309 _In_ HANDLE CounterSetHandle
);
311 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
314 #if (NTDDI_VERSION >= NTDDI_WIN2K)
318 HalGetDmaAlignmentRequirement(VOID
);
320 #endif /* defined(_IA64_) */
322 #if defined(_M_IX86) || defined(_M_AMD64)
323 #define HalGetDmaAlignmentRequirement() 1L
326 #if (NTDDI_VERSION >= NTDDI_WIN7)
328 typedef struct _WHEA_ERROR_SOURCE_DESCRIPTOR
*PWHEA_ERROR_SOURCE_DESCRIPTOR
;
329 typedef struct _WHEA_ERROR_RECORD
*PWHEA_ERROR_RECORD
;
335 _In_ PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource
,
336 _In_ PWHEA_ERROR_RECORD ErrorRecord
);
340 typedef struct _WHEA_ERROR_RECORD
*PWHEA_ERROR_RECORD
;
346 _In_ PWHEA_ERROR_RECORD ErrorRecord
);
348 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */