2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/include/hal.h
5 * PURPOSE: Internal header for the I/O HAL Functions (Fstub)
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
12 // Default implementations of HAL dispatch table
16 xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject
,
18 IN ULONG MbrTypeIdentifier
,
19 OUT PVOID
*MbrBuffer
);
23 xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock
,
24 IN PSTRING NtDeviceName
,
25 OUT PUCHAR NtSystemPath
,
26 OUT PSTRING NtSystemPathString
);
30 xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject
,
32 IN BOOLEAN ReturnRecognizedPartitions
,
33 IN OUT PDRIVE_LAYOUT_INFORMATION
*PartitionBuffer
);
37 xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject
,
39 IN ULONG PartitionNumber
,
40 IN ULONG PartitionType
);
44 xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject
,
46 IN ULONG SectorsPerTrack
,
47 IN ULONG NumberOfHeads
,
48 IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer
);
76 // Various offsets in the boot record
78 #define PARTITION_TABLE_OFFSET (0x1BE / 2)
79 #define BOOT_SIGNATURE_OFFSET ((0x200 / 2) - 1)
80 #define BOOT_RECORD_RESERVED 0x1BC
81 #define BOOT_RECORD_SIGNATURE 0xAA55
82 #define NUM_PARTITION_TABLE_ENTRIES 4
87 #define GET_STARTING_SECTOR(p) \
88 ((ULONG)(p->StartingSectorLsb0) + \
89 (ULONG)(p->StartingSectorLsb1 << 8 ) + \
90 (ULONG)(p->StartingSectorMsb0 << 16) + \
91 (ULONG)(p->StartingSectorMsb1 << 24))
93 #define GET_ENDING_S_OF_CHS(p) \
94 ((UCHAR)(p->EndingCylinderLsb & 0x3F))
96 #define GET_PARTITION_LENGTH(p) \
97 ((ULONG)(p->PartitionLengthLsb0) + \
98 (ULONG)(p->PartitionLengthLsb1 << 8) + \
99 (ULONG)(p->PartitionLengthMsb0 << 16) + \
100 (ULONG)(p->PartitionLengthMsb1 << 24))
103 // Structure describing a partition
105 typedef struct _PARTITION_DESCRIPTOR
109 UCHAR StartingCylinderLsb
;
110 UCHAR StartingCylinderMsb
;
113 UCHAR EndingCylinderLsb
;
114 UCHAR EndingCylinderMsb
;
115 UCHAR StartingSectorLsb0
;
116 UCHAR StartingSectorLsb1
;
117 UCHAR StartingSectorMsb0
;
118 UCHAR StartingSectorMsb1
;
119 UCHAR PartitionLengthLsb0
;
120 UCHAR PartitionLengthLsb1
;
121 UCHAR PartitionLengthMsb0
;
122 UCHAR PartitionLengthMsb1
;
123 } PARTITION_DESCRIPTOR
, *PPARTITION_DESCRIPTOR
;
126 // Structure describing a boot sector
128 typedef struct _BOOT_SECTOR_INFO
133 UCHAR BytesPerSector
[2];
135 UCHAR NumberOfSectors
[2];
138 UCHAR SectorsPerTrack
[2];
139 UCHAR NumberOfHeads
[2];
140 } BOOT_SECTOR_INFO
, *PBOOT_SECTOR_INFO
;
143 // Partition Table and Disk Layout
145 typedef struct _PARTITION_TABLE
147 PARTITION_INFORMATION PartitionEntry
[4];
148 } PARTITION_TABLE
, *PPARTITION_TABLE
;
150 typedef struct _DISK_LAYOUT
154 PARTITION_TABLE PartitionTable
[1];
155 } DISK_LAYOUT
, *PDISK_LAYOUT
;
158 // Partition Table Entry
164 USHORT StartingCylinder
;
167 USHORT EndingCylinder
;
168 ULONG StartingSector
;
169 ULONG PartitionLength
;