Blame view

drivers/scsi/gdth_ioctl.h 14.5 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  #ifndef _GDTH_IOCTL_H
  #define _GDTH_IOCTL_H
  
  /* gdth_ioctl.h
   * $Id: gdth_ioctl.h,v 1.14 2004/02/19 15:43:15 achim Exp $
   */
  
  /* IOCTLs */
  #define GDTIOCTL_MASK       ('J'<<8)
  #define GDTIOCTL_GENERAL    (GDTIOCTL_MASK | 0) /* general IOCTL */
  #define GDTIOCTL_DRVERS     (GDTIOCTL_MASK | 1) /* get driver version */
  #define GDTIOCTL_CTRTYPE    (GDTIOCTL_MASK | 2) /* get controller type */
  #define GDTIOCTL_OSVERS     (GDTIOCTL_MASK | 3) /* get OS version */
  #define GDTIOCTL_HDRLIST    (GDTIOCTL_MASK | 4) /* get host drive list */
  #define GDTIOCTL_CTRCNT     (GDTIOCTL_MASK | 5) /* get controller count */
  #define GDTIOCTL_LOCKDRV    (GDTIOCTL_MASK | 6) /* lock host drive */
  #define GDTIOCTL_LOCKCHN    (GDTIOCTL_MASK | 7) /* lock channel */
  #define GDTIOCTL_EVENT      (GDTIOCTL_MASK | 8) /* read controller events */
  #define GDTIOCTL_SCSI       (GDTIOCTL_MASK | 9) /* SCSI command */
  #define GDTIOCTL_RESET_BUS  (GDTIOCTL_MASK |10) /* reset SCSI bus */
  #define GDTIOCTL_RESCAN     (GDTIOCTL_MASK |11) /* rescan host drives */
  #define GDTIOCTL_RESET_DRV  (GDTIOCTL_MASK |12) /* reset (remote) drv. res. */
  
  #define GDTIOCTL_MAGIC  0xaffe0004
  #define EVENT_SIZE      294 
  #define GDTH_MAXSG      32                      /* max. s/g elements */
  
  #define MAX_LDRIVES     255                     /* max. log. drive count */
  #ifdef GDTH_IOCTL_PROC
  #define MAX_HDRIVES     100                     /* max. host drive count */
  #else
  #define MAX_HDRIVES     MAX_LDRIVES             /* max. host drive count */
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34
35
  /* scatter/gather element */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
36
37
38
      u32     sg_ptr;                         /* address */
      u32     sg_len;                         /* length */
  } __attribute__((packed)) gdth_sg_str;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
40
41
  
  /* scatter/gather element - 64bit addresses */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
42
43
44
      u64     sg_ptr;                         /* address */
      u32     sg_len;                         /* length */
  } __attribute__((packed)) gdth_sg64_str;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
46
47
  
  /* command structure */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
48
49
50
      u32     BoardNode;                      /* board node (always 0) */
      u32     CommandIndex;                   /* command number */
      u16      OpCode;                         /* the command (READ,..) */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51
52
      union {
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
53
54
55
56
57
              u16      DeviceNo;               /* number of cache drive */
              u32     BlockNo;                /* block number */
              u32     BlockCnt;               /* block count */
              u32     DestAddr;               /* dest. addr. (if s/g: -1) */
              u32     sg_canz;                /* s/g element count */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
              gdth_sg_str sg_lst[GDTH_MAXSG];     /* s/g list */
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
59
          } __attribute__((packed)) cache;                         /* cache service cmd. str. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
61
62
63
64
65
              u16      DeviceNo;               /* number of cache drive */
              u64     BlockNo;                /* block number */
              u32     BlockCnt;               /* block count */
              u64     DestAddr;               /* dest. addr. (if s/g: -1) */
              u32     sg_canz;                /* s/g element count */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
              gdth_sg64_str sg_lst[GDTH_MAXSG];   /* s/g list */
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
67
          } __attribute__((packed)) cache64;                       /* cache service cmd. str. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
68
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
69
70
71
72
73
              u16      param_size;             /* size of p_param buffer */
              u32     subfunc;                /* IOCTL function */
              u32     channel;                /* device */
              u64     p_param;                /* buffer */
          } __attribute__((packed)) ioctl;                         /* IOCTL command structure */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
75
              u16      reserved;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
76
77
              union {
                  struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
78
79
80
81
                      u32  msg_handle;        /* message handle */
                      u64  msg_addr;          /* message buffer address */
                  } __attribute__((packed)) msg;
                  u8       data[12];          /* buffer for rtc data, ... */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82
              } su;
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
83
          } __attribute__((packed)) screen;                        /* screen service cmd. str. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
84
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
              u16      reserved;
              u32     direction;              /* data direction */
              u32     mdisc_time;             /* disc. time (0: no timeout)*/
              u32     mcon_time;              /* connect time(0: no to.) */
              u32     sdata;                  /* dest. addr. (if s/g: -1) */
              u32     sdlen;                  /* data length (bytes) */
              u32     clen;                   /* SCSI cmd. length(6,10,12) */
              u8      cmd[12];                /* SCSI command */
              u8      target;                 /* target ID */
              u8      lun;                    /* LUN */
              u8      bus;                    /* SCSI bus number */
              u8      priority;               /* only 0 used */
              u32     sense_len;              /* sense data length */
              u32     sense_data;             /* sense data addr. */
              u32     link_p;                 /* linked cmds (not supp.) */
              u32     sg_ranz;                /* s/g element count */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
101
              gdth_sg_str sg_lst[GDTH_MAXSG];     /* s/g list */
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
102
          } __attribute__((packed)) raw;                           /* raw service cmd. struct. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
103
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
              u16      reserved;
              u32     direction;              /* data direction */
              u32     mdisc_time;             /* disc. time (0: no timeout)*/
              u32     mcon_time;              /* connect time(0: no to.) */
              u64     sdata;                  /* dest. addr. (if s/g: -1) */
              u32     sdlen;                  /* data length (bytes) */
              u32     clen;                   /* SCSI cmd. length(6,..,16) */
              u8      cmd[16];                /* SCSI command */
              u8      target;                 /* target ID */
              u8      lun;                    /* LUN */
              u8      bus;                    /* SCSI bus number */
              u8      priority;               /* only 0 used */
              u32     sense_len;              /* sense data length */
              u64     sense_data;             /* sense data addr. */
              u32     sg_ranz;                /* s/g element count */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119
              gdth_sg64_str sg_lst[GDTH_MAXSG];   /* s/g list */
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
120
          } __attribute__((packed)) raw64;                         /* raw service cmd. struct. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
121
122
      } u;
      /* additional variables */
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
123
124
125
126
      u8      Service;                        /* controller service */
      u8      reserved;
      u16      Status;                         /* command result */
      u32     Info;                           /* additional information */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127
      void        *RequestBuffer;                 /* request buffer */
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
128
  } __attribute__((packed)) gdth_cmd_str;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
129
130
131
132
133
134
135
  
  /* controller event structure */
  #define ES_ASYNC    1
  #define ES_DRIVER   2
  #define ES_TEST     3
  #define ES_SYNC     4
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
136
      u16                  size;               /* size of structure */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
137
138
139
      union {
          char                stream[16];
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
140
141
142
143
              u16          ionode;
              u16          service;
              u32         index;
          } __attribute__((packed)) driver;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
144
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
145
146
147
148
149
150
              u16          ionode;
              u16          service;
              u16          status;
              u32         info;
              u8          scsi_coord[3];
          } __attribute__((packed)) async;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
151
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
152
153
154
155
156
157
158
159
              u16          ionode;
              u16          service;
              u16          status;
              u32         info;
              u16          hostdrive;
              u8          scsi_coord[3];
              u8          sense_key;
          } __attribute__((packed)) sync;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
160
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
161
162
              u32         l1, l2, l3, l4;
          } __attribute__((packed)) test;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
163
      } eu;
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
164
165
166
      u32                 severity;
      u8                  event_string[256];          
  } __attribute__((packed)) gdth_evt_data;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
167
168
  
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
169
170
171
172
173
174
175
      u32         first_stamp;
      u32         last_stamp;
      u16          same_count;
      u16          event_source;
      u16          event_idx;
      u8          application;
      u8          reserved;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
176
      gdth_evt_data   event_data;
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
177
  } __attribute__((packed)) gdth_evt_str;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
178
179
180
181
182
  
  
  #ifdef GDTH_IOCTL_PROC
  /* IOCTL structure (write) */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
183
184
185
186
187
      u32                 magic;              /* IOCTL magic */
      u16                  ioctl;              /* IOCTL */
      u16                  ionode;             /* controller number */
      u16                  service;            /* controller service */
      u16                  timeout;            /* timeout */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
188
189
      union {
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
190
191
              u8          command[512];       /* controller command */
              u8          data[1];            /* add. data */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
192
193
          } general;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
194
195
196
              u8          lock;               /* lock/unlock */
              u8          drive_cnt;          /* drive count */
              u16          drives[MAX_HDRIVES];/* drives */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
197
198
          } lockdrv;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
199
200
              u8          lock;               /* lock/unlock */
              u8          channel;            /* channel */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
201
202
203
204
          } lockchn;
          struct {
              int             erase;              /* erase event ? */
              int             handle;
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
205
              u8          evt[EVENT_SIZE];    /* event structure */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
206
207
          } event;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
208
209
210
211
212
              u8          bus;                /* SCSI bus */
              u8          target;             /* target ID */
              u8          lun;                /* LUN */
              u8          cmd_len;            /* command length */
              u8          cmd[12];            /* SCSI command */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
213
214
          } scsi;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
215
216
              u16          hdr_no;             /* host drive number */
              u8          flag;               /* old meth./add/remove */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
217
218
219
220
221
222
          } rescan;
      } iu;
  } gdth_iowr_str;
  
  /* IOCTL structure (read) */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
223
224
      u32                 size;               /* buffer size */
      u32                 status;             /* IOCTL error code */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
225
226
      union {
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
227
              u8          data[1];            /* data */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
228
229
          } general;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
230
              u16          version;            /* driver version */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
231
232
          } drvers;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
233
234
235
236
237
238
239
240
              u8          type;               /* controller type */
              u16          info;               /* slot etc. */
              u16          oem_id;             /* OEM ID */
              u16          bios_ver;           /* not used */
              u16          access;             /* not used */
              u16          ext_type;           /* extended type */
              u16          device_id;          /* device ID */
              u16          sub_device_id;      /* sub device ID */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
241
242
          } ctrtype;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
243
244
245
              u8          version;            /* OS version */
              u8          subversion;         /* OS subversion */
              u16          revision;           /* revision */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
246
247
          } osvers;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
248
              u16          count;              /* controller count */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
249
250
251
          } ctrcnt;
          struct {
              int             handle;
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
252
              u8          evt[EVENT_SIZE];    /* event structure */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
253
254
          } event;
          struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
255
256
257
258
              u8          bus;                /* SCSI bus, 0xff: invalid */
              u8          target;             /* target ID */
              u8          lun;                /* LUN */
              u8          cluster_type;       /* cluster properties */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
259
260
261
262
263
264
265
          } hdr_list[MAX_HDRIVES];                /* index is host drive number */
      } iu;
  } gdth_iord_str;
  #endif
  
  /* GDTIOCTL_GENERAL */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
266
267
268
269
270
271
      u16 ionode;                              /* controller number */
      u16 timeout;                             /* timeout */
      u32 info;                               /* error info */ 
      u16 status;                              /* status */
      unsigned long data_len;                             /* data buffer size */
      unsigned long sense_len;                            /* sense buffer size */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
272
273
274
275
276
      gdth_cmd_str command;                       /* command */                   
  } gdth_ioctl_general;
  
  /* GDTIOCTL_LOCKDRV */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
277
278
279
280
      u16 ionode;                              /* controller number */
      u8 lock;                                /* lock/unlock */
      u8 drive_cnt;                           /* drive count */
      u16 drives[MAX_HDRIVES];                 /* drives */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
281
282
283
284
  } gdth_ioctl_lockdrv;
  
  /* GDTIOCTL_LOCKCHN */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
285
286
287
      u16 ionode;                              /* controller number */
      u8 lock;                                /* lock/unlock */
      u8 channel;                             /* channel */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
288
289
290
291
  } gdth_ioctl_lockchn;
  
  /* GDTIOCTL_OSVERS */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
292
293
294
      u8 version;                             /* OS version */
      u8 subversion;                          /* OS subversion */
      u16 revision;                            /* revision */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
295
296
297
298
  } gdth_ioctl_osvers;
  
  /* GDTIOCTL_CTRTYPE */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
299
300
301
302
303
304
305
306
307
      u16 ionode;                              /* controller number */
      u8 type;                                /* controller type */
      u16 info;                                /* slot etc. */
      u16 oem_id;                              /* OEM ID */
      u16 bios_ver;                            /* not used */
      u16 access;                              /* not used */
      u16 ext_type;                            /* extended type */
      u16 device_id;                           /* device ID */
      u16 sub_device_id;                       /* sub device ID */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
308
309
310
311
  } gdth_ioctl_ctrtype;
  
  /* GDTIOCTL_EVENT */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
312
      u16 ionode;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
313
314
315
316
317
318
319
      int erase;                                  /* erase event? */
      int handle;                                 /* event handle */
      gdth_evt_str event;
  } gdth_ioctl_event;
  
  /* GDTIOCTL_RESCAN/GDTIOCTL_HDRLIST */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
320
321
322
      u16 ionode;                              /* controller number */
      u8 flag;                                /* add/remove */
      u16 hdr_no;                              /* drive no. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
323
      struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
324
325
326
327
          u8 bus;                             /* SCSI bus */
          u8 target;                          /* target ID */
          u8 lun;                             /* LUN */
          u8 cluster_type;                    /* cluster properties */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
328
329
330
331
332
      } hdr_list[MAX_HDRIVES];                    /* index is host drive number */
  } gdth_ioctl_rescan;
  
  /* GDTIOCTL_RESET_BUS/GDTIOCTL_RESET_DRV */
  typedef struct {
1fe6dbf4d   Dave Jones   [SCSI] gdth: Conv...
333
334
335
      u16 ionode;                              /* controller number */
      u16 number;                              /* bus/host drive number */
      u16 status;                              /* status */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
336
337
338
  } gdth_ioctl_reset;
  
  #endif