Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #ifndef _GDTH_IOCTL_H |
| 3 | #define _GDTH_IOCTL_H |
| 4 | |
| 5 | /* gdth_ioctl.h |
| 6 | * $Id: gdth_ioctl.h,v 1.14 2004/02/19 15:43:15 achim Exp $ |
| 7 | */ |
| 8 | |
| 9 | /* IOCTLs */ |
| 10 | #define GDTIOCTL_MASK ('J'<<8) |
| 11 | #define GDTIOCTL_GENERAL (GDTIOCTL_MASK | 0) /* general IOCTL */ |
| 12 | #define GDTIOCTL_DRVERS (GDTIOCTL_MASK | 1) /* get driver version */ |
| 13 | #define GDTIOCTL_CTRTYPE (GDTIOCTL_MASK | 2) /* get controller type */ |
| 14 | #define GDTIOCTL_OSVERS (GDTIOCTL_MASK | 3) /* get OS version */ |
| 15 | #define GDTIOCTL_HDRLIST (GDTIOCTL_MASK | 4) /* get host drive list */ |
| 16 | #define GDTIOCTL_CTRCNT (GDTIOCTL_MASK | 5) /* get controller count */ |
| 17 | #define GDTIOCTL_LOCKDRV (GDTIOCTL_MASK | 6) /* lock host drive */ |
| 18 | #define GDTIOCTL_LOCKCHN (GDTIOCTL_MASK | 7) /* lock channel */ |
| 19 | #define GDTIOCTL_EVENT (GDTIOCTL_MASK | 8) /* read controller events */ |
| 20 | #define GDTIOCTL_SCSI (GDTIOCTL_MASK | 9) /* SCSI command */ |
| 21 | #define GDTIOCTL_RESET_BUS (GDTIOCTL_MASK |10) /* reset SCSI bus */ |
| 22 | #define GDTIOCTL_RESCAN (GDTIOCTL_MASK |11) /* rescan host drives */ |
| 23 | #define GDTIOCTL_RESET_DRV (GDTIOCTL_MASK |12) /* reset (remote) drv. res. */ |
| 24 | |
| 25 | #define GDTIOCTL_MAGIC 0xaffe0004 |
| 26 | #define EVENT_SIZE 294 |
| 27 | #define GDTH_MAXSG 32 /* max. s/g elements */ |
| 28 | |
| 29 | #define MAX_LDRIVES 255 /* max. log. drive count */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #define MAX_HDRIVES MAX_LDRIVES /* max. host drive count */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | /* scatter/gather element */ |
| 33 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 34 | u32 sg_ptr; /* address */ |
| 35 | u32 sg_len; /* length */ |
| 36 | } __attribute__((packed)) gdth_sg_str; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
| 38 | /* scatter/gather element - 64bit addresses */ |
| 39 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 40 | u64 sg_ptr; /* address */ |
| 41 | u32 sg_len; /* length */ |
| 42 | } __attribute__((packed)) gdth_sg64_str; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
| 44 | /* command structure */ |
| 45 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 46 | u32 BoardNode; /* board node (always 0) */ |
| 47 | u32 CommandIndex; /* command number */ |
| 48 | u16 OpCode; /* the command (READ,..) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | union { |
| 50 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 51 | u16 DeviceNo; /* number of cache drive */ |
| 52 | u32 BlockNo; /* block number */ |
| 53 | u32 BlockCnt; /* block count */ |
| 54 | u32 DestAddr; /* dest. addr. (if s/g: -1) */ |
| 55 | u32 sg_canz; /* s/g element count */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | gdth_sg_str sg_lst[GDTH_MAXSG]; /* s/g list */ |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 57 | } __attribute__((packed)) cache; /* cache service cmd. str. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 59 | u16 DeviceNo; /* number of cache drive */ |
| 60 | u64 BlockNo; /* block number */ |
| 61 | u32 BlockCnt; /* block count */ |
| 62 | u64 DestAddr; /* dest. addr. (if s/g: -1) */ |
| 63 | u32 sg_canz; /* s/g element count */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | gdth_sg64_str sg_lst[GDTH_MAXSG]; /* s/g list */ |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 65 | } __attribute__((packed)) cache64; /* cache service cmd. str. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 67 | u16 param_size; /* size of p_param buffer */ |
| 68 | u32 subfunc; /* IOCTL function */ |
| 69 | u32 channel; /* device */ |
| 70 | u64 p_param; /* buffer */ |
| 71 | } __attribute__((packed)) ioctl; /* IOCTL command structure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 73 | u16 reserved; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | union { |
| 75 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 76 | u32 msg_handle; /* message handle */ |
| 77 | u64 msg_addr; /* message buffer address */ |
| 78 | } __attribute__((packed)) msg; |
| 79 | u8 data[12]; /* buffer for rtc data, ... */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | } su; |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 81 | } __attribute__((packed)) screen; /* screen service cmd. str. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 83 | u16 reserved; |
| 84 | u32 direction; /* data direction */ |
| 85 | u32 mdisc_time; /* disc. time (0: no timeout)*/ |
| 86 | u32 mcon_time; /* connect time(0: no to.) */ |
| 87 | u32 sdata; /* dest. addr. (if s/g: -1) */ |
| 88 | u32 sdlen; /* data length (bytes) */ |
| 89 | u32 clen; /* SCSI cmd. length(6,10,12) */ |
| 90 | u8 cmd[12]; /* SCSI command */ |
| 91 | u8 target; /* target ID */ |
| 92 | u8 lun; /* LUN */ |
| 93 | u8 bus; /* SCSI bus number */ |
| 94 | u8 priority; /* only 0 used */ |
| 95 | u32 sense_len; /* sense data length */ |
| 96 | u32 sense_data; /* sense data addr. */ |
| 97 | u32 link_p; /* linked cmds (not supp.) */ |
| 98 | u32 sg_ranz; /* s/g element count */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | gdth_sg_str sg_lst[GDTH_MAXSG]; /* s/g list */ |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 100 | } __attribute__((packed)) raw; /* raw service cmd. struct. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 102 | u16 reserved; |
| 103 | u32 direction; /* data direction */ |
| 104 | u32 mdisc_time; /* disc. time (0: no timeout)*/ |
| 105 | u32 mcon_time; /* connect time(0: no to.) */ |
| 106 | u64 sdata; /* dest. addr. (if s/g: -1) */ |
| 107 | u32 sdlen; /* data length (bytes) */ |
| 108 | u32 clen; /* SCSI cmd. length(6,..,16) */ |
| 109 | u8 cmd[16]; /* SCSI command */ |
| 110 | u8 target; /* target ID */ |
| 111 | u8 lun; /* LUN */ |
| 112 | u8 bus; /* SCSI bus number */ |
| 113 | u8 priority; /* only 0 used */ |
| 114 | u32 sense_len; /* sense data length */ |
| 115 | u64 sense_data; /* sense data addr. */ |
| 116 | u32 sg_ranz; /* s/g element count */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | gdth_sg64_str sg_lst[GDTH_MAXSG]; /* s/g list */ |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 118 | } __attribute__((packed)) raw64; /* raw service cmd. struct. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | } u; |
| 120 | /* additional variables */ |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 121 | u8 Service; /* controller service */ |
| 122 | u8 reserved; |
| 123 | u16 Status; /* command result */ |
| 124 | u32 Info; /* additional information */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | void *RequestBuffer; /* request buffer */ |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 126 | } __attribute__((packed)) gdth_cmd_str; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
| 128 | /* controller event structure */ |
| 129 | #define ES_ASYNC 1 |
| 130 | #define ES_DRIVER 2 |
| 131 | #define ES_TEST 3 |
| 132 | #define ES_SYNC 4 |
| 133 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 134 | u16 size; /* size of structure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | union { |
| 136 | char stream[16]; |
| 137 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 138 | u16 ionode; |
| 139 | u16 service; |
| 140 | u32 index; |
| 141 | } __attribute__((packed)) driver; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 143 | u16 ionode; |
| 144 | u16 service; |
| 145 | u16 status; |
| 146 | u32 info; |
| 147 | u8 scsi_coord[3]; |
| 148 | } __attribute__((packed)) async; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 150 | u16 ionode; |
| 151 | u16 service; |
| 152 | u16 status; |
| 153 | u32 info; |
| 154 | u16 hostdrive; |
| 155 | u8 scsi_coord[3]; |
| 156 | u8 sense_key; |
| 157 | } __attribute__((packed)) sync; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 159 | u32 l1, l2, l3, l4; |
| 160 | } __attribute__((packed)) test; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | } eu; |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 162 | u32 severity; |
| 163 | u8 event_string[256]; |
| 164 | } __attribute__((packed)) gdth_evt_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | |
| 166 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 167 | u32 first_stamp; |
| 168 | u32 last_stamp; |
| 169 | u16 same_count; |
| 170 | u16 event_source; |
| 171 | u16 event_idx; |
| 172 | u8 application; |
| 173 | u8 reserved; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | gdth_evt_data event_data; |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 175 | } __attribute__((packed)) gdth_evt_str; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | /* GDTIOCTL_GENERAL */ |
| 178 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 179 | u16 ionode; /* controller number */ |
| 180 | u16 timeout; /* timeout */ |
| 181 | u32 info; /* error info */ |
| 182 | u16 status; /* status */ |
| 183 | unsigned long data_len; /* data buffer size */ |
| 184 | unsigned long sense_len; /* sense buffer size */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | gdth_cmd_str command; /* command */ |
| 186 | } gdth_ioctl_general; |
| 187 | |
| 188 | /* GDTIOCTL_LOCKDRV */ |
| 189 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 190 | u16 ionode; /* controller number */ |
| 191 | u8 lock; /* lock/unlock */ |
| 192 | u8 drive_cnt; /* drive count */ |
| 193 | u16 drives[MAX_HDRIVES]; /* drives */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | } gdth_ioctl_lockdrv; |
| 195 | |
| 196 | /* GDTIOCTL_LOCKCHN */ |
| 197 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 198 | u16 ionode; /* controller number */ |
| 199 | u8 lock; /* lock/unlock */ |
| 200 | u8 channel; /* channel */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | } gdth_ioctl_lockchn; |
| 202 | |
| 203 | /* GDTIOCTL_OSVERS */ |
| 204 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 205 | u8 version; /* OS version */ |
| 206 | u8 subversion; /* OS subversion */ |
| 207 | u16 revision; /* revision */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | } gdth_ioctl_osvers; |
| 209 | |
| 210 | /* GDTIOCTL_CTRTYPE */ |
| 211 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 212 | u16 ionode; /* controller number */ |
| 213 | u8 type; /* controller type */ |
| 214 | u16 info; /* slot etc. */ |
| 215 | u16 oem_id; /* OEM ID */ |
| 216 | u16 bios_ver; /* not used */ |
| 217 | u16 access; /* not used */ |
| 218 | u16 ext_type; /* extended type */ |
| 219 | u16 device_id; /* device ID */ |
| 220 | u16 sub_device_id; /* sub device ID */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | } gdth_ioctl_ctrtype; |
| 222 | |
| 223 | /* GDTIOCTL_EVENT */ |
| 224 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 225 | u16 ionode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | int erase; /* erase event? */ |
| 227 | int handle; /* event handle */ |
| 228 | gdth_evt_str event; |
| 229 | } gdth_ioctl_event; |
| 230 | |
| 231 | /* GDTIOCTL_RESCAN/GDTIOCTL_HDRLIST */ |
| 232 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 233 | u16 ionode; /* controller number */ |
| 234 | u8 flag; /* add/remove */ |
| 235 | u16 hdr_no; /* drive no. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 237 | u8 bus; /* SCSI bus */ |
| 238 | u8 target; /* target ID */ |
| 239 | u8 lun; /* LUN */ |
| 240 | u8 cluster_type; /* cluster properties */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | } hdr_list[MAX_HDRIVES]; /* index is host drive number */ |
| 242 | } gdth_ioctl_rescan; |
| 243 | |
| 244 | /* GDTIOCTL_RESET_BUS/GDTIOCTL_RESET_DRV */ |
| 245 | typedef struct { |
Dave Jones | 1fe6dbf | 2010-01-04 10:19:34 -0500 | [diff] [blame] | 246 | u16 ionode; /* controller number */ |
| 247 | u16 number; /* bus/host drive number */ |
| 248 | u16 status; /* status */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | } gdth_ioctl_reset; |
| 250 | |
| 251 | #endif |