ReactOS 0.4.15-dev-7953-g1f49173
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
27extern "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>
35typedef struct _IDENTIFY_DATA {
38 USHORT Reserved1; /* 04 */
39 USHORT NumHeads; /* 06 */
43 USHORT VendorUnique1[3]; /* 14 */
44 UCHAR SerialNumber[20]; /* 20 */
45 USHORT BufferType; /* 40 */
46 USHORT BufferSectorSize; /* 42 */
47 USHORT NumberOfEccBytes; /* 44 */
49 UCHAR ModelNumber[40]; /* 54 */
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 */
60 USHORT Reserved3:13; /* - */
67 USHORT SingleWordDMASupport:8; /* 124 */
69 USHORT MultiWordDMASupport:8; /* 126 */
70 USHORT MultiWordDMAActive:8; /* - */
71 USHORT AdvancedPIOModes:8; /* 128 */
72 USHORT Reserved4:8; /* - */
77 USHORT Reserved5[11]; /* 138 */
78 USHORT MajorRevision; /* 160 */
79 USHORT MinorRevision; /* 162 */
80 USHORT Reserved6; /* 164 */
82 USHORT Reserved6a[2]; /* 168 */
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; /* - */
93 USHORT Reserved9:6; /* - */
95 USHORT Reserved10:7; /* - */
96 USHORT Reserved11[128]; /* 256 */
98
103 USHORT NumHeads; /* 06 */
107 __GNU_EXTENSION union
108 {
110 struct
111 {
117 } u;
118 };
119 UCHAR SerialNumber[20]; /* 20 */
124 UCHAR ModelNumber[40]; /* 54 */
129 USHORT Reserved2; /* 100 */
135 USHORT Reserved3:13; /* - */
147 USHORT Reserved4:8; /* - */
152 USHORT Reserved5[11]; /* 138 */
155 USHORT Reserved6; /* 164 */
157 USHORT Reserved6a[2]; /* 168 */
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; /* - */
171 USHORT Reserved11[128]; /* 256 */
173#include <poppack.h>
174
176{
194
195typedef enum
196{
201
204 _In_ PVOID DeviceExtension,
205 _In_ ULONG Channel);
206
207typedef BOOLEAN
209 _In_ PVOID DeviceExtension);
210
211typedef NTSTATUS
213 _In_ PVOID DeviceExtension,
215
216typedef ULONG
218 _In_ PVOID DeviceExtension,
219 _In_ PUCHAR CdbCommand,
220 _In_ PUCHAR Slave);
221
222typedef NTSTATUS
224 _In_ IDENTIFY_DATA IdentifyData,
225 _Out_ PULONG BestXferMode,
226 _Out_ PULONG CurrentXferMode);
227
229{
243
244typedef NTSTATUS
246 _In_ PVOID DeviceExtension,
247 _In_ PIDE_CONTROLLER_PROPERTIES ControllerProperties);
248
249CODE_SEG("PAGE")
254 _In_ PCONTROLLER_PROPERTIES HwGetControllerProperties,
255 _In_ ULONG ExtensionSize);
256
259 _In_ PVOID DeviceExtension,
261 _In_ ULONG ConfigDataOffset,
263
266 _In_ PVOID DeviceExtension,
269 _In_ ULONG ConfigDataOffset,
271
272/* Bit field values for
273 * PCIIDE_TRANSFER_MODE_SELECT.DeviceTransferModeSupported and
274 * IDE_CONTROLLER_PROPERTIES.SupportedTransferMode
275 */
276// PIO Modes
277#define PIO_MODE0 (1 << 0)
278#define PIO_MODE1 (1 << 1)
279#define PIO_MODE2 (1 << 2)
280#define PIO_MODE3 (1 << 3)
281#define PIO_MODE4 (1 << 4)
282// Single-word DMA Modes
283#define SWDMA_MODE0 (1 << 5)
284#define SWDMA_MODE1 (1 << 6)
285#define SWDMA_MODE2 (1 << 7)
286// Multi-word DMA Modes
287#define MWDMA_MODE0 (1 << 8)
288#define MWDMA_MODE1 (1 << 9)
289#define MWDMA_MODE2 (1 << 10)
290// Ultra DMA Modes
291#define UDMA_MODE0 (1 << 11)
292#define UDMA_MODE1 (1 << 12)
293#define UDMA_MODE2 (1 << 13)
294#define UDMA_MODE3 (1 << 14)
295#define UDMA_MODE4 (1 << 15)
296#define UDMA_MODE5 (1 << 16)
297
298#ifdef __cplusplus
299}
300#endif
301
302#endif /* __IDE_H */
#define CODE_SEG(...)
unsigned char BOOLEAN
#define __GNU_EXTENSION
Definition: _mingw_mac.h:135
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
#define NTSTATUS
Definition: precomp.h:21
struct _EXTENDED_IDENTIFY_DATA * PEXTENDED_IDENTIFY_DATA
struct _IDE_CONTROLLER_PROPERTIES IDE_CONTROLLER_PROPERTIES
struct _IDENTIFY_DATA * PIDENTIFY_DATA
#define MAX_IDE_DEVICE
Definition: ide.h:32
NTSTATUS NTAPI PciIdeXSetBusData(_In_ PVOID DeviceExtension, _In_reads_bytes_(BufferLength) PVOID Buffer, _In_reads_bytes_(BufferLength) PVOID DataMask, _In_ ULONG ConfigDataOffset, _In_ ULONG BufferLength)
Definition: miniport.c:122
struct _IDENTIFY_DATA IDENTIFY_DATA
ULONG(NTAPI * PCIIDE_USEDMA_FUNC)(_In_ PVOID DeviceExtension, _In_ PUCHAR CdbCommand, _In_ PUCHAR Slave)
Definition: ide.h:217
NTSTATUS(NTAPI * PCIIDE_TRANSFER_MODE_SELECT_FUNC)(_In_ PVOID DeviceExtension, _Inout_ PPCIIDE_TRANSFER_MODE_SELECT XferMode)
Definition: ide.h:212
struct _IDE_CONTROLLER_PROPERTIES * PIDE_CONTROLLER_PROPERTIES
struct _PCIIDE_TRANSFER_MODE_SELECT PCIIDE_TRANSFER_MODE_SELECT
NTSTATUS NTAPI PciIdeXInitialize(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath, _In_ PCONTROLLER_PROPERTIES HwGetControllerProperties, _In_ ULONG ExtensionSize)
Definition: pciidex.c:289
NTSTATUS(NTAPI * PCONTROLLER_PROPERTIES)(_In_ PVOID DeviceExtension, _In_ PIDE_CONTROLLER_PROPERTIES ControllerProperties)
Definition: ide.h:245
NTSTATUS NTAPI PciIdeXGetBusData(_In_ PVOID DeviceExtension, _Out_writes_bytes_all_(BufferLength) PVOID Buffer, _In_ ULONG ConfigDataOffset, _In_ ULONG BufferLength)
Definition: miniport.c:92
#define MAX_IDE_LINE
Definition: ide.h:31
IDE_CHANNEL_STATE
Definition: ide.h:196
@ ChannelDisabled
Definition: ide.h:197
@ ChannelStateUnknown
Definition: ide.h:199
@ ChannelEnabled
Definition: ide.h:198
NTSTATUS(NTAPI * PCIIDE_UDMA_MODES_SUPPORTED)(_In_ IDENTIFY_DATA IdentifyData, _Out_ PULONG BestXferMode, _Out_ PULONG CurrentXferMode)
Definition: ide.h:223
struct _EXTENDED_IDENTIFY_DATA EXTENDED_IDENTIFY_DATA
IDE_CHANNEL_STATE(NTAPI * PCIIDE_CHANNEL_ENABLED)(_In_ PVOID DeviceExtension, _In_ ULONG Channel)
Definition: ide.h:203
struct _PCIIDE_TRANSFER_MODE_SELECT * PPCIIDE_TRANSFER_MODE_SELECT
BOOLEAN(NTAPI * PCIIDE_SYNC_ACCESS_REQUIRED)(_In_ PVOID DeviceExtension)
Definition: ide.h:208
#define MAX_IDE_CHANNEL
Definition: ide.h:30
#define _In_reads_bytes_(size)
Definition: ms_sal.h:321
#define _Inout_
Definition: ms_sal.h:378
#define _Out_writes_bytes_all_(size)
Definition: ms_sal.h:362
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define BOOLEAN
Definition: pedump.c:73
unsigned short USHORT
Definition: pedump.c:61
USHORT Reserved11[128]
Definition: ide.h:171
USHORT DeviceWriteProtect
Definition: ide.h:169
USHORT GeneralConfiguration
Definition: ide.h:100
USHORT SingleWordDMASupport
Definition: ide.h:142
USHORT MajorRevision
Definition: ide.h:153
UCHAR InterSectorGap
Definition: ide.h:112
UCHAR ModelNumber[40]
Definition: ide.h:124
USHORT VendorUnique1[3]
Definition: ide.h:109
USHORT CommandSetActive
Definition: ide.h:158
USHORT Reserved7a[22]
Definition: ide.h:164
USHORT DoubleWordIo
Definition: ide.h:127
USHORT Reserved7[11]
Definition: ide.h:162
USHORT NumberOfEccBytes
Definition: ide.h:122
USHORT NumberOfCurrentHeads
Definition: ide.h:137
USHORT MediaStatusNotification
Definition: ide.h:167
USHORT MinimumPIOCycleTimeIORDY
Definition: ide.h:151
USHORT Reserved6a[2]
Definition: ide.h:157
UCHAR PioCycleTimingMode
Definition: ide.h:131
USHORT MultiWordDMAActive
Definition: ide.h:145
USHORT TranslationFieldsValid
Definition: ide.h:134
ULONG CurrentSectorCapacity
Definition: ide.h:139
UCHAR MaximumBlockTransfer
Definition: ide.h:125
USHORT NumCylinders
Definition: ide.h:101
USHORT MinimumMWXferCycleTime
Definition: ide.h:148
USHORT NumSectorsPerTrack
Definition: ide.h:106
UCHAR DmaCycleTimingMode
Definition: ide.h:133
USHORT BufferSectorSize
Definition: ide.h:121
USHORT RecommendedMWXferCycleTime
Definition: ide.h:149
USHORT CurrentSectorsPerTrack
Definition: ide.h:138
USHORT MultiWordDMASupport
Definition: ide.h:144
USHORT UnformattedBytesPerTrack
Definition: ide.h:104
USHORT CurrentMultiSectorSetting
Definition: ide.h:140
USHORT MinorRevision
Definition: ide.h:154
USHORT NumberOfCurrentCylinders
Definition: ide.h:136
USHORT VendorUniqueCnt
Definition: ide.h:116
USHORT AdvancedPIOModes
Definition: ide.h:146
USHORT Capabilities
Definition: ide.h:128
ULONG UserAddressableSectors
Definition: ide.h:141
USHORT MinimumPIOCycleTime
Definition: ide.h:150
USHORT UltraDMASupport
Definition: ide.h:160
USHORT CommandSetSupport
Definition: ide.h:156
UCHAR FirmwareRevision[8]
Definition: ide.h:123
struct _EXTENDED_IDENTIFY_DATA::@2043::@2045 u
ULONG Max48BitLBA[2]
Definition: ide.h:163
UCHAR InterSectorGapSize
Definition: ide.h:113
USHORT Reserved5[11]
Definition: ide.h:152
USHORT UnformattedBytesPerSector
Definition: ide.h:105
USHORT UltraDMAActive
Definition: ide.h:161
USHORT SingleWordDMAActive
Definition: ide.h:143
UCHAR SerialNumber[20]
Definition: ide.h:119
USHORT NumberOfCurrentCylinders
Definition: hwide.h:208
USHORT BufferType
Definition: hwide.h:184
USHORT UltraDMASupport
Definition: atapi.h:830
USHORT Capabilities
Definition: atapi.h:210
USHORT DeviceWriteProtect
Definition: ide.h:94
USHORT Reserved4
Definition: hwide.h:219
USHORT UnformattedBytesPerSector
Definition: hwide.h:180
USHORT SingleWordDMASupport
Definition: hwide.h:214
USHORT NumberOfCurrentHeads
Definition: hwide.h:209
USHORT Reserved5[2]
Definition: hwide.h:224
USHORT Reserved6b
Definition: ide.h:84
USHORT LastLun
Definition: ide.h:90
USHORT CommandSetActive
Definition: ide.h:83
ULONG UserAddressableSectors
Definition: hwide.h:213
ULONG Max48BitLBA[2]
Definition: ide.h:88
USHORT Reserved8
Definition: ide.h:91
USHORT MultiWordDMASupport
Definition: hwide.h:216
USHORT GeneralConfiguration
Definition: atapi.h:193
UCHAR PioCycleTimingMode
Definition: hwide.h:203
USHORT NumSectorsPerTrack
Definition: ide.h:42
USHORT Reserved10
Definition: ide.h:95
USHORT SerialNumber[10]
Definition: hwide.h:183
USHORT Reserved7a[22]
Definition: ide.h:89
USHORT Reserved7[151]
Definition: hwide.h:281
USHORT MediaStatusNotification
Definition: ide.h:92
USHORT Reserved9
Definition: ide.h:93
USHORT BufferSectorSize
Definition: hwide.h:185
USHORT MinorRevision
Definition: hwide.h:235
UCHAR VendorUnique4
Definition: hwide.h:204
USHORT Reserved3
Definition: hwide.h:207
USHORT CurrentSectorsPerTrack
Definition: hwide.h:210
UCHAR VendorUnique2
Definition: hwide.h:190
USHORT DoubleWordIo
Definition: hwide.h:191
USHORT CurrentMultiSectorSetting
Definition: hwide.h:212
USHORT MajorRevision
Definition: hwide.h:234
USHORT NumberOfEccBytes
Definition: hwide.h:186
USHORT TranslationFieldsValid
Definition: hwide.h:206
USHORT Reserved6[13]
Definition: hwide.h:279
UCHAR VendorUnique3
Definition: hwide.h:202
USHORT UnformattedBytesPerTrack
Definition: hwide.h:179
USHORT UltraDMAActive
Definition: atapi.h:831
USHORT NumHeads
Definition: ide.h:39
UCHAR DmaCycleTimingMode
Definition: hwide.h:205
USHORT CommandSetSupport
Definition: ide.h:81
USHORT SingleWordDMAActive
Definition: hwide.h:215
USHORT AdvancedPIOModes
Definition: hwide.h:218
USHORT NumCylinders
Definition: ide.h:37
USHORT Reserved2
Definition: hwide.h:201
USHORT FirmwareRevision[4]
Definition: hwide.h:187
UCHAR MaximumBlockTransfer
Definition: atapi.h:207
USHORT VendorUnique1[3]
Definition: hwide.h:182
USHORT MultiWordDMAActive
Definition: hwide.h:217
USHORT Reserved11[128]
Definition: ide.h:96
USHORT Reserved6a[2]
Definition: ide.h:82
USHORT RecommendedMWXferCycleTime
Definition: hwide.h:221
USHORT MinimumPIOCycleTimeIORDY
Definition: hwide.h:223
USHORT ModelNumber[20]
Definition: hwide.h:188
USHORT Reserved1
Definition: hwide.h:177
USHORT MinimumMWXferCycleTime
Definition: hwide.h:220
ULONG CurrentSectorCapacity
Definition: hwide.h:211
USHORT MinimumPIOCycleTime
Definition: hwide.h:222
PCIIDE_USEDMA_FUNC PciIdeUseDma
Definition: ide.h:238
ULONG AlignmentRequirement
Definition: ide.h:239
ULONG SupportedTransferMode[MAX_IDE_CHANNEL][MAX_IDE_DEVICE]
Definition: ide.h:232
PCIIDE_CHANNEL_ENABLED PciIdeChannelEnabled
Definition: ide.h:233
PCIIDE_SYNC_ACCESS_REQUIRED PciIdeSyncAccessRequired
Definition: ide.h:234
BOOLEAN AlwaysClearBusMasterInterrupt
Definition: ide.h:237
PCIIDE_TRANSFER_MODE_SELECT_FUNC PciIdeTransferModeSelect
Definition: ide.h:235
BOOLEAN IgnoreActiveBitForAtaDevice
Definition: ide.h:236
PCIIDE_UDMA_MODES_SUPPORTED PciIdeUdmaModesSupported
Definition: ide.h:241
ULONG DeviceTransferModeSelected[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:190
ULONG BestSwDmaCycleTime[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:183
IDENTIFY_DATA IdentifyData[MAX_IDE_DEVICE]
Definition: ide.h:189
BOOLEAN FixedDisk[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:179
ULONG BestUDmaCycleTime[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:185
ULONG BestPioCycleTime[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:182
ULONG BestMwDmaCycleTime[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:184
ULONG DeviceTransferModeSupported[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:181
BOOLEAN DevicePresent[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:178
PULONG TransferModeTimingTable
Definition: ide.h:191
BOOLEAN IoReadySupported[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:180
ULONG DeviceTransferModeCurrent[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:186
ULONG UserChoiceTransferMode[MAX_IDE_DEVICE *MAX_IDE_LINE]
Definition: ide.h:187
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
unsigned char UCHAR
Definition: xmlstorage.h:181