ReactOS 0.4.15-dev-7659-ga55345b
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//
15VOID
19 IN ULONG MbrTypeIdentifier,
20 OUT PVOID *MbrBuffer);
21
22VOID
25 IN PSTRING NtDeviceName,
26 OUT PUCHAR NtSystemPath,
27 OUT PSTRING NtSystemPathString);
28
35
42
50
51VOID
54 VOID
55);
56
57VOID
60 VOID
61);
62
63VOID
67);
68
73);
74
78 IN INTERFACE_TYPE ParentInterfaceType,
79 IN ULONG ParentBusNumber,
80 IN INTERFACE_TYPE BridgeInterfaceType,
83 OUT PTRANSLATOR_INTERFACE Translator,
84 OUT PULONG BridgeBusNumber
85);
86
92);
93
94VOID
97 IN PBUS_HANDLER BusHandler
98);
99
101NTAPI
103 VOID
104);
105
107NTAPI
109 IN PPM_DISPATCH_TABLE PmDriverDispatchTable,
110 OUT PPM_DISPATCH_TABLE *PmHalDispatchTable
111);
112
114NTAPI
116 VOID
117);
118
120NTAPI
122 IN ULONG PassNumber
123);
124
126NTAPI
130);
131
133NTAPI
135 IN PBUS_HANDLER BusHandler,
137 OUT PULONG SlotNumbers,
139);
140
142NTAPI
147);
148
150NTAPI
156);
157
158VOID
159NTAPI
162);
163
165NTAPI
168 IN BUS_DATA_TYPE ConfigSpace,
170 IN INTERFACE_TYPE ParentInterfaceType,
171 IN ULONG ParentBusNumber,
174 OUT PBUS_HANDLER *BusHandler
175);
176
177VOID
178NTAPI
180 IN ULONGLONG AlartTime,
182);
183
185NTAPI
192);
193
195NTAPI
197 IN PADAPTER_OBJECT AdapterObject,
199 IN ULONG Unknown2,
200 PMAP_REGISTER_ENTRY Registers
201);
202
204NTAPI
206 IN PVOID LoaderBlock OPTIONAL,
208);
209
211NTAPI
214);
215
216PVOID
217NTAPI
219 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
221);
222
223PVOID
224NTAPI
227 IN ULONG NumberPages,
228 IN BOOLEAN FlushCurrentTLB
229);
230
231VOID
232NTAPI
235 IN ULONG NumberPages,
236 IN BOOLEAN FlushCurrentTLB
237);
238
239
240//
241// Various offsets in the boot record
242//
243#define DISK_SIGNATURE_OFFSET 0x1B8
244#define PARTITION_TABLE_OFFSET 0x1BE
245#define BOOT_SIGNATURE_OFFSET (0x200 - 2)
246
247#define BOOT_RECORD_SIGNATURE 0xAA55
248#define NUM_PARTITION_TABLE_ENTRIES 4
249
250//
251// Helper Macros
252//
253#define GET_STARTING_SECTOR(p) \
254 ((ULONG)(p->StartingSectorLsb0) + \
255 (ULONG)(p->StartingSectorLsb1 << 8 ) + \
256 (ULONG)(p->StartingSectorMsb0 << 16) + \
257 (ULONG)(p->StartingSectorMsb1 << 24))
258
259#define GET_ENDING_S_OF_CHS(p) \
260 ((UCHAR)(p->EndingCylinderLsb & 0x3F))
261
262#define GET_PARTITION_LENGTH(p) \
263 ((ULONG)(p->PartitionLengthLsb0) + \
264 (ULONG)(p->PartitionLengthLsb1 << 8) + \
265 (ULONG)(p->PartitionLengthMsb0 << 16) + \
266 (ULONG)(p->PartitionLengthMsb1 << 24))
267
268#define SET_PARTITION_LENGTH(p, l) \
269 p->PartitionLengthLsb0 = l & 0xFF; \
270 p->PartitionLengthLsb1 = (l >> 8) & 0xFF; \
271 p->PartitionLengthMsb0 = (l >> 16) & 0xFF; \
272 p->PartitionLengthMsb1 = (l >> 24) & 0xFF
273
274//
275// Structure describing a partition
276//
278{
296
297//
298// Structure describing a boot sector
299//
300typedef struct _BOOT_SECTOR_INFO
301{
313
314//
315// Partition Table and Disk Layout
316//
317typedef struct _PARTITION_TABLE
318{
321
322typedef struct _DISK_LAYOUT
323{
328
329//
330// Partition Table Entry
331//
332typedef struct _PTE
333{
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:188
BIOS_MEMORY_MAP MemoryMap[32]
Definition: loader.c:11
Definition: bufpool.h:45
static const WCHAR Signature[]
Definition: parser.c:141
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1713
enum _INTERFACE_TYPE INTERFACE_TYPE
@ Unknown
Definition: i8042prt.h:114
static PTIME_FIELDS TimeFields
Definition: time.c:104
NTSTATUS(NTAPI * PINSTALL_BUS_HANDLER)(_In_ PBUS_HANDLER Bus)
Definition: haltypes.h:54
#define FASTCALL
Definition: nt_native.h:50
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
struct _PARTITION_DESCRIPTOR * PPARTITION_DESCRIPTOR
struct _PARTITION_TABLE * PPARTITION_TABLE
NTSTATUS NTAPI xHalQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN OUT PVOID Buffer, OUT PULONG ReturnedLength)
Definition: halstub.c:184
struct _DISK_LAYOUT * PDISK_LAYOUT
PBUS_HANDLER FASTCALL xHalHandlerForBus(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber)
Definition: halstub.c:106
VOID NTAPI xKdUnmapVirtualAddress(IN PVOID VirtualAddress, IN ULONG NumberPages, IN BOOLEAN FlushCurrentTLB)
Definition: halstub.c:286
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
NTSTATUS FASTCALL xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN BOOLEAN ReturnRecognizedPartitions, IN OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
Definition: disksup.c:1768
VOID FASTCALL xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PSTRING NtDeviceName, OUT PUCHAR NtSystemPath, OUT PSTRING NtSystemPathString)
Definition: disksup.c:912
UCHAR NTAPI xHalVectorToIDTEntry(IN ULONG Vector)
Definition: halstub.c:31
VOID NTAPI xHalLocateHiberRanges(IN PVOID MemoryMap)
Definition: halstub.c:196
NTSTATUS NTAPI xHalMirrorPhysicalMemory(IN PHYSICAL_ADDRESS PhysicalAddress, IN LARGE_INTEGER NumberOfBytes)
Definition: halstub.c:153
struct _BOOT_SECTOR_INFO BOOT_SECTOR_INFO
VOID NTAPI xHalSetWakeAlarm(IN ULONGLONG AlartTime, IN PTIME_FIELDS TimeFields)
Definition: halstub.c:220
struct _PTE * PPTE
NTSTATUS NTAPI xHalInitPowerManagement(IN PPM_DISPATCH_TABLE PmDriverDispatchTable, OUT PPM_DISPATCH_TABLE *PmHalDispatchTable)
Definition: halstub.c:129
NTSTATUS NTAPI xHalStartMirroring(VOID)
Definition: halstub.c:137
NTSTATUS NTAPI xKdReleasePciDeviceForDebugging(IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Definition: halstub.c:262
VOID NTAPI xHalHaltSystem(VOID)
Definition: halstub.c:39
struct _PARTITION_DESCRIPTOR PARTITION_DESCRIPTOR
VOID FASTCALL xHalReferenceHandler(IN PBUS_HANDLER BusHandler)
Definition: halstub.c:114
NTSTATUS NTAPI xHalInitPnpDriver(VOID)
Definition: halstub.c:122
struct _PTE PTE
VOID NTAPI xHalSetWakeEnable(IN BOOLEAN Enable)
Definition: halstub.c:98
VOID FASTCALL xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG MbrTypeIdentifier, OUT PVOID *MbrBuffer)
Definition: disksup.c:1643
NTSTATUS FASTCALL xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG PartitionNumber, IN ULONG PartitionType)
Definition: disksup.c:2200
NTSTATUS NTAPI xKdSetupPciDeviceForDebugging(IN PVOID LoaderBlock OPTIONAL, IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Definition: halstub.c:254
NTSTATUS NTAPI xHalEndMirroring(IN ULONG PassNumber)
Definition: halstub.c:146
struct _PARTITION_TABLE PARTITION_TABLE
PVOID NTAPI xKdGetAcpiTablePhase(IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock, IN ULONG Signature)
Definition: halstub.c:269
NTSTATUS NTAPI xHalQueryBusSlots(IN PBUS_HANDLER BusHandler, IN ULONG BufferSize, OUT PULONG SlotNumbers, OUT PULONG ReturnedLength)
Definition: halstub.c:161
NTSTATUS NTAPI xHalSetSystemInformation(IN HAL_SET_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN PVOID Buffer)
Definition: halstub.c:173
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
struct _BOOT_SECTOR_INFO * PBOOT_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
NTSTATUS FASTCALL xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG SectorsPerTrack, IN ULONG NumberOfHeads, IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
Definition: disksup.c:2387
VOID NTAPI xHalEndOfBoot(VOID)
Definition: halstub.c:88
PVOID NTAPI MatchAll(IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG NumberPages, IN BOOLEAN FlushCurrentTLB)
Definition: halstub.c:277
struct _DISK_LAYOUT DISK_LAYOUT
NTSTATUS NTAPI xHalAllocateMapRegisters(IN PADAPTER_OBJECT AdapterObject, IN ULONG Unknown, IN ULONG Unknown2, PMAP_REGISTER_ENTRY Registers)
Definition: halstub.c:242
CHAR PartitionType
Definition: part_xbox.c:32
unsigned short USHORT
Definition: pedump.c:61
enum _BUS_DATA_TYPE BUS_DATA_TYPE
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
UCHAR BytesPerSector[2]
Definition: hal.h:305
UCHAR Ignore2[6]
Definition: hal.h:306
UCHAR MediaByte[1]
Definition: hal.h:308
UCHAR SectorsPerTrack[2]
Definition: hal.h:310
UCHAR OemData[8]
Definition: hal.h:304
UCHAR JumpByte[1]
Definition: hal.h:302
UCHAR NumberOfHeads[2]
Definition: hal.h:311
UCHAR NumberOfSectors[2]
Definition: hal.h:307
UCHAR Ignore1[2]
Definition: hal.h:303
UCHAR Ignore3[2]
Definition: hal.h:309
ULONG Signature
Definition: hal.h:325
ULONG TableCount
Definition: hal.h:324
PARTITION_TABLE PartitionTable[1]
Definition: hal.h:326
Definition: haltypes.h:185
UCHAR EndingTrack
Definition: hal.h:284
UCHAR StartingSectorMsb1
Definition: hal.h:290
UCHAR EndingCylinderMsb
Definition: hal.h:286
UCHAR StartingSectorMsb0
Definition: hal.h:289
UCHAR PartitionLengthMsb0
Definition: hal.h:293
UCHAR PartitionLengthLsb1
Definition: hal.h:292
UCHAR PartitionLengthMsb1
Definition: hal.h:294
UCHAR PartitionLengthLsb0
Definition: hal.h:291
UCHAR PartitionType
Definition: hal.h:283
UCHAR StartingCylinderLsb
Definition: hal.h:281
UCHAR StartingTrack
Definition: hal.h:280
UCHAR StartingCylinderMsb
Definition: hal.h:282
UCHAR StartingSectorLsb1
Definition: hal.h:288
UCHAR StartingSectorLsb0
Definition: hal.h:287
UCHAR ActiveFlag
Definition: hal.h:279
UCHAR EndingCylinderLsb
Definition: hal.h:285
PARTITION_INFORMATION PartitionEntry[4]
Definition: hal.h:319
Definition: hal.h:333
USHORT EndingCylinder
Definition: hal.h:339
UCHAR EndingTrack
Definition: hal.h:338
UCHAR StartingTrack
Definition: hal.h:335
ULONG StartingSector
Definition: hal.h:340
ULONG PartitionLength
Definition: hal.h:341
USHORT StartingCylinder
Definition: hal.h:336
UCHAR PartitionType
Definition: hal.h:337
UCHAR ActiveFlag
Definition: hal.h:334
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define OUT
Definition: typedefs.h:40
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
_In_ ULONG SectorSize
Definition: halfuncs.h:291
enum _HAL_SET_INFORMATION_CLASS HAL_SET_INFORMATION_CLASS
enum _HAL_QUERY_INFORMATION_CLASS HAL_QUERY_INFORMATION_CLASS
_In_ ULONG _In_ ULONG _In_ ULONG NumberOfHeads
Definition: iofuncs.h:2072
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2273
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2275
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2274
_In_ ULONG _In_ BOOLEAN ReturnRecognizedPartitions
Definition: iofuncs.h:2051
_In_ ULONG _In_ ULONG SectorsPerTrack
Definition: iofuncs.h:2071
_In_ ULONG _In_ BOOLEAN _Out_ struct _DRIVE_LAYOUT_INFORMATION ** PartitionBuffer
Definition: iofuncs.h:2052
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2061
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
unsigned char UCHAR
Definition: xmlstorage.h:181