Ticket #328: aacraid.h

File aacraid.h, 5.2 KB (added by adityaseven, 10 years ago)
Line 
1/* aacraid.h
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2, or (at your option)
6 * any later version.
7 *
8 * You should have received a copy of the GNU General Public License
9 * (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
10 *
11 * This code was originally developed as a Senior Thesis by Michael Cornwell
12 * at the Concurrent Systems Laboratory (now part of the Storage Systems
13 * Research Center), Jack Baskin School of Engineering, University of
14 * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
15 *
16 */
17
18// Check windows
19#if _WIN32 || _WIN64
20#if _WIN64
21 #define ENVIRONMENT64
22#else
23 #define ENVIRONMENT32
24#endif
25#endif
26
27// Check GCC
28#if __GNUC__
29#if __x86_64__ || __ppc64__
30 #define ENVIRONMENT64
31#else
32 #define ENVIRONMENT32
33#endif
34#endif
35
36
37
38
39#define SRB_FUNCTION_EXECUTE_SCSI 0X00
40
41#define METHOD_BUFFERED 0
42#define METHOD_NEITHER 3
43
44#define CTL_CODE(function, method) ( (4<< 16) | ((function) << 2) | (method) )
45
46#define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED)
47
48#define SRB_DataIn 0x0040
49#define SRB_DataOut 0x0080
50#define SRB_NoDataXfer 0x0000
51
52
53typedef struct{
54 uint32_t lo32;
55 uint32_t hi32;
56 }address64;
57
58 typedef struct{
59 address64 addr64;
60 uint32_t length; /* Length. */
61 }user_sgentry64;
62
63typedef struct{
64 uint32_t aadr32;
65 uint32_t length;
66 }user_sgentry32;
67
68typedef struct {
69 uint32_t count;
70 user_sgentry64 sg64[1];
71 }user_sgmap64;
72
73typedef struct {
74 uint32_t count;
75 user_sgentry32 sg32[1];
76 }user_sgmap32;
77
78
79typedef struct
80 {
81 uint32_t function; //SRB_FUNCTION_EXECUTE_SCSI 0x00
82 uint32_t channel; //bus
83 uint32_t id; //use the ID number this is wrong
84 uint32_t lun; //Logical unit number
85 uint32_t timeout;
86 uint32_t flags; //Interesting stuff I must say
87 uint32_t count; // Data xfer size
88 uint32_t retry_limit; // We shall see
89 uint32_t cdb_size; // Length of CDB
90 uint8_t cdb[16]; // The actual cdb command
91 user_sgmap64 sg64; // pDatabuffer and address of Databuffer
92 }user_aac_srb64;
93
94
95typedef struct
96 {
97 uint32_t function; //SRB_FUNCTION_EXECUTE_SCSI 0x00
98 uint32_t channel; //bus
99 uint32_t id; //use the ID number this is wrong
100 uint32_t lun; //Logical unit number
101 uint32_t timeout;
102 uint32_t flags; //Interesting stuff I must say
103 uint32_t count; // Data xfer size
104 uint32_t retry_limit; // We shall see
105 uint32_t cdb_size; // Length of CDB
106 uint8_t cdb[16]; // The actual cdb command
107 user_sgmap32 sg32; // pDatabuffer and address of Databuffer
108 }user_aac_srb32;
109
110
111
112 typedef struct
113 {
114 uint8_t error_code; /*70h (current errors),71h(deferred errors)*/
115 uint8_t valid:1; /*A valid bit of one indicates that information
116 field contains valid information as defined in
117 the SCSI 2 Standard*/
118 uint8_t segment_number; /*Only used for COPY, COMPARE ,or COPY AND VERIFY commands*/
119 uint8_t sense_key:4; /*Sense Key*/
120 uint8_t reserved:1;
121 uint8_t ILI:1; /*Incorrect Length Indicator*/
122 uint8_t EOM:1; /*End of Medium - reserved for random acess devices*/
123 uint8_t filemark:1; /*Filemark - reserved for random acces devices*/
124 uint8_t information[4]; /*for direct-access devices,contains the unsigned logical
125 block address or residure associated with the sense key*/
126 uint8_t add_sense_len; /*number of additional sense bytes to follow this field*/
127 uint8_t cmnd_info[4]; /*not used*/
128 uint8_t ASC; /*Additional Sense Code*/
129 uint8_t ASCQ; /*Additional Sense Code Qualifier*/
130 uint8_t FRUC; /*Field Replacement Unit Code - not used*/
131 uint8_t bit_ptr:3; /*Indicates which byte of the CDB or parameter data was in error*/
132
133
134 uint8_t BPV:1; /* bit pointer valid(BPV):1- indicates that the bit_ptr field has valid value*/
135
136 uint8_t reserved2:2;
137 uint8_t CD:1; /*Command data bit:1 - illegal parameter in CDB
138 0-illegal parameter in data*/
139 uint8_t SKSV:1;
140 uint8_t field_ptr[2]; /*byte of CDB or parameter data in error*/
141 }sense_data;
142
143 typedef struct
144 {
145 uint32_t status;
146 uint32_t srb_status;
147 uint32_t scsi_status;
148 uint32_t data_xfer_length;
149 uint32_t sense_data_size;
150 uint8_t sense_data[30];
151 }user_aac_reply;
152
153
154