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
);
58 // Various offsets in the boot record
60 #define PARTITION_TABLE_OFFSET (0x1BE / 2)
61 #define BOOT_SIGNATURE_OFFSET ((0x200 / 2) - 1)
62 #define BOOT_RECORD_RESERVED 0x1BC
63 #define BOOT_RECORD_SIGNATURE 0xAA55
64 #define NUM_PARTITION_TABLE_ENTRIES 4
69 #define GET_STARTING_SECTOR(p) \
70 ((ULONG)(p->StartingSectorLsb0) + \
71 (ULONG)(p->StartingSectorLsb1 << 8 ) + \
72 (ULONG)(p->StartingSectorMsb0 << 16) + \
73 (ULONG)(p->StartingSectorMsb1 << 24))
75 #define GET_ENDING_S_OF_CHS(p) \
76 ((UCHAR)(p->EndingCylinderLsb & 0x3F))
78 #define GET_PARTITION_LENGTH(p) \
79 ((ULONG)(p->PartitionLengthLsb0) + \
80 (ULONG)(p->PartitionLengthLsb1 << 8) + \
81 (ULONG)(p->PartitionLengthMsb0 << 16) + \
82 (ULONG)(p->PartitionLengthMsb1 << 24))
85 // Structure describing a partition
87 typedef struct _PARTITION_DESCRIPTOR
91 UCHAR StartingCylinderLsb
;
92 UCHAR StartingCylinderMsb
;
95 UCHAR EndingCylinderLsb
;
96 UCHAR EndingCylinderMsb
;
97 UCHAR StartingSectorLsb0
;
98 UCHAR StartingSectorLsb1
;
99 UCHAR StartingSectorMsb0
;
100 UCHAR StartingSectorMsb1
;
101 UCHAR PartitionLengthLsb0
;
102 UCHAR PartitionLengthLsb1
;
103 UCHAR PartitionLengthMsb0
;
104 UCHAR PartitionLengthMsb1
;
105 } PARTITION_DESCRIPTOR
, *PPARTITION_DESCRIPTOR
;
108 // Structure describing a boot sector
110 typedef struct _BOOT_SECTOR_INFO
115 UCHAR BytesPerSector
[2];
117 UCHAR NumberOfSectors
[2];
120 UCHAR SectorsPerTrack
[2];
121 UCHAR NumberOfHeads
[2];
122 } BOOT_SECTOR_INFO
, *PBOOT_SECTOR_INFO
;
125 // Partition Table and Disk Layout
127 typedef struct _PARTITION_TABLE
129 PARTITION_INFORMATION PartitionEntry
[4];
130 } PARTITION_TABLE
, *PPARTITION_TABLE
;
132 typedef struct _DISK_LAYOUT
136 PARTITION_TABLE PartitionTable
[1];
137 } DISK_LAYOUT
, *PDISK_LAYOUT
;
140 // Partition Table Entry
146 USHORT StartingCylinder
;
149 USHORT EndingCylinder
;
150 ULONG StartingSector
;
151 ULONG PartitionLength
;