ReactOS  0.4.15-dev-1177-g6cb3b62
hal.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: ntoskrnl/include/internal/hal.h
5  * PURPOSE: Internal header for the I/O HAL Functions (Fstub)
6  * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7  * Pierre Schweitzer (pierre.schweitzer@reactos.org)
8  */
9 
10 #pragma once
11 
12 //
13 // Default implementations of HAL dispatch table
14 //
15 VOID
19  IN ULONG MbrTypeIdentifier,
20  OUT PVOID *MbrBuffer);
21 
22 VOID
25  IN PSTRING NtDeviceName,
26  OUT PUCHAR NtSystemPath,
27  OUT PSTRING NtSystemPathString);
28 
35 
42 
50 
51 VOID
52 NTAPI
54  VOID
55 );
56 
57 VOID
58 NTAPI
60  VOID
61 );
62 
63 VOID
64 NTAPI
67 );
68 
69 UCHAR
70 NTAPI
73 );
74 
76 NTAPI
78  IN INTERFACE_TYPE ParentInterfaceType,
79  IN ULONG ParentBusNumber,
80  IN INTERFACE_TYPE BridgeInterfaceType,
81  IN USHORT Size,
83  OUT PTRANSLATOR_INTERFACE Translator,
84  OUT PULONG BridgeBusNumber
85 );
86 
92 );
93 
94 VOID
97  IN PBUS_HANDLER BusHandler
98 );
99 
100 NTSTATUS
101 NTAPI
103  VOID
104 );
105 
106 NTSTATUS
107 NTAPI
109  IN PPM_DISPATCH_TABLE PmDriverDispatchTable,
110  OUT PPM_DISPATCH_TABLE *PmHalDispatchTable
111 );
112 
113 NTSTATUS
114 NTAPI
116  VOID
117 );
118 
119 NTSTATUS
120 NTAPI
122  IN ULONG PassNumber
123 );
124 
125 NTSTATUS
126 NTAPI
130 );
131 
132 NTSTATUS
133 NTAPI
135  IN PBUS_HANDLER BusHandler,
137  OUT PULONG SlotNumbers,
139 );
140 
141 NTSTATUS
142 NTAPI
146  IN PVOID Buffer
147 );
148 
149 NTSTATUS
150 NTAPI
154  IN OUT PVOID Buffer,
156 );
157 
158 VOID
159 NTAPI
162 );
163 
164 NTSTATUS
165 NTAPI
168  IN BUS_DATA_TYPE ConfigSpace,
170  IN INTERFACE_TYPE ParentInterfaceType,
171  IN ULONG ParentBusNumber,
174  OUT PBUS_HANDLER *BusHandler
175 );
176 
177 VOID
178 NTAPI
180  IN ULONGLONG AlartTime,
182 );
183 
184 BOOLEAN
185 NTAPI
192 );
193 
194 NTSTATUS
195 NTAPI
197  IN PADAPTER_OBJECT AdapterObject,
198  IN ULONG Unknown,
199  IN ULONG Unknown2,
200  PMAP_REGISTER_ENTRY Registers
201 );
202 
203 NTSTATUS
204 NTAPI
206  IN PVOID LoaderBlock OPTIONAL,
208 );
209 
210 NTSTATUS
211 NTAPI
214 );
215 
216 PVOID
217 NTAPI
219  IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
221 );
222 
223 PVOID
224 NTAPI
225 MatchAll(
227  IN ULONG NumberPages,
228  IN BOOLEAN FlushCurrentTLB
229 );
230 
231 VOID
232 NTAPI
235  IN ULONG NumberPages,
236  IN BOOLEAN FlushCurrentTLB
237 );
238 
239 
240 //
241 // Various offsets in the boot record
242 //
243 #define PARTITION_TABLE_OFFSET (0x1BE / 2)
244 #define BOOT_SIGNATURE_OFFSET ((0x200 / 2) - 1)
245 #define BOOT_RECORD_RESERVED 0x1BC
246 #define BOOT_RECORD_SIGNATURE 0xAA55
247 #define NUM_PARTITION_TABLE_ENTRIES 4
248 
249 //
250 // Helper Macros
251 //
252 #define GET_STARTING_SECTOR(p) \
253  ((ULONG)(p->StartingSectorLsb0) + \
254  (ULONG)(p->StartingSectorLsb1 << 8 ) + \
255  (ULONG)(p->StartingSectorMsb0 << 16) + \
256  (ULONG)(p->StartingSectorMsb1 << 24))
257 
258 #define GET_ENDING_S_OF_CHS(p) \
259  ((UCHAR)(p->EndingCylinderLsb & 0x3F))
260 
261 #define GET_PARTITION_LENGTH(p) \
262  ((ULONG)(p->PartitionLengthLsb0) + \
263  (ULONG)(p->PartitionLengthLsb1 << 8) + \
264  (ULONG)(p->PartitionLengthMsb0 << 16) + \
265  (ULONG)(p->PartitionLengthMsb1 << 24))
266 
267 #define SET_PARTITION_LENGTH(p, l) \
268  p->PartitionLengthLsb0 = l & 0xFF; \
269  p->PartitionLengthLsb1 = (l >> 8) & 0xFF; \
270  p->PartitionLengthMsb0 = (l >> 16) & 0xFF; \
271  p->PartitionLengthMsb1 = (l >> 24) & 0xFF
272 
273 //
274 // Structure describing a partition
275 //
276 typedef struct _PARTITION_DESCRIPTOR
277 {
295 
296 //
297 // Structure describing a boot sector
298 //
299 typedef struct _BOOT_SECTOR_INFO
300 {
312 
313 //
314 // Partition Table and Disk Layout
315 //
316 typedef struct _PARTITION_TABLE
317 {
320 
321 typedef struct _DISK_LAYOUT
322 {
327 
328 //
329 // Partition Table Entry
330 //
331 typedef struct _PTE
332 {
341 } PTE, *PPTE;
VOID NTAPI xKdUnmapVirtualAddress(IN PVOID VirtualAddress, IN ULONG NumberPages, IN BOOLEAN FlushCurrentTLB)
Definition: halstub.c:286
#define IN
Definition: typedefs.h:39
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2268
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
enum _INTERFACE_TYPE INTERFACE_TYPE
NTSTATUS FASTCALL xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG PartitionNumber, IN ULONG PartitionType)
Definition: disksup.c:2203
UCHAR StartingTrack
Definition: hal.h:279
struct _DISK_LAYOUT DISK_LAYOUT
UCHAR StartingSectorMsb0
Definition: hal.h:288
NTSTATUS NTAPI xHalGetInterruptTranslator(IN INTERFACE_TYPE ParentInterfaceType, IN ULONG ParentBusNumber, IN INTERFACE_TYPE BridgeInterfaceType, IN USHORT Size, IN USHORT Version, OUT PTRANSLATOR_INTERFACE Translator, OUT PULONG BridgeBusNumber)
Definition: translate.c:156
Definition: hal.h:331
struct _PTE * PPTE
USHORT StartingCylinder
Definition: hal.h:335
UCHAR PartitionLengthLsb0
Definition: hal.h:290
UCHAR EndingCylinderMsb
Definition: hal.h:285
UCHAR JumpByte[1]
Definition: hal.h:301
BIOS_MEMORY_MAP MemoryMap[32]
Definition: loader.c:11
enum _BUS_DATA_TYPE BUS_DATA_TYPE
PBUS_HANDLER FASTCALL xHalHandlerForBus(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber)
Definition: halstub.c:106
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2268
NTSTATUS NTAPI xHalQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN OUT PVOID Buffer, OUT PULONG ReturnedLength)
Definition: halstub.c:184
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
UCHAR EndingCylinderLsb
Definition: hal.h:284
VOID NTAPI xHalSetWakeAlarm(IN ULONGLONG AlartTime, IN PTIME_FIELDS TimeFields)
Definition: halstub.c:220
UCHAR SectorsPerTrack[2]
Definition: hal.h:309
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444
_In_ ULONG _In_ ULONG _In_ ULONG NumberOfHeads
Definition: iofuncs.h:2066
UCHAR MediaByte[1]
Definition: hal.h:307
NTSTATUS NTAPI xHalInitPnpDriver(VOID)
Definition: halstub.c:122
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2056
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2268
#define FASTCALL
Definition: nt_native.h:50
UCHAR PartitionLengthLsb1
Definition: hal.h:291
struct _DISK_LAYOUT * PDISK_LAYOUT
PARTITION_INFORMATION PartitionEntry[4]
Definition: hal.h:318
Definition: haltypes.h:185
UCHAR StartingTrack
Definition: hal.h:334
UCHAR PartitionType
Definition: hal.h:336
UCHAR NumberOfSectors[2]
Definition: hal.h:306
ULONG StartingSector
Definition: hal.h:339
ULONG Signature
Definition: hal.h:324
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS NTAPI xHalSetSystemInformation(IN HAL_SET_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN PVOID Buffer)
Definition: halstub.c:173
_In_ ULONG _In_ ULONG SectorsPerTrack
Definition: iofuncs.h:2066
NTSTATUS NTAPI xKdSetupPciDeviceForDebugging(IN PVOID LoaderBlock OPTIONAL, IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Definition: halstub.c:254
UCHAR StartingSectorLsb0
Definition: hal.h:286
_In_ ULONG _In_ BOOLEAN _Out_ struct _DRIVE_LAYOUT_INFORMATION ** PartitionBuffer
Definition: iofuncs.h:2048
VOID FASTCALL xHalReferenceHandler(IN PBUS_HANDLER BusHandler)
Definition: halstub.c:114
NTSTATUS FASTCALL xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN BOOLEAN ReturnRecognizedPartitions, IN OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
Definition: disksup.c:1769
unsigned char BOOLEAN
UCHAR PartitionLengthMsb0
Definition: hal.h:292
VOID NTAPI xHalLocateHiberRanges(IN PVOID MemoryMap)
Definition: halstub.c:196
Definition: bufpool.h:45
NTSTATUS NTAPI xHalStartMirroring(VOID)
Definition: halstub.c:137
VOID FASTCALL xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PSTRING NtDeviceName, OUT PUCHAR NtSystemPath, OUT PSTRING NtSystemPathString)
Definition: disksup.c:912
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
enum _HAL_QUERY_INFORMATION_CLASS HAL_QUERY_INFORMATION_CLASS
struct _PARTITION_DESCRIPTOR PARTITION_DESCRIPTOR
NTSTATUS NTAPI xHalAllocateMapRegisters(IN PADAPTER_OBJECT AdapterObject, IN ULONG Unknown, IN ULONG Unknown2, PMAP_REGISTER_ENTRY Registers)
Definition: halstub.c:242
VOID NTAPI xHalEndOfBoot(VOID)
Definition: halstub.c:88
struct _BOOT_SECTOR_INFO BOOT_SECTOR_INFO
BOOLEAN NTAPI xHalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: halstub.c:229
UCHAR StartingSectorMsb1
Definition: hal.h:289
UCHAR PartitionType
Definition: hal.h:282
uint64_t ULONGLONG
Definition: typedefs.h:67
ULONG TableCount
Definition: hal.h:323
USHORT EndingCylinder
Definition: hal.h:338
struct _PARTITION_DESCRIPTOR * PPARTITION_DESCRIPTOR
#define BufferSize
Definition: mmc.h:75
NTSTATUS FASTCALL xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG SectorsPerTrack, IN ULONG NumberOfHeads, IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
Definition: disksup.c:2392
PARTITION_TABLE PartitionTable[1]
Definition: hal.h:325
enum _HAL_SET_INFORMATION_CLASS HAL_SET_INFORMATION_CLASS
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1081
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR OemData[8]
Definition: hal.h:303
_In_ ULONG _In_ BOOLEAN ReturnRecognizedPartitions
Definition: iofuncs.h:2046
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:187
_In_ CDROM_DEVICE_INTERFACES InterfaceType
Definition: cdrom.h:1140
VOID FASTCALL xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG MbrTypeIdentifier, OUT PVOID *MbrBuffer)
Definition: disksup.c:1643
NTSTATUS NTAPI xHalInitPowerManagement(IN PPM_DISPATCH_TABLE PmDriverDispatchTable, OUT PPM_DISPATCH_TABLE *PmHalDispatchTable)
Definition: halstub.c:129
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
UCHAR StartingCylinderLsb
Definition: hal.h:280
UCHAR ActiveFlag
Definition: hal.h:278
PVOID NTAPI xKdGetAcpiTablePhase(IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock, IN ULONG Signature)
Definition: halstub.c:269
struct _PARTITION_TABLE * PPARTITION_TABLE
VOID NTAPI xHalSetWakeEnable(IN BOOLEAN Enable)
Definition: halstub.c:98
UCHAR NTAPI xHalVectorToIDTEntry(IN ULONG Vector)
Definition: halstub.c:33
UCHAR EndingTrack
Definition: hal.h:337
ULONG PartitionLength
Definition: hal.h:340
UCHAR ActiveFlag
Definition: hal.h:333
NTSTATUS NTAPI xHalMirrorPhysicalMemory(IN PHYSICAL_ADDRESS PhysicalAddress, IN LARGE_INTEGER NumberOfBytes)
Definition: halstub.c:153
unsigned short USHORT
Definition: pedump.c:61
struct _PARTITION_TABLE PARTITION_TABLE
UCHAR StartingCylinderMsb
Definition: hal.h:281
NTSTATUS NTAPI xKdReleasePciDeviceForDebugging(IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Definition: halstub.c:262
UCHAR PartitionLengthMsb1
Definition: hal.h:293
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
UCHAR Ignore3[2]
Definition: hal.h:308
unsigned int * PULONG
Definition: retypes.h:1
UCHAR StartingSectorLsb1
Definition: hal.h:287
#define OUT
Definition: typedefs.h:40
NTSTATUS(NTAPI * PINSTALL_BUS_HANDLER)(_In_ PBUS_HANDLER Bus)
Definition: haltypes.h:54
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1018
CHAR PartitionType
Definition: part_xbox.c:32
unsigned int ULONG
Definition: retypes.h:1
UCHAR Ignore2[6]
Definition: hal.h:305
PVOID NTAPI MatchAll(IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG NumberPages, IN BOOLEAN FlushCurrentTLB)
Definition: halstub.c:277
_In_ ULONG SectorSize
Definition: halfuncs.h:291
UCHAR Ignore1[2]
Definition: hal.h:302
NTSTATUS NTAPI xHalEndMirroring(IN ULONG PassNumber)
Definition: halstub.c:146
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1714
UCHAR BytesPerSector[2]
Definition: hal.h:304
static PTIME_FIELDS TimeFields
Definition: time.c:104
static const WCHAR Signature[]
Definition: parser.c:141
UCHAR EndingTrack
Definition: hal.h:283
struct _BOOT_SECTOR_INFO * PBOOT_SECTOR_INFO
NTSTATUS NTAPI xHalQueryBusSlots(IN PBUS_HANDLER BusHandler, IN ULONG BufferSize, OUT PULONG SlotNumbers, OUT PULONG ReturnedLength)
Definition: halstub.c:161
struct _PTE PTE
VOID NTAPI xHalHaltSystem(VOID)
Definition: halstub.c:41
NTSTATUS NTAPI xHalRegisterBusHandler(IN INTERFACE_TYPE InterfaceType, IN BUS_DATA_TYPE ConfigSpace, IN ULONG BusNumber, IN INTERFACE_TYPE ParentInterfaceType, IN ULONG ParentBusNumber, IN ULONG ContextSize, IN PINSTALL_BUS_HANDLER InstallCallback, OUT PBUS_HANDLER *BusHandler)
Definition: halstub.c:204
UCHAR NumberOfHeads[2]
Definition: hal.h:310
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68