1 /* $Id: halddk.h,v 1.10 2001/08/21 20:13:05 chorns Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: include/internal/hal/ddk.h
6 * PURPOSE: HAL provided defintions for device drivers
7 * PROGRAMMER: David Welch (welch@mcmail.com)
9 * 23/06/98: Taken from linux system.h
13 #ifndef __INCLUDE_DDK_HALDDK_H
14 #define __INCLUDE_DDK_HALDDK_H
16 /* HalReturnToFirmware */
17 #define FIRMWARE_HALT 1
18 #define FIRMWARE_REBOOT 3
23 DEVICE_DESCRIPTION_VERSION
,
24 DEVICE_DESCRIPTION_VERSION1
,
27 typedef ULONG DMA_WIDTH
;
28 typedef ULONG DMA_SPEED
;
31 * PURPOSE: Types for HalGetBusData
33 typedef enum _BUS_DATA_TYPE
35 ConfigurationSpaceUndefined
= -1,
48 } BUS_DATA_TYPE
, *PBUS_DATA_TYPE
;
50 typedef struct _DEVICE_DESCRIPTION
54 BOOLEAN ScatterGather
;
56 BOOLEAN AutoInitialize
;
57 BOOLEAN Dma32BitAddress
;
63 INTERFACE_TYPE InterfaceType
;
68 } DEVICE_DESCRIPTION
, *PDEVICE_DESCRIPTION
;
70 typedef BOOLEAN (*PHAL_RESET_DISPLAY_PARAMETERS
)(ULONG Columns
, ULONG Rows
);
72 /* Hal dispatch table */
74 typedef enum _HAL_QUERY_INFORMATION_CLASS
76 HalInstalledBusInformation
,
77 HalProfileSourceInformation
,
78 HalSystemDockInformation
,
80 HalProcessorSpeedInformation
,
81 HalCallbackInformation
,
82 HalMapRegisterInformation
,
84 HalFrameBufferCachingInformation
,
85 HalDisplayBiosInformation
86 /* information levels >= 0x8000000 reserved for OEM use */
87 } HAL_QUERY_INFORMATION_CLASS
, *PHAL_QUERY_INFORMATION_CLASS
;
90 typedef enum _HAL_SET_INFORMATION_CLASS
92 HalProfileSourceInterval
,
93 HalProfileSourceInterruptHandler
,
95 } HAL_SET_INFORMATION_CLASS
, *PHAL_SET_INFORMATION_CLASS
;
100 (*pHalQuerySystemInformation
) (
101 IN HAL_QUERY_INFORMATION_CLASS InformationClass
,
104 OUT PULONG ReturnedLength
110 (*pHalSetSystemInformation
) (
111 IN HAL_SET_INFORMATION_CLASS InformationClass
,
119 (*pHalQueryBusSlots
) (
120 // IN PBUS_HANDLER BusHandler,
123 OUT PULONG SlotNumbers
,
124 OUT PULONG ReturnedLength
128 /* Control codes of HalDeviceControl function */
129 #define BCTL_EJECT 0x0001
130 #define BCTL_QUERY_DEVICE_ID 0x0002
131 #define BCTL_QUERY_DEVICE_UNIQUE_ID 0x0003
132 #define BCTL_QUERY_DEVICE_CAPABILITIES 0x0004
133 #define BCTL_QUERY_DEVICE_RESOURCES 0x0005
134 #define BCTL_QUERY_DEVICE_RESOURCE_REQUIREMENTS 0x0006
135 #define BCTL_QUERY_EJECT 0x0007
136 #define BCTL_SET_LOCK 0x0008
137 #define BCTL_SET_POWER 0x0009
138 #define BCTL_SET_RESUME 0x000A
139 #define BCTL_SET_DEVICE_RESOURCES 0x000B
141 /* Defines for BCTL structures */
144 BOOLEAN PowerSupported
;
145 BOOLEAN ResumeSupported
;
146 BOOLEAN LockSupported
;
147 BOOLEAN EjectSupported
;
149 } BCTL_DEVICE_CAPABILITIES
, *PBCTL_DEVICE_CAPABILITIES
;
152 typedef struct _DEVICE_CONTROL_CONTEXT
155 // PDEVICE_HANDLER_OBJECT DeviceHandler;
157 PDEVICE_OBJECT DeviceObject
;
162 } DEVICE_CONTROL_CONTEXT
, *PDEVICE_CONTROL_CONTEXT
;
167 (*PDEVICE_CONTROL_COMPLETION
) (
168 IN PDEVICE_CONTROL_CONTEXT ControlContext
174 (*pHalDeviceControl
) (
175 // IN PDEVICE_HANDLER_OBJECT DeviceHandler,
176 IN PVOID DeviceHandler
,
177 IN PDEVICE_OBJECT DeviceObject
,
178 IN ULONG ControlCode
,
179 IN OUT PVOID Buffer OPTIONAL
,
180 IN OUT PULONG BufferLength OPTIONAL
,
182 IN PDEVICE_CONTROL_COMPLETION CompletionRoutine
188 (FASTCALL
*pHalExamineMBR
) (
189 IN PDEVICE_OBJECT DeviceObject
,
191 IN ULONG MBRTypeIdentifier
,
197 (FASTCALL
*pHalIoAssignDriveLetters
) (
198 IN PLOADER_PARAMETER_BLOCK LoaderBlock
,
199 IN PSTRING NtDeviceName
,
200 OUT PUCHAR NtSystemPath
,
201 OUT PSTRING NtSystemPathString
206 (FASTCALL
*pHalIoReadPartitionTable
) (
207 IN PDEVICE_OBJECT DeviceObject
,
209 IN BOOLEAN ReturnRecognizedPartitions
,
210 OUT PDRIVE_LAYOUT_INFORMATION
* PartitionBuffer
215 (FASTCALL
*pHalIoSetPartitionInformation
) (
216 IN PDEVICE_OBJECT DeviceObject
,
218 IN ULONG PartitionNumber
,
219 IN ULONG PartitionType
224 (FASTCALL
*pHalIoWritePartitionTable
) (
225 IN PDEVICE_OBJECT DeviceObject
,
227 IN ULONG SectorsPerTrack
,
228 IN ULONG NumberOfHeads
,
229 IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer
235 (FASTCALL
*pHalHandlerForBus
) (
236 IN INTERFACE_TYPE InterfaceType
,
242 (FASTCALL
*pHalReferenceBusHandler
) (
243 // IN PBUS_HANDLER BusHandler
247 typedef struct _HAL_DISPATCH
250 pHalQuerySystemInformation HalQuerySystemInformation
;
251 pHalSetSystemInformation HalSetSystemInformation
;
252 pHalQueryBusSlots HalQueryBusSlots
;
253 pHalDeviceControl HalDeviceControl
;
254 pHalExamineMBR HalExamineMBR
;
255 pHalIoAssignDriveLetters HalIoAssignDriveLetters
;
256 pHalIoReadPartitionTable HalIoReadPartitionTable
;
257 pHalIoSetPartitionInformation HalIoSetPartitionInformation
;
258 pHalIoWritePartitionTable HalIoWritePartitionTable
;
259 pHalHandlerForBus HalReferenceHandlerForBus
;
260 pHalReferenceBusHandler HalReferenceBusHandler
;
261 pHalReferenceBusHandler HalDereferenceBusHandler
;
262 } HAL_DISPATCH
, *PHAL_DISPATCH
;
264 #define HAL_DISPATCH_VERSION 1
267 extern HAL_DISPATCH EXPORTED HalDispatchTable
;
269 extern HAL_DISPATCH IMPORTED HalDispatchTable
;
273 /* Hal private dispatch table */
275 typedef struct _HAL_PRIVATE_DISPATCH
280 } HAL_PRIVATE_DISPATCH
, *PHAL_PRIVATE_DISPATCH
;
282 #define HAL_PRIVATE_DISPATCH_VERSION 1
285 extern HAL_PRIVATE_DISPATCH EXPORTED HalPrivateDispatchTable
;
287 extern HAL_PRIVATE_DISPATCH IMPORTED HalPrivateDispatchTable
;
293 HalAcquireDisplayOwnership (
294 PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters
299 HalAdjustResourceList (
300 PCM_RESOURCE_LIST Resources
305 HalAllocateAdapterChannel (
306 IN PADAPTER_OBJECT AdapterObject
,
307 IN PDEVICE_OBJECT DeviceObject
,
308 IN ULONG NumberOfMapRegisters
,
309 IN PDRIVER_CONTROL ExecutionRoutine
,
315 HalAllocateCommonBuffer (
316 PADAPTER_OBJECT AdapterObject
,
318 PPHYSICAL_ADDRESS LogicalAddress
,
324 HalAllocateCrashDumpRegisters (
325 IN PADAPTER_OBJECT AdapterObject
,
326 IN OUT PULONG NumberOfMapRegisters
331 HalAllProcessorsStarted (
337 HalAssignSlotResources (
338 PUNICODE_STRING RegistryPath
,
339 PUNICODE_STRING DriverClassName
,
340 PDRIVER_OBJECT DriverObject
,
341 PDEVICE_OBJECT DeviceObject
,
342 INTERFACE_TYPE BusType
,
345 PCM_RESOURCE_LIST
*AllocatedResources
348 BOOLEAN STDCALL
HalBeginSystemInterrupt (ULONG Vector
,
354 HalCalibratePerformanceCounter (
360 HalClearSoftwareInterrupt
363 BOOLEAN STDCALL
HalDisableSystemInterrupt (ULONG Vector
,
372 BOOLEAN STDCALL
HalEnableSystemInterrupt (ULONG Vector
,
376 VOID STDCALL
HalEndSystemInterrupt (KIRQL Irql
,
380 /* Is this function really exported ?? */
383 PDEVICE_OBJECT DeviceObject
,
385 ULONG MBRTypeIdentifier
,
391 HalFlushCommonBuffer (
404 HalFreeCommonBuffer (
405 PADAPTER_OBJECT AdapterObject
,
407 PHYSICAL_ADDRESS LogicalAddress
,
408 PVOID VirtualAddress
,
415 PDEVICE_DESCRIPTION DeviceDescription
,
416 PULONG NumberOfMapRegisters
422 BUS_DATA_TYPE BusDataType
,
431 HalGetBusDataByOffset (
432 BUS_DATA_TYPE BusDataType
,
440 /* Is this function really exported ?? */
442 HalGetDmaAlignmentRequirement (
448 HalGetEnvironmentVariable (
451 IN USHORT ValueLength
456 HalGetInterruptVector (
457 INTERFACE_TYPE InterfaceType
,
459 ULONG BusInterruptLevel
,
460 ULONG BusInterruptVector
,
467 HalInitializeProcessor (
468 ULONG ProcessorNumber
,
476 PLOADER_PARAMETER_BLOCK LoaderBlock
487 HalQueryDisplayParameters (
496 HalQueryRealTimeClock (
500 /* Is this function really exported ?? */
502 HalQuerySystemInformation(VOID
);
507 PADAPTER_OBJECT AdapterObject
512 HalReportResourceUsage (
524 HalRequestSoftwareInterrupt
529 HalReturnToFirmware (
536 BUS_DATA_TYPE BusDataType
,
545 HalSetBusDataByOffset (
546 BUS_DATA_TYPE BusDataType
,
556 HalSetDisplayParameters (
563 HalSetEnvironmentVariable (
569 HalSetProfileInterval
574 HalSetRealTimeClock (
584 HalStartNextProcessor (
590 HalStartProfileInterrupt
594 HalStopProfileInterrupt
599 HalSystemVectorDispatchEntry (
607 HalTranslateBusAddress (
608 INTERFACE_TYPE InterfaceType
,
610 PHYSICAL_ADDRESS BusAddress
,
612 PPHYSICAL_ADDRESS TranslatedAddress
616 * Kernel debugger section
619 typedef struct _KD_PORT_INFORMATION
624 } KD_PORT_INFORMATION
, *PKD_PORT_INFORMATION
;
627 #if defined(__NTOSKRNL__)
628 extern ULONG KdComPortInUse
__declspec(dllexport
);
632 extern ULONG KdComPortInUse
__declspec(dllimport
);
637 KdPortInitialize (PKD_PORT_INFORMATION PortInformation
,
643 KdPortGetByte (PUCHAR ByteRecieved
);
647 KdPortPollByte (PUCHAR ByteRecieved
);
651 KdPortPutByte (UCHAR ByteToSend
);
660 READ_PORT_BUFFER_UCHAR (PUCHAR Port
, PUCHAR Value
, ULONG Count
);
664 READ_PORT_BUFFER_ULONG (PULONG Port
, PULONG Value
, ULONG Count
);
668 READ_PORT_BUFFER_USHORT (PUSHORT Port
, PUSHORT Value
, ULONG Count
);
672 READ_PORT_UCHAR (PUCHAR Port
);
676 READ_PORT_ULONG (PULONG Port
);
680 READ_PORT_USHORT (PUSHORT Port
);
684 WRITE_PORT_BUFFER_UCHAR (PUCHAR Port
, PUCHAR Value
, ULONG Count
);
688 WRITE_PORT_BUFFER_ULONG (PULONG Port
, PULONG Value
, ULONG Count
);
692 WRITE_PORT_BUFFER_USHORT (PUSHORT Port
, PUSHORT Value
, ULONG Count
);
696 WRITE_PORT_UCHAR (PUCHAR Port
, UCHAR Value
);
700 WRITE_PORT_ULONG (PULONG Port
, ULONG Value
);
704 WRITE_PORT_USHORT (PUSHORT Port
, USHORT Value
);
707 #endif /* __INCLUDE_DDK_HALDDK_H */