[NDK]
[reactos.git] / reactos / include / ndk / haltypes.h
1 /*++ NDK Version: 0098
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 haltypes.h
8
9 Abstract:
10
11 Type definitions for the HAL.
12
13 Author:
14
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16
17 --*/
18
19 #ifndef _HALTYPES_H
20 #define _HALTYPES_H
21
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26
27 #ifndef NTOS_MODE_USER
28
29 //
30 // HalShutdownSystem Types
31 //
32 typedef enum _FIRMWARE_REENTRY
33 {
34 HalHaltRoutine,
35 HalPowerDownRoutine,
36 HalRestartRoutine,
37 HalRebootRoutine,
38 HalInteractiveModeRoutine,
39 HalMaximumRoutine
40 } FIRMWARE_REENTRY, *PFIRMWARE_REENTRY;
41
42 //
43 // HAL Private function Types
44 //
45 typedef
46 PBUS_HANDLER
47 (FASTCALL *pHalHandlerForConfigSpace)(
48 IN BUS_DATA_TYPE ConfigSpace,
49 IN ULONG BusNumber
50 );
51
52 typedef
53 NTSTATUS
54 (NTAPI *PINSTALL_BUS_HANDLER)(
55 IN PBUS_HANDLER Bus
56 );
57
58 typedef
59 NTSTATUS
60 (NTAPI *pHalRegisterBusHandler)(
61 IN INTERFACE_TYPE InterfaceType,
62 IN BUS_DATA_TYPE ConfigSpace,
63 IN ULONG BusNumber,
64 IN INTERFACE_TYPE ParentInterfaceType,
65 IN ULONG ParentBusNumber,
66 IN ULONG ContextSize,
67 IN PINSTALL_BUS_HANDLER InstallCallback,
68 OUT PBUS_HANDLER *BusHandler
69 );
70
71 typedef
72 VOID
73 (NTAPI *pHalSetWakeEnable)(
74 IN BOOLEAN Enable
75 );
76
77 typedef
78 VOID
79 (NTAPI *pHalSetWakeAlarm)(
80 IN ULONGLONG AlartTime,
81 IN PTIME_FIELDS TimeFields
82 );
83
84 typedef
85 VOID
86 (NTAPI *pHalLocateHiberRanges)(
87 IN PVOID MemoryMap
88 );
89
90 typedef
91 NTSTATUS
92 (NTAPI *pHalAllocateMapRegisters)(
93 IN PADAPTER_OBJECT AdapterObject,
94 IN ULONG Unknown,
95 IN ULONG Unknown2,
96 PMAP_REGISTER_ENTRY Registers
97 );
98
99 //
100 // HAL Bus Handler Callback Types
101 //
102 typedef
103 NTSTATUS
104 (NTAPI *PADJUSTRESOURCELIST)(
105 IN PBUS_HANDLER BusHandler,
106 IN PBUS_HANDLER RootHandler,
107 IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *Resources
108 );
109
110 typedef
111 NTSTATUS
112 (NTAPI *PASSIGNSLOTRESOURCES)(
113 IN PBUS_HANDLER BusHandler,
114 IN PBUS_HANDLER RootHandler,
115 IN PUNICODE_STRING RegistryPath,
116 IN PUNICODE_STRING DriverClassName,
117 IN PDRIVER_OBJECT DriverObject,
118 IN PDEVICE_OBJECT DeviceObject,
119 IN ULONG SlotNumber,
120 IN OUT PCM_RESOURCE_LIST *AllocatedResources
121 );
122
123 typedef
124 ULONG
125 (NTAPI *PGETSETBUSDATA)(
126 IN PBUS_HANDLER BusHandler,
127 IN PBUS_HANDLER RootHandler,
128 IN ULONG SlotNumber,
129 OUT PVOID Buffer,
130 IN ULONG Offset,
131 IN ULONG Length
132 );
133
134 typedef
135 ULONG
136 (NTAPI *PGETINTERRUPTVECTOR)(
137 IN PBUS_HANDLER BusHandler,
138 IN PBUS_HANDLER RootHandler,
139 IN ULONG BusInterruptLevel,
140 IN ULONG BusInterruptVector,
141 OUT PKIRQL Irql,
142 OUT PKAFFINITY Affinity
143 );
144
145 typedef
146 BOOLEAN
147 (NTAPI *PTRANSLATEBUSADDRESS)(
148 IN PBUS_HANDLER BusHandler,
149 IN PBUS_HANDLER RootHandler,
150 IN PHYSICAL_ADDRESS BusAddress,
151 IN OUT PULONG AddressSpace,
152 OUT PPHYSICAL_ADDRESS TranslatedAddress
153 );
154
155 //
156 // Hal Private dispatch Table
157 //
158 #define HAL_PRIVATE_DISPATCH_VERSION 2
159 typedef struct _HAL_PRIVATE_DISPATCH
160 {
161 ULONG Version;
162 pHalHandlerForBus HalHandlerForBus;
163 pHalHandlerForConfigSpace HalHandlerForConfigSpace;
164 pHalLocateHiberRanges HalLocateHiberRanges;
165 pHalRegisterBusHandler HalRegisterBusHandler;
166 pHalSetWakeEnable HalSetWakeEnable;
167 pHalSetWakeAlarm HalSetWakeAlarm;
168 pHalTranslateBusAddress HalPciTranslateBusAddress;
169 pHalAssignSlotResources HalPciAssignSlotResources;
170 pHalHaltSystem HalHaltSystem;
171 pHalFindBusAddressTranslation HalFindBusAddressTranslation;
172 pHalResetDisplay HalResetDisplay;
173 pHalAllocateMapRegisters HalAllocateMapRegisters;
174 pKdSetupPciDeviceForDebugging KdSetupPciDeviceForDebugging;
175 pKdReleasePciDeviceForDebugging KdReleasePciDeviceforDebugging;
176 pKdGetAcpiTablePhase0 KdGetAcpiTablePhase0;
177 pKdCheckPowerButton KdCheckPowerButton;
178 pHalVectorToIDTEntry HalVectorToIDTEntry;
179 pKdMapPhysicalMemory64 KdMapPhysicalMemory64;
180 pKdUnmapVirtualAddress KdUnmapVirtualAddress;
181 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
182 pKdGetPciDataByOffset KdGetPciDataByOffset;
183 pKdSetPciDataByOffset KdSetPciDataByOffset;
184 PVOID HalGetInterruptVectorOverride;
185 PVOID HalGetVectorInputOverride;
186 #endif
187 } HAL_PRIVATE_DISPATCH, *PHAL_PRIVATE_DISPATCH;
188
189 //
190 // HAL Supported Range
191 //
192 #define HAL_SUPPORTED_RANGE_VERSION 1
193 typedef struct _SUPPORTED_RANGE
194 {
195 struct _SUPPORTED_RANGE *Next;
196 ULONG SystemAddressSpace;
197 LONGLONG SystemBase;
198 LONGLONG Base;
199 LONGLONG Limit;
200 } SUPPORTED_RANGE, *PSUPPORTED_RANGE;
201
202 typedef struct _SUPPORTED_RANGES
203 {
204 USHORT Version;
205 BOOLEAN Sorted;
206 UCHAR Reserved;
207 ULONG NoIO;
208 SUPPORTED_RANGE IO;
209 ULONG NoMemory;
210 SUPPORTED_RANGE Memory;
211 ULONG NoPrefetchMemory;
212 SUPPORTED_RANGE PrefetchMemory;
213 ULONG NoDma;
214 SUPPORTED_RANGE Dma;
215 } SUPPORTED_RANGES, *PSUPPORTED_RANGES;
216
217 //
218 // HAL Bus Handler
219 //
220 #define HAL_BUS_HANDLER_VERSION 1
221 typedef struct _BUS_HANDLER
222 {
223 ULONG Version;
224 INTERFACE_TYPE InterfaceType;
225 BUS_DATA_TYPE ConfigurationType;
226 ULONG BusNumber;
227 PDEVICE_OBJECT DeviceObject;
228 struct _BUS_HANDLER *ParentHandler;
229 PVOID BusData;
230 ULONG DeviceControlExtensionSize;
231 PSUPPORTED_RANGES BusAddresses;
232 ULONG Reserved[4];
233 PGETSETBUSDATA GetBusData;
234 PGETSETBUSDATA SetBusData;
235 PADJUSTRESOURCELIST AdjustResourceList;
236 PASSIGNSLOTRESOURCES AssignSlotResources;
237 PGETINTERRUPTVECTOR GetInterruptVector;
238 PTRANSLATEBUSADDRESS TranslateBusAddress;
239 PVOID Spare1;
240 PVOID Spare2;
241 PVOID Spare3;
242 PVOID Spare4;
243 PVOID Spare5;
244 PVOID Spare6;
245 PVOID Spare7;
246 PVOID Spare8;
247 } BUS_HANDLER;
248
249 //
250 // HAL Chip Hacks
251 //
252 #define HAL_PCI_CHIP_HACK_BROKEN_ACPI_TIMER 0x01
253 #define HAL_PCI_CHIP_HACK_DISABLE_HIBERNATE 0x02
254 #define HAL_PCI_CHIP_HACK_DISABLE_ACPI_IRQ_ROUTING 0x04
255 #define HAL_PCI_CHIP_HACK_USB_SMI_DISABLE 0x08
256
257 //
258 // Kernel Exports
259 //
260 #if defined(_NTDRIVER_) || defined(_NTHAL_)
261 extern NTSYSAPI PHAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
262 #define HALPRIVATEDISPATCH ((PHAL_PRIVATE_DISPATCH)&HalPrivateDispatchTable)
263 #else
264 extern NTSYSAPI HAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
265 #define HALPRIVATEDISPATCH (&HalPrivateDispatchTable)
266 #endif
267
268 //
269 // HAL Exports
270 //
271 extern PUCHAR NTHALAPI KdComPortInUse;
272
273 #endif
274 #endif
275
276
277