1 /* linux/drivers/scsi/esas2r/atvda.h
2 * ATTO VDA interface definitions
4 * Copyright (c) 2001-2013 ATTO Technology, Inc.
5 * (mailto:linuxdrivers@attotech.com)
7 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
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.
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.
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.
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
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
42 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
48 struct __packed atto_dev_addr
{
53 #define VDA_DEVADDRF_SATA 0x01
54 #define VDA_DEVADDRF_SSD 0x02
55 u8 link_speed
; /* VDALINKSPEED_xxx */
59 /* dev_addr2 was added for 64-bit alignment */
61 struct __packed atto_dev_addr2
{
70 struct __packed atto_vda_sge
{
76 /* VDA request function codes */
78 #define VDA_FUNC_SCSI 0x00
79 #define VDA_FUNC_FLASH 0x01
80 #define VDA_FUNC_DIAG 0x02
81 #define VDA_FUNC_AE 0x03
82 #define VDA_FUNC_CLI 0x04
83 #define VDA_FUNC_IOCTL 0x05
84 #define VDA_FUNC_CFG 0x06
85 #define VDA_FUNC_MGT 0x07
86 #define VDA_FUNC_GSV 0x08
89 /* VDA request status values. for host driver considerations, values for
90 * SCSI requests start at zero. other requests may use these values as well. */
92 #define RS_SUCCESS 0x00 /*! successful completion */
93 #define RS_INV_FUNC 0x01 /*! invalid command function */
94 #define RS_BUSY 0x02 /*! insufficient resources */
95 #define RS_SEL 0x03 /*! no target at target_id */
96 #define RS_NO_LUN 0x04 /*! invalid LUN */
97 #define RS_TIMEOUT 0x05 /*! request timeout */
98 #define RS_OVERRUN 0x06 /*! data overrun */
99 #define RS_UNDERRUN 0x07 /*! data underrun */
100 #define RS_SCSI_ERROR 0x08 /*! SCSI error occurred */
101 #define RS_ABORTED 0x0A /*! command aborted */
102 #define RS_RESID_MISM 0x0B /*! residual length incorrect */
103 #define RS_TM_FAILED 0x0C /*! task management failed */
104 #define RS_RESET 0x0D /*! aborted due to bus reset */
105 #define RS_ERR_DMA_SG 0x0E /*! error reading SG list */
106 #define RS_ERR_DMA_DATA 0x0F /*! error transferring data */
107 #define RS_UNSUPPORTED 0x10 /*! unsupported request */
108 #define RS_SEL2 0x70 /*! internal generated RS_SEL */
109 #define RS_VDA_BASE 0x80 /*! base of VDA-specific errors */
110 #define RS_MGT_BASE 0x80 /*! base of VDA management errors */
111 #define RS_SCAN_FAIL (RS_MGT_BASE + 0x00)
112 #define RS_DEV_INVALID (RS_MGT_BASE + 0x01)
113 #define RS_DEV_ASSIGNED (RS_MGT_BASE + 0x02)
114 #define RS_DEV_REMOVE (RS_MGT_BASE + 0x03)
115 #define RS_DEV_LOST (RS_MGT_BASE + 0x04)
116 #define RS_SCAN_GEN (RS_MGT_BASE + 0x05)
117 #define RS_GRP_INVALID (RS_MGT_BASE + 0x08)
118 #define RS_GRP_EXISTS (RS_MGT_BASE + 0x09)
119 #define RS_GRP_LIMIT (RS_MGT_BASE + 0x0A)
120 #define RS_GRP_INTLV (RS_MGT_BASE + 0x0B)
121 #define RS_GRP_SPAN (RS_MGT_BASE + 0x0C)
122 #define RS_GRP_TYPE (RS_MGT_BASE + 0x0D)
123 #define RS_GRP_MEMBERS (RS_MGT_BASE + 0x0E)
124 #define RS_GRP_COMMIT (RS_MGT_BASE + 0x0F)
125 #define RS_GRP_REBUILD (RS_MGT_BASE + 0x10)
126 #define RS_GRP_REBUILD_TYPE (RS_MGT_BASE + 0x11)
127 #define RS_GRP_BLOCK_SIZE (RS_MGT_BASE + 0x12)
128 #define RS_CFG_SAVE (RS_MGT_BASE + 0x14)
129 #define RS_PART_LAST (RS_MGT_BASE + 0x18)
130 #define RS_ELEM_INVALID (RS_MGT_BASE + 0x19)
131 #define RS_PART_MAPPED (RS_MGT_BASE + 0x1A)
132 #define RS_PART_TARGET (RS_MGT_BASE + 0x1B)
133 #define RS_PART_LUN (RS_MGT_BASE + 0x1C)
134 #define RS_PART_DUP (RS_MGT_BASE + 0x1D)
135 #define RS_PART_NOMAP (RS_MGT_BASE + 0x1E)
136 #define RS_PART_MAX (RS_MGT_BASE + 0x1F)
137 #define RS_PART_CAP (RS_MGT_BASE + 0x20)
138 #define RS_PART_STATE (RS_MGT_BASE + 0x21)
139 #define RS_TEST_IN_PROG (RS_MGT_BASE + 0x22)
140 #define RS_METRICS_ERROR (RS_MGT_BASE + 0x23)
141 #define RS_HS_ERROR (RS_MGT_BASE + 0x24)
142 #define RS_NO_METRICS_TEST (RS_MGT_BASE + 0x25)
143 #define RS_BAD_PARAM (RS_MGT_BASE + 0x26)
144 #define RS_GRP_MEMBER_SIZE (RS_MGT_BASE + 0x27)
145 #define RS_FLS_BASE 0xB0 /*! base of VDA errors */
146 #define RS_FLS_ERR_AREA (RS_FLS_BASE + 0x00)
147 #define RS_FLS_ERR_BUSY (RS_FLS_BASE + 0x01)
148 #define RS_FLS_ERR_RANGE (RS_FLS_BASE + 0x02)
149 #define RS_FLS_ERR_BEGIN (RS_FLS_BASE + 0x03)
150 #define RS_FLS_ERR_CHECK (RS_FLS_BASE + 0x04)
151 #define RS_FLS_ERR_FAIL (RS_FLS_BASE + 0x05)
152 #define RS_FLS_ERR_RSRC (RS_FLS_BASE + 0x06)
153 #define RS_FLS_ERR_NOFILE (RS_FLS_BASE + 0x07)
154 #define RS_FLS_ERR_FSIZE (RS_FLS_BASE + 0x08)
155 #define RS_CFG_BASE 0xC0 /*! base of VDA configuration errors */
156 #define RS_CFG_ERR_BUSY (RS_CFG_BASE + 0)
157 #define RS_CFG_ERR_SGE (RS_CFG_BASE + 1)
158 #define RS_CFG_ERR_DATE (RS_CFG_BASE + 2)
159 #define RS_CFG_ERR_TIME (RS_CFG_BASE + 3)
160 #define RS_DEGRADED 0xFB /*! degraded mode */
161 #define RS_CLI_INTERNAL 0xFC /*! VDA CLI internal error */
162 #define RS_VDA_INTERNAL 0xFD /*! catch-all */
163 #define RS_PENDING 0xFE /*! pending, not started */
164 #define RS_STARTED 0xFF /*! started */
167 /* flash request subfunctions. these are used in both the IOCTL and the
168 * driver-firmware interface (VDA_FUNC_FLASH). */
170 #define VDA_FLASH_BEGINW 0x00
171 #define VDA_FLASH_READ 0x01
172 #define VDA_FLASH_WRITE 0x02
173 #define VDA_FLASH_COMMIT 0x03
174 #define VDA_FLASH_CANCEL 0x04
175 #define VDA_FLASH_INFO 0x05
176 #define VDA_FLASH_FREAD 0x06
177 #define VDA_FLASH_FWRITE 0x07
178 #define VDA_FLASH_FINFO 0x08
181 /* IOCTL request subfunctions. these identify the payload type for
185 #define VDA_IOCTL_HBA 0x00
186 #define VDA_IOCTL_CSMI 0x01
187 #define VDA_IOCTL_SMP 0x02
189 struct __packed atto_vda_devinfo
{
190 struct atto_dev_addr dev_addr
;
200 #define VDADEVSTAT_INVALID 0x00
201 #define VDADEVSTAT_CORRUPT VDADEVSTAT_INVALID
202 #define VDADEVSTAT_ASSIGNED 0x01
203 #define VDADEVSTAT_SPARE 0x02
204 #define VDADEVSTAT_UNAVAIL 0x03
205 #define VDADEVSTAT_PT_MAINT 0x04
206 #define VDADEVSTAT_LCLSPARE 0x05
207 #define VDADEVSTAT_UNUSEABLE 0x06
208 #define VDADEVSTAT_AVAIL 0xFF
211 #define VDA_DEV_OP_CTRL_START 0x01
212 #define VDA_DEV_OP_CTRL_HALT 0x02
213 #define VDA_DEV_OP_CTRL_RESUME 0x03
214 #define VDA_DEV_OP_CTRL_CANCEL 0x04
218 #define VDAMBRSTATE_ONLINE 0x00
219 #define VDAMBRSTATE_DEGRADED 0x01
220 #define VDAMBRSTATE_UNAVAIL 0x02
221 #define VDAMBRSTATE_FAULTED 0x03
222 #define VDAMBRSTATE_MISREAD 0x04
223 #define VDAMBRSTATE_INCOMPAT 0x05
226 #define VDAOP_NONE 0x00
227 #define VDAOP_REBUILD 0x01
228 #define VDAOP_ERASE 0x02
229 #define VDAOP_PATTERN 0x03
230 #define VDAOP_CONVERSION 0x04
231 #define VDAOP_FULL_INIT 0x05
232 #define VDAOP_QUICK_INIT 0x06
233 #define VDAOP_SECT_SCAN 0x07
234 #define VDAOP_SECT_SCAN_PARITY 0x08
235 #define VDAOP_SECT_SCAN_PARITY_FIX 0x09
236 #define VDAOP_RECOV_REBUILD 0x0A
239 #define VDAOPSTAT_OK 0x00
240 #define VDAOPSTAT_FAULTED 0x01
241 #define VDAOPSTAT_HALTED 0x02
242 #define VDAOPSTAT_INT 0x03
244 u8 progress
; /* 0 - 100% */
246 #define VDASESDI_INVALID 0xFFFF
252 #define VDATGTID_INVALID 0xFFFF
259 #define VDADEVFEAT_ENC_SERV 0x0001
260 #define VDADEVFEAT_IDENT 0x0002
261 #define VDADEVFEAT_DH_SUPP 0x0004
262 #define VDADEVFEAT_PHYS_ID 0x0008
266 #define VDALINKSPEED_UNKNOWN 0x00
267 #define VDALINKSPEED_1GB 0x01
268 #define VDALINKSPEED_1_5GB 0x02
269 #define VDALINKSPEED_2GB 0x03
270 #define VDALINKSPEED_3GB 0x04
271 #define VDALINKSPEED_4GB 0x05
272 #define VDALINKSPEED_6GB 0x06
273 #define VDALINKSPEED_8GB 0x07
280 /*! struct atto_vda_devinfo2 is a replacement for atto_vda_devinfo. it
281 * extends beyond the 0x70 bytes allowed in atto_vda_mgmt_req; therefore,
282 * the entire structure is DMaed between the firmware and host buffer and
283 * the data will always be in little endian format.
286 struct __packed atto_vda_devinfo2
{
287 struct atto_dev_addr dev_addr
;
313 /* This is where fields specific to struct atto_vda_devinfo2 begin. Note
314 * that the structure version started at one so applications that unionize this
315 * structure with atto_vda_dev_info can differentiate them if desired.
319 #define VDADEVINFO_VERSION0 0x00
320 #define VDADEVINFO_VERSION1 0x01
321 #define VDADEVINFO_VERSION2 0x02
322 #define VDADEVINFO_VERSION3 0x03
323 #define VDADEVINFO_VERSION VDADEVINFO_VERSION3
327 /* sector scanning fields */
337 /* grp_name was added in version 2 of this structure. */
342 /* dev_addr_list was added in version 3 of this structure. */
345 struct atto_dev_addr2 dev_addr_list
[8];
349 struct __packed atto_vda_grp_info
{
351 #define VDA_MAX_RAID_GROUPS 32
358 #define VDA_GRP_TYPE_RAID0 0
359 #define VDA_GRP_TYPE_RAID1 1
360 #define VDA_GRP_TYPE_RAID4 4
361 #define VDA_GRP_TYPE_RAID5 5
362 #define VDA_GRP_TYPE_RAID6 6
363 #define VDA_GRP_TYPE_RAID10 10
364 #define VDA_GRP_TYPE_RAID40 40
365 #define VDA_GRP_TYPE_RAID50 50
366 #define VDA_GRP_TYPE_RAID60 60
367 #define VDA_GRP_TYPE_DVRAID_HS 252
368 #define VDA_GRP_TYPE_DVRAID_NOHS 253
369 #define VDA_GRP_TYPE_JBOD 254
370 #define VDA_GRP_TYPE_SPARE 255
374 #define VDA_GRP_STAT_INVALID 0x00
375 #define VDA_GRP_STAT_NEW 0x01
376 #define VDA_GRP_STAT_WAITING 0x02
377 #define VDA_GRP_STAT_ONLINE 0x03
378 #define VDA_GRP_STAT_DEGRADED 0x04
379 #define VDA_GRP_STAT_OFFLINE 0x05
380 #define VDA_GRP_STAT_DELETED 0x06
381 #define VDA_GRP_STAT_RECOV_BASIC 0x07
382 #define VDA_GRP_STAT_RECOV_EXTREME 0x08
385 #define VDA_GRP_OP_CTRL_START 0x01
386 #define VDA_GRP_OP_CTRL_HALT 0x02
387 #define VDA_GRP_OP_CTRL_RESUME 0x03
388 #define VDA_GRP_OP_CTRL_CANCEL 0x04
392 #define VDA_RBLD_NONE 0x00
393 #define VDA_RBLD_REBUILD 0x01
394 #define VDA_RBLD_ERASE 0x02
395 #define VDA_RBLD_PATTERN 0x03
396 #define VDA_RBLD_CONV 0x04
397 #define VDA_RBLD_FULL_INIT 0x05
398 #define VDA_RBLD_QUICK_INIT 0x06
399 #define VDA_RBLD_SECT_SCAN 0x07
400 #define VDA_RBLD_SECT_SCAN_PARITY 0x08
401 #define VDA_RBLD_SECT_SCAN_PARITY_FIX 0x09
402 #define VDA_RBLD_RECOV_REBUILD 0x0A
403 #define VDA_RBLD_RECOV_BASIC 0x0B
404 #define VDA_RBLD_RECOV_EXTREME 0x0C
414 #define VDA_MEMBER_MISSING 0xFFFF
415 #define VDA_MEMBER_NEW 0xFFFE
420 #define VDA_GRP_FEAT_HOTSWAP 0x0001
421 #define VDA_GRP_FEAT_SPDRD_MASK 0x0006
422 #define VDA_GRP_FEAT_SPDRD_DIS 0x0000
423 #define VDA_GRP_FEAT_SPDRD_ENB 0x0002
424 #define VDA_GRP_FEAT_SPDRD_AUTO 0x0004
425 #define VDA_GRP_FEAT_IDENT 0x0008
426 #define VDA_GRP_FEAT_RBLDPRI_MASK 0x0030
427 #define VDA_GRP_FEAT_RBLDPRI_LOW 0x0010
428 #define VDA_GRP_FEAT_RBLDPRI_SAME 0x0020
429 #define VDA_GRP_FEAT_RBLDPRI_HIGH 0x0030
430 #define VDA_GRP_FEAT_WRITE_CACHE 0x0040
431 #define VDA_GRP_FEAT_RBLD_RESUME 0x0080
432 #define VDA_GRP_FEAT_SECT_RESUME 0x0100
433 #define VDA_GRP_FEAT_INIT_RESUME 0x0200
434 #define VDA_GRP_FEAT_SSD 0x0400
435 #define VDA_GRP_FEAT_BOOT_DEV 0x0800
438 * for backward compatibility, a prefetch value of zero means the
439 * setting is ignored/unsupported. therefore, the firmware supported
440 * 0-6 values are incremented to 1-7.
445 #define VDAGRPOPSTAT_MASK 0x0F
446 #define VDAGRPOPSTAT_INVALID 0x00
447 #define VDAGRPOPSTAT_OK 0x01
448 #define VDAGRPOPSTAT_FAULTED 0x02
449 #define VDAGRPOPSTAT_HALTED 0x03
450 #define VDAGRPOPSTAT_INT 0x04
451 #define VDAGRPOPPROC_MASK 0xF0
452 #define VDAGRPOPPROC_STARTABLE 0x10
453 #define VDAGRPOPPROC_CANCELABLE 0x20
454 #define VDAGRPOPPROC_RESUMABLE 0x40
455 #define VDAGRPOPPROC_HALTABLE 0x80
462 struct __packed atto_vdapart_info
{
464 #define VDA_MAX_PARTITIONS 128
474 #define VDAPI_FEAT_WRITE_CACHE 0x01
480 struct __packed atto_vda_dh_info
{
482 #define VDADH_RQTYPE_CACHE 0x01
483 #define VDADH_RQTYPE_FETCH 0x02
484 #define VDADH_RQTYPE_SET_STAT 0x03
485 #define VDADH_RQTYPE_GET_STAT 0x04
488 #define VDADH_RQQUAL_SMART 0x01
489 #define VDADH_RQQUAL_MEDDEF 0x02
490 #define VDADH_RQQUAL_INFOEXC 0x04
492 u8 num_smart_attribs
;
494 #define VDADH_STAT_DISABLE 0x00
495 #define VDADH_STAT_ENABLE 0x01
500 #define VDADH_SMARTSTAT_OK 0x00
501 #define VDADH_SMARTSTAT_ERR 0x01
504 struct atto_vda_sge sge
[1];
508 struct __packed atto_vda_dh_smart
{
514 u8 raw_attrib_status
;
515 #define VDADHSM_RAWSTAT_PREFAIL_WARRANTY 0x01
516 #define VDADHSM_RAWSTAT_ONLINE_COLLECTION 0x02
517 #define VDADHSM_RAWSTAT_PERFORMANCE_ATTR 0x04
518 #define VDADHSM_RAWSTAT_ERROR_RATE_ATTR 0x08
519 #define VDADHSM_RAWSTAT_EVENT_COUNT_ATTR 0x10
520 #define VDADHSM_RAWSTAT_SELF_PRESERVING_ATTR 0x20
522 u8 calc_attrib_status
;
523 #define VDADHSM_CALCSTAT_UNKNOWN 0x00
524 #define VDADHSM_CALCSTAT_GOOD 0x01
525 #define VDADHSM_CALCSTAT_PREFAIL 0x02
526 #define VDADHSM_CALCSTAT_OLDAGE 0x03
532 struct __packed atto_vda_metrics_info
{
534 #define VDAMET_VERSION0 0x00
535 #define VDAMET_VERSION VDAMET_VERSION0
538 #define VDAMET_METACT_NONE 0x00
539 #define VDAMET_METACT_START 0x01
540 #define VDAMET_METACT_STOP 0x02
541 #define VDAMET_METACT_RETRIEVE 0x03
542 #define VDAMET_METACT_CLEAR 0x04
545 #define VDAMET_TSTACT_NONE 0x00
546 #define VDAMET_TSTACT_STRT_INIT 0x01
547 #define VDAMET_TSTACT_STRT_READ 0x02
548 #define VDAMET_TSTACT_STRT_VERIFY 0x03
549 #define VDAMET_TSTACT_STRT_INIT_VERIFY 0x04
550 #define VDAMET_TSTACT_STOP 0x05
553 #define VDAMET_ALL_DEVICES 0xFF
557 struct atto_vda_sge sge
[1];
561 struct __packed atto_vda_metrics_data
{
564 #define VDAMD_LEN_LAST 0x8000
565 #define VDAMD_LEN_MASK 0x0FFF
568 #define VDAMDF_RUN 0x00000007
569 #define VDAMDF_RUN_READ 0x00000001
570 #define VDAMDF_RUN_WRITE 0x00000002
571 #define VDAMDF_RUN_ALL 0x00000004
572 #define VDAMDF_READ 0x00000010
573 #define VDAMDF_WRITE 0x00000020
574 #define VDAMDF_ALL 0x00000040
575 #define VDAMDF_DRIVETEST 0x40000000
576 #define VDAMDF_NEW 0x80000000
579 u64 total_write_data
;
584 u64 write_start_time
;
587 u64 wpvdadmetricsdatarite_maxio_time
;
588 u64 read_totalio_time
;
589 u64 write_totalio_time
;
591 u64 write_total_errs
;
592 u64 read_recvrd_errs
;
593 u64 write_recvrd_errs
;
598 struct __packed atto_vda_schedule_info
{
600 #define VDASI_SCHTYPE_ONETIME 0x01
601 #define VDASI_SCHTYPE_DAILY 0x02
602 #define VDASI_SCHTYPE_WEEKLY 0x03
605 #define VDASI_OP_NONE 0x00
606 #define VDASI_OP_CREATE 0x01
607 #define VDASI_OP_CANCEL 0x02
612 #define VDASI_DAY_NONE 0x00
615 #define VDASI_PROG_NONE 0xFF
618 #define VDASI_EVTTYPE_SECT_SCAN 0x01
619 #define VDASI_EVTTYPE_SECT_SCAN_PARITY 0x02
620 #define VDASI_EVTTYPE_SECT_SCAN_PARITY_FIX 0x03
623 #define VDASI_RECUR_FOREVER 0x00
626 #define VDASI_ID_NONE 0x00
633 struct __packed atto_vda_n_vcache_info
{
635 #define VDANVCI_SUPERCAP_NOT_PRESENT 0x00
636 #define VDANVCI_SUPERCAP_FULLY_CHARGED 0x01
637 #define VDANVCI_SUPERCAP_NOT_CHARGED 0x02
639 u8 nvcache_module_status
;
640 #define VDANVCI_NVCACHEMODULE_NOT_PRESENT 0x00
641 #define VDANVCI_NVCACHEMODULE_PRESENT 0x01
644 #define VDANVCI_PROTMODE_HI_PROTECT 0x00
645 #define VDANVCI_PROTMODE_HI_PERFORM 0x01
651 struct __packed atto_vda_buzzer_info
{
653 #define VDABUZZI_BUZZER_OFF 0x00
654 #define VDABUZZI_BUZZER_ON 0x01
655 #define VDABUZZI_BUZZER_LAST 0x02
659 #define VDABUZZI_DURATION_INDEFINITE 0xffffffff
665 struct __packed atto_vda_adapter_info
{
667 #define VDAADAPINFO_VERSION0 0x00
668 #define VDAADAPINFO_VERSION VDAADAPINFO_VERSION0
671 signed short utc_offset
;
674 #define VDA_ADAP_FEAT_IDENT 0x0001
675 #define VDA_ADAP_FEAT_BUZZ_ERR 0x0002
676 #define VDA_ADAP_FEAT_UTC_TIME 0x0004
679 char active_config
[33];
686 struct __packed atto_vda_temp_info
{
693 #define VDA_TEMP_TYPE_CPU 1
699 struct __packed atto_vda_fan_info
{
702 #define VDA_FAN_STAT_UNKNOWN 0
703 #define VDA_FAN_STAT_NORMAL 1
704 #define VDA_FAN_STAT_FAIL 2
706 u16 crit_pvdafaninfothreshold
;
713 /* VDA management commands */
715 #define VDAMGT_DEV_SCAN 0x00
716 #define VDAMGT_DEV_INFO 0x01
717 #define VDAMGT_DEV_CLEAN 0x02
718 #define VDAMGT_DEV_IDENTIFY 0x03
719 #define VDAMGT_DEV_IDENTSTOP 0x04
720 #define VDAMGT_DEV_PT_INFO 0x05
721 #define VDAMGT_DEV_FEATURES 0x06
722 #define VDAMGT_DEV_PT_FEATURES 0x07
723 #define VDAMGT_DEV_HEALTH_REQ 0x08
724 #define VDAMGT_DEV_METRICS 0x09
725 #define VDAMGT_DEV_INFO2 0x0A
726 #define VDAMGT_DEV_OPERATION 0x0B
727 #define VDAMGT_DEV_INFO2_BYADDR 0x0C
728 #define VDAMGT_GRP_INFO 0x10
729 #define VDAMGT_GRP_CREATE 0x11
730 #define VDAMGT_GRP_DELETE 0x12
731 #define VDAMGT_ADD_STORAGE 0x13
732 #define VDAMGT_MEMBER_ADD 0x14
733 #define VDAMGT_GRP_COMMIT 0x15
734 #define VDAMGT_GRP_REBUILD 0x16
735 #define VDAMGT_GRP_COMMIT_INIT 0x17
736 #define VDAMGT_QUICK_RAID 0x18
737 #define VDAMGT_GRP_FEATURES 0x19
738 #define VDAMGT_GRP_COMMIT_INIT_AUTOMAP 0x1A
739 #define VDAMGT_QUICK_RAID_INIT_AUTOMAP 0x1B
740 #define VDAMGT_GRP_OPERATION 0x1C
741 #define VDAMGT_CFG_SAVE 0x20
742 #define VDAMGT_LAST_ERROR 0x21
743 #define VDAMGT_ADAP_INFO 0x22
744 #define VDAMGT_ADAP_FEATURES 0x23
745 #define VDAMGT_TEMP_INFO 0x24
746 #define VDAMGT_FAN_INFO 0x25
747 #define VDAMGT_PART_INFO 0x30
748 #define VDAMGT_PART_MAP 0x31
749 #define VDAMGT_PART_UNMAP 0x32
750 #define VDAMGT_PART_AUTOMAP 0x33
751 #define VDAMGT_PART_SPLIT 0x34
752 #define VDAMGT_PART_MERGE 0x35
753 #define VDAMGT_SPARE_LIST 0x40
754 #define VDAMGT_SPARE_ADD 0x41
755 #define VDAMGT_SPARE_REMOVE 0x42
756 #define VDAMGT_LOCAL_SPARE_ADD 0x43
757 #define VDAMGT_SCHEDULE_EVENT 0x50
758 #define VDAMGT_SCHEDULE_INFO 0x51
759 #define VDAMGT_NVCACHE_INFO 0x60
760 #define VDAMGT_NVCACHE_SET 0x61
761 #define VDAMGT_BUZZER_INFO 0x70
762 #define VDAMGT_BUZZER_SET 0x71
765 struct __packed atto_vda_ae_hdr
{
768 #define VDAAE_HDRF_EVENT_ACK 0x01
771 #define VDAAE_HDR_VER_0 0
774 #define VDAAE_HDR_TYPE_RAID 1
775 #define VDAAE_HDR_TYPE_LU 2
776 #define VDAAE_HDR_TYPE_DISK 3
777 #define VDAAE_HDR_TYPE_RESET 4
778 #define VDAAE_HDR_TYPE_LOG_INFO 5
779 #define VDAAE_HDR_TYPE_LOG_WARN 6
780 #define VDAAE_HDR_TYPE_LOG_CRIT 7
781 #define VDAAE_HDR_TYPE_LOG_FAIL 8
782 #define VDAAE_HDR_TYPE_NVC 9
783 #define VDAAE_HDR_TYPE_TLG_INFO 10
784 #define VDAAE_HDR_TYPE_TLG_WARN 11
785 #define VDAAE_HDR_TYPE_TLG_CRIT 12
786 #define VDAAE_HDR_TYPE_PWRMGT 13
787 #define VDAAE_HDR_TYPE_MUTE 14
788 #define VDAAE_HDR_TYPE_DEV 15
792 struct __packed atto_vda_ae_raid
{
793 struct atto_vda_ae_hdr hdr
;
795 #define VDAAE_GROUP_STATE 0x00000001
796 #define VDAAE_RBLD_STATE 0x00000002
797 #define VDAAE_RBLD_PROG 0x00000004
798 #define VDAAE_MEMBER_CHG 0x00000008
799 #define VDAAE_PART_CHG 0x00000010
800 #define VDAAE_MEM_STATE_CHG 0x00000020
803 #define VDAAE_RAID_INVALID 0
804 #define VDAAE_RAID_NEW 1
805 #define VDAAE_RAID_WAITING 2
806 #define VDAAE_RAID_ONLINE 3
807 #define VDAAE_RAID_DEGRADED 4
808 #define VDAAE_RAID_OFFLINE 5
809 #define VDAAE_RAID_DELETED 6
810 #define VDAAE_RAID_BASIC 7
811 #define VDAAE_RAID_EXTREME 8
812 #define VDAAE_RAID_UNKNOWN 9
815 #define VDAAE_RBLD_NONE 0
816 #define VDAAE_RBLD_REBUILD 1
817 #define VDAAE_RBLD_ERASE 2
818 #define VDAAE_RBLD_PATTERN 3
819 #define VDAAE_RBLD_CONV 4
820 #define VDAAE_RBLD_FULL_INIT 5
821 #define VDAAE_RBLD_QUICK_INIT 6
822 #define VDAAE_RBLD_SECT_SCAN 7
823 #define VDAAE_RBLD_SECT_SCAN_PARITY 8
824 #define VDAAE_RBLD_SECT_SCAN_PARITY_FIX 9
825 #define VDAAE_RBLD_RECOV_REBUILD 10
826 #define VDAAE_RBLD_UNKNOWN 11
828 u8 byrebuild_progress
;
830 #define VDAAE_GRPOPSTAT_MASK 0x0F
831 #define VDAAE_GRPOPSTAT_INVALID 0x00
832 #define VDAAE_GRPOPSTAT_OK 0x01
833 #define VDAAE_GRPOPSTAT_FAULTED 0x02
834 #define VDAAE_GRPOPSTAT_HALTED 0x03
835 #define VDAAE_GRPOPSTAT_INT 0x04
836 #define VDAAE_GRPOPPROC_MASK 0xF0
837 #define VDAAE_GRPOPPROC_STARTABLE 0x10
838 #define VDAAE_GRPOPPROC_CANCELABLE 0x20
839 #define VDAAE_GRPOPPROC_RESUMABLE 0x40
840 #define VDAAE_GRPOPPROC_HALTABLE 0x80
843 u8 byreserved2
[0x80 - 0x1C];
847 struct __packed atto_vda_ae_lu_tgt_lun
{
854 struct __packed atto_vda_ae_lu_tgt_lun_raid
{
863 struct __packed atto_vda_ae_lu
{
864 struct atto_vda_ae_hdr hdr
;
866 #define VDAAE_LU_DISC 0x00000001
867 #define VDAAE_LU_LOST 0x00000002
868 #define VDAAE_LU_STATE 0x00000004
869 #define VDAAE_LU_PASSTHROUGH 0x10000000
870 #define VDAAE_LU_PHYS_ID 0x20000000
873 #define VDAAE_LU_UNDEFINED 0
874 #define VDAAE_LU_NOT_PRESENT 1
875 #define VDAAE_LU_OFFLINE 2
876 #define VDAAE_LU_ONLINE 3
877 #define VDAAE_LU_DEGRADED 4
878 #define VDAAE_LU_FACTORY_DISABLED 5
879 #define VDAAE_LU_DELETED 6
880 #define VDAAE_LU_BUSSCAN 7
881 #define VDAAE_LU_UNKNOWN 8
887 struct atto_vda_ae_lu_tgt_lun tgtlun
;
888 struct atto_vda_ae_lu_tgt_lun_raid tgtlun_raid
;
893 struct __packed atto_vda_ae_disk
{
894 struct atto_vda_ae_hdr hdr
;
898 #define VDAAE_LOG_STRSZ 64
900 struct __packed atto_vda_ae_log
{
901 struct atto_vda_ae_hdr hdr
;
902 char aclog_ascii
[VDAAE_LOG_STRSZ
];
906 #define VDAAE_TLG_STRSZ 56
908 struct __packed atto_vda_ae_timestamp_log
{
909 struct atto_vda_ae_hdr hdr
;
911 char aclog_ascii
[VDAAE_TLG_STRSZ
];
915 struct __packed atto_vda_ae_nvc
{
916 struct atto_vda_ae_hdr hdr
;
920 struct __packed atto_vda_ae_dev
{
921 struct atto_vda_ae_hdr hdr
;
922 struct atto_dev_addr devaddr
;
927 struct atto_vda_ae_hdr hdr
;
928 struct atto_vda_ae_disk disk
;
929 struct atto_vda_ae_lu lu
;
930 struct atto_vda_ae_raid raid
;
931 struct atto_vda_ae_log log
;
932 struct atto_vda_ae_timestamp_log tslog
;
933 struct atto_vda_ae_nvc nvcache
;
934 struct atto_vda_ae_dev dev
;
938 struct __packed atto_vda_date_and_time
{
940 #define VDA_DT_DAY_MASK 0x07
941 #define VDA_DT_DAY_NONE 0x00
942 #define VDA_DT_DAY_SUN 0x01
943 #define VDA_DT_DAY_MON 0x02
944 #define VDA_DT_DAY_TUE 0x03
945 #define VDA_DT_DAY_WED 0x04
946 #define VDA_DT_DAY_THU 0x05
947 #define VDA_DT_DAY_FRI 0x06
948 #define VDA_DT_DAY_SAT 0x07
949 #define VDA_DT_PM 0x40
950 #define VDA_DT_MILITARY 0x80
960 #define SGE_LEN_LIMIT 0x003FFFFF /*! mask of segment length */
961 #define SGE_LEN_MAX 0x003FF000 /*! maximum segment length */
962 #define SGE_LAST 0x01000000 /*! last entry */
963 #define SGE_ADDR_64 0x04000000 /*! 64-bit addressing flag */
964 #define SGE_CHAIN 0x80000000 /*! chain descriptor flag */
965 #define SGE_CHAIN_LEN 0x0000FFFF /*! mask of length in chain entries */
966 #define SGE_CHAIN_SZ 0x00FF0000 /*! mask of size of chained buffer */
969 struct __packed atto_vda_cfg_init
{
970 struct atto_vda_date_and_time date_time
;
978 #define VDA_ITF_MEM_RW 0x00000001
979 #define VDA_ITF_TRACE 0x00000002
980 #define VDA_ITF_SCSI_PASS_THRU 0x00000004
981 #define VDA_ITF_GET_DEV_ADDR 0x00000008
982 #define VDA_ITF_PHY_CTRL 0x00000010
983 #define VDA_ITF_CONN_CTRL 0x00000020
984 #define VDA_ITF_GET_DEV_INFO 0x00000040
986 u32 num_targets_backend
;
991 /* configuration commands */
993 #define VDA_CFG_INIT 0x00
994 #define VDA_CFG_GET_INIT 0x01
995 #define VDA_CFG_GET_INIT2 0x02
998 /*! physical region descriptor (PRD) aka scatter/gather entry */
1000 struct __packed atto_physical_region_description
{
1003 #define PRD_LEN_LIMIT 0x003FFFFF
1004 #define PRD_LEN_MAX 0x003FF000
1005 #define PRD_NXT_PRD_CNT 0x0000007F
1006 #define PRD_CHAIN 0x01000000
1007 #define PRD_DATA 0x00000000
1008 #define PRD_INT_SEL 0xF0000000
1009 #define PRD_INT_SEL_F0 0x00000000
1010 #define PRD_INT_SEL_F1 0x40000000
1011 #define PRD_INT_SEL_F2 0x80000000
1012 #define PRD_INT_SEL_F3 0xc0000000
1013 #define PRD_INT_SEL_SRAM 0x10000000
1014 #define PRD_INT_SEL_PBSR 0x20000000
1018 /* Request types. NOTE that ALL requests have the same layout for the first
1021 struct __packed atto_vda_req_header
{
1031 #define FCP_CDB_SIZE 16
1033 struct __packed atto_vda_scsi_req
{
1035 u8 function
; /* VDA_FUNC_SCSI */
1041 #define FCP_CMND_LUN_MASK 0x000000FF
1042 #define FCP_CMND_TA_MASK 0x00000700
1043 #define FCP_CMND_TA_SIMPL_Q 0x00000000
1044 #define FCP_CMND_TA_HEAD_Q 0x00000100
1045 #define FCP_CMND_TA_ORDRD_Q 0x00000200
1046 #define FCP_CMND_TA_ACA 0x00000400
1047 #define FCP_CMND_PRI_MASK 0x00007800
1048 #define FCP_CMND_TM_MASK 0x00FF0000
1049 #define FCP_CMND_ATS 0x00020000
1050 #define FCP_CMND_CTS 0x00040000
1051 #define FCP_CMND_LRS 0x00100000
1052 #define FCP_CMND_TRS 0x00200000
1053 #define FCP_CMND_CLA 0x00400000
1054 #define FCP_CMND_TRM 0x00800000
1055 #define FCP_CMND_DATA_DIR 0x03000000
1056 #define FCP_CMND_WRD 0x01000000
1057 #define FCP_CMND_RDD 0x02000000
1059 u8 cdb
[FCP_CDB_SIZE
];
1068 struct atto_physical_region_description sense_buff_prd
;
1072 struct atto_vda_sge sge
[1];
1076 struct atto_physical_region_description prd
[1];
1081 struct __packed atto_vda_flash_req
{
1083 u8 function
; /* VDA_FUNC_FLASH */
1094 char file_name
[16]; /* 8.3 fname, NULL term, wc=* */
1095 struct atto_vda_sge sge
[1];
1098 struct atto_vda_sge sge
[1];
1099 struct atto_physical_region_description prde
[2];
1104 struct __packed atto_vda_diag_req
{
1106 u8 function
; /* VDA_FUNC_DIAG */
1108 #define VDA_DIAG_STATUS 0x00
1109 #define VDA_DIAG_RESET 0x01
1110 #define VDA_DIAG_PAUSE 0x02
1111 #define VDA_DIAG_RESUME 0x03
1112 #define VDA_DIAG_READ 0x04
1113 #define VDA_DIAG_WRITE 0x05
1120 struct atto_vda_sge sge
[1];
1124 struct __packed atto_vda_ae_req
{
1126 u8 function
; /* VDA_FUNC_AE */
1133 struct atto_vda_sge sge
[1];
1134 struct atto_physical_region_description prde
[1];
1139 struct __packed atto_vda_cli_req
{
1141 u8 function
; /* VDA_FUNC_CLI */
1147 struct atto_vda_sge sge
[1];
1151 struct __packed atto_vda_ioctl_req
{
1153 u8 function
; /* VDA_FUNC_IOCTL */
1160 struct atto_vda_sge reserved_sge
;
1161 struct atto_physical_region_description reserved_prde
;
1174 struct atto_vda_sge sge
[1];
1175 struct atto_physical_region_description prde
[1];
1180 struct __packed atto_vda_cfg_req
{
1182 u8 function
; /* VDA_FUNC_CFG */
1190 struct atto_vda_cfg_init init
;
1191 struct atto_vda_sge sge
;
1192 struct atto_physical_region_description prde
;
1197 struct __packed atto_vda_mgmt_req
{
1199 u8 function
; /* VDA_FUNC_MGT */
1205 u8 payld_sglst_offset
;
1210 struct atto_vda_sge sge
[2];
1211 struct atto_physical_region_description prde
[2];
1213 struct atto_vda_sge payld_sge
[1];
1217 union atto_vda_req
{
1218 struct atto_vda_scsi_req scsi
;
1219 struct atto_vda_flash_req flash
;
1220 struct atto_vda_diag_req diag
;
1221 struct atto_vda_ae_req ae
;
1222 struct atto_vda_cli_req cli
;
1223 struct atto_vda_ioctl_req ioctl
;
1224 struct atto_vda_cfg_req cfg
;
1225 struct atto_vda_mgmt_req mgt
;
1229 /* Outbound response structures */
1231 struct __packed atto_vda_scsi_rsp
{
1235 u32 residual_length
;
1238 struct __packed atto_vda_flash_rsp
{
1242 struct __packed atto_vda_ae_rsp
{
1246 struct __packed atto_vda_cli_rsp
{
1250 struct __packed atto_vda_ioctl_rsp
{
1261 struct __packed atto_vda_cfg_rsp
{
1267 struct __packed atto_vda_mgmt_rsp
{
1273 union atto_vda_func_rsp
{
1274 struct atto_vda_scsi_rsp scsi_rsp
;
1275 struct atto_vda_flash_rsp flash_rsp
;
1276 struct atto_vda_ae_rsp ae_rsp
;
1277 struct atto_vda_cli_rsp cli_rsp
;
1278 struct atto_vda_ioctl_rsp ioctl_rsp
;
1279 struct atto_vda_cfg_rsp cfg_rsp
;
1280 struct atto_vda_mgmt_rsp mgt_rsp
;
1284 struct __packed atto_vda_ob_rsp
{
1289 union atto_vda_func_rsp
1293 struct __packed atto_vda_ae_data
{
1297 struct __packed atto_vda_mgmt_data
{
1300 struct atto_vda_devinfo dev_info
;
1301 struct atto_vda_grp_info grp_info
;
1302 struct atto_vdapart_info part_info
;
1303 struct atto_vda_dh_info dev_health_info
;
1304 struct atto_vda_metrics_info metrics_info
;
1305 struct atto_vda_schedule_info sched_info
;
1306 struct atto_vda_n_vcache_info nvcache_info
;
1307 struct atto_vda_buzzer_info buzzer_info
;
1311 union atto_vda_rsp_data
{
1312 struct atto_vda_ae_data ae_data
;
1313 struct atto_vda_mgmt_data mgt_data
;
1315 #define SENSE_DATA_SZ 252;