ReactOS  0.4.14-dev-49-gfb4591c
uata_ctl.h
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) 2004-2005 Alexandr A. Telyatnikov (Alter)
4 
5 Module Name:
6  uata_ctl.h
7 
8 Abstract:
9  This header contains definitions for private UniATA SRB_IOCTL.
10 
11 Author:
12  Alexander A. Telyatnikov (Alter)
13 
14 Environment:
15  kernel mode only
16 
17 Notes:
18 
19  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 
30 Revision History:
31 
32 Licence:
33  GPLv2
34 
35 --*/
36 
37 #ifndef __UNIATA_IO_CONTROL_CODES__H__
38 #define __UNIATA_IO_CONTROL_CODES__H__
39 
40 //#include "scsi.h"
41 
42 #pragma pack(push, 8)
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif //__cplusplus
47 
48 #define AHCI_MAX_PORT 32
49 #define IDE_MAX_CHAN 16
50 // Thanks to SATA Port Multipliers:
51 #define IDE_MAX_LUN_PER_CHAN 2
52 #define IDE_MAX_LUN (AHCI_MAX_PORT*IDE_MAX_LUN_PER_CHAN)
53 
54 #define MAX_QUEUE_STAT 8
55 
56 #define UNIATA_COMM_PORT_VENDOR_STR "UNIATA " "Management Port " UNIATA_VER_STR
57 
58 #ifndef UNIATA_CORE
59 
60 #define IOCTL_SCSI_MINIPORT_UNIATA_FIND_DEVICES ((FILE_DEVICE_SCSI << 16) + 0x09a0)
61 #define IOCTL_SCSI_MINIPORT_UNIATA_DELETE_DEVICE ((FILE_DEVICE_SCSI << 16) + 0x09a1)
62 #define IOCTL_SCSI_MINIPORT_UNIATA_SET_MAX_MODE ((FILE_DEVICE_SCSI << 16) + 0x09a2)
63 #define IOCTL_SCSI_MINIPORT_UNIATA_GET_MODE ((FILE_DEVICE_SCSI << 16) + 0x09a3)
64 #define IOCTL_SCSI_MINIPORT_UNIATA_ADAPTER_INFO ((FILE_DEVICE_SCSI << 16) + 0x09a4)
65 //#define IOCTL_SCSI_MINIPORT_UNIATA_LUN_IDENT ((FILE_DEVICE_SCSI << 16) + 0x09a5) -> IOCTL_SCSI_MINIPORT_IDENTIFY
66 #define IOCTL_SCSI_MINIPORT_UNIATA_RESETBB ((FILE_DEVICE_SCSI << 16) + 0x09a5)
67 #define IOCTL_SCSI_MINIPORT_UNIATA_RESET_DEVICE ((FILE_DEVICE_SCSI << 16) + 0x09a6)
68 #define IOCTL_SCSI_MINIPORT_UNIATA_REG_IO ((FILE_DEVICE_SCSI << 16) + 0x09a7)
69 #define IOCTL_SCSI_MINIPORT_UNIATA_GET_VERSION ((FILE_DEVICE_SCSI << 16) + 0x09a8)
70 
71 typedef struct _ADDREMOVEDEV {
74 
75 #define UNIATA_REMOVE_FLAGS_HIDE 0x01
76 #define UNIATA_ADD_FLAGS_UNHIDE 0x01
77 
79 
80 typedef struct _SETTRANSFERMODE {
86 
87 typedef struct _GETTRANSFERMODE {
91  ULONG PhyMode; // since v0.42i6
93 
94 typedef struct _GETDRVVERSION {
102 
103 typedef struct _CHANINFO {
104  ULONG MaxTransferMode; // may differ from Controller's value due to 40-pin cable
111  LONGLONG TryReorderTailCount; /* in-order requests */
112 // ULONG opt_MaxTransferMode; // user-specified
113 } CHANINFO, *PCHANINFO;
114 
115 typedef struct _ADAPTERINFO {
116  // Device identification
123 
125 
131 
135 
137 
138  ULONG BusInterruptLevel; // Interrupt level
139  ULONG InterruptMode; // Interrupt Mode (Level or Edge)
141  // Number of channels being supported by one instantiation
142  // of the device extension. Normally (and correctly) one, but
143  // with so many broken PCI IDE controllers being sold, we have
144  // to support them.
147 
148  UCHAR NumberLuns; // per channel
150  BOOLEAN ChanHeaderLengthValid; // since v0.42i8
151 
155 
156  //CHANINFO Chan[0];
157 
159 
160 #ifdef USER_MODE
161 
162 typedef enum _INTERFACE_TYPE {
164  Internal,
165  Isa,
166  Eisa,
167  MicroChannel,
168  TurboChannel,
169  PCIBus,
170  VMEBus,
171  NuBus,
172  PCMCIABus,
173  CBus,
174  MPIBus,
175  MPSABus,
178  PNPISABus,
181 
182 typedef struct _PCI_SLOT_NUMBER {
183  union {
184  struct {
187  ULONG Reserved:24;
188  } bits;
189  ULONG AsULONG;
190  } u;
192 
193 #endif
194 
195 #ifndef ATA_FLAGS_DRDY_REQUIRED
196 
197 //The ATA_PASS_THROUGH_DIRECT structure is used in conjunction with an IOCTL_ATA_PASS_THROUGH_DIRECT request to instruct the port driver to send an embedded ATA command to the target device.
198 
199 typedef struct _ATA_PASS_THROUGH_DIRECT {
210  union {
213  };
214  union {
217  };
219 
220 #define ATA_FLAGS_DRDY_REQUIRED 0x01 // Wait for DRDY status from the device before sending the command to the device.
221 #define ATA_FLAGS_DATA_OUT 0x02 // Write data to the device.
222 #define ATA_FLAGS_DATA_IN 0x04 // Read data from the device.
223 #define ATA_FLAGS_48BIT_COMMAND 0x08 // The ATA command to be send uses the 48 bit LBA feature set.
224  // When this flag is set, the contents of the PreviousTaskFile member in the
225  // ATA_PASS_THROUGH_DIRECT structure should be valid.
226 #define ATA_FLAGS_USE_DMA 0x10 // Set the transfer mode to DMA.
227 #define ATA_FLAGS_NO_MULTIPLE 0x20 // Read single sector only.
228 
229 #endif //ATA_FLAGS_DRDY_REQUIRED
230 
231 #pragma pack(pop)
232 
233 #pragma pack(push, 1)
234 typedef struct _IDEREGS_EX {
235  union {
236  UCHAR bFeaturesReg; // Used for specifying SMART "commands" on input.
237  UCHAR bErrorReg; // Error on output.
238  };
239  UCHAR bSectorCountReg; // IDE sector count register
240  UCHAR bSectorNumberReg; // IDE sector number register
241  UCHAR bCylLowReg; // IDE low order cylinder value
242  UCHAR bCylHighReg; // IDE high order cylinder value
243  UCHAR bDriveHeadReg; // IDE drive/head register
244  union {
245  UCHAR bCommandReg; // Actual IDE command.
246  UCHAR bStatusReg; // Status register.
247  };
248  UCHAR bOpFlags; // 00 - send
249  // 01 - read regs
250  // 08 - lba48
251  // 10 - treat timeout as msec
252 
253 #define UNIATA_SPTI_EX_SND 0x00
254 #define UNIATA_SPTI_EX_RCV 0x01
255 #define UNIATA_SPTI_EX_LBA48 0x08
256 //#define UNIATA_SPTI_EX_SPEC_TO 0x10
257 //#define UNIATA_SPTI_EX_FREEZE_TO 0x20 // do not reset device on timeout and keep interrupts disabled
258 #define UNIATA_SPTI_EX_USE_DMA 0x10 // Force DMA transfer mode
259 
260 // use 'invalid' combination to specify special TO options
261 #define UNIATA_SPTI_EX_SPEC_TO (ATA_FLAGS_DATA_OUT | ATA_FLAGS_DATA_IN)
262 
263  UCHAR bFeaturesRegH; // feature (high part for LBA48 mode)
264  UCHAR bSectorCountRegH; // IDE sector count register (high part for LBA48 mode)
265  UCHAR bSectorNumberRegH; // IDE sector number register (high part for LBA48 mode)
266  UCHAR bCylLowRegH; // IDE low order cylinder value (high part for LBA48 mode)
267  UCHAR bCylHighRegH; // IDE high order cylinder value (high part for LBA48 mode)
270 
271 typedef struct _UNIATA_REG_IO {
273  UCHAR RegSz:3; // 0=1, 1=2, 2=4, 3=1+1 (for lba48) 4=2+2 (for lba48)
274  UCHAR InOut:1; // 0=in, 1=out
277  union {
281  USHORT d8[2];
282  };
284 
285 typedef struct _UNIATA_REG_IO_HDR {
289 
290 #pragma pack(pop)
291 
292 #pragma pack(push, 1)
293 
294 typedef struct _UNIATA_CTL {
298  union {
304 // IDENTIFY_DATA2 LunIdent;
305 // ATA_PASS_THROUGH_DIRECT AtaDirect;
308  };
310 
313  ULONG Filler; // realign buffers to double word boundary
315  UCHAR ucDataBuf[512]; // recommended minimum
317 
320  ULONG Filler; // realign buffer to double word boundary
323 
324 #endif //UNIATA_CORE
325 
326 #ifdef __cplusplus
327 };
328 #endif //__cplusplus
329 
330 #pragma pack(pop)
331 
332 #endif //__UNIATA_IO_CONTROL_CODES__H__
UCHAR bSectorCountReg
Definition: uata_ctl.h:239
struct _SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER * PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER
ULONG NumberChannels
Definition: uata_ctl.h:145
struct _ATA_PASS_THROUGH_DIRECT ATA_PASS_THROUGH_DIRECT
struct _UNIATA_CTL UNIATA_CTL
ULONG Reserved
Definition: uata_ctl.h:297
ULONG DevIndex
Definition: uata_ctl.h:122
UCHAR bCylHighRegH
Definition: uata_ctl.h:267
enum _INTERFACE_TYPE INTERFACE_TYPE
LONGLONG TryReorderCount
Definition: uata_ctl.h:109
ULONG BusInterruptVector
Definition: uata_ctl.h:140
struct _ATA_PASS_THROUGH_DIRECT * PATA_PASS_THROUGH_DIRECT
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
struct _UNIATA_REG_IO_HDR * PUNIATA_REG_IO_HDR
ULONG Length
Definition: uata_ctl.h:95
char CHAR
Definition: xmlstorage.h:175
BOOLEAN UnknownDev
Definition: uata_ctl.h:129
UCHAR bCommandReg
Definition: uata_ctl.h:245
struct _GETDRVVERSION * PGETDRVVERSION
struct _IDEREGS_EX IDEREGS_EX
struct _UNIATA_REG_IO_HDR UNIATA_REG_IO_HDR
UCHAR RawData[1]
Definition: uata_ctl.h:299
struct _CHANINFO CHANINFO
struct _SETTRANSFERMODE SETTRANSFERMODE
ULONG AdapterInterfaceType
Definition: uata_ctl.h:152
enum _INTERFACE_TYPE * PINTERFACE_TYPE
CHAR DeviceName[64]
Definition: uata_ctl.h:136
ULONG slotNumber
Definition: uata_ctl.h:120
struct _ADDREMOVEDEV ADDREMOVEDEV
LONGLONG QueueStat[MAX_QUEUE_STAT]
Definition: uata_ctl.h:106
ULONG ChannelCtrlFlags
Definition: uata_ctl.h:105
ULONG CurrentMode
Definition: uata_ctl.h:90
UCHAR Reserved1
Definition: uata_ctl.h:276
UNIATA_REG_IO_HDR RegIo
Definition: uata_ctl.h:307
UCHAR bFeaturesReg
Definition: uata_ctl.h:236
SCSI_ADDRESS addr
Definition: uata_ctl.h:296
UCHAR NumberLuns
Definition: uata_ctl.h:148
USHORT VersionMn
Definition: uata_ctl.h:97
UCHAR bErrorReg
Definition: uata_ctl.h:237
GETTRANSFERMODE GetMode
Definition: uata_ctl.h:302
ULONG LunHeaderLength
Definition: uata_ctl.h:154
struct _UNIATA_REG_IO * PUNIATA_REG_IO
ULONG Channel
Definition: uata_ctl.h:124
struct _PCI_SLOT_NUMBER * PPCI_SLOT_NUMBER
BOOLEAN ApplyImmediately
Definition: uata_ctl.h:83
struct _ADAPTERINFO ADAPTERINFO
LONGLONG IntersectCount
Definition: uata_ctl.h:108
ULONG HwFlags
Definition: uata_ctl.h:133
SETTRANSFERMODE SetMode
Definition: uata_ctl.h:301
unsigned char BOOLEAN
struct _ADAPTERINFO * PADAPTERINFO
LONGLONG ReorderCount
Definition: uata_ctl.h:107
SCSI_PASS_THROUGH_DIRECT sptd
Definition: uata_ctl.h:319
ULONG MaxTransferMode
Definition: uata_ctl.h:132
ULONG SystemIoBusNumber
Definition: uata_ctl.h:121
struct _SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
struct _SCSI_PASS_THROUGH_WITH_BUFFERS SCSI_PASS_THROUGH_WITH_BUFFERS
USHORT d8[2]
Definition: uata_ctl.h:281
struct _CHANINFO * PCHANINFO
struct _UNIATA_REG_IO UNIATA_REG_IO
BOOLEAN MasterDev
Definition: uata_ctl.h:130
struct _GETDRVVERSION GETDRVVERSION
struct _GETTRANSFERMODE * PGETTRANSFERMODE
ULONG BusInterruptLevel
Definition: uata_ctl.h:138
struct _SCSI_PASS_THROUGH_WITH_BUFFERS * PSCSI_PASS_THROUGH_WITH_BUFFERS
int64_t LONGLONG
Definition: typedefs.h:66
ULONG HbaCtrlFlags
Definition: uata_ctl.h:126
#define MAX_QUEUE_STAT
Definition: uata_ctl.h:54
struct _UNIATA_CTL * PUNIATA_CTL
UCHAR bFeaturesRegH
Definition: uata_ctl.h:263
USHORT VersionMj
Definition: uata_ctl.h:96
ULONG DeviceNumber
Definition: iotypes.h:3136
BOOLEAN ChanInfoValid
Definition: uata_ctl.h:146
ULONG OrigMode
Definition: uata_ctl.h:82
struct _IDEREGS_EX * PIDEREGS_EX
USHORT RegIDX
Definition: uata_ctl.h:272
struct _ADDREMOVEDEV * PADDREMOVEDEV
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR bDriveHeadReg
Definition: uata_ctl.h:243
struct _GETTRANSFERMODE GETTRANSFERMODE
union _PCI_SLOT_NUMBER::@3636 u
BOOLEAN simplexOnly
Definition: uata_ctl.h:127
ULONG DevID
Definition: uata_ctl.h:118
ULONG WaitForPhysicalLink
Definition: uata_ctl.h:72
UCHAR bCylHighReg
Definition: uata_ctl.h:242
ULONG ChanHeaderLength
Definition: uata_ctl.h:153
struct _PCI_SLOT_NUMBER::@3636::@3637 bits
struct _IDEREGS_EX * LPIDEREGS_EX
LONGLONG TryReorderTailCount
Definition: uata_ctl.h:111
UCHAR bStatusReg
Definition: uata_ctl.h:246
BOOLEAN ChanHeaderLengthValid
Definition: uata_ctl.h:150
BOOLEAN LunInfoValid
Definition: uata_ctl.h:149
LONGLONG TryReorderHeadCount
Definition: uata_ctl.h:110
_INTERFACE_TYPE
Definition: hwresource.cpp:135
struct _PCI_SLOT_NUMBER PCI_SLOT_NUMBER
ULONG Flags
Definition: uata_ctl.h:73
USHORT d16[2]
Definition: uata_ctl.h:280
unsigned short USHORT
Definition: pedump.c:61
ULONG RevID
Definition: uata_ctl.h:119
ULONG OrigAdapterInterfaceType
Definition: uata_ctl.h:134
ULONG MaxTransferMode
Definition: uata_ctl.h:104
SRB_IO_CONTROL hdr
Definition: uata_ctl.h:295
UCHAR bOpFlags
Definition: uata_ctl.h:248
ULONG OrigMode
Definition: uata_ctl.h:89
ULONG FunctionNumber
Definition: iotypes.h:3137
ADDREMOVEDEV FindDelDev
Definition: uata_ctl.h:300
ULONG HeaderLength
Definition: uata_ctl.h:117
UCHAR bCylLowRegH
Definition: uata_ctl.h:266
UCHAR bReserved2
Definition: uata_ctl.h:268
unsigned int ULONG
Definition: retypes.h:1
UCHAR bSectorNumberRegH
Definition: uata_ctl.h:265
UCHAR bCylLowReg
Definition: uata_ctl.h:241
USHORT SubVerMn
Definition: uata_ctl.h:99
ADAPTERINFO AdapterInfo
Definition: uata_ctl.h:303
ULONG InterruptMode
Definition: uata_ctl.h:139
UCHAR bSectorNumberReg
Definition: uata_ctl.h:240
Definition: helper.h:8
struct _SETTRANSFERMODE * PSETTRANSFERMODE
BOOLEAN MemIo
Definition: uata_ctl.h:128
UCHAR bSectorCountRegH
Definition: uata_ctl.h:264
GETDRVVERSION Version
Definition: uata_ctl.h:306
USHORT SubVerMj
Definition: uata_ctl.h:98
ULONG Reserved
Definition: uata_ctl.h:100
UCHAR Reserved
Definition: uata_ctl.h:275