atvda.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319
  1. /* linux/drivers/scsi/esas2r/atvda.h
  2. * ATTO VDA interface definitions
  3. *
  4. * Copyright (c) 2001-2013 ATTO Technology, Inc.
  5. * (mailto:linuxdrivers@attotech.com)
  6. */
  7. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  8. /*
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; version 2 of the License.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * NO WARRANTY
  19. * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
  20. * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
  21. * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
  22. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
  23. * solely responsible for determining the appropriateness of using and
  24. * distributing the Program and assumes all risks associated with its
  25. * exercise of rights under this Agreement, including but not limited to
  26. * the risks and costs of program errors, damage to or loss of data,
  27. * programs or equipment, and unavailability or interruption of operations.
  28. *
  29. * DISCLAIMER OF LIABILITY
  30. * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
  31. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  32. * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
  33. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  34. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  35. * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
  36. * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
  37. *
  38. * You should have received a copy of the GNU General Public License
  39. * along with this program; if not, write to the Free Software
  40. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  41. */
  42. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  43. #ifndef ATVDA_H
  44. #define ATVDA_H
  45. struct __packed atto_dev_addr {
  46. u64 dev_port;
  47. u64 hba_port;
  48. u8 lun;
  49. u8 flags;
  50. #define VDA_DEVADDRF_SATA 0x01
  51. #define VDA_DEVADDRF_SSD 0x02
  52. u8 link_speed; /* VDALINKSPEED_xxx */
  53. u8 pad[1];
  54. };
  55. /* dev_addr2 was added for 64-bit alignment */
  56. struct __packed atto_dev_addr2 {
  57. u64 dev_port;
  58. u64 hba_port;
  59. u8 lun;
  60. u8 flags;
  61. u8 link_speed;
  62. u8 pad[5];
  63. };
  64. struct __packed atto_vda_sge {
  65. u32 length;
  66. u64 address;
  67. };
  68. /* VDA request function codes */
  69. #define VDA_FUNC_SCSI 0x00
  70. #define VDA_FUNC_FLASH 0x01
  71. #define VDA_FUNC_DIAG 0x02
  72. #define VDA_FUNC_AE 0x03
  73. #define VDA_FUNC_CLI 0x04
  74. #define VDA_FUNC_IOCTL 0x05
  75. #define VDA_FUNC_CFG 0x06
  76. #define VDA_FUNC_MGT 0x07
  77. #define VDA_FUNC_GSV 0x08
  78. /* VDA request status values. for host driver considerations, values for
  79. * SCSI requests start at zero. other requests may use these values as well. */
  80. #define RS_SUCCESS 0x00 /*! successful completion */
  81. #define RS_INV_FUNC 0x01 /*! invalid command function */
  82. #define RS_BUSY 0x02 /*! insufficient resources */
  83. #define RS_SEL 0x03 /*! no target at target_id */
  84. #define RS_NO_LUN 0x04 /*! invalid LUN */
  85. #define RS_TIMEOUT 0x05 /*! request timeout */
  86. #define RS_OVERRUN 0x06 /*! data overrun */
  87. #define RS_UNDERRUN 0x07 /*! data underrun */
  88. #define RS_SCSI_ERROR 0x08 /*! SCSI error occurred */
  89. #define RS_ABORTED 0x0A /*! command aborted */
  90. #define RS_RESID_MISM 0x0B /*! residual length incorrect */
  91. #define RS_TM_FAILED 0x0C /*! task management failed */
  92. #define RS_RESET 0x0D /*! aborted due to bus reset */
  93. #define RS_ERR_DMA_SG 0x0E /*! error reading SG list */
  94. #define RS_ERR_DMA_DATA 0x0F /*! error transferring data */
  95. #define RS_UNSUPPORTED 0x10 /*! unsupported request */
  96. #define RS_SEL2 0x70 /*! internal generated RS_SEL */
  97. #define RS_VDA_BASE 0x80 /*! base of VDA-specific errors */
  98. #define RS_MGT_BASE 0x80 /*! base of VDA management errors */
  99. #define RS_SCAN_FAIL (RS_MGT_BASE + 0x00)
  100. #define RS_DEV_INVALID (RS_MGT_BASE + 0x01)
  101. #define RS_DEV_ASSIGNED (RS_MGT_BASE + 0x02)
  102. #define RS_DEV_REMOVE (RS_MGT_BASE + 0x03)
  103. #define RS_DEV_LOST (RS_MGT_BASE + 0x04)
  104. #define RS_SCAN_GEN (RS_MGT_BASE + 0x05)
  105. #define RS_GRP_INVALID (RS_MGT_BASE + 0x08)
  106. #define RS_GRP_EXISTS (RS_MGT_BASE + 0x09)
  107. #define RS_GRP_LIMIT (RS_MGT_BASE + 0x0A)
  108. #define RS_GRP_INTLV (RS_MGT_BASE + 0x0B)
  109. #define RS_GRP_SPAN (RS_MGT_BASE + 0x0C)
  110. #define RS_GRP_TYPE (RS_MGT_BASE + 0x0D)
  111. #define RS_GRP_MEMBERS (RS_MGT_BASE + 0x0E)
  112. #define RS_GRP_COMMIT (RS_MGT_BASE + 0x0F)
  113. #define RS_GRP_REBUILD (RS_MGT_BASE + 0x10)
  114. #define RS_GRP_REBUILD_TYPE (RS_MGT_BASE + 0x11)
  115. #define RS_GRP_BLOCK_SIZE (RS_MGT_BASE + 0x12)
  116. #define RS_CFG_SAVE (RS_MGT_BASE + 0x14)
  117. #define RS_PART_LAST (RS_MGT_BASE + 0x18)
  118. #define RS_ELEM_INVALID (RS_MGT_BASE + 0x19)
  119. #define RS_PART_MAPPED (RS_MGT_BASE + 0x1A)
  120. #define RS_PART_TARGET (RS_MGT_BASE + 0x1B)
  121. #define RS_PART_LUN (RS_MGT_BASE + 0x1C)
  122. #define RS_PART_DUP (RS_MGT_BASE + 0x1D)
  123. #define RS_PART_NOMAP (RS_MGT_BASE + 0x1E)
  124. #define RS_PART_MAX (RS_MGT_BASE + 0x1F)
  125. #define RS_PART_CAP (RS_MGT_BASE + 0x20)
  126. #define RS_PART_STATE (RS_MGT_BASE + 0x21)
  127. #define RS_TEST_IN_PROG (RS_MGT_BASE + 0x22)
  128. #define RS_METRICS_ERROR (RS_MGT_BASE + 0x23)
  129. #define RS_HS_ERROR (RS_MGT_BASE + 0x24)
  130. #define RS_NO_METRICS_TEST (RS_MGT_BASE + 0x25)
  131. #define RS_BAD_PARAM (RS_MGT_BASE + 0x26)
  132. #define RS_GRP_MEMBER_SIZE (RS_MGT_BASE + 0x27)
  133. #define RS_FLS_BASE 0xB0 /*! base of VDA errors */
  134. #define RS_FLS_ERR_AREA (RS_FLS_BASE + 0x00)
  135. #define RS_FLS_ERR_BUSY (RS_FLS_BASE + 0x01)
  136. #define RS_FLS_ERR_RANGE (RS_FLS_BASE + 0x02)
  137. #define RS_FLS_ERR_BEGIN (RS_FLS_BASE + 0x03)
  138. #define RS_FLS_ERR_CHECK (RS_FLS_BASE + 0x04)
  139. #define RS_FLS_ERR_FAIL (RS_FLS_BASE + 0x05)
  140. #define RS_FLS_ERR_RSRC (RS_FLS_BASE + 0x06)
  141. #define RS_FLS_ERR_NOFILE (RS_FLS_BASE + 0x07)
  142. #define RS_FLS_ERR_FSIZE (RS_FLS_BASE + 0x08)
  143. #define RS_CFG_BASE 0xC0 /*! base of VDA configuration errors */
  144. #define RS_CFG_ERR_BUSY (RS_CFG_BASE + 0)
  145. #define RS_CFG_ERR_SGE (RS_CFG_BASE + 1)
  146. #define RS_CFG_ERR_DATE (RS_CFG_BASE + 2)
  147. #define RS_CFG_ERR_TIME (RS_CFG_BASE + 3)
  148. #define RS_DEGRADED 0xFB /*! degraded mode */
  149. #define RS_CLI_INTERNAL 0xFC /*! VDA CLI internal error */
  150. #define RS_VDA_INTERNAL 0xFD /*! catch-all */
  151. #define RS_PENDING 0xFE /*! pending, not started */
  152. #define RS_STARTED 0xFF /*! started */
  153. /* flash request subfunctions. these are used in both the IOCTL and the
  154. * driver-firmware interface (VDA_FUNC_FLASH). */
  155. #define VDA_FLASH_BEGINW 0x00
  156. #define VDA_FLASH_READ 0x01
  157. #define VDA_FLASH_WRITE 0x02
  158. #define VDA_FLASH_COMMIT 0x03
  159. #define VDA_FLASH_CANCEL 0x04
  160. #define VDA_FLASH_INFO 0x05
  161. #define VDA_FLASH_FREAD 0x06
  162. #define VDA_FLASH_FWRITE 0x07
  163. #define VDA_FLASH_FINFO 0x08
  164. /* IOCTL request subfunctions. these identify the payload type for
  165. * VDA_FUNC_IOCTL.
  166. */
  167. #define VDA_IOCTL_HBA 0x00
  168. #define VDA_IOCTL_CSMI 0x01
  169. #define VDA_IOCTL_SMP 0x02
  170. struct __packed atto_vda_devinfo {
  171. struct atto_dev_addr dev_addr;
  172. u8 vendor_id[8];
  173. u8 product_id[16];
  174. u8 revision[4];
  175. u64 capacity;
  176. u32 block_size;
  177. u8 dev_type;
  178. union {
  179. u8 dev_status;
  180. #define VDADEVSTAT_INVALID 0x00
  181. #define VDADEVSTAT_CORRUPT VDADEVSTAT_INVALID
  182. #define VDADEVSTAT_ASSIGNED 0x01
  183. #define VDADEVSTAT_SPARE 0x02
  184. #define VDADEVSTAT_UNAVAIL 0x03
  185. #define VDADEVSTAT_PT_MAINT 0x04
  186. #define VDADEVSTAT_LCLSPARE 0x05
  187. #define VDADEVSTAT_UNUSEABLE 0x06
  188. #define VDADEVSTAT_AVAIL 0xFF
  189. u8 op_ctrl;
  190. #define VDA_DEV_OP_CTRL_START 0x01
  191. #define VDA_DEV_OP_CTRL_HALT 0x02
  192. #define VDA_DEV_OP_CTRL_RESUME 0x03
  193. #define VDA_DEV_OP_CTRL_CANCEL 0x04
  194. };
  195. u8 member_state;
  196. #define VDAMBRSTATE_ONLINE 0x00
  197. #define VDAMBRSTATE_DEGRADED 0x01
  198. #define VDAMBRSTATE_UNAVAIL 0x02
  199. #define VDAMBRSTATE_FAULTED 0x03
  200. #define VDAMBRSTATE_MISREAD 0x04
  201. #define VDAMBRSTATE_INCOMPAT 0x05
  202. u8 operation;
  203. #define VDAOP_NONE 0x00
  204. #define VDAOP_REBUILD 0x01
  205. #define VDAOP_ERASE 0x02
  206. #define VDAOP_PATTERN 0x03
  207. #define VDAOP_CONVERSION 0x04
  208. #define VDAOP_FULL_INIT 0x05
  209. #define VDAOP_QUICK_INIT 0x06
  210. #define VDAOP_SECT_SCAN 0x07
  211. #define VDAOP_SECT_SCAN_PARITY 0x08
  212. #define VDAOP_SECT_SCAN_PARITY_FIX 0x09
  213. #define VDAOP_RECOV_REBUILD 0x0A
  214. u8 op_status;
  215. #define VDAOPSTAT_OK 0x00
  216. #define VDAOPSTAT_FAULTED 0x01
  217. #define VDAOPSTAT_HALTED 0x02
  218. #define VDAOPSTAT_INT 0x03
  219. u8 progress; /* 0 - 100% */
  220. u16 ses_dev_index;
  221. #define VDASESDI_INVALID 0xFFFF
  222. u8 serial_no[32];
  223. union {
  224. u16 target_id;
  225. #define VDATGTID_INVALID 0xFFFF
  226. u16 features_mask;
  227. };
  228. u16 lun;
  229. u16 features;
  230. #define VDADEVFEAT_ENC_SERV 0x0001
  231. #define VDADEVFEAT_IDENT 0x0002
  232. #define VDADEVFEAT_DH_SUPP 0x0004
  233. #define VDADEVFEAT_PHYS_ID 0x0008
  234. u8 ses_element_id;
  235. u8 link_speed;
  236. #define VDALINKSPEED_UNKNOWN 0x00
  237. #define VDALINKSPEED_1GB 0x01
  238. #define VDALINKSPEED_1_5GB 0x02
  239. #define VDALINKSPEED_2GB 0x03
  240. #define VDALINKSPEED_3GB 0x04
  241. #define VDALINKSPEED_4GB 0x05
  242. #define VDALINKSPEED_6GB 0x06
  243. #define VDALINKSPEED_8GB 0x07
  244. u16 phys_target_id;
  245. u8 reserved[2];
  246. };
  247. /*! struct atto_vda_devinfo2 is a replacement for atto_vda_devinfo. it
  248. * extends beyond the 0x70 bytes allowed in atto_vda_mgmt_req; therefore,
  249. * the entire structure is DMaed between the firmware and host buffer and
  250. * the data will always be in little endian format.
  251. */
  252. struct __packed atto_vda_devinfo2 {
  253. struct atto_dev_addr dev_addr;
  254. u8 vendor_id[8];
  255. u8 product_id[16];
  256. u8 revision[4];
  257. u64 capacity;
  258. u32 block_size;
  259. u8 dev_type;
  260. u8 dev_status;
  261. u8 member_state;
  262. u8 operation;
  263. u8 op_status;
  264. u8 progress;
  265. u16 ses_dev_index;
  266. u8 serial_no[32];
  267. union {
  268. u16 target_id;
  269. u16 features_mask;
  270. };
  271. u16 lun;
  272. u16 features;
  273. u8 ses_element_id;
  274. u8 link_speed;
  275. u16 phys_target_id;
  276. u8 reserved[2];
  277. /* This is where fields specific to struct atto_vda_devinfo2 begin. Note
  278. * that the structure version started at one so applications that unionize this
  279. * structure with atto_vda_dev_info can differentiate them if desired.
  280. */
  281. u8 version;
  282. #define VDADEVINFO_VERSION0 0x00
  283. #define VDADEVINFO_VERSION1 0x01
  284. #define VDADEVINFO_VERSION2 0x02
  285. #define VDADEVINFO_VERSION3 0x03
  286. #define VDADEVINFO_VERSION VDADEVINFO_VERSION3
  287. u8 reserved2[3];
  288. /* sector scanning fields */
  289. u32 ss_curr_errors;
  290. u64 ss_curr_scanned;
  291. u32 ss_curr_recvrd;
  292. u32 ss_scan_length;
  293. u32 ss_total_errors;
  294. u32 ss_total_recvrd;
  295. u32 ss_num_scans;
  296. /* grp_name was added in version 2 of this structure. */
  297. char grp_name[15];
  298. u8 reserved3[4];
  299. /* dev_addr_list was added in version 3 of this structure. */
  300. u8 num_dev_addr;
  301. struct atto_dev_addr2 dev_addr_list[8];
  302. };
  303. struct __packed atto_vda_grp_info {
  304. u8 grp_index;
  305. #define VDA_MAX_RAID_GROUPS 32
  306. char grp_name[15];
  307. u64 capacity;
  308. u32 block_size;
  309. u32 interleave;
  310. u8 type;
  311. #define VDA_GRP_TYPE_RAID0 0
  312. #define VDA_GRP_TYPE_RAID1 1
  313. #define VDA_GRP_TYPE_RAID4 4
  314. #define VDA_GRP_TYPE_RAID5 5
  315. #define VDA_GRP_TYPE_RAID6 6
  316. #define VDA_GRP_TYPE_RAID10 10
  317. #define VDA_GRP_TYPE_RAID40 40
  318. #define VDA_GRP_TYPE_RAID50 50
  319. #define VDA_GRP_TYPE_RAID60 60
  320. #define VDA_GRP_TYPE_DVRAID_HS 252
  321. #define VDA_GRP_TYPE_DVRAID_NOHS 253
  322. #define VDA_GRP_TYPE_JBOD 254
  323. #define VDA_GRP_TYPE_SPARE 255
  324. union {
  325. u8 status;
  326. #define VDA_GRP_STAT_INVALID 0x00
  327. #define VDA_GRP_STAT_NEW 0x01
  328. #define VDA_GRP_STAT_WAITING 0x02
  329. #define VDA_GRP_STAT_ONLINE 0x03
  330. #define VDA_GRP_STAT_DEGRADED 0x04
  331. #define VDA_GRP_STAT_OFFLINE 0x05
  332. #define VDA_GRP_STAT_DELETED 0x06
  333. #define VDA_GRP_STAT_RECOV_BASIC 0x07
  334. #define VDA_GRP_STAT_RECOV_EXTREME 0x08
  335. u8 op_ctrl;
  336. #define VDA_GRP_OP_CTRL_START 0x01
  337. #define VDA_GRP_OP_CTRL_HALT 0x02
  338. #define VDA_GRP_OP_CTRL_RESUME 0x03
  339. #define VDA_GRP_OP_CTRL_CANCEL 0x04
  340. };
  341. u8 rebuild_state;
  342. #define VDA_RBLD_NONE 0x00
  343. #define VDA_RBLD_REBUILD 0x01
  344. #define VDA_RBLD_ERASE 0x02
  345. #define VDA_RBLD_PATTERN 0x03
  346. #define VDA_RBLD_CONV 0x04
  347. #define VDA_RBLD_FULL_INIT 0x05
  348. #define VDA_RBLD_QUICK_INIT 0x06
  349. #define VDA_RBLD_SECT_SCAN 0x07
  350. #define VDA_RBLD_SECT_SCAN_PARITY 0x08
  351. #define VDA_RBLD_SECT_SCAN_PARITY_FIX 0x09
  352. #define VDA_RBLD_RECOV_REBUILD 0x0A
  353. #define VDA_RBLD_RECOV_BASIC 0x0B
  354. #define VDA_RBLD_RECOV_EXTREME 0x0C
  355. u8 span_depth;
  356. u8 progress;
  357. u8 mirror_width;
  358. u8 stripe_width;
  359. u8 member_cnt;
  360. union {
  361. u16 members[32];
  362. #define VDA_MEMBER_MISSING 0xFFFF
  363. #define VDA_MEMBER_NEW 0xFFFE
  364. u16 features_mask;
  365. };
  366. u16 features;
  367. #define VDA_GRP_FEAT_HOTSWAP 0x0001
  368. #define VDA_GRP_FEAT_SPDRD_MASK 0x0006
  369. #define VDA_GRP_FEAT_SPDRD_DIS 0x0000
  370. #define VDA_GRP_FEAT_SPDRD_ENB 0x0002
  371. #define VDA_GRP_FEAT_SPDRD_AUTO 0x0004
  372. #define VDA_GRP_FEAT_IDENT 0x0008
  373. #define VDA_GRP_FEAT_RBLDPRI_MASK 0x0030
  374. #define VDA_GRP_FEAT_RBLDPRI_LOW 0x0010
  375. #define VDA_GRP_FEAT_RBLDPRI_SAME 0x0020
  376. #define VDA_GRP_FEAT_RBLDPRI_HIGH 0x0030
  377. #define VDA_GRP_FEAT_WRITE_CACHE 0x0040
  378. #define VDA_GRP_FEAT_RBLD_RESUME 0x0080
  379. #define VDA_GRP_FEAT_SECT_RESUME 0x0100
  380. #define VDA_GRP_FEAT_INIT_RESUME 0x0200
  381. #define VDA_GRP_FEAT_SSD 0x0400
  382. #define VDA_GRP_FEAT_BOOT_DEV 0x0800
  383. /*
  384. * for backward compatibility, a prefetch value of zero means the
  385. * setting is ignored/unsupported. therefore, the firmware supported
  386. * 0-6 values are incremented to 1-7.
  387. */
  388. u8 prefetch;
  389. u8 op_status;
  390. #define VDAGRPOPSTAT_MASK 0x0F
  391. #define VDAGRPOPSTAT_INVALID 0x00
  392. #define VDAGRPOPSTAT_OK 0x01
  393. #define VDAGRPOPSTAT_FAULTED 0x02
  394. #define VDAGRPOPSTAT_HALTED 0x03
  395. #define VDAGRPOPSTAT_INT 0x04
  396. #define VDAGRPOPPROC_MASK 0xF0
  397. #define VDAGRPOPPROC_STARTABLE 0x10
  398. #define VDAGRPOPPROC_CANCELABLE 0x20
  399. #define VDAGRPOPPROC_RESUMABLE 0x40
  400. #define VDAGRPOPPROC_HALTABLE 0x80
  401. u8 over_provision;
  402. u8 reserved[3];
  403. };
  404. struct __packed atto_vdapart_info {
  405. u8 part_no;
  406. #define VDA_MAX_PARTITIONS 128
  407. char grp_name[15];
  408. u64 part_size;
  409. u64 start_lba;
  410. u32 block_size;
  411. u16 target_id;
  412. u8 LUN;
  413. char serial_no[41];
  414. u8 features;
  415. #define VDAPI_FEAT_WRITE_CACHE 0x01
  416. u8 reserved[7];
  417. };
  418. struct __packed atto_vda_dh_info {
  419. u8 req_type;
  420. #define VDADH_RQTYPE_CACHE 0x01
  421. #define VDADH_RQTYPE_FETCH 0x02
  422. #define VDADH_RQTYPE_SET_STAT 0x03
  423. #define VDADH_RQTYPE_GET_STAT 0x04
  424. u8 req_qual;
  425. #define VDADH_RQQUAL_SMART 0x01
  426. #define VDADH_RQQUAL_MEDDEF 0x02
  427. #define VDADH_RQQUAL_INFOEXC 0x04
  428. u8 num_smart_attribs;
  429. u8 status;
  430. #define VDADH_STAT_DISABLE 0x00
  431. #define VDADH_STAT_ENABLE 0x01
  432. u32 med_defect_cnt;
  433. u32 info_exc_cnt;
  434. u8 smart_status;
  435. #define VDADH_SMARTSTAT_OK 0x00
  436. #define VDADH_SMARTSTAT_ERR 0x01
  437. u8 reserved[35];
  438. struct atto_vda_sge sge[1];
  439. };
  440. struct __packed atto_vda_dh_smart {
  441. u8 attrib_id;
  442. u8 current_val;
  443. u8 worst;
  444. u8 threshold;
  445. u8 raw_data[6];
  446. u8 raw_attrib_status;
  447. #define VDADHSM_RAWSTAT_PREFAIL_WARRANTY 0x01
  448. #define VDADHSM_RAWSTAT_ONLINE_COLLECTION 0x02
  449. #define VDADHSM_RAWSTAT_PERFORMANCE_ATTR 0x04
  450. #define VDADHSM_RAWSTAT_ERROR_RATE_ATTR 0x08
  451. #define VDADHSM_RAWSTAT_EVENT_COUNT_ATTR 0x10
  452. #define VDADHSM_RAWSTAT_SELF_PRESERVING_ATTR 0x20
  453. u8 calc_attrib_status;
  454. #define VDADHSM_CALCSTAT_UNKNOWN 0x00
  455. #define VDADHSM_CALCSTAT_GOOD 0x01
  456. #define VDADHSM_CALCSTAT_PREFAIL 0x02
  457. #define VDADHSM_CALCSTAT_OLDAGE 0x03
  458. u8 reserved[4];
  459. };
  460. struct __packed atto_vda_metrics_info {
  461. u8 data_version;
  462. #define VDAMET_VERSION0 0x00
  463. #define VDAMET_VERSION VDAMET_VERSION0
  464. u8 metrics_action;
  465. #define VDAMET_METACT_NONE 0x00
  466. #define VDAMET_METACT_START 0x01
  467. #define VDAMET_METACT_STOP 0x02
  468. #define VDAMET_METACT_RETRIEVE 0x03
  469. #define VDAMET_METACT_CLEAR 0x04
  470. u8 test_action;
  471. #define VDAMET_TSTACT_NONE 0x00
  472. #define VDAMET_TSTACT_STRT_INIT 0x01
  473. #define VDAMET_TSTACT_STRT_READ 0x02
  474. #define VDAMET_TSTACT_STRT_VERIFY 0x03
  475. #define VDAMET_TSTACT_STRT_INIT_VERIFY 0x04
  476. #define VDAMET_TSTACT_STOP 0x05
  477. u8 num_dev_indexes;
  478. #define VDAMET_ALL_DEVICES 0xFF
  479. u16 dev_indexes[32];
  480. u8 reserved[12];
  481. struct atto_vda_sge sge[1];
  482. };
  483. struct __packed atto_vda_metrics_data {
  484. u16 dev_index;
  485. u16 length;
  486. #define VDAMD_LEN_LAST 0x8000
  487. #define VDAMD_LEN_MASK 0x0FFF
  488. u32 flags;
  489. #define VDAMDF_RUN 0x00000007
  490. #define VDAMDF_RUN_READ 0x00000001
  491. #define VDAMDF_RUN_WRITE 0x00000002
  492. #define VDAMDF_RUN_ALL 0x00000004
  493. #define VDAMDF_READ 0x00000010
  494. #define VDAMDF_WRITE 0x00000020
  495. #define VDAMDF_ALL 0x00000040
  496. #define VDAMDF_DRIVETEST 0x40000000
  497. #define VDAMDF_NEW 0x80000000
  498. u64 total_read_data;
  499. u64 total_write_data;
  500. u64 total_read_io;
  501. u64 total_write_io;
  502. u64 read_start_time;
  503. u64 read_stop_time;
  504. u64 write_start_time;
  505. u64 write_stop_time;
  506. u64 read_maxio_time;
  507. u64 wpvdadmetricsdatarite_maxio_time;
  508. u64 read_totalio_time;
  509. u64 write_totalio_time;
  510. u64 read_total_errs;
  511. u64 write_total_errs;
  512. u64 read_recvrd_errs;
  513. u64 write_recvrd_errs;
  514. u64 miscompares;
  515. };
  516. struct __packed atto_vda_schedule_info {
  517. u8 schedule_type;
  518. #define VDASI_SCHTYPE_ONETIME 0x01
  519. #define VDASI_SCHTYPE_DAILY 0x02
  520. #define VDASI_SCHTYPE_WEEKLY 0x03
  521. u8 operation;
  522. #define VDASI_OP_NONE 0x00
  523. #define VDASI_OP_CREATE 0x01
  524. #define VDASI_OP_CANCEL 0x02
  525. u8 hour;
  526. u8 minute;
  527. u8 day;
  528. #define VDASI_DAY_NONE 0x00
  529. u8 progress;
  530. #define VDASI_PROG_NONE 0xFF
  531. u8 event_type;
  532. #define VDASI_EVTTYPE_SECT_SCAN 0x01
  533. #define VDASI_EVTTYPE_SECT_SCAN_PARITY 0x02
  534. #define VDASI_EVTTYPE_SECT_SCAN_PARITY_FIX 0x03
  535. u8 recurrences;
  536. #define VDASI_RECUR_FOREVER 0x00
  537. u32 id;
  538. #define VDASI_ID_NONE 0x00
  539. char grp_name[15];
  540. u8 reserved[85];
  541. };
  542. struct __packed atto_vda_n_vcache_info {
  543. u8 super_cap_status;
  544. #define VDANVCI_SUPERCAP_NOT_PRESENT 0x00
  545. #define VDANVCI_SUPERCAP_FULLY_CHARGED 0x01
  546. #define VDANVCI_SUPERCAP_NOT_CHARGED 0x02
  547. u8 nvcache_module_status;
  548. #define VDANVCI_NVCACHEMODULE_NOT_PRESENT 0x00
  549. #define VDANVCI_NVCACHEMODULE_PRESENT 0x01
  550. u8 protection_mode;
  551. #define VDANVCI_PROTMODE_HI_PROTECT 0x00
  552. #define VDANVCI_PROTMODE_HI_PERFORM 0x01
  553. u8 reserved[109];
  554. };
  555. struct __packed atto_vda_buzzer_info {
  556. u8 status;
  557. #define VDABUZZI_BUZZER_OFF 0x00
  558. #define VDABUZZI_BUZZER_ON 0x01
  559. #define VDABUZZI_BUZZER_LAST 0x02
  560. u8 reserved[3];
  561. u32 duration;
  562. #define VDABUZZI_DURATION_INDEFINITE 0xffffffff
  563. u8 reserved2[104];
  564. };
  565. struct __packed atto_vda_adapter_info {
  566. u8 version;
  567. #define VDAADAPINFO_VERSION0 0x00
  568. #define VDAADAPINFO_VERSION VDAADAPINFO_VERSION0
  569. u8 reserved;
  570. signed short utc_offset;
  571. u32 utc_time;
  572. u32 features;
  573. #define VDA_ADAP_FEAT_IDENT 0x0001
  574. #define VDA_ADAP_FEAT_BUZZ_ERR 0x0002
  575. #define VDA_ADAP_FEAT_UTC_TIME 0x0004
  576. u32 valid_features;
  577. char active_config[33];
  578. u8 temp_count;
  579. u8 fan_count;
  580. u8 reserved3[61];
  581. };
  582. struct __packed atto_vda_temp_info {
  583. u8 temp_index;
  584. u8 max_op_temp;
  585. u8 min_op_temp;
  586. u8 op_temp_warn;
  587. u8 temperature;
  588. u8 type;
  589. #define VDA_TEMP_TYPE_CPU 1
  590. u8 reserved[106];
  591. };
  592. struct __packed atto_vda_fan_info {
  593. u8 fan_index;
  594. u8 status;
  595. #define VDA_FAN_STAT_UNKNOWN 0
  596. #define VDA_FAN_STAT_NORMAL 1
  597. #define VDA_FAN_STAT_FAIL 2
  598. u16 crit_pvdafaninfothreshold;
  599. u16 warn_threshold;
  600. u16 speed;
  601. u8 reserved[104];
  602. };
  603. /* VDA management commands */
  604. #define VDAMGT_DEV_SCAN 0x00
  605. #define VDAMGT_DEV_INFO 0x01
  606. #define VDAMGT_DEV_CLEAN 0x02
  607. #define VDAMGT_DEV_IDENTIFY 0x03
  608. #define VDAMGT_DEV_IDENTSTOP 0x04
  609. #define VDAMGT_DEV_PT_INFO 0x05
  610. #define VDAMGT_DEV_FEATURES 0x06
  611. #define VDAMGT_DEV_PT_FEATURES 0x07
  612. #define VDAMGT_DEV_HEALTH_REQ 0x08
  613. #define VDAMGT_DEV_METRICS 0x09
  614. #define VDAMGT_DEV_INFO2 0x0A
  615. #define VDAMGT_DEV_OPERATION 0x0B
  616. #define VDAMGT_DEV_INFO2_BYADDR 0x0C
  617. #define VDAMGT_GRP_INFO 0x10
  618. #define VDAMGT_GRP_CREATE 0x11
  619. #define VDAMGT_GRP_DELETE 0x12
  620. #define VDAMGT_ADD_STORAGE 0x13
  621. #define VDAMGT_MEMBER_ADD 0x14
  622. #define VDAMGT_GRP_COMMIT 0x15
  623. #define VDAMGT_GRP_REBUILD 0x16
  624. #define VDAMGT_GRP_COMMIT_INIT 0x17
  625. #define VDAMGT_QUICK_RAID 0x18
  626. #define VDAMGT_GRP_FEATURES 0x19
  627. #define VDAMGT_GRP_COMMIT_INIT_AUTOMAP 0x1A
  628. #define VDAMGT_QUICK_RAID_INIT_AUTOMAP 0x1B
  629. #define VDAMGT_GRP_OPERATION 0x1C
  630. #define VDAMGT_CFG_SAVE 0x20
  631. #define VDAMGT_LAST_ERROR 0x21
  632. #define VDAMGT_ADAP_INFO 0x22
  633. #define VDAMGT_ADAP_FEATURES 0x23
  634. #define VDAMGT_TEMP_INFO 0x24
  635. #define VDAMGT_FAN_INFO 0x25
  636. #define VDAMGT_PART_INFO 0x30
  637. #define VDAMGT_PART_MAP 0x31
  638. #define VDAMGT_PART_UNMAP 0x32
  639. #define VDAMGT_PART_AUTOMAP 0x33
  640. #define VDAMGT_PART_SPLIT 0x34
  641. #define VDAMGT_PART_MERGE 0x35
  642. #define VDAMGT_SPARE_LIST 0x40
  643. #define VDAMGT_SPARE_ADD 0x41
  644. #define VDAMGT_SPARE_REMOVE 0x42
  645. #define VDAMGT_LOCAL_SPARE_ADD 0x43
  646. #define VDAMGT_SCHEDULE_EVENT 0x50
  647. #define VDAMGT_SCHEDULE_INFO 0x51
  648. #define VDAMGT_NVCACHE_INFO 0x60
  649. #define VDAMGT_NVCACHE_SET 0x61
  650. #define VDAMGT_BUZZER_INFO 0x70
  651. #define VDAMGT_BUZZER_SET 0x71
  652. struct __packed atto_vda_ae_hdr {
  653. u8 bylength;
  654. u8 byflags;
  655. #define VDAAE_HDRF_EVENT_ACK 0x01
  656. u8 byversion;
  657. #define VDAAE_HDR_VER_0 0
  658. u8 bytype;
  659. #define VDAAE_HDR_TYPE_RAID 1
  660. #define VDAAE_HDR_TYPE_LU 2
  661. #define VDAAE_HDR_TYPE_DISK 3
  662. #define VDAAE_HDR_TYPE_RESET 4
  663. #define VDAAE_HDR_TYPE_LOG_INFO 5
  664. #define VDAAE_HDR_TYPE_LOG_WARN 6
  665. #define VDAAE_HDR_TYPE_LOG_CRIT 7
  666. #define VDAAE_HDR_TYPE_LOG_FAIL 8
  667. #define VDAAE_HDR_TYPE_NVC 9
  668. #define VDAAE_HDR_TYPE_TLG_INFO 10
  669. #define VDAAE_HDR_TYPE_TLG_WARN 11
  670. #define VDAAE_HDR_TYPE_TLG_CRIT 12
  671. #define VDAAE_HDR_TYPE_PWRMGT 13
  672. #define VDAAE_HDR_TYPE_MUTE 14
  673. #define VDAAE_HDR_TYPE_DEV 15
  674. };
  675. struct __packed atto_vda_ae_raid {
  676. struct atto_vda_ae_hdr hdr;
  677. u32 dwflags;
  678. #define VDAAE_GROUP_STATE 0x00000001
  679. #define VDAAE_RBLD_STATE 0x00000002
  680. #define VDAAE_RBLD_PROG 0x00000004
  681. #define VDAAE_MEMBER_CHG 0x00000008
  682. #define VDAAE_PART_CHG 0x00000010
  683. #define VDAAE_MEM_STATE_CHG 0x00000020
  684. u8 bygroup_state;
  685. #define VDAAE_RAID_INVALID 0
  686. #define VDAAE_RAID_NEW 1
  687. #define VDAAE_RAID_WAITING 2
  688. #define VDAAE_RAID_ONLINE 3
  689. #define VDAAE_RAID_DEGRADED 4
  690. #define VDAAE_RAID_OFFLINE 5
  691. #define VDAAE_RAID_DELETED 6
  692. #define VDAAE_RAID_BASIC 7
  693. #define VDAAE_RAID_EXTREME 8
  694. #define VDAAE_RAID_UNKNOWN 9
  695. u8 byrebuild_state;
  696. #define VDAAE_RBLD_NONE 0
  697. #define VDAAE_RBLD_REBUILD 1
  698. #define VDAAE_RBLD_ERASE 2
  699. #define VDAAE_RBLD_PATTERN 3
  700. #define VDAAE_RBLD_CONV 4
  701. #define VDAAE_RBLD_FULL_INIT 5
  702. #define VDAAE_RBLD_QUICK_INIT 6
  703. #define VDAAE_RBLD_SECT_SCAN 7
  704. #define VDAAE_RBLD_SECT_SCAN_PARITY 8
  705. #define VDAAE_RBLD_SECT_SCAN_PARITY_FIX 9
  706. #define VDAAE_RBLD_RECOV_REBUILD 10
  707. #define VDAAE_RBLD_UNKNOWN 11
  708. u8 byrebuild_progress;
  709. u8 op_status;
  710. #define VDAAE_GRPOPSTAT_MASK 0x0F
  711. #define VDAAE_GRPOPSTAT_INVALID 0x00
  712. #define VDAAE_GRPOPSTAT_OK 0x01
  713. #define VDAAE_GRPOPSTAT_FAULTED 0x02
  714. #define VDAAE_GRPOPSTAT_HALTED 0x03
  715. #define VDAAE_GRPOPSTAT_INT 0x04
  716. #define VDAAE_GRPOPPROC_MASK 0xF0
  717. #define VDAAE_GRPOPPROC_STARTABLE 0x10
  718. #define VDAAE_GRPOPPROC_CANCELABLE 0x20
  719. #define VDAAE_GRPOPPROC_RESUMABLE 0x40
  720. #define VDAAE_GRPOPPROC_HALTABLE 0x80
  721. char acname[15];
  722. u8 byreserved;
  723. u8 byreserved2[0x80 - 0x1C];
  724. };
  725. struct __packed atto_vda_ae_lu_tgt_lun {
  726. u16 wtarget_id;
  727. u8 bylun;
  728. u8 byreserved;
  729. };
  730. struct __packed atto_vda_ae_lu_tgt_lun_raid {
  731. u16 wtarget_id;
  732. u8 bylun;
  733. u8 byreserved;
  734. u32 dwinterleave;
  735. u32 dwblock_size;
  736. };
  737. struct __packed atto_vda_ae_lu {
  738. struct atto_vda_ae_hdr hdr;
  739. u32 dwevent;
  740. #define VDAAE_LU_DISC 0x00000001
  741. #define VDAAE_LU_LOST 0x00000002
  742. #define VDAAE_LU_STATE 0x00000004
  743. #define VDAAE_LU_PASSTHROUGH 0x10000000
  744. #define VDAAE_LU_PHYS_ID 0x20000000
  745. u8 bystate;
  746. #define VDAAE_LU_UNDEFINED 0
  747. #define VDAAE_LU_NOT_PRESENT 1
  748. #define VDAAE_LU_OFFLINE 2
  749. #define VDAAE_LU_ONLINE 3
  750. #define VDAAE_LU_DEGRADED 4
  751. #define VDAAE_LU_FACTORY_DISABLED 5
  752. #define VDAAE_LU_DELETED 6
  753. #define VDAAE_LU_BUSSCAN 7
  754. #define VDAAE_LU_UNKNOWN 8
  755. u8 byreserved;
  756. u16 wphys_target_id;
  757. union {
  758. struct atto_vda_ae_lu_tgt_lun tgtlun;
  759. struct atto_vda_ae_lu_tgt_lun_raid tgtlun_raid;
  760. } id;
  761. };
  762. struct __packed atto_vda_ae_disk {
  763. struct atto_vda_ae_hdr hdr;
  764. };
  765. #define VDAAE_LOG_STRSZ 64
  766. struct __packed atto_vda_ae_log {
  767. struct atto_vda_ae_hdr hdr;
  768. char aclog_ascii[VDAAE_LOG_STRSZ];
  769. };
  770. #define VDAAE_TLG_STRSZ 56
  771. struct __packed atto_vda_ae_timestamp_log {
  772. struct atto_vda_ae_hdr hdr;
  773. u32 dwtimestamp;
  774. char aclog_ascii[VDAAE_TLG_STRSZ];
  775. };
  776. struct __packed atto_vda_ae_nvc {
  777. struct atto_vda_ae_hdr hdr;
  778. };
  779. struct __packed atto_vda_ae_dev {
  780. struct atto_vda_ae_hdr hdr;
  781. struct atto_dev_addr devaddr;
  782. };
  783. union atto_vda_ae {
  784. struct atto_vda_ae_hdr hdr;
  785. struct atto_vda_ae_disk disk;
  786. struct atto_vda_ae_lu lu;
  787. struct atto_vda_ae_raid raid;
  788. struct atto_vda_ae_log log;
  789. struct atto_vda_ae_timestamp_log tslog;
  790. struct atto_vda_ae_nvc nvcache;
  791. struct atto_vda_ae_dev dev;
  792. };
  793. struct __packed atto_vda_date_and_time {
  794. u8 flags;
  795. #define VDA_DT_DAY_MASK 0x07
  796. #define VDA_DT_DAY_NONE 0x00
  797. #define VDA_DT_DAY_SUN 0x01
  798. #define VDA_DT_DAY_MON 0x02
  799. #define VDA_DT_DAY_TUE 0x03
  800. #define VDA_DT_DAY_WED 0x04
  801. #define VDA_DT_DAY_THU 0x05
  802. #define VDA_DT_DAY_FRI 0x06
  803. #define VDA_DT_DAY_SAT 0x07
  804. #define VDA_DT_PM 0x40
  805. #define VDA_DT_MILITARY 0x80
  806. u8 seconds;
  807. u8 minutes;
  808. u8 hours;
  809. u8 day;
  810. u8 month;
  811. u16 year;
  812. };
  813. #define SGE_LEN_LIMIT 0x003FFFFF /*! mask of segment length */
  814. #define SGE_LEN_MAX 0x003FF000 /*! maximum segment length */
  815. #define SGE_LAST 0x01000000 /*! last entry */
  816. #define SGE_ADDR_64 0x04000000 /*! 64-bit addressing flag */
  817. #define SGE_CHAIN 0x80000000 /*! chain descriptor flag */
  818. #define SGE_CHAIN_LEN 0x0000FFFF /*! mask of length in chain entries */
  819. #define SGE_CHAIN_SZ 0x00FF0000 /*! mask of size of chained buffer */
  820. struct __packed atto_vda_cfg_init {
  821. struct atto_vda_date_and_time date_time;
  822. u32 sgl_page_size;
  823. u32 vda_version;
  824. u32 fw_version;
  825. u32 fw_build;
  826. u32 fw_release;
  827. u32 epoch_time;
  828. u32 ioctl_tunnel;
  829. #define VDA_ITF_MEM_RW 0x00000001
  830. #define VDA_ITF_TRACE 0x00000002
  831. #define VDA_ITF_SCSI_PASS_THRU 0x00000004
  832. #define VDA_ITF_GET_DEV_ADDR 0x00000008
  833. #define VDA_ITF_PHY_CTRL 0x00000010
  834. #define VDA_ITF_CONN_CTRL 0x00000020
  835. #define VDA_ITF_GET_DEV_INFO 0x00000040
  836. u32 num_targets_backend;
  837. u8 reserved[0x48];
  838. };
  839. /* configuration commands */
  840. #define VDA_CFG_INIT 0x00
  841. #define VDA_CFG_GET_INIT 0x01
  842. #define VDA_CFG_GET_INIT2 0x02
  843. /*! physical region descriptor (PRD) aka scatter/gather entry */
  844. struct __packed atto_physical_region_description {
  845. u64 address;
  846. u32 ctl_len;
  847. #define PRD_LEN_LIMIT 0x003FFFFF
  848. #define PRD_LEN_MAX 0x003FF000
  849. #define PRD_NXT_PRD_CNT 0x0000007F
  850. #define PRD_CHAIN 0x01000000
  851. #define PRD_DATA 0x00000000
  852. #define PRD_INT_SEL 0xF0000000
  853. #define PRD_INT_SEL_F0 0x00000000
  854. #define PRD_INT_SEL_F1 0x40000000
  855. #define PRD_INT_SEL_F2 0x80000000
  856. #define PRD_INT_SEL_F3 0xc0000000
  857. #define PRD_INT_SEL_SRAM 0x10000000
  858. #define PRD_INT_SEL_PBSR 0x20000000
  859. };
  860. /* Request types. NOTE that ALL requests have the same layout for the first
  861. * few bytes.
  862. */
  863. struct __packed atto_vda_req_header {
  864. u32 length;
  865. u8 function;
  866. u8 variable1;
  867. u8 chain_offset;
  868. u8 sg_list_offset;
  869. u32 handle;
  870. };
  871. #define FCP_CDB_SIZE 16
  872. struct __packed atto_vda_scsi_req {
  873. u32 length;
  874. u8 function; /* VDA_FUNC_SCSI */
  875. u8 sense_len;
  876. u8 chain_offset;
  877. u8 sg_list_offset;
  878. u32 handle;
  879. u32 flags;
  880. #define FCP_CMND_LUN_MASK 0x000000FF
  881. #define FCP_CMND_TA_MASK 0x00000700
  882. #define FCP_CMND_TA_SIMPL_Q 0x00000000
  883. #define FCP_CMND_TA_HEAD_Q 0x00000100
  884. #define FCP_CMND_TA_ORDRD_Q 0x00000200
  885. #define FCP_CMND_TA_ACA 0x00000400
  886. #define FCP_CMND_PRI_MASK 0x00007800
  887. #define FCP_CMND_TM_MASK 0x00FF0000
  888. #define FCP_CMND_ATS 0x00020000
  889. #define FCP_CMND_CTS 0x00040000
  890. #define FCP_CMND_LRS 0x00100000
  891. #define FCP_CMND_TRS 0x00200000
  892. #define FCP_CMND_CLA 0x00400000
  893. #define FCP_CMND_TRM 0x00800000
  894. #define FCP_CMND_DATA_DIR 0x03000000
  895. #define FCP_CMND_WRD 0x01000000
  896. #define FCP_CMND_RDD 0x02000000
  897. u8 cdb[FCP_CDB_SIZE];
  898. union {
  899. struct __packed {
  900. u64 ppsense_buf;
  901. u16 target_id;
  902. u8 iblk_cnt_prd;
  903. u8 reserved;
  904. };
  905. struct atto_physical_region_description sense_buff_prd;
  906. };
  907. union {
  908. struct atto_vda_sge sge[1];
  909. u32 abort_handle;
  910. u32 dwords[245];
  911. struct atto_physical_region_description prd[1];
  912. } u;
  913. };
  914. struct __packed atto_vda_flash_req {
  915. u32 length;
  916. u8 function; /* VDA_FUNC_FLASH */
  917. u8 sub_func;
  918. u8 chain_offset;
  919. u8 sg_list_offset;
  920. u32 handle;
  921. u32 flash_addr;
  922. u8 checksum;
  923. u8 rsvd[3];
  924. union {
  925. struct {
  926. char file_name[16]; /* 8.3 fname, NULL term, wc=* */
  927. struct atto_vda_sge sge[1];
  928. } file;
  929. struct atto_vda_sge sge[1];
  930. struct atto_physical_region_description prde[2];
  931. } data;
  932. };
  933. struct __packed atto_vda_diag_req {
  934. u32 length;
  935. u8 function; /* VDA_FUNC_DIAG */
  936. u8 sub_func;
  937. #define VDA_DIAG_STATUS 0x00
  938. #define VDA_DIAG_RESET 0x01
  939. #define VDA_DIAG_PAUSE 0x02
  940. #define VDA_DIAG_RESUME 0x03
  941. #define VDA_DIAG_READ 0x04
  942. #define VDA_DIAG_WRITE 0x05
  943. u8 chain_offset;
  944. u8 sg_list_offset;
  945. u32 handle;
  946. u32 rsvd;
  947. u64 local_addr;
  948. struct atto_vda_sge sge[1];
  949. };
  950. struct __packed atto_vda_ae_req {
  951. u32 length;
  952. u8 function; /* VDA_FUNC_AE */
  953. u8 reserved1;
  954. u8 chain_offset;
  955. u8 sg_list_offset;
  956. u32 handle;
  957. union {
  958. struct atto_vda_sge sge[1];
  959. struct atto_physical_region_description prde[1];
  960. };
  961. };
  962. struct __packed atto_vda_cli_req {
  963. u32 length;
  964. u8 function; /* VDA_FUNC_CLI */
  965. u8 reserved1;
  966. u8 chain_offset;
  967. u8 sg_list_offset;
  968. u32 handle;
  969. u32 cmd_rsp_len;
  970. struct atto_vda_sge sge[1];
  971. };
  972. struct __packed atto_vda_ioctl_req {
  973. u32 length;
  974. u8 function; /* VDA_FUNC_IOCTL */
  975. u8 sub_func;
  976. u8 chain_offset;
  977. u8 sg_list_offset;
  978. u32 handle;
  979. union {
  980. struct atto_vda_sge reserved_sge;
  981. struct atto_physical_region_description reserved_prde;
  982. };
  983. union {
  984. struct {
  985. u32 ctrl_code;
  986. u16 target_id;
  987. u8 lun;
  988. u8 reserved;
  989. } csmi;
  990. };
  991. union {
  992. struct atto_vda_sge sge[1];
  993. struct atto_physical_region_description prde[1];
  994. };
  995. };
  996. struct __packed atto_vda_cfg_req {
  997. u32 length;
  998. u8 function; /* VDA_FUNC_CFG */
  999. u8 sub_func;
  1000. u8 rsvd1;
  1001. u8 sg_list_offset;
  1002. u32 handle;
  1003. union {
  1004. u8 bytes[116];
  1005. struct atto_vda_cfg_init init;
  1006. struct atto_vda_sge sge;
  1007. struct atto_physical_region_description prde;
  1008. } data;
  1009. };
  1010. struct __packed atto_vda_mgmt_req {
  1011. u32 length;
  1012. u8 function; /* VDA_FUNC_MGT */
  1013. u8 mgt_func;
  1014. u8 chain_offset;
  1015. u8 sg_list_offset;
  1016. u32 handle;
  1017. u8 scan_generation;
  1018. u8 payld_sglst_offset;
  1019. u16 dev_index;
  1020. u32 payld_length;
  1021. u32 pad;
  1022. union {
  1023. struct atto_vda_sge sge[2];
  1024. struct atto_physical_region_description prde[2];
  1025. };
  1026. struct atto_vda_sge payld_sge[1];
  1027. };
  1028. union atto_vda_req {
  1029. struct atto_vda_scsi_req scsi;
  1030. struct atto_vda_flash_req flash;
  1031. struct atto_vda_diag_req diag;
  1032. struct atto_vda_ae_req ae;
  1033. struct atto_vda_cli_req cli;
  1034. struct atto_vda_ioctl_req ioctl;
  1035. struct atto_vda_cfg_req cfg;
  1036. struct atto_vda_mgmt_req mgt;
  1037. u8 bytes[1024];
  1038. };
  1039. /* Outbound response structures */
  1040. struct __packed atto_vda_scsi_rsp {
  1041. u8 scsi_stat;
  1042. u8 sense_len;
  1043. u8 rsvd[2];
  1044. u32 residual_length;
  1045. };
  1046. struct __packed atto_vda_flash_rsp {
  1047. u32 file_size;
  1048. };
  1049. struct __packed atto_vda_ae_rsp {
  1050. u32 length;
  1051. };
  1052. struct __packed atto_vda_cli_rsp {
  1053. u32 cmd_rsp_len;
  1054. };
  1055. struct __packed atto_vda_ioctl_rsp {
  1056. union {
  1057. struct {
  1058. u32 csmi_status;
  1059. u16 target_id;
  1060. u8 lun;
  1061. u8 reserved;
  1062. } csmi;
  1063. };
  1064. };
  1065. struct __packed atto_vda_cfg_rsp {
  1066. u16 vda_version;
  1067. u16 fw_release;
  1068. u32 fw_build;
  1069. };
  1070. struct __packed atto_vda_mgmt_rsp {
  1071. u32 length;
  1072. u16 dev_index;
  1073. u8 scan_generation;
  1074. };
  1075. union atto_vda_func_rsp {
  1076. struct atto_vda_scsi_rsp scsi_rsp;
  1077. struct atto_vda_flash_rsp flash_rsp;
  1078. struct atto_vda_ae_rsp ae_rsp;
  1079. struct atto_vda_cli_rsp cli_rsp;
  1080. struct atto_vda_ioctl_rsp ioctl_rsp;
  1081. struct atto_vda_cfg_rsp cfg_rsp;
  1082. struct atto_vda_mgmt_rsp mgt_rsp;
  1083. u32 dwords[2];
  1084. };
  1085. struct __packed atto_vda_ob_rsp {
  1086. u32 handle;
  1087. u8 req_stat;
  1088. u8 rsvd[3];
  1089. union atto_vda_func_rsp
  1090. func_rsp;
  1091. };
  1092. struct __packed atto_vda_ae_data {
  1093. u8 event_data[256];
  1094. };
  1095. struct __packed atto_vda_mgmt_data {
  1096. union {
  1097. u8 bytes[112];
  1098. struct atto_vda_devinfo dev_info;
  1099. struct atto_vda_grp_info grp_info;
  1100. struct atto_vdapart_info part_info;
  1101. struct atto_vda_dh_info dev_health_info;
  1102. struct atto_vda_metrics_info metrics_info;
  1103. struct atto_vda_schedule_info sched_info;
  1104. struct atto_vda_n_vcache_info nvcache_info;
  1105. struct atto_vda_buzzer_info buzzer_info;
  1106. } data;
  1107. };
  1108. union atto_vda_rsp_data {
  1109. struct atto_vda_ae_data ae_data;
  1110. struct atto_vda_mgmt_data mgt_data;
  1111. u8 sense_data[252];
  1112. #define SENSE_DATA_SZ 252;
  1113. u8 bytes[256];
  1114. };
  1115. #endif