OSDN Git Service

Insert removed author attribution.
[mingw/mingw-org-wsl.git] / include / ddk / scsiscan.h
1 /**
2  * @file scsiscan.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 /* Created by Casper S. Hornstrup <chorns@users.sourceforge.net> */
25 #ifndef __SCSISCAN_H
26 #define __SCSISCAN_H
27 #pragma GCC system_header
28 #include <_mingw.h>
29
30 /*
31  * SCSI scanner driver interface
32  */
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #include "ntddk.h"
39
40 #define IOCTL_SCSISCAN_CMD \
41   CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_CMD_CODE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
42
43 #define IOCTL_SCSISCAN_LOCKDEVICE \
44   CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_LOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
45
46 #define IOCTL_SCSISCAN_SET_TIMEOUT \
47   CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_SET_TIMEOUT,   METHOD_BUFFERED, FILE_ANY_ACCESS)
48
49 #define IOCTL_SCSISCAN_GET_INFO \
50   CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_GET_INFO, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
51
52 #define IOCTL_SCSISCAN_UNLOCKDEVICE \
53   CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_UNLOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
54
55
56 /* SCSISCAN_CMD.SrbFlags constants */
57 #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER  0x00000008
58 #define SRB_FLAGS_DISABLE_AUTOSENSE       0x00000020
59 #define SRB_FLAGS_DATA_IN                 0x00000040
60 #define SRB_FLAGS_DATA_OUT                0x00000080
61 #define SRB_FLAGS_NO_DATA_TRANSFER        0x00000000
62
63 /* SCSISCAN_CMD.pSrbStatus constants */
64 #define SRB_STATUS_PENDING                  0x00
65 #define SRB_STATUS_SUCCESS                  0x01
66 #define SRB_STATUS_ABORTED                  0x02
67 #define SRB_STATUS_ABORT_FAILED             0x03
68 #define SRB_STATUS_ERROR                    0x04
69 #define SRB_STATUS_BUSY                     0x05
70 #define SRB_STATUS_INVALID_REQUEST          0x06
71 #define SRB_STATUS_INVALID_PATH_ID          0x07
72 #define SRB_STATUS_NO_DEVICE                0x08
73 #define SRB_STATUS_TIMEOUT                  0x09
74 #define SRB_STATUS_SELECTION_TIMEOUT        0x0A
75 #define SRB_STATUS_COMMAND_TIMEOUT          0x0B
76 #define SRB_STATUS_MESSAGE_REJECTED         0x0D
77 #define SRB_STATUS_BUS_RESET                0x0E
78 #define SRB_STATUS_PARITY_ERROR             0x0F
79 #define SRB_STATUS_REQUEST_SENSE_FAILED     0x10
80 #define SRB_STATUS_NO_HBA                   0x11
81 #define SRB_STATUS_DATA_OVERRUN             0x12
82 #define SRB_STATUS_UNEXPECTED_BUS_FREE      0x13
83 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE   0x14
84 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH     0x15
85 #define SRB_STATUS_REQUEST_FLUSHED          0x16
86 #define SRB_STATUS_INVALID_LUN              0x20
87 #define SRB_STATUS_INVALID_TARGET_ID        0x21
88 #define SRB_STATUS_BAD_FUNCTION             0x22
89 #define SRB_STATUS_ERROR_RECOVERY           0x23
90 #define SRB_STATUS_QUEUE_FROZEN             0x40
91 #define SRB_STATUS_AUTOSENSE_VALID          0x80
92
93 #define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
94
95 typedef struct _SCSISCAN_CMD {
96   ULONG  Reserved1;
97   ULONG  Size;
98   ULONG  SrbFlags;
99   UCHAR  CdbLength;
100   UCHAR  SenseLength;
101   UCHAR  Reserved2;
102   UCHAR  Reserved3;
103   ULONG  TransferLength;
104   UCHAR  Cdb[16];
105   PUCHAR  pSrbStatus;
106   PUCHAR  pSenseBuffer;
107 } SCSISCAN_CMD, *PSCSISCAN_CMD;
108
109 #define MAX_STRING 128
110
111 /* SCSISCAN_INFO.Flags constants */
112 #define SCSISCAN_RESERVED         0x000
113 #define SCSISCAN_CMD_CODE         0x004
114 #define SCSISCAN_LOCKDEVICE       0x005
115 #define SCSISCAN_UNLOCKDEVICE     0x006
116 #define SCSISCAN_SET_TIMEOUT      0x007
117 #define SCSISCAN_GET_INFO         0x008
118
119 typedef struct _SCSISCAN_INFO {
120   ULONG  Size;
121   ULONG  Flags;
122   UCHAR  PortNumber;
123   UCHAR  PathId;
124   UCHAR  TargetId;
125   UCHAR  Lun;
126   UCHAR  AdapterName[MAX_STRING];
127   ULONG  Reserved;
128 } SCSISCAN_INFO, *PSCSISCAN_INFO;
129
130 #ifdef __cplusplus
131 }
132 #endif
133
134 #endif /* __SCSISCAN_H */