b1ba9d329c871aef6fca12df0789e7042b2ab6bd
[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 (NTAPI *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 BOOLEAN
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 ULONG BusNumber,
107 IN OUT PCM_RESOURCE_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 PCI_SLOT_NUMBER SlotNumber,
129 OUT PUCHAR 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 ULONG BusNumber,
139 IN ULONG BusInterruptLevel,
140 IN ULONG BusInterruptVector,
141 OUT PKIRQL Irql,
142 OUT PKAFFINITY Affinity
143 );
144
145 typedef
146 ULONG
147 (NTAPI *pTranslateBusAddress)(
148 IN PBUS_HANDLER BusHandler,
149 IN ULONG BusNumber,
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 Bus Handler
191 //
192 typedef struct _BUS_HANDLER
193 {
194 ULONG Version;
195 INTERFACE_TYPE InterfaceType;
196 BUS_DATA_TYPE ConfigurationType;
197 ULONG BusNumber;
198 PDEVICE_OBJECT DeviceObject;
199 struct _BUS_HANDLER *ParentHandler;
200 PVOID BusData;
201 ULONG DeviceControlExtensionSize;
202 //PSUPPORTED_RANGES BusAddresses;
203 ULONG Reserved[4];
204 pGetSetBusData GetBusData;
205 pGetSetBusData SetBusData;
206 pAdjustResourceList AdjustResourceList;
207 pAssignSlotResources AssignSlotResources;
208 pGetInterruptVector GetInterruptVector;
209 pTranslateBusAddress TranslateBusAddress;
210 } BUS_HANDLER;
211
212 //
213 // Kernel Exports
214 //
215 #if defined(_NTDRIVER_) || defined(_NTHAL_)
216 extern NTSYSAPI PHAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
217 #define HALPRIVATEDISPATCH ((PHAL_PRIVATE_DISPATCH)&HalPrivateDispatchTable)
218 #else
219 extern NTSYSAPI HAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
220 #define HALPRIVATEDISPATCH (&HalPrivateDispatchTable)
221 #endif
222
223 //
224 // HAL Exports
225 //
226 extern PUCHAR NTHALAPI KdComPortInUse;
227
228 #endif
229 #endif
230
231
232