ReactOS  0.4.15-dev-506-ga3ec01c
ide.h
Go to the documentation of this file.
1 /*
2  * ide.h
3  *
4  * IDE driver interface
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  * Created by Hervé Poussineau <hpoussin@reactos.org>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #ifndef __IDE_H
24 #define __IDE_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #define MAX_IDE_CHANNEL 2
31 #define MAX_IDE_LINE 2
32 #define MAX_IDE_DEVICE 2
33 
34 #include <pshpack1.h>
35 typedef struct _IDENTIFY_DATA {
37  USHORT NumCylinders; /* 02 */
38  USHORT Reserved1; /* 04 */
39  USHORT NumHeads; /* 06 */
42  USHORT NumSectorsPerTrack; /* 12 */
43  USHORT VendorUnique1[3]; /* 14 */
44  UCHAR SerialNumber[20]; /* 20 */
45  USHORT BufferType; /* 40 */
46  USHORT BufferSectorSize; /* 42 */
47  USHORT NumberOfEccBytes; /* 44 */
48  UCHAR FirmwareRevision[8]; /* 46 */
49  UCHAR ModelNumber[40]; /* 54 */
50  UCHAR MaximumBlockTransfer; /* 94 */
51  UCHAR VendorUnique2; /* 95 */
52  USHORT DoubleWordIo; /* 96 */
53  USHORT Capabilities; /* 98 */
54  USHORT Reserved2; /* 100 */
55  UCHAR VendorUnique3; /* 102 */
56  UCHAR PioCycleTimingMode; /* 103 */
57  UCHAR VendorUnique4; /* 104 */
58  UCHAR DmaCycleTimingMode; /* 105 */
59  USHORT TranslationFieldsValid:3; /* 106 */
60  USHORT Reserved3:13; /* - */
62  USHORT NumberOfCurrentHeads; /* 110 */
64  ULONG CurrentSectorCapacity; /* 114 */
66  ULONG UserAddressableSectors; /* 120 */
67  USHORT SingleWordDMASupport:8; /* 124 */
68  USHORT SingleWordDMAActive:8; /* - */
69  USHORT MultiWordDMASupport:8; /* 126 */
70  USHORT MultiWordDMAActive:8; /* - */
71  USHORT AdvancedPIOModes:8; /* 128 */
72  USHORT Reserved4:8; /* - */
75  USHORT MinimumPIOCycleTime; /* 134 */
77  USHORT Reserved5[11]; /* 138 */
78  USHORT MajorRevision; /* 160 */
79  USHORT MinorRevision; /* 162 */
80  USHORT Reserved6; /* 164 */
81  USHORT CommandSetSupport; /* 166 */
82  USHORT Reserved6a[2]; /* 168 */
83  USHORT CommandSetActive; /* 172 */
84  USHORT Reserved6b; /* 174 */
85  USHORT UltraDMASupport:8; /* 176 */
86  USHORT UltraDMAActive:8; /* - */
87  USHORT Reserved7[11]; /* 178 */
88  ULONG Max48BitLBA[2]; /* 200 */
89  USHORT Reserved7a[22]; /* 208 */
90  USHORT LastLun:3; /* 252 */
91  USHORT Reserved8:13; /* - */
92  USHORT MediaStatusNotification:2; /* 254 */
93  USHORT Reserved9:6; /* - */
94  USHORT DeviceWriteProtect:1; /* - */
95  USHORT Reserved10:7; /* - */
96  USHORT Reserved11[128]; /* 256 */
98 
99 typedef struct _EXTENDED_IDENTIFY_DATA {
102  USHORT Reserved1; /* 04 */
103  USHORT NumHeads; /* 06 */
107  __GNU_EXTENSION union
108  {
109  USHORT VendorUnique1[3]; /* 14 */
110  struct
111  {
114  UCHAR Reserved16; /* 16 */
115  UCHAR BytesInPLO; /* - */
117  } u;
118  };
119  UCHAR SerialNumber[20]; /* 20 */
120  USHORT BufferType; /* 40 */
123  UCHAR FirmwareRevision[8]; /* 46 */
124  UCHAR ModelNumber[40]; /* 54 */
129  USHORT Reserved2; /* 100 */
130  UCHAR VendorUnique3; /* 102 */
132  UCHAR VendorUnique4; /* 104 */
135  USHORT Reserved3:13; /* - */
147  USHORT Reserved4:8; /* - */
152  USHORT Reserved5[11]; /* 138 */
155  USHORT Reserved6; /* 164 */
157  USHORT Reserved6a[2]; /* 168 */
159  USHORT Reserved6b; /* 174 */
160  USHORT UltraDMASupport:8; /* 176 */
162  USHORT Reserved7[11]; /* 178 */
163  ULONG Max48BitLBA[2]; /* 200 */
164  USHORT Reserved7a[22]; /* 208 */
165  USHORT LastLun:3; /* 252 */
166  USHORT Reserved8:13; /* - */
168  USHORT Reserved9:6; /* - */
170  USHORT Reserved10:7; /* - */
171  USHORT Reserved11[128]; /* 256 */
173 #include <poppack.h>
174 
175 typedef struct _PCIIDE_TRANSFER_MODE_SELECT
176 {
177  ULONG Channel;
194 
195 typedef enum
196 {
201 
202 typedef IDE_CHANNEL_STATE
204  IN PVOID DeviceExtension,
205  IN ULONG Channel);
206 
207 typedef BOOLEAN
209  IN PVOID DeviceExtension);
210 
211 typedef NTSTATUS
213  IN PVOID DeviceExtension,
215 
216 typedef ULONG
218  IN PVOID DeviceExtension,
219  IN PUCHAR CdbCommand,
220  IN PUCHAR Slave);
221 
222 typedef NTSTATUS
224  IN IDENTIFY_DATA IdentifyData,
225  OUT PULONG BestXferMode,
226  OUT PULONG CurrentXferMode);
227 
228 typedef struct _IDE_CONTROLLER_PROPERTIES
229 {
230  ULONG Size;
243 
244 typedef NTSTATUS
246  IN PVOID DeviceExtension,
247  IN PIDE_CONTROLLER_PROPERTIES ControllerProperties);
248 
253  IN PCONTROLLER_PROPERTIES HwGetControllerProperties,
254  IN ULONG ExtensionSize);
255 
258  IN PVOID DeviceExtension,
259  IN PVOID Buffer,
260  IN ULONG ConfigDataOffset,
262 
265  IN PVOID DeviceExtension,
266  IN PVOID Buffer,
267  IN PVOID DataMask,
268  IN ULONG ConfigDataOffset,
270 
271 /* Bit field values for
272  * PCIIDE_TRANSFER_MODE_SELECT.DeviceTransferModeSupported and
273  * IDE_CONTROLLER_PROPERTIES.SupportedTransferMode
274  */
275 // PIO Modes
276 #define PIO_MODE0 (1 << 0)
277 #define PIO_MODE1 (1 << 1)
278 #define PIO_MODE2 (1 << 2)
279 #define PIO_MODE3 (1 << 3)
280 #define PIO_MODE4 (1 << 4)
281 // Single-word DMA Modes
282 #define SWDMA_MODE0 (1 << 5)
283 #define SWDMA_MODE1 (1 << 6)
284 #define SWDMA_MODE2 (1 << 7)
285 // Multi-word DMA Modes
286 #define MWDMA_MODE0 (1 << 8)
287 #define MWDMA_MODE1 (1 << 9)
288 #define MWDMA_MODE2 (1 << 10)
289 // Ultra DMA Modes
290 #define UDMA_MODE0 (1 << 11)
291 #define UDMA_MODE1 (1 << 12)
292 #define UDMA_MODE2 (1 << 13)
293 #define UDMA_MODE3 (1 << 14)
294 #define UDMA_MODE4 (1 << 15)
295 #define UDMA_MODE5 (1 << 16)
296 
297 #ifdef __cplusplus
298 }
299 #endif
300 
301 #endif /* __IDE_H */
USHORT BufferSectorSize
Definition: hwide.h:185
#define __GNU_EXTENSION
Definition: _mingw_mac.h:135
PCIIDE_CHANNEL_ENABLED PciIdeChannelEnabled
Definition: ide.h:326
NTSTATUS(* PCIIDE_TRANSFER_MODE_SELECT_FUNC)(IN PVOID DeviceExtension, IN OUT PPCIIDE_TRANSFER_MODE_SELECT TransferModeSelect)
Definition: ide.h:282
USHORT NumberOfCurrentCylinders
Definition: ide.h:136
ULONG BestPioCycleTime[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:209
USHORT CommandSetActive
Definition: ide.h:87
UCHAR DmaCycleTimingMode
Definition: ide.h:133
USHORT Reserved1
Definition: hwide.h:177
struct _PCIIDE_TRANSFER_MODE_SELECT * PPCIIDE_TRANSFER_MODE_SELECT
#define IN
Definition: typedefs.h:39
NTSTATUS(* PCONTROLLER_PROPERTIES)(IN PVOID DeviceExtension, IN PIDE_CONTROLLER_PROPERTIES ControllerProperties)
Definition: ide.h:377
USHORT Reserved11[128]
Definition: ide.h:171
USHORT UltraDMAActive
Definition: atapi.h:832
USHORT Reserved6a[2]
Definition: ide.h:157
IDE_CHANNEL_STATE
Definition: ide.h:259
USHORT BufferType
Definition: hwide.h:184
#define MAX_IDE_LINE
Definition: ide.h:31
USHORT MinimumPIOCycleTimeIORDY
Definition: hwide.h:223
UCHAR VendorUnique3
Definition: hwide.h:202
USHORT Reserved7[151]
Definition: hwide.h:281
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG DeviceTransferModeSupported[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:203
NTSTATUS(* PCIIDE_UDMA_MODES_SUPPORTED)(IDENTIFY_DATA IdentifyData, PULONG BestXferMode, PULONG CurrentMode)
Definition: ide.h:295
USHORT Reserved4
Definition: hwide.h:219
BOOLEAN AlwaysClearBusMasterInterrupt
Definition: ide.h:350
USHORT MediaStatusNotification
Definition: ide.h:167
USHORT MultiWordDMAActive
Definition: ide.h:145
LONG NTSTATUS
Definition: precomp.h:26
struct _IDE_CONTROLLER_PROPERTIES IDE_CONTROLLER_PROPERTIES
USHORT UnformattedBytesPerTrack
Definition: ide.h:104
USHORT MinimumPIOCycleTime
Definition: ide.h:150
USHORT MultiWordDMAActive
Definition: hwide.h:217
ULONG(* PCIIDE_USEDMA_FUNC)(IN PVOID deviceExtension, IN PVOID cdbCmd, IN UCHAR targetID)
Definition: ide.h:288
USHORT Reserved8
Definition: ide.h:95
struct _PCIIDE_TRANSFER_MODE_SELECT PCIIDE_TRANSFER_MODE_SELECT
USHORT GeneralConfiguration
Definition: ide.h:100
ULONG BestMwDmaCycleTime[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:211
USHORT MinorRevision
Definition: hwide.h:235
USHORT NumCylinders
Definition: ide.h:41
BOOLEAN(* PCIIDE_SYNC_ACCESS_REQUIRED)(IN PVOID DeviceExtension)
Definition: ide.h:277
USHORT SingleWordDMASupport
Definition: hwide.h:214
USHORT MinimumPIOCycleTimeIORDY
Definition: ide.h:151
USHORT MinimumMWXferCycleTime
Definition: hwide.h:220
USHORT Reserved2
Definition: hwide.h:201
USHORT NumCylinders
Definition: ide.h:101
USHORT CurrentMultiSectorSetting
Definition: ide.h:140
UCHAR PioCycleTimingMode
Definition: ide.h:131
UCHAR InterSectorGap
Definition: ide.h:112
USHORT SingleWordDMAActive
Definition: hwide.h:215
USHORT VendorUniqueCnt
Definition: ide.h:116
ULONG UserAddressableSectors
Definition: hwide.h:213
USHORT DeviceWriteProtect
Definition: ide.h:169
PCIIDE_TRANSFER_MODE_SELECT_FUNC PciIdeTransferModeSelect
Definition: ide.h:338
USHORT LastLun
Definition: ide.h:94
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
USHORT NumSectorsPerTrack
Definition: ide.h:46
USHORT Reserved11[128]
Definition: ide.h:100
USHORT Reserved5[11]
Definition: ide.h:152
USHORT NumberOfEccBytes
Definition: ide.h:122
_In_ ULONG BufferLength
Definition: usbdlib.h:225
UCHAR PioCycleTimingMode
Definition: hwide.h:203
ULONG AlignmentRequirement
Definition: ide.h:362
#define MAX_IDE_CHANNEL
Definition: ide.h:30
ULONG UserAddressableSectors
Definition: ide.h:141
USHORT TranslationFieldsValid
Definition: ide.h:134
USHORT MajorRevision
Definition: ide.h:153
USHORT MultiWordDMASupport
Definition: ide.h:144
USHORT TranslationFieldsValid
Definition: hwide.h:206
USHORT FirmwareRevision[4]
Definition: hwide.h:187
USHORT UnformattedBytesPerSector
Definition: ide.h:105
USHORT AdvancedPIOModes
Definition: hwide.h:218
unsigned char BOOLEAN
NTSTATUS PciIdeXInitialize(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath, IN PCONTROLLER_PROPERTIES PciIdeGetControllerProperties, IN ULONG ExtensionSize)
Definition: miniport.c:94
USHORT NumberOfCurrentHeads
Definition: hwide.h:209
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
Definition: bufpool.h:45
BOOLEAN IgnoreActiveBitForAtaDevice
Definition: ide.h:344
UCHAR DmaCycleTimingMode
Definition: hwide.h:205
BOOLEAN DevicePresent[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:188
USHORT CurrentSectorsPerTrack
Definition: hwide.h:210
UCHAR VendorUnique2
Definition: hwide.h:190
USHORT Reserved7a[22]
Definition: ide.h:164
PCIIDE_USEDMA_FUNC PciIdeUseDma
Definition: ide.h:356
BOOLEAN IoReadySupported[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:198
PCIIDE_SYNC_ACCESS_REQUIRED PciIdeSyncAccessRequired
Definition: ide.h:332
ULONG BestSwDmaCycleTime[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:210
struct _IDENTIFY_DATA IDENTIFY_DATA
ULONG CurrentSectorCapacity
Definition: ide.h:139
ULONG DeviceTransferModeCurrent[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:217
USHORT Reserved6[13]
Definition: hwide.h:279
USHORT NumSectorsPerTrack
Definition: ide.h:106
USHORT MultiWordDMASupport
Definition: hwide.h:216
USHORT SerialNumber[10]
Definition: hwide.h:183
USHORT Reserved7[11]
Definition: ide.h:162
struct _IDE_CONTROLLER_PROPERTIES * PIDE_CONTROLLER_PROPERTIES
USHORT DoubleWordIo
Definition: hwide.h:191
USHORT NumHeads
Definition: ide.h:43
ULONG UserChoiceTransferMode[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:223
ULONG Max48BitLBA[2]
Definition: ide.h:92
NTSTATUS PciIdeXGetBusData(IN PVOID DeviceExtension, IN PVOID Buffer, IN ULONG ConfigDataOffset, IN ULONG BufferLength)
Definition: miniport.c:130
USHORT MediaStatusNotification
Definition: ide.h:96
UCHAR ModelNumber[40]
Definition: ide.h:124
USHORT MinimumMWXferCycleTime
Definition: ide.h:148
UCHAR SerialNumber[20]
Definition: ide.h:119
USHORT MajorRevision
Definition: hwide.h:234
USHORT Reserved9
Definition: ide.h:97
unsigned char UCHAR
Definition: xmlstorage.h:181
USHORT Capabilities
Definition: ide.h:128
IDENTIFY_DATA IdentifyData[MAX_IDE_DEVICE]
Definition: ide.h:234
USHORT Reserved10
Definition: ide.h:99
IDE_CHANNEL_STATE(* PCIIDE_CHANNEL_ENABLED)(IN PVOID DeviceExtension, IN ULONG Channel)
Definition: ide.h:271
#define NTSTATUS
Definition: precomp.h:20
ULONG CurrentSectorCapacity
Definition: hwide.h:211
UCHAR VendorUnique4
Definition: hwide.h:204
UCHAR MaximumBlockTransfer
Definition: ide.h:125
UCHAR MaximumBlockTransfer
Definition: atapi.h:207
USHORT CommandSetSupport
Definition: ide.h:85
USHORT Capabilities
Definition: atapi.h:210
USHORT Reserved6a[2]
Definition: ide.h:86
USHORT RecommendedMWXferCycleTime
Definition: hwide.h:221
USHORT CurrentMultiSectorSetting
Definition: hwide.h:212
PCIIDE_UDMA_MODES_SUPPORTED PciIdeUdmaModesSupported
Definition: ide.h:369
USHORT UltraDMASupport
Definition: ide.h:160
USHORT DoubleWordIo
Definition: ide.h:127
USHORT VendorUnique1[3]
Definition: hwide.h:182
USHORT Reserved3
Definition: hwide.h:207
unsigned short USHORT
Definition: pedump.c:61
ULONG BestUDmaCycleTime[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:212
USHORT ModelNumber[20]
Definition: hwide.h:188
USHORT CurrentSectorsPerTrack
Definition: ide.h:138
USHORT Reserved6b
Definition: ide.h:88
unsigned int * PULONG
Definition: retypes.h:1
USHORT CommandSetActive
Definition: ide.h:158
USHORT NumberOfEccBytes
Definition: hwide.h:186
USHORT UnformattedBytesPerSector
Definition: hwide.h:180
NTSTATUS PciIdeXSetBusData(IN PVOID DeviceExtension, IN PVOID Buffer, IN PVOID DataMask, IN ULONG ConfigDataOffset, IN ULONG BufferLength)
Definition: miniport.c:161
ULONG Max48BitLBA[2]
Definition: ide.h:163
USHORT Reserved7a[22]
Definition: ide.h:93
UCHAR InterSectorGapSize
Definition: ide.h:113
USHORT AdvancedPIOModes
Definition: ide.h:146
USHORT MinorRevision
Definition: ide.h:154
USHORT MinimumPIOCycleTime
Definition: hwide.h:222
#define BOOLEAN
Definition: pedump.c:73
#define OUT
Definition: typedefs.h:40
struct _IDENTIFY_DATA * PIDENTIFY_DATA
ULONG DeviceTransferModeSelected[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:245
unsigned int ULONG
Definition: retypes.h:1
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:28
#define MAX_IDE_DEVICE
Definition: ide.h:32
USHORT UnformattedBytesPerTrack
Definition: hwide.h:179
USHORT NumberOfCurrentCylinders
Definition: hwide.h:208
USHORT DeviceWriteProtect
Definition: ide.h:98
USHORT GeneralConfiguration
Definition: atapi.h:193
USHORT BufferSectorSize
Definition: ide.h:121
USHORT RecommendedMWXferCycleTime
Definition: ide.h:149
struct _EXTENDED_IDENTIFY_DATA * PEXTENDED_IDENTIFY_DATA
USHORT VendorUnique1[3]
Definition: ide.h:109
PULONG TransferModeTimingTable
Definition: ide.h:250
USHORT SingleWordDMASupport
Definition: ide.h:142
struct _EXTENDED_IDENTIFY_DATA::@2005::@2007 u
BOOLEAN FixedDisk[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:193
USHORT UltraDMASupport
Definition: atapi.h:831
UCHAR FirmwareRevision[8]
Definition: ide.h:123
USHORT UltraDMAActive
Definition: ide.h:161
USHORT Reserved5[2]
Definition: hwide.h:224
USHORT SingleWordDMAActive
Definition: ide.h:143
USHORT NumberOfCurrentHeads
Definition: ide.h:137
USHORT CommandSetSupport
Definition: ide.h:156
ULONG SupportedTransferMode[MAX_IDE_CHANNEL][MAX_IDE_DEVICE]
Definition: ide.h:321
struct _EXTENDED_IDENTIFY_DATA EXTENDED_IDENTIFY_DATA