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