18c2ecf20Sopenharmony_ci/*  linux/drivers/scsi/esas2r/atvda.h
28c2ecf20Sopenharmony_ci *       ATTO VDA interface definitions
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *  Copyright (c) 2001-2013 ATTO Technology, Inc.
58c2ecf20Sopenharmony_ci *  (mailto:linuxdrivers@attotech.com)
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci *  This program is free software; you can redistribute it and/or modify
108c2ecf20Sopenharmony_ci *  it under the terms of the GNU General Public License as published by
118c2ecf20Sopenharmony_ci *  the Free Software Foundation; version 2 of the License.
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci *  This program is distributed in the hope that it will be useful,
148c2ecf20Sopenharmony_ci *  but WITHOUT ANY WARRANTY; without even the implied warranty of
158c2ecf20Sopenharmony_ci *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
168c2ecf20Sopenharmony_ci *  GNU General Public License for more details.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci *  NO WARRANTY
198c2ecf20Sopenharmony_ci *  THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
208c2ecf20Sopenharmony_ci *  CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
218c2ecf20Sopenharmony_ci *  LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
228c2ecf20Sopenharmony_ci *  MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
238c2ecf20Sopenharmony_ci *  solely responsible for determining the appropriateness of using and
248c2ecf20Sopenharmony_ci *  distributing the Program and assumes all risks associated with its
258c2ecf20Sopenharmony_ci *  exercise of rights under this Agreement, including but not limited to
268c2ecf20Sopenharmony_ci *  the risks and costs of program errors, damage to or loss of data,
278c2ecf20Sopenharmony_ci *  programs or equipment, and unavailability or interruption of operations.
288c2ecf20Sopenharmony_ci *
298c2ecf20Sopenharmony_ci *  DISCLAIMER OF LIABILITY
308c2ecf20Sopenharmony_ci *  NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
318c2ecf20Sopenharmony_ci *  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
328c2ecf20Sopenharmony_ci *  DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
338c2ecf20Sopenharmony_ci *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
348c2ecf20Sopenharmony_ci *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
358c2ecf20Sopenharmony_ci *  USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
368c2ecf20Sopenharmony_ci *  HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
378c2ecf20Sopenharmony_ci *
388c2ecf20Sopenharmony_ci *  You should have received a copy of the GNU General Public License
398c2ecf20Sopenharmony_ci *  along with this program; if not, write to the Free Software
408c2ecf20Sopenharmony_ci *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
418c2ecf20Sopenharmony_ci */
428c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#ifndef ATVDA_H
468c2ecf20Sopenharmony_ci#define ATVDA_H
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistruct __packed atto_dev_addr {
498c2ecf20Sopenharmony_ci	u64 dev_port;
508c2ecf20Sopenharmony_ci	u64 hba_port;
518c2ecf20Sopenharmony_ci	u8 lun;
528c2ecf20Sopenharmony_ci	u8 flags;
538c2ecf20Sopenharmony_ci	   #define VDA_DEVADDRF_SATA   0x01
548c2ecf20Sopenharmony_ci	   #define VDA_DEVADDRF_SSD    0x02
558c2ecf20Sopenharmony_ci	u8 link_speed; /* VDALINKSPEED_xxx */
568c2ecf20Sopenharmony_ci	u8 pad[1];
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* dev_addr2 was added for 64-bit alignment */
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistruct __packed atto_dev_addr2 {
628c2ecf20Sopenharmony_ci	u64 dev_port;
638c2ecf20Sopenharmony_ci	u64 hba_port;
648c2ecf20Sopenharmony_ci	u8 lun;
658c2ecf20Sopenharmony_ci	u8 flags;
668c2ecf20Sopenharmony_ci	u8 link_speed;
678c2ecf20Sopenharmony_ci	u8 pad[5];
688c2ecf20Sopenharmony_ci};
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_cistruct __packed atto_vda_sge {
718c2ecf20Sopenharmony_ci	u32 length;
728c2ecf20Sopenharmony_ci	u64 address;
738c2ecf20Sopenharmony_ci};
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* VDA request function codes */
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define VDA_FUNC_SCSI     0x00
798c2ecf20Sopenharmony_ci#define VDA_FUNC_FLASH    0x01
808c2ecf20Sopenharmony_ci#define VDA_FUNC_DIAG     0x02
818c2ecf20Sopenharmony_ci#define VDA_FUNC_AE       0x03
828c2ecf20Sopenharmony_ci#define VDA_FUNC_CLI      0x04
838c2ecf20Sopenharmony_ci#define VDA_FUNC_IOCTL    0x05
848c2ecf20Sopenharmony_ci#define VDA_FUNC_CFG      0x06
858c2ecf20Sopenharmony_ci#define VDA_FUNC_MGT      0x07
868c2ecf20Sopenharmony_ci#define VDA_FUNC_GSV      0x08
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/* VDA request status values.  for host driver considerations, values for
908c2ecf20Sopenharmony_ci * SCSI requests start at zero.  other requests may use these values as well. */
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define RS_SUCCESS          0x00        /*! successful completion            */
938c2ecf20Sopenharmony_ci#define RS_INV_FUNC         0x01        /*! invalid command function         */
948c2ecf20Sopenharmony_ci#define RS_BUSY             0x02        /*! insufficient resources           */
958c2ecf20Sopenharmony_ci#define RS_SEL              0x03        /*! no target at target_id           */
968c2ecf20Sopenharmony_ci#define RS_NO_LUN           0x04        /*! invalid LUN                      */
978c2ecf20Sopenharmony_ci#define RS_TIMEOUT          0x05        /*! request timeout                  */
988c2ecf20Sopenharmony_ci#define RS_OVERRUN          0x06        /*! data overrun                     */
998c2ecf20Sopenharmony_ci#define RS_UNDERRUN         0x07        /*! data underrun                    */
1008c2ecf20Sopenharmony_ci#define RS_SCSI_ERROR       0x08        /*! SCSI error occurred              */
1018c2ecf20Sopenharmony_ci#define RS_ABORTED          0x0A        /*! command aborted                  */
1028c2ecf20Sopenharmony_ci#define RS_RESID_MISM       0x0B        /*! residual length incorrect        */
1038c2ecf20Sopenharmony_ci#define RS_TM_FAILED        0x0C        /*! task management failed           */
1048c2ecf20Sopenharmony_ci#define RS_RESET            0x0D        /*! aborted due to bus reset         */
1058c2ecf20Sopenharmony_ci#define RS_ERR_DMA_SG       0x0E        /*! error reading SG list            */
1068c2ecf20Sopenharmony_ci#define RS_ERR_DMA_DATA     0x0F        /*! error transferring data          */
1078c2ecf20Sopenharmony_ci#define RS_UNSUPPORTED      0x10        /*! unsupported request              */
1088c2ecf20Sopenharmony_ci#define RS_SEL2             0x70        /*! internal generated RS_SEL        */
1098c2ecf20Sopenharmony_ci#define RS_VDA_BASE         0x80        /*! base of VDA-specific errors      */
1108c2ecf20Sopenharmony_ci#define RS_MGT_BASE         0x80        /*! base of VDA management errors    */
1118c2ecf20Sopenharmony_ci#define RS_SCAN_FAIL        (RS_MGT_BASE + 0x00)
1128c2ecf20Sopenharmony_ci#define RS_DEV_INVALID      (RS_MGT_BASE + 0x01)
1138c2ecf20Sopenharmony_ci#define RS_DEV_ASSIGNED     (RS_MGT_BASE + 0x02)
1148c2ecf20Sopenharmony_ci#define RS_DEV_REMOVE       (RS_MGT_BASE + 0x03)
1158c2ecf20Sopenharmony_ci#define RS_DEV_LOST         (RS_MGT_BASE + 0x04)
1168c2ecf20Sopenharmony_ci#define RS_SCAN_GEN         (RS_MGT_BASE + 0x05)
1178c2ecf20Sopenharmony_ci#define RS_GRP_INVALID      (RS_MGT_BASE + 0x08)
1188c2ecf20Sopenharmony_ci#define RS_GRP_EXISTS       (RS_MGT_BASE + 0x09)
1198c2ecf20Sopenharmony_ci#define RS_GRP_LIMIT        (RS_MGT_BASE + 0x0A)
1208c2ecf20Sopenharmony_ci#define RS_GRP_INTLV        (RS_MGT_BASE + 0x0B)
1218c2ecf20Sopenharmony_ci#define RS_GRP_SPAN         (RS_MGT_BASE + 0x0C)
1228c2ecf20Sopenharmony_ci#define RS_GRP_TYPE         (RS_MGT_BASE + 0x0D)
1238c2ecf20Sopenharmony_ci#define RS_GRP_MEMBERS      (RS_MGT_BASE + 0x0E)
1248c2ecf20Sopenharmony_ci#define RS_GRP_COMMIT       (RS_MGT_BASE + 0x0F)
1258c2ecf20Sopenharmony_ci#define RS_GRP_REBUILD      (RS_MGT_BASE + 0x10)
1268c2ecf20Sopenharmony_ci#define RS_GRP_REBUILD_TYPE (RS_MGT_BASE + 0x11)
1278c2ecf20Sopenharmony_ci#define RS_GRP_BLOCK_SIZE   (RS_MGT_BASE + 0x12)
1288c2ecf20Sopenharmony_ci#define RS_CFG_SAVE         (RS_MGT_BASE + 0x14)
1298c2ecf20Sopenharmony_ci#define RS_PART_LAST        (RS_MGT_BASE + 0x18)
1308c2ecf20Sopenharmony_ci#define RS_ELEM_INVALID     (RS_MGT_BASE + 0x19)
1318c2ecf20Sopenharmony_ci#define RS_PART_MAPPED      (RS_MGT_BASE + 0x1A)
1328c2ecf20Sopenharmony_ci#define RS_PART_TARGET      (RS_MGT_BASE + 0x1B)
1338c2ecf20Sopenharmony_ci#define RS_PART_LUN         (RS_MGT_BASE + 0x1C)
1348c2ecf20Sopenharmony_ci#define RS_PART_DUP         (RS_MGT_BASE + 0x1D)
1358c2ecf20Sopenharmony_ci#define RS_PART_NOMAP       (RS_MGT_BASE + 0x1E)
1368c2ecf20Sopenharmony_ci#define RS_PART_MAX         (RS_MGT_BASE + 0x1F)
1378c2ecf20Sopenharmony_ci#define RS_PART_CAP         (RS_MGT_BASE + 0x20)
1388c2ecf20Sopenharmony_ci#define RS_PART_STATE       (RS_MGT_BASE + 0x21)
1398c2ecf20Sopenharmony_ci#define RS_TEST_IN_PROG     (RS_MGT_BASE + 0x22)
1408c2ecf20Sopenharmony_ci#define RS_METRICS_ERROR    (RS_MGT_BASE + 0x23)
1418c2ecf20Sopenharmony_ci#define RS_HS_ERROR         (RS_MGT_BASE + 0x24)
1428c2ecf20Sopenharmony_ci#define RS_NO_METRICS_TEST  (RS_MGT_BASE + 0x25)
1438c2ecf20Sopenharmony_ci#define RS_BAD_PARAM        (RS_MGT_BASE + 0x26)
1448c2ecf20Sopenharmony_ci#define RS_GRP_MEMBER_SIZE  (RS_MGT_BASE + 0x27)
1458c2ecf20Sopenharmony_ci#define RS_FLS_BASE         0xB0        /*! base of VDA errors               */
1468c2ecf20Sopenharmony_ci#define RS_FLS_ERR_AREA     (RS_FLS_BASE + 0x00)
1478c2ecf20Sopenharmony_ci#define RS_FLS_ERR_BUSY     (RS_FLS_BASE + 0x01)
1488c2ecf20Sopenharmony_ci#define RS_FLS_ERR_RANGE    (RS_FLS_BASE + 0x02)
1498c2ecf20Sopenharmony_ci#define RS_FLS_ERR_BEGIN    (RS_FLS_BASE + 0x03)
1508c2ecf20Sopenharmony_ci#define RS_FLS_ERR_CHECK    (RS_FLS_BASE + 0x04)
1518c2ecf20Sopenharmony_ci#define RS_FLS_ERR_FAIL     (RS_FLS_BASE + 0x05)
1528c2ecf20Sopenharmony_ci#define RS_FLS_ERR_RSRC     (RS_FLS_BASE + 0x06)
1538c2ecf20Sopenharmony_ci#define RS_FLS_ERR_NOFILE   (RS_FLS_BASE + 0x07)
1548c2ecf20Sopenharmony_ci#define RS_FLS_ERR_FSIZE    (RS_FLS_BASE + 0x08)
1558c2ecf20Sopenharmony_ci#define RS_CFG_BASE         0xC0        /*! base of VDA configuration errors */
1568c2ecf20Sopenharmony_ci#define RS_CFG_ERR_BUSY     (RS_CFG_BASE + 0)
1578c2ecf20Sopenharmony_ci#define RS_CFG_ERR_SGE      (RS_CFG_BASE + 1)
1588c2ecf20Sopenharmony_ci#define RS_CFG_ERR_DATE     (RS_CFG_BASE + 2)
1598c2ecf20Sopenharmony_ci#define RS_CFG_ERR_TIME     (RS_CFG_BASE + 3)
1608c2ecf20Sopenharmony_ci#define RS_DEGRADED         0xFB        /*! degraded mode                    */
1618c2ecf20Sopenharmony_ci#define RS_CLI_INTERNAL     0xFC        /*! VDA CLI internal error           */
1628c2ecf20Sopenharmony_ci#define RS_VDA_INTERNAL     0xFD        /*! catch-all                        */
1638c2ecf20Sopenharmony_ci#define RS_PENDING          0xFE        /*! pending, not started             */
1648c2ecf20Sopenharmony_ci#define RS_STARTED          0xFF        /*! started                          */
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/* flash request subfunctions.  these are used in both the IOCTL and the
1688c2ecf20Sopenharmony_ci * driver-firmware interface (VDA_FUNC_FLASH). */
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci#define VDA_FLASH_BEGINW  0x00
1718c2ecf20Sopenharmony_ci#define VDA_FLASH_READ    0x01
1728c2ecf20Sopenharmony_ci#define VDA_FLASH_WRITE   0x02
1738c2ecf20Sopenharmony_ci#define VDA_FLASH_COMMIT  0x03
1748c2ecf20Sopenharmony_ci#define VDA_FLASH_CANCEL  0x04
1758c2ecf20Sopenharmony_ci#define VDA_FLASH_INFO    0x05
1768c2ecf20Sopenharmony_ci#define VDA_FLASH_FREAD   0x06
1778c2ecf20Sopenharmony_ci#define VDA_FLASH_FWRITE  0x07
1788c2ecf20Sopenharmony_ci#define VDA_FLASH_FINFO   0x08
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* IOCTL request subfunctions.  these identify the payload type for
1828c2ecf20Sopenharmony_ci * VDA_FUNC_IOCTL.
1838c2ecf20Sopenharmony_ci */
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci#define VDA_IOCTL_HBA     0x00
1868c2ecf20Sopenharmony_ci#define VDA_IOCTL_CSMI    0x01
1878c2ecf20Sopenharmony_ci#define VDA_IOCTL_SMP     0x02
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_cistruct __packed atto_vda_devinfo {
1908c2ecf20Sopenharmony_ci	struct atto_dev_addr dev_addr;
1918c2ecf20Sopenharmony_ci	u8 vendor_id[8];
1928c2ecf20Sopenharmony_ci	u8 product_id[16];
1938c2ecf20Sopenharmony_ci	u8 revision[4];
1948c2ecf20Sopenharmony_ci	u64 capacity;
1958c2ecf20Sopenharmony_ci	u32 block_size;
1968c2ecf20Sopenharmony_ci	u8 dev_type;
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci	union {
1998c2ecf20Sopenharmony_ci		u8 dev_status;
2008c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_INVALID   0x00
2018c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_CORRUPT   VDADEVSTAT_INVALID
2028c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_ASSIGNED  0x01
2038c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_SPARE     0x02
2048c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_UNAVAIL   0x03
2058c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_PT_MAINT  0x04
2068c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_LCLSPARE  0x05
2078c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_UNUSEABLE 0x06
2088c2ecf20Sopenharmony_ci	    #define VDADEVSTAT_AVAIL     0xFF
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci		u8 op_ctrl;
2118c2ecf20Sopenharmony_ci	    #define VDA_DEV_OP_CTRL_START   0x01
2128c2ecf20Sopenharmony_ci	    #define VDA_DEV_OP_CTRL_HALT    0x02
2138c2ecf20Sopenharmony_ci	    #define VDA_DEV_OP_CTRL_RESUME  0x03
2148c2ecf20Sopenharmony_ci	    #define VDA_DEV_OP_CTRL_CANCEL  0x04
2158c2ecf20Sopenharmony_ci	};
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci	u8 member_state;
2188c2ecf20Sopenharmony_ci	#define VDAMBRSTATE_ONLINE   0x00
2198c2ecf20Sopenharmony_ci	#define VDAMBRSTATE_DEGRADED 0x01
2208c2ecf20Sopenharmony_ci	#define VDAMBRSTATE_UNAVAIL  0x02
2218c2ecf20Sopenharmony_ci	#define VDAMBRSTATE_FAULTED  0x03
2228c2ecf20Sopenharmony_ci	#define VDAMBRSTATE_MISREAD  0x04
2238c2ecf20Sopenharmony_ci	#define VDAMBRSTATE_INCOMPAT 0x05
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	u8 operation;
2268c2ecf20Sopenharmony_ci	#define VDAOP_NONE           0x00
2278c2ecf20Sopenharmony_ci	#define VDAOP_REBUILD        0x01
2288c2ecf20Sopenharmony_ci	#define VDAOP_ERASE          0x02
2298c2ecf20Sopenharmony_ci	#define VDAOP_PATTERN        0x03
2308c2ecf20Sopenharmony_ci	#define VDAOP_CONVERSION     0x04
2318c2ecf20Sopenharmony_ci	#define VDAOP_FULL_INIT      0x05
2328c2ecf20Sopenharmony_ci	#define VDAOP_QUICK_INIT     0x06
2338c2ecf20Sopenharmony_ci	#define VDAOP_SECT_SCAN      0x07
2348c2ecf20Sopenharmony_ci	#define VDAOP_SECT_SCAN_PARITY      0x08
2358c2ecf20Sopenharmony_ci	#define VDAOP_SECT_SCAN_PARITY_FIX  0x09
2368c2ecf20Sopenharmony_ci	#define VDAOP_RECOV_REBUILD  0x0A
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci	u8 op_status;
2398c2ecf20Sopenharmony_ci	#define VDAOPSTAT_OK         0x00
2408c2ecf20Sopenharmony_ci	#define VDAOPSTAT_FAULTED    0x01
2418c2ecf20Sopenharmony_ci	#define VDAOPSTAT_HALTED     0x02
2428c2ecf20Sopenharmony_ci	#define VDAOPSTAT_INT        0x03
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci	u8 progress; /* 0 - 100% */
2458c2ecf20Sopenharmony_ci	u16 ses_dev_index;
2468c2ecf20Sopenharmony_ci	#define VDASESDI_INVALID     0xFFFF
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci	u8 serial_no[32];
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci	union {
2518c2ecf20Sopenharmony_ci		u16 target_id;
2528c2ecf20Sopenharmony_ci	#define VDATGTID_INVALID     0xFFFF
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci		u16 features_mask;
2558c2ecf20Sopenharmony_ci	};
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	u16 lun;
2588c2ecf20Sopenharmony_ci	u16 features;
2598c2ecf20Sopenharmony_ci	#define VDADEVFEAT_ENC_SERV  0x0001
2608c2ecf20Sopenharmony_ci	#define VDADEVFEAT_IDENT     0x0002
2618c2ecf20Sopenharmony_ci	#define VDADEVFEAT_DH_SUPP   0x0004
2628c2ecf20Sopenharmony_ci	#define VDADEVFEAT_PHYS_ID   0x0008
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci	u8 ses_element_id;
2658c2ecf20Sopenharmony_ci	u8 link_speed;
2668c2ecf20Sopenharmony_ci	#define VDALINKSPEED_UNKNOWN 0x00
2678c2ecf20Sopenharmony_ci	#define VDALINKSPEED_1GB     0x01
2688c2ecf20Sopenharmony_ci	#define VDALINKSPEED_1_5GB   0x02
2698c2ecf20Sopenharmony_ci	#define VDALINKSPEED_2GB     0x03
2708c2ecf20Sopenharmony_ci	#define VDALINKSPEED_3GB     0x04
2718c2ecf20Sopenharmony_ci	#define VDALINKSPEED_4GB     0x05
2728c2ecf20Sopenharmony_ci	#define VDALINKSPEED_6GB     0x06
2738c2ecf20Sopenharmony_ci	#define VDALINKSPEED_8GB     0x07
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci	u16 phys_target_id;
2768c2ecf20Sopenharmony_ci	u8 reserved[2];
2778c2ecf20Sopenharmony_ci};
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci/*! struct atto_vda_devinfo2 is a replacement for atto_vda_devinfo.  it
2818c2ecf20Sopenharmony_ci * extends beyond the 0x70 bytes allowed in atto_vda_mgmt_req; therefore,
2828c2ecf20Sopenharmony_ci * the entire structure is DMaed between the firmware and host buffer and
2838c2ecf20Sopenharmony_ci * the data will always be in little endian format.
2848c2ecf20Sopenharmony_ci */
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_cistruct __packed atto_vda_devinfo2 {
2878c2ecf20Sopenharmony_ci	struct atto_dev_addr dev_addr;
2888c2ecf20Sopenharmony_ci	u8 vendor_id[8];
2898c2ecf20Sopenharmony_ci	u8 product_id[16];
2908c2ecf20Sopenharmony_ci	u8 revision[4];
2918c2ecf20Sopenharmony_ci	u64 capacity;
2928c2ecf20Sopenharmony_ci	u32 block_size;
2938c2ecf20Sopenharmony_ci	u8 dev_type;
2948c2ecf20Sopenharmony_ci	u8 dev_status;
2958c2ecf20Sopenharmony_ci	u8 member_state;
2968c2ecf20Sopenharmony_ci	u8 operation;
2978c2ecf20Sopenharmony_ci	u8 op_status;
2988c2ecf20Sopenharmony_ci	u8 progress;
2998c2ecf20Sopenharmony_ci	u16 ses_dev_index;
3008c2ecf20Sopenharmony_ci	u8 serial_no[32];
3018c2ecf20Sopenharmony_ci	union {
3028c2ecf20Sopenharmony_ci		u16 target_id;
3038c2ecf20Sopenharmony_ci		u16 features_mask;
3048c2ecf20Sopenharmony_ci	};
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci	u16 lun;
3078c2ecf20Sopenharmony_ci	u16 features;
3088c2ecf20Sopenharmony_ci	u8 ses_element_id;
3098c2ecf20Sopenharmony_ci	u8 link_speed;
3108c2ecf20Sopenharmony_ci	u16 phys_target_id;
3118c2ecf20Sopenharmony_ci	u8 reserved[2];
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci/* This is where fields specific to struct atto_vda_devinfo2 begin.  Note
3148c2ecf20Sopenharmony_ci * that the structure version started at one so applications that unionize this
3158c2ecf20Sopenharmony_ci * structure with atto_vda_dev_info can differentiate them if desired.
3168c2ecf20Sopenharmony_ci */
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci	u8 version;
3198c2ecf20Sopenharmony_ci	#define VDADEVINFO_VERSION0         0x00
3208c2ecf20Sopenharmony_ci	#define VDADEVINFO_VERSION1         0x01
3218c2ecf20Sopenharmony_ci	#define VDADEVINFO_VERSION2         0x02
3228c2ecf20Sopenharmony_ci	#define VDADEVINFO_VERSION3         0x03
3238c2ecf20Sopenharmony_ci	#define VDADEVINFO_VERSION          VDADEVINFO_VERSION3
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci	u8 reserved2[3];
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	/* sector scanning fields */
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci	u32 ss_curr_errors;
3308c2ecf20Sopenharmony_ci	u64 ss_curr_scanned;
3318c2ecf20Sopenharmony_ci	u32 ss_curr_recvrd;
3328c2ecf20Sopenharmony_ci	u32 ss_scan_length;
3338c2ecf20Sopenharmony_ci	u32 ss_total_errors;
3348c2ecf20Sopenharmony_ci	u32 ss_total_recvrd;
3358c2ecf20Sopenharmony_ci	u32 ss_num_scans;
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci	/* grp_name was added in version 2 of this structure. */
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	char grp_name[15];
3408c2ecf20Sopenharmony_ci	u8 reserved3[4];
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci	/* dev_addr_list was added in version 3 of this structure. */
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci	u8 num_dev_addr;
3458c2ecf20Sopenharmony_ci	struct atto_dev_addr2 dev_addr_list[8];
3468c2ecf20Sopenharmony_ci};
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_cistruct __packed atto_vda_grp_info {
3508c2ecf20Sopenharmony_ci	u8 grp_index;
3518c2ecf20Sopenharmony_ci	#define VDA_MAX_RAID_GROUPS         32
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci	char grp_name[15];
3548c2ecf20Sopenharmony_ci	u64 capacity;
3558c2ecf20Sopenharmony_ci	u32 block_size;
3568c2ecf20Sopenharmony_ci	u32 interleave;
3578c2ecf20Sopenharmony_ci	u8 type;
3588c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID0          0
3598c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID1          1
3608c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID4          4
3618c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID5          5
3628c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID6          6
3638c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID10         10
3648c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID40         40
3658c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID50         50
3668c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_RAID60         60
3678c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_DVRAID_HS      252
3688c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_DVRAID_NOHS    253
3698c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_JBOD           254
3708c2ecf20Sopenharmony_ci	#define VDA_GRP_TYPE_SPARE          255
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_ci	union {
3738c2ecf20Sopenharmony_ci		u8 status;
3748c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_INVALID  0x00
3758c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_NEW      0x01
3768c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_WAITING  0x02
3778c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_ONLINE   0x03
3788c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_DEGRADED 0x04
3798c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_OFFLINE  0x05
3808c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_DELETED  0x06
3818c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_RECOV_BASIC    0x07
3828c2ecf20Sopenharmony_ci	    #define VDA_GRP_STAT_RECOV_EXTREME  0x08
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci		u8 op_ctrl;
3858c2ecf20Sopenharmony_ci	    #define VDA_GRP_OP_CTRL_START   0x01
3868c2ecf20Sopenharmony_ci	    #define VDA_GRP_OP_CTRL_HALT    0x02
3878c2ecf20Sopenharmony_ci	    #define VDA_GRP_OP_CTRL_RESUME  0x03
3888c2ecf20Sopenharmony_ci	    #define VDA_GRP_OP_CTRL_CANCEL  0x04
3898c2ecf20Sopenharmony_ci	};
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci	u8 rebuild_state;
3928c2ecf20Sopenharmony_ci	#define VDA_RBLD_NONE      0x00
3938c2ecf20Sopenharmony_ci	#define VDA_RBLD_REBUILD   0x01
3948c2ecf20Sopenharmony_ci	#define VDA_RBLD_ERASE     0x02
3958c2ecf20Sopenharmony_ci	#define VDA_RBLD_PATTERN   0x03
3968c2ecf20Sopenharmony_ci	#define VDA_RBLD_CONV      0x04
3978c2ecf20Sopenharmony_ci	#define VDA_RBLD_FULL_INIT 0x05
3988c2ecf20Sopenharmony_ci	#define VDA_RBLD_QUICK_INIT 0x06
3998c2ecf20Sopenharmony_ci	#define VDA_RBLD_SECT_SCAN 0x07
4008c2ecf20Sopenharmony_ci	#define VDA_RBLD_SECT_SCAN_PARITY     0x08
4018c2ecf20Sopenharmony_ci	#define VDA_RBLD_SECT_SCAN_PARITY_FIX 0x09
4028c2ecf20Sopenharmony_ci	#define VDA_RBLD_RECOV_REBUILD 0x0A
4038c2ecf20Sopenharmony_ci	#define VDA_RBLD_RECOV_BASIC   0x0B
4048c2ecf20Sopenharmony_ci	#define VDA_RBLD_RECOV_EXTREME 0x0C
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci	u8 span_depth;
4078c2ecf20Sopenharmony_ci	u8 progress;
4088c2ecf20Sopenharmony_ci	u8 mirror_width;
4098c2ecf20Sopenharmony_ci	u8 stripe_width;
4108c2ecf20Sopenharmony_ci	u8 member_cnt;
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci	union {
4138c2ecf20Sopenharmony_ci		u16 members[32];
4148c2ecf20Sopenharmony_ci	#define VDA_MEMBER_MISSING  0xFFFF
4158c2ecf20Sopenharmony_ci	#define VDA_MEMBER_NEW      0xFFFE
4168c2ecf20Sopenharmony_ci		u16 features_mask;
4178c2ecf20Sopenharmony_ci	};
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci	u16 features;
4208c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_HOTSWAP    0x0001
4218c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_SPDRD_MASK 0x0006
4228c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_SPDRD_DIS  0x0000
4238c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_SPDRD_ENB  0x0002
4248c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_SPDRD_AUTO 0x0004
4258c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_IDENT      0x0008
4268c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_RBLDPRI_MASK 0x0030
4278c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_RBLDPRI_LOW  0x0010
4288c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_RBLDPRI_SAME 0x0020
4298c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_RBLDPRI_HIGH 0x0030
4308c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_WRITE_CACHE  0x0040
4318c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_RBLD_RESUME  0x0080
4328c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_SECT_RESUME  0x0100
4338c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_INIT_RESUME  0x0200
4348c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_SSD          0x0400
4358c2ecf20Sopenharmony_ci	#define VDA_GRP_FEAT_BOOT_DEV     0x0800
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci	/*
4388c2ecf20Sopenharmony_ci	 * for backward compatibility, a prefetch value of zero means the
4398c2ecf20Sopenharmony_ci	 * setting is ignored/unsupported.  therefore, the firmware supported
4408c2ecf20Sopenharmony_ci	 * 0-6 values are incremented to 1-7.
4418c2ecf20Sopenharmony_ci	 */
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_ci	u8 prefetch;
4448c2ecf20Sopenharmony_ci	u8 op_status;
4458c2ecf20Sopenharmony_ci	#define VDAGRPOPSTAT_MASK       0x0F
4468c2ecf20Sopenharmony_ci	#define VDAGRPOPSTAT_INVALID    0x00
4478c2ecf20Sopenharmony_ci	#define VDAGRPOPSTAT_OK         0x01
4488c2ecf20Sopenharmony_ci	#define VDAGRPOPSTAT_FAULTED    0x02
4498c2ecf20Sopenharmony_ci	#define VDAGRPOPSTAT_HALTED     0x03
4508c2ecf20Sopenharmony_ci	#define VDAGRPOPSTAT_INT        0x04
4518c2ecf20Sopenharmony_ci	#define VDAGRPOPPROC_MASK       0xF0
4528c2ecf20Sopenharmony_ci	#define VDAGRPOPPROC_STARTABLE  0x10
4538c2ecf20Sopenharmony_ci	#define VDAGRPOPPROC_CANCELABLE 0x20
4548c2ecf20Sopenharmony_ci	#define VDAGRPOPPROC_RESUMABLE  0x40
4558c2ecf20Sopenharmony_ci	#define VDAGRPOPPROC_HALTABLE   0x80
4568c2ecf20Sopenharmony_ci	u8 over_provision;
4578c2ecf20Sopenharmony_ci	u8 reserved[3];
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci};
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_cistruct __packed atto_vdapart_info {
4638c2ecf20Sopenharmony_ci	u8 part_no;
4648c2ecf20Sopenharmony_ci	#define VDA_MAX_PARTITIONS   128
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci	char grp_name[15];
4678c2ecf20Sopenharmony_ci	u64 part_size;
4688c2ecf20Sopenharmony_ci	u64 start_lba;
4698c2ecf20Sopenharmony_ci	u32 block_size;
4708c2ecf20Sopenharmony_ci	u16 target_id;
4718c2ecf20Sopenharmony_ci	u8 LUN;
4728c2ecf20Sopenharmony_ci	char serial_no[41];
4738c2ecf20Sopenharmony_ci	u8 features;
4748c2ecf20Sopenharmony_ci	#define VDAPI_FEAT_WRITE_CACHE   0x01
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci	u8 reserved[7];
4778c2ecf20Sopenharmony_ci};
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_cistruct __packed atto_vda_dh_info {
4818c2ecf20Sopenharmony_ci	u8 req_type;
4828c2ecf20Sopenharmony_ci	#define VDADH_RQTYPE_CACHE      0x01
4838c2ecf20Sopenharmony_ci	#define VDADH_RQTYPE_FETCH      0x02
4848c2ecf20Sopenharmony_ci	#define VDADH_RQTYPE_SET_STAT   0x03
4858c2ecf20Sopenharmony_ci	#define VDADH_RQTYPE_GET_STAT   0x04
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci	u8 req_qual;
4888c2ecf20Sopenharmony_ci	#define VDADH_RQQUAL_SMART      0x01
4898c2ecf20Sopenharmony_ci	#define VDADH_RQQUAL_MEDDEF     0x02
4908c2ecf20Sopenharmony_ci	#define VDADH_RQQUAL_INFOEXC    0x04
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci	u8 num_smart_attribs;
4938c2ecf20Sopenharmony_ci	u8 status;
4948c2ecf20Sopenharmony_ci	#define VDADH_STAT_DISABLE      0x00
4958c2ecf20Sopenharmony_ci	#define VDADH_STAT_ENABLE       0x01
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci	u32 med_defect_cnt;
4988c2ecf20Sopenharmony_ci	u32 info_exc_cnt;
4998c2ecf20Sopenharmony_ci	u8 smart_status;
5008c2ecf20Sopenharmony_ci	#define VDADH_SMARTSTAT_OK      0x00
5018c2ecf20Sopenharmony_ci	#define VDADH_SMARTSTAT_ERR     0x01
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci	u8 reserved[35];
5048c2ecf20Sopenharmony_ci	struct atto_vda_sge sge[1];
5058c2ecf20Sopenharmony_ci};
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_cistruct __packed atto_vda_dh_smart {
5098c2ecf20Sopenharmony_ci	u8 attrib_id;
5108c2ecf20Sopenharmony_ci	u8 current_val;
5118c2ecf20Sopenharmony_ci	u8 worst;
5128c2ecf20Sopenharmony_ci	u8 threshold;
5138c2ecf20Sopenharmony_ci	u8 raw_data[6];
5148c2ecf20Sopenharmony_ci	u8 raw_attrib_status;
5158c2ecf20Sopenharmony_ci	#define VDADHSM_RAWSTAT_PREFAIL_WARRANTY        0x01
5168c2ecf20Sopenharmony_ci	#define VDADHSM_RAWSTAT_ONLINE_COLLECTION       0x02
5178c2ecf20Sopenharmony_ci	#define VDADHSM_RAWSTAT_PERFORMANCE_ATTR        0x04
5188c2ecf20Sopenharmony_ci	#define VDADHSM_RAWSTAT_ERROR_RATE_ATTR         0x08
5198c2ecf20Sopenharmony_ci	#define VDADHSM_RAWSTAT_EVENT_COUNT_ATTR        0x10
5208c2ecf20Sopenharmony_ci	#define VDADHSM_RAWSTAT_SELF_PRESERVING_ATTR    0x20
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci	u8 calc_attrib_status;
5238c2ecf20Sopenharmony_ci	#define VDADHSM_CALCSTAT_UNKNOWN                0x00
5248c2ecf20Sopenharmony_ci	#define VDADHSM_CALCSTAT_GOOD                   0x01
5258c2ecf20Sopenharmony_ci	#define VDADHSM_CALCSTAT_PREFAIL                0x02
5268c2ecf20Sopenharmony_ci	#define VDADHSM_CALCSTAT_OLDAGE                 0x03
5278c2ecf20Sopenharmony_ci
5288c2ecf20Sopenharmony_ci	u8 reserved[4];
5298c2ecf20Sopenharmony_ci};
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_cistruct __packed atto_vda_metrics_info {
5338c2ecf20Sopenharmony_ci	u8 data_version;
5348c2ecf20Sopenharmony_ci	#define VDAMET_VERSION0         0x00
5358c2ecf20Sopenharmony_ci	#define VDAMET_VERSION          VDAMET_VERSION0
5368c2ecf20Sopenharmony_ci
5378c2ecf20Sopenharmony_ci	u8 metrics_action;
5388c2ecf20Sopenharmony_ci	#define VDAMET_METACT_NONE      0x00
5398c2ecf20Sopenharmony_ci	#define VDAMET_METACT_START     0x01
5408c2ecf20Sopenharmony_ci	#define VDAMET_METACT_STOP      0x02
5418c2ecf20Sopenharmony_ci	#define VDAMET_METACT_RETRIEVE  0x03
5428c2ecf20Sopenharmony_ci	#define VDAMET_METACT_CLEAR     0x04
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_ci	u8 test_action;
5458c2ecf20Sopenharmony_ci	#define VDAMET_TSTACT_NONE              0x00
5468c2ecf20Sopenharmony_ci	#define VDAMET_TSTACT_STRT_INIT         0x01
5478c2ecf20Sopenharmony_ci	#define VDAMET_TSTACT_STRT_READ         0x02
5488c2ecf20Sopenharmony_ci	#define VDAMET_TSTACT_STRT_VERIFY       0x03
5498c2ecf20Sopenharmony_ci	#define VDAMET_TSTACT_STRT_INIT_VERIFY  0x04
5508c2ecf20Sopenharmony_ci	#define VDAMET_TSTACT_STOP              0x05
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci	u8 num_dev_indexes;
5538c2ecf20Sopenharmony_ci	#define VDAMET_ALL_DEVICES      0xFF
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci	u16 dev_indexes[32];
5568c2ecf20Sopenharmony_ci	u8 reserved[12];
5578c2ecf20Sopenharmony_ci	struct atto_vda_sge sge[1];
5588c2ecf20Sopenharmony_ci};
5598c2ecf20Sopenharmony_ci
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_cistruct __packed atto_vda_metrics_data {
5628c2ecf20Sopenharmony_ci	u16 dev_index;
5638c2ecf20Sopenharmony_ci	u16 length;
5648c2ecf20Sopenharmony_ci	#define VDAMD_LEN_LAST          0x8000
5658c2ecf20Sopenharmony_ci	#define VDAMD_LEN_MASK          0x0FFF
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_ci	u32 flags;
5688c2ecf20Sopenharmony_ci	#define VDAMDF_RUN          0x00000007
5698c2ecf20Sopenharmony_ci	#define VDAMDF_RUN_READ     0x00000001
5708c2ecf20Sopenharmony_ci	#define VDAMDF_RUN_WRITE    0x00000002
5718c2ecf20Sopenharmony_ci	#define VDAMDF_RUN_ALL      0x00000004
5728c2ecf20Sopenharmony_ci	#define VDAMDF_READ         0x00000010
5738c2ecf20Sopenharmony_ci	#define VDAMDF_WRITE        0x00000020
5748c2ecf20Sopenharmony_ci	#define VDAMDF_ALL          0x00000040
5758c2ecf20Sopenharmony_ci	#define VDAMDF_DRIVETEST    0x40000000
5768c2ecf20Sopenharmony_ci	#define VDAMDF_NEW          0x80000000
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci	u64 total_read_data;
5798c2ecf20Sopenharmony_ci	u64 total_write_data;
5808c2ecf20Sopenharmony_ci	u64 total_read_io;
5818c2ecf20Sopenharmony_ci	u64 total_write_io;
5828c2ecf20Sopenharmony_ci	u64 read_start_time;
5838c2ecf20Sopenharmony_ci	u64 read_stop_time;
5848c2ecf20Sopenharmony_ci	u64 write_start_time;
5858c2ecf20Sopenharmony_ci	u64 write_stop_time;
5868c2ecf20Sopenharmony_ci	u64 read_maxio_time;
5878c2ecf20Sopenharmony_ci	u64 wpvdadmetricsdatarite_maxio_time;
5888c2ecf20Sopenharmony_ci	u64 read_totalio_time;
5898c2ecf20Sopenharmony_ci	u64 write_totalio_time;
5908c2ecf20Sopenharmony_ci	u64 read_total_errs;
5918c2ecf20Sopenharmony_ci	u64 write_total_errs;
5928c2ecf20Sopenharmony_ci	u64 read_recvrd_errs;
5938c2ecf20Sopenharmony_ci	u64 write_recvrd_errs;
5948c2ecf20Sopenharmony_ci	u64 miscompares;
5958c2ecf20Sopenharmony_ci};
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_cistruct __packed atto_vda_schedule_info {
5998c2ecf20Sopenharmony_ci	u8 schedule_type;
6008c2ecf20Sopenharmony_ci	#define VDASI_SCHTYPE_ONETIME   0x01
6018c2ecf20Sopenharmony_ci	#define VDASI_SCHTYPE_DAILY     0x02
6028c2ecf20Sopenharmony_ci	#define VDASI_SCHTYPE_WEEKLY    0x03
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci	u8 operation;
6058c2ecf20Sopenharmony_ci	#define VDASI_OP_NONE           0x00
6068c2ecf20Sopenharmony_ci	#define VDASI_OP_CREATE         0x01
6078c2ecf20Sopenharmony_ci	#define VDASI_OP_CANCEL         0x02
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci	u8 hour;
6108c2ecf20Sopenharmony_ci	u8 minute;
6118c2ecf20Sopenharmony_ci	u8 day;
6128c2ecf20Sopenharmony_ci	#define VDASI_DAY_NONE          0x00
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_ci	u8 progress;
6158c2ecf20Sopenharmony_ci	#define VDASI_PROG_NONE         0xFF
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ci	u8 event_type;
6188c2ecf20Sopenharmony_ci	#define VDASI_EVTTYPE_SECT_SCAN             0x01
6198c2ecf20Sopenharmony_ci	#define VDASI_EVTTYPE_SECT_SCAN_PARITY      0x02
6208c2ecf20Sopenharmony_ci	#define VDASI_EVTTYPE_SECT_SCAN_PARITY_FIX  0x03
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci	u8 recurrences;
6238c2ecf20Sopenharmony_ci	#define VDASI_RECUR_FOREVER     0x00
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci	u32 id;
6268c2ecf20Sopenharmony_ci	#define VDASI_ID_NONE           0x00
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_ci	char grp_name[15];
6298c2ecf20Sopenharmony_ci	u8 reserved[85];
6308c2ecf20Sopenharmony_ci};
6318c2ecf20Sopenharmony_ci
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_cistruct __packed atto_vda_n_vcache_info {
6348c2ecf20Sopenharmony_ci	u8 super_cap_status;
6358c2ecf20Sopenharmony_ci	#define VDANVCI_SUPERCAP_NOT_PRESENT       0x00
6368c2ecf20Sopenharmony_ci	#define VDANVCI_SUPERCAP_FULLY_CHARGED     0x01
6378c2ecf20Sopenharmony_ci	#define VDANVCI_SUPERCAP_NOT_CHARGED       0x02
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci	u8 nvcache_module_status;
6408c2ecf20Sopenharmony_ci	#define VDANVCI_NVCACHEMODULE_NOT_PRESENT  0x00
6418c2ecf20Sopenharmony_ci	#define VDANVCI_NVCACHEMODULE_PRESENT      0x01
6428c2ecf20Sopenharmony_ci
6438c2ecf20Sopenharmony_ci	u8 protection_mode;
6448c2ecf20Sopenharmony_ci	#define VDANVCI_PROTMODE_HI_PROTECT        0x00
6458c2ecf20Sopenharmony_ci	#define VDANVCI_PROTMODE_HI_PERFORM        0x01
6468c2ecf20Sopenharmony_ci
6478c2ecf20Sopenharmony_ci	u8 reserved[109];
6488c2ecf20Sopenharmony_ci};
6498c2ecf20Sopenharmony_ci
6508c2ecf20Sopenharmony_ci
6518c2ecf20Sopenharmony_cistruct __packed atto_vda_buzzer_info {
6528c2ecf20Sopenharmony_ci	u8 status;
6538c2ecf20Sopenharmony_ci	#define VDABUZZI_BUZZER_OFF           0x00
6548c2ecf20Sopenharmony_ci	#define VDABUZZI_BUZZER_ON            0x01
6558c2ecf20Sopenharmony_ci	#define VDABUZZI_BUZZER_LAST          0x02
6568c2ecf20Sopenharmony_ci
6578c2ecf20Sopenharmony_ci	u8 reserved[3];
6588c2ecf20Sopenharmony_ci	u32 duration;
6598c2ecf20Sopenharmony_ci	#define VDABUZZI_DURATION_INDEFINITE  0xffffffff
6608c2ecf20Sopenharmony_ci
6618c2ecf20Sopenharmony_ci	u8 reserved2[104];
6628c2ecf20Sopenharmony_ci};
6638c2ecf20Sopenharmony_ci
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_cistruct  __packed atto_vda_adapter_info {
6668c2ecf20Sopenharmony_ci	u8 version;
6678c2ecf20Sopenharmony_ci	#define VDAADAPINFO_VERSION0         0x00
6688c2ecf20Sopenharmony_ci	#define VDAADAPINFO_VERSION          VDAADAPINFO_VERSION0
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci	u8 reserved;
6718c2ecf20Sopenharmony_ci	signed short utc_offset;
6728c2ecf20Sopenharmony_ci	u32 utc_time;
6738c2ecf20Sopenharmony_ci	u32 features;
6748c2ecf20Sopenharmony_ci	#define VDA_ADAP_FEAT_IDENT     0x0001
6758c2ecf20Sopenharmony_ci	#define VDA_ADAP_FEAT_BUZZ_ERR  0x0002
6768c2ecf20Sopenharmony_ci	#define VDA_ADAP_FEAT_UTC_TIME  0x0004
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci	u32 valid_features;
6798c2ecf20Sopenharmony_ci	char active_config[33];
6808c2ecf20Sopenharmony_ci	u8 temp_count;
6818c2ecf20Sopenharmony_ci	u8 fan_count;
6828c2ecf20Sopenharmony_ci	u8 reserved3[61];
6838c2ecf20Sopenharmony_ci};
6848c2ecf20Sopenharmony_ci
6858c2ecf20Sopenharmony_ci
6868c2ecf20Sopenharmony_cistruct __packed atto_vda_temp_info {
6878c2ecf20Sopenharmony_ci	u8 temp_index;
6888c2ecf20Sopenharmony_ci	u8 max_op_temp;
6898c2ecf20Sopenharmony_ci	u8 min_op_temp;
6908c2ecf20Sopenharmony_ci	u8 op_temp_warn;
6918c2ecf20Sopenharmony_ci	u8 temperature;
6928c2ecf20Sopenharmony_ci	u8 type;
6938c2ecf20Sopenharmony_ci	#define VDA_TEMP_TYPE_CPU  1
6948c2ecf20Sopenharmony_ci
6958c2ecf20Sopenharmony_ci	u8 reserved[106];
6968c2ecf20Sopenharmony_ci};
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_ci
6998c2ecf20Sopenharmony_cistruct __packed atto_vda_fan_info {
7008c2ecf20Sopenharmony_ci	u8 fan_index;
7018c2ecf20Sopenharmony_ci	u8 status;
7028c2ecf20Sopenharmony_ci	#define VDA_FAN_STAT_UNKNOWN 0
7038c2ecf20Sopenharmony_ci	#define VDA_FAN_STAT_NORMAL  1
7048c2ecf20Sopenharmony_ci	#define VDA_FAN_STAT_FAIL    2
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_ci	u16 crit_pvdafaninfothreshold;
7078c2ecf20Sopenharmony_ci	u16 warn_threshold;
7088c2ecf20Sopenharmony_ci	u16 speed;
7098c2ecf20Sopenharmony_ci	u8 reserved[104];
7108c2ecf20Sopenharmony_ci};
7118c2ecf20Sopenharmony_ci
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_ci/* VDA management commands */
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_ci#define VDAMGT_DEV_SCAN         0x00
7168c2ecf20Sopenharmony_ci#define VDAMGT_DEV_INFO         0x01
7178c2ecf20Sopenharmony_ci#define VDAMGT_DEV_CLEAN        0x02
7188c2ecf20Sopenharmony_ci#define VDAMGT_DEV_IDENTIFY     0x03
7198c2ecf20Sopenharmony_ci#define VDAMGT_DEV_IDENTSTOP    0x04
7208c2ecf20Sopenharmony_ci#define VDAMGT_DEV_PT_INFO      0x05
7218c2ecf20Sopenharmony_ci#define VDAMGT_DEV_FEATURES     0x06
7228c2ecf20Sopenharmony_ci#define VDAMGT_DEV_PT_FEATURES  0x07
7238c2ecf20Sopenharmony_ci#define VDAMGT_DEV_HEALTH_REQ   0x08
7248c2ecf20Sopenharmony_ci#define VDAMGT_DEV_METRICS      0x09
7258c2ecf20Sopenharmony_ci#define VDAMGT_DEV_INFO2        0x0A
7268c2ecf20Sopenharmony_ci#define VDAMGT_DEV_OPERATION    0x0B
7278c2ecf20Sopenharmony_ci#define VDAMGT_DEV_INFO2_BYADDR 0x0C
7288c2ecf20Sopenharmony_ci#define VDAMGT_GRP_INFO         0x10
7298c2ecf20Sopenharmony_ci#define VDAMGT_GRP_CREATE       0x11
7308c2ecf20Sopenharmony_ci#define VDAMGT_GRP_DELETE       0x12
7318c2ecf20Sopenharmony_ci#define VDAMGT_ADD_STORAGE      0x13
7328c2ecf20Sopenharmony_ci#define VDAMGT_MEMBER_ADD       0x14
7338c2ecf20Sopenharmony_ci#define VDAMGT_GRP_COMMIT       0x15
7348c2ecf20Sopenharmony_ci#define VDAMGT_GRP_REBUILD      0x16
7358c2ecf20Sopenharmony_ci#define VDAMGT_GRP_COMMIT_INIT  0x17
7368c2ecf20Sopenharmony_ci#define VDAMGT_QUICK_RAID       0x18
7378c2ecf20Sopenharmony_ci#define VDAMGT_GRP_FEATURES     0x19
7388c2ecf20Sopenharmony_ci#define VDAMGT_GRP_COMMIT_INIT_AUTOMAP  0x1A
7398c2ecf20Sopenharmony_ci#define VDAMGT_QUICK_RAID_INIT_AUTOMAP  0x1B
7408c2ecf20Sopenharmony_ci#define VDAMGT_GRP_OPERATION    0x1C
7418c2ecf20Sopenharmony_ci#define VDAMGT_CFG_SAVE         0x20
7428c2ecf20Sopenharmony_ci#define VDAMGT_LAST_ERROR       0x21
7438c2ecf20Sopenharmony_ci#define VDAMGT_ADAP_INFO        0x22
7448c2ecf20Sopenharmony_ci#define VDAMGT_ADAP_FEATURES    0x23
7458c2ecf20Sopenharmony_ci#define VDAMGT_TEMP_INFO        0x24
7468c2ecf20Sopenharmony_ci#define VDAMGT_FAN_INFO         0x25
7478c2ecf20Sopenharmony_ci#define VDAMGT_PART_INFO        0x30
7488c2ecf20Sopenharmony_ci#define VDAMGT_PART_MAP         0x31
7498c2ecf20Sopenharmony_ci#define VDAMGT_PART_UNMAP       0x32
7508c2ecf20Sopenharmony_ci#define VDAMGT_PART_AUTOMAP     0x33
7518c2ecf20Sopenharmony_ci#define VDAMGT_PART_SPLIT       0x34
7528c2ecf20Sopenharmony_ci#define VDAMGT_PART_MERGE       0x35
7538c2ecf20Sopenharmony_ci#define VDAMGT_SPARE_LIST       0x40
7548c2ecf20Sopenharmony_ci#define VDAMGT_SPARE_ADD        0x41
7558c2ecf20Sopenharmony_ci#define VDAMGT_SPARE_REMOVE     0x42
7568c2ecf20Sopenharmony_ci#define VDAMGT_LOCAL_SPARE_ADD  0x43
7578c2ecf20Sopenharmony_ci#define VDAMGT_SCHEDULE_EVENT   0x50
7588c2ecf20Sopenharmony_ci#define VDAMGT_SCHEDULE_INFO    0x51
7598c2ecf20Sopenharmony_ci#define VDAMGT_NVCACHE_INFO     0x60
7608c2ecf20Sopenharmony_ci#define VDAMGT_NVCACHE_SET      0x61
7618c2ecf20Sopenharmony_ci#define VDAMGT_BUZZER_INFO      0x70
7628c2ecf20Sopenharmony_ci#define VDAMGT_BUZZER_SET       0x71
7638c2ecf20Sopenharmony_ci
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_hdr {
7668c2ecf20Sopenharmony_ci	u8 bylength;
7678c2ecf20Sopenharmony_ci	u8 byflags;
7688c2ecf20Sopenharmony_ci	#define VDAAE_HDRF_EVENT_ACK    0x01
7698c2ecf20Sopenharmony_ci
7708c2ecf20Sopenharmony_ci	u8 byversion;
7718c2ecf20Sopenharmony_ci	#define VDAAE_HDR_VER_0         0
7728c2ecf20Sopenharmony_ci
7738c2ecf20Sopenharmony_ci	u8 bytype;
7748c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_RAID     1
7758c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_LU       2
7768c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_DISK     3
7778c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_RESET    4
7788c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_LOG_INFO 5
7798c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_LOG_WARN 6
7808c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_LOG_CRIT 7
7818c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_LOG_FAIL 8
7828c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_NVC      9
7838c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_TLG_INFO 10
7848c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_TLG_WARN 11
7858c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_TLG_CRIT 12
7868c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_PWRMGT   13
7878c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_MUTE     14
7888c2ecf20Sopenharmony_ci	#define VDAAE_HDR_TYPE_DEV      15
7898c2ecf20Sopenharmony_ci};
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci
7928c2ecf20Sopenharmony_cistruct  __packed atto_vda_ae_raid {
7938c2ecf20Sopenharmony_ci	struct atto_vda_ae_hdr hdr;
7948c2ecf20Sopenharmony_ci	u32 dwflags;
7958c2ecf20Sopenharmony_ci	#define VDAAE_GROUP_STATE   0x00000001
7968c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_STATE    0x00000002
7978c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_PROG     0x00000004
7988c2ecf20Sopenharmony_ci	#define VDAAE_MEMBER_CHG    0x00000008
7998c2ecf20Sopenharmony_ci	#define VDAAE_PART_CHG      0x00000010
8008c2ecf20Sopenharmony_ci	#define VDAAE_MEM_STATE_CHG 0x00000020
8018c2ecf20Sopenharmony_ci
8028c2ecf20Sopenharmony_ci	u8 bygroup_state;
8038c2ecf20Sopenharmony_ci	#define VDAAE_RAID_INVALID  0
8048c2ecf20Sopenharmony_ci	#define VDAAE_RAID_NEW      1
8058c2ecf20Sopenharmony_ci	#define VDAAE_RAID_WAITING  2
8068c2ecf20Sopenharmony_ci	#define VDAAE_RAID_ONLINE   3
8078c2ecf20Sopenharmony_ci	#define VDAAE_RAID_DEGRADED 4
8088c2ecf20Sopenharmony_ci	#define VDAAE_RAID_OFFLINE  5
8098c2ecf20Sopenharmony_ci	#define VDAAE_RAID_DELETED  6
8108c2ecf20Sopenharmony_ci	#define VDAAE_RAID_BASIC    7
8118c2ecf20Sopenharmony_ci	#define VDAAE_RAID_EXTREME  8
8128c2ecf20Sopenharmony_ci	#define VDAAE_RAID_UNKNOWN  9
8138c2ecf20Sopenharmony_ci
8148c2ecf20Sopenharmony_ci	u8 byrebuild_state;
8158c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_NONE       0
8168c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_REBUILD    1
8178c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_ERASE      2
8188c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_PATTERN    3
8198c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_CONV       4
8208c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_FULL_INIT  5
8218c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_QUICK_INIT 6
8228c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_SECT_SCAN  7
8238c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_SECT_SCAN_PARITY     8
8248c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_SECT_SCAN_PARITY_FIX 9
8258c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_RECOV_REBUILD 10
8268c2ecf20Sopenharmony_ci	#define VDAAE_RBLD_UNKNOWN    11
8278c2ecf20Sopenharmony_ci
8288c2ecf20Sopenharmony_ci	u8 byrebuild_progress;
8298c2ecf20Sopenharmony_ci	u8 op_status;
8308c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPSTAT_MASK       0x0F
8318c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPSTAT_INVALID    0x00
8328c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPSTAT_OK         0x01
8338c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPSTAT_FAULTED    0x02
8348c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPSTAT_HALTED     0x03
8358c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPSTAT_INT        0x04
8368c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPPROC_MASK       0xF0
8378c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPPROC_STARTABLE  0x10
8388c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPPROC_CANCELABLE 0x20
8398c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPPROC_RESUMABLE  0x40
8408c2ecf20Sopenharmony_ci	#define VDAAE_GRPOPPROC_HALTABLE   0x80
8418c2ecf20Sopenharmony_ci	char acname[15];
8428c2ecf20Sopenharmony_ci	u8 byreserved;
8438c2ecf20Sopenharmony_ci	u8 byreserved2[0x80 - 0x1C];
8448c2ecf20Sopenharmony_ci};
8458c2ecf20Sopenharmony_ci
8468c2ecf20Sopenharmony_ci
8478c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_lu_tgt_lun {
8488c2ecf20Sopenharmony_ci	u16 wtarget_id;
8498c2ecf20Sopenharmony_ci	u8 bylun;
8508c2ecf20Sopenharmony_ci	u8 byreserved;
8518c2ecf20Sopenharmony_ci};
8528c2ecf20Sopenharmony_ci
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_lu_tgt_lun_raid {
8558c2ecf20Sopenharmony_ci	u16 wtarget_id;
8568c2ecf20Sopenharmony_ci	u8 bylun;
8578c2ecf20Sopenharmony_ci	u8 byreserved;
8588c2ecf20Sopenharmony_ci	u32 dwinterleave;
8598c2ecf20Sopenharmony_ci	u32 dwblock_size;
8608c2ecf20Sopenharmony_ci};
8618c2ecf20Sopenharmony_ci
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_lu {
8648c2ecf20Sopenharmony_ci	struct atto_vda_ae_hdr hdr;
8658c2ecf20Sopenharmony_ci	u32 dwevent;
8668c2ecf20Sopenharmony_ci	#define VDAAE_LU_DISC        0x00000001
8678c2ecf20Sopenharmony_ci	#define VDAAE_LU_LOST        0x00000002
8688c2ecf20Sopenharmony_ci	#define VDAAE_LU_STATE       0x00000004
8698c2ecf20Sopenharmony_ci	#define VDAAE_LU_PASSTHROUGH 0x10000000
8708c2ecf20Sopenharmony_ci	#define VDAAE_LU_PHYS_ID     0x20000000
8718c2ecf20Sopenharmony_ci
8728c2ecf20Sopenharmony_ci	u8 bystate;
8738c2ecf20Sopenharmony_ci	#define VDAAE_LU_UNDEFINED        0
8748c2ecf20Sopenharmony_ci	#define VDAAE_LU_NOT_PRESENT      1
8758c2ecf20Sopenharmony_ci	#define VDAAE_LU_OFFLINE          2
8768c2ecf20Sopenharmony_ci	#define VDAAE_LU_ONLINE           3
8778c2ecf20Sopenharmony_ci	#define VDAAE_LU_DEGRADED         4
8788c2ecf20Sopenharmony_ci	#define VDAAE_LU_FACTORY_DISABLED 5
8798c2ecf20Sopenharmony_ci	#define VDAAE_LU_DELETED          6
8808c2ecf20Sopenharmony_ci	#define VDAAE_LU_BUSSCAN          7
8818c2ecf20Sopenharmony_ci	#define VDAAE_LU_UNKNOWN          8
8828c2ecf20Sopenharmony_ci
8838c2ecf20Sopenharmony_ci	u8 byreserved;
8848c2ecf20Sopenharmony_ci	u16 wphys_target_id;
8858c2ecf20Sopenharmony_ci
8868c2ecf20Sopenharmony_ci	union {
8878c2ecf20Sopenharmony_ci		struct atto_vda_ae_lu_tgt_lun tgtlun;
8888c2ecf20Sopenharmony_ci		struct atto_vda_ae_lu_tgt_lun_raid tgtlun_raid;
8898c2ecf20Sopenharmony_ci	} id;
8908c2ecf20Sopenharmony_ci};
8918c2ecf20Sopenharmony_ci
8928c2ecf20Sopenharmony_ci
8938c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_disk {
8948c2ecf20Sopenharmony_ci	struct atto_vda_ae_hdr hdr;
8958c2ecf20Sopenharmony_ci};
8968c2ecf20Sopenharmony_ci
8978c2ecf20Sopenharmony_ci
8988c2ecf20Sopenharmony_ci#define VDAAE_LOG_STRSZ 64
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_log {
9018c2ecf20Sopenharmony_ci	struct atto_vda_ae_hdr hdr;
9028c2ecf20Sopenharmony_ci	char aclog_ascii[VDAAE_LOG_STRSZ];
9038c2ecf20Sopenharmony_ci};
9048c2ecf20Sopenharmony_ci
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_ci#define VDAAE_TLG_STRSZ 56
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_timestamp_log {
9098c2ecf20Sopenharmony_ci	struct atto_vda_ae_hdr hdr;
9108c2ecf20Sopenharmony_ci	u32 dwtimestamp;
9118c2ecf20Sopenharmony_ci	char aclog_ascii[VDAAE_TLG_STRSZ];
9128c2ecf20Sopenharmony_ci};
9138c2ecf20Sopenharmony_ci
9148c2ecf20Sopenharmony_ci
9158c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_nvc {
9168c2ecf20Sopenharmony_ci	struct atto_vda_ae_hdr hdr;
9178c2ecf20Sopenharmony_ci};
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci
9208c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_dev {
9218c2ecf20Sopenharmony_ci	struct atto_vda_ae_hdr hdr;
9228c2ecf20Sopenharmony_ci	struct atto_dev_addr devaddr;
9238c2ecf20Sopenharmony_ci};
9248c2ecf20Sopenharmony_ci
9258c2ecf20Sopenharmony_ci
9268c2ecf20Sopenharmony_ciunion atto_vda_ae {
9278c2ecf20Sopenharmony_ci	struct atto_vda_ae_hdr hdr;
9288c2ecf20Sopenharmony_ci	struct atto_vda_ae_disk disk;
9298c2ecf20Sopenharmony_ci	struct atto_vda_ae_lu lu;
9308c2ecf20Sopenharmony_ci	struct atto_vda_ae_raid raid;
9318c2ecf20Sopenharmony_ci	struct atto_vda_ae_log log;
9328c2ecf20Sopenharmony_ci	struct atto_vda_ae_timestamp_log tslog;
9338c2ecf20Sopenharmony_ci	struct atto_vda_ae_nvc nvcache;
9348c2ecf20Sopenharmony_ci	struct atto_vda_ae_dev dev;
9358c2ecf20Sopenharmony_ci};
9368c2ecf20Sopenharmony_ci
9378c2ecf20Sopenharmony_ci
9388c2ecf20Sopenharmony_cistruct __packed atto_vda_date_and_time {
9398c2ecf20Sopenharmony_ci	u8 flags;
9408c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_MASK   0x07
9418c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_NONE   0x00
9428c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_SUN    0x01
9438c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_MON    0x02
9448c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_TUE    0x03
9458c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_WED    0x04
9468c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_THU    0x05
9478c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_FRI    0x06
9488c2ecf20Sopenharmony_ci	#define VDA_DT_DAY_SAT    0x07
9498c2ecf20Sopenharmony_ci	#define VDA_DT_PM         0x40
9508c2ecf20Sopenharmony_ci	#define VDA_DT_MILITARY   0x80
9518c2ecf20Sopenharmony_ci
9528c2ecf20Sopenharmony_ci	u8 seconds;
9538c2ecf20Sopenharmony_ci	u8 minutes;
9548c2ecf20Sopenharmony_ci	u8 hours;
9558c2ecf20Sopenharmony_ci	u8 day;
9568c2ecf20Sopenharmony_ci	u8 month;
9578c2ecf20Sopenharmony_ci	u16 year;
9588c2ecf20Sopenharmony_ci};
9598c2ecf20Sopenharmony_ci
9608c2ecf20Sopenharmony_ci#define SGE_LEN_LIMIT   0x003FFFFF      /*! mask of segment length            */
9618c2ecf20Sopenharmony_ci#define SGE_LEN_MAX     0x003FF000      /*! maximum segment length            */
9628c2ecf20Sopenharmony_ci#define SGE_LAST        0x01000000      /*! last entry                        */
9638c2ecf20Sopenharmony_ci#define SGE_ADDR_64     0x04000000      /*! 64-bit addressing flag            */
9648c2ecf20Sopenharmony_ci#define SGE_CHAIN       0x80000000      /*! chain descriptor flag             */
9658c2ecf20Sopenharmony_ci#define SGE_CHAIN_LEN   0x0000FFFF      /*! mask of length in chain entries   */
9668c2ecf20Sopenharmony_ci#define SGE_CHAIN_SZ    0x00FF0000      /*! mask of size of chained buffer    */
9678c2ecf20Sopenharmony_ci
9688c2ecf20Sopenharmony_ci
9698c2ecf20Sopenharmony_cistruct __packed atto_vda_cfg_init {
9708c2ecf20Sopenharmony_ci	struct atto_vda_date_and_time date_time;
9718c2ecf20Sopenharmony_ci	u32 sgl_page_size;
9728c2ecf20Sopenharmony_ci	u32 vda_version;
9738c2ecf20Sopenharmony_ci	u32 fw_version;
9748c2ecf20Sopenharmony_ci	u32 fw_build;
9758c2ecf20Sopenharmony_ci	u32 fw_release;
9768c2ecf20Sopenharmony_ci	u32 epoch_time;
9778c2ecf20Sopenharmony_ci	u32 ioctl_tunnel;
9788c2ecf20Sopenharmony_ci	#define VDA_ITF_MEM_RW           0x00000001
9798c2ecf20Sopenharmony_ci	#define VDA_ITF_TRACE            0x00000002
9808c2ecf20Sopenharmony_ci	#define VDA_ITF_SCSI_PASS_THRU   0x00000004
9818c2ecf20Sopenharmony_ci	#define VDA_ITF_GET_DEV_ADDR     0x00000008
9828c2ecf20Sopenharmony_ci	#define VDA_ITF_PHY_CTRL         0x00000010
9838c2ecf20Sopenharmony_ci	#define VDA_ITF_CONN_CTRL        0x00000020
9848c2ecf20Sopenharmony_ci	#define VDA_ITF_GET_DEV_INFO     0x00000040
9858c2ecf20Sopenharmony_ci
9868c2ecf20Sopenharmony_ci	u32 num_targets_backend;
9878c2ecf20Sopenharmony_ci	u8 reserved[0x48];
9888c2ecf20Sopenharmony_ci};
9898c2ecf20Sopenharmony_ci
9908c2ecf20Sopenharmony_ci
9918c2ecf20Sopenharmony_ci/* configuration commands */
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci#define VDA_CFG_INIT          0x00
9948c2ecf20Sopenharmony_ci#define VDA_CFG_GET_INIT      0x01
9958c2ecf20Sopenharmony_ci#define VDA_CFG_GET_INIT2     0x02
9968c2ecf20Sopenharmony_ci
9978c2ecf20Sopenharmony_ci
9988c2ecf20Sopenharmony_ci/*! physical region descriptor (PRD) aka scatter/gather entry */
9998c2ecf20Sopenharmony_ci
10008c2ecf20Sopenharmony_cistruct __packed atto_physical_region_description {
10018c2ecf20Sopenharmony_ci	u64 address;
10028c2ecf20Sopenharmony_ci	u32 ctl_len;
10038c2ecf20Sopenharmony_ci	#define PRD_LEN_LIMIT       0x003FFFFF
10048c2ecf20Sopenharmony_ci	#define PRD_LEN_MAX         0x003FF000
10058c2ecf20Sopenharmony_ci	#define PRD_NXT_PRD_CNT     0x0000007F
10068c2ecf20Sopenharmony_ci	#define PRD_CHAIN           0x01000000
10078c2ecf20Sopenharmony_ci	#define PRD_DATA            0x00000000
10088c2ecf20Sopenharmony_ci	#define PRD_INT_SEL         0xF0000000
10098c2ecf20Sopenharmony_ci	  #define PRD_INT_SEL_F0    0x00000000
10108c2ecf20Sopenharmony_ci	  #define PRD_INT_SEL_F1    0x40000000
10118c2ecf20Sopenharmony_ci	  #define PRD_INT_SEL_F2    0x80000000
10128c2ecf20Sopenharmony_ci	  #define PRD_INT_SEL_F3    0xc0000000
10138c2ecf20Sopenharmony_ci	  #define PRD_INT_SEL_SRAM  0x10000000
10148c2ecf20Sopenharmony_ci	  #define PRD_INT_SEL_PBSR  0x20000000
10158c2ecf20Sopenharmony_ci
10168c2ecf20Sopenharmony_ci};
10178c2ecf20Sopenharmony_ci
10188c2ecf20Sopenharmony_ci/* Request types. NOTE that ALL requests have the same layout for the first
10198c2ecf20Sopenharmony_ci * few bytes.
10208c2ecf20Sopenharmony_ci */
10218c2ecf20Sopenharmony_cistruct __packed atto_vda_req_header {
10228c2ecf20Sopenharmony_ci	u32 length;
10238c2ecf20Sopenharmony_ci	u8 function;
10248c2ecf20Sopenharmony_ci	u8 variable1;
10258c2ecf20Sopenharmony_ci	u8 chain_offset;
10268c2ecf20Sopenharmony_ci	u8 sg_list_offset;
10278c2ecf20Sopenharmony_ci	u32 handle;
10288c2ecf20Sopenharmony_ci};
10298c2ecf20Sopenharmony_ci
10308c2ecf20Sopenharmony_ci
10318c2ecf20Sopenharmony_ci#define FCP_CDB_SIZE    16
10328c2ecf20Sopenharmony_ci
10338c2ecf20Sopenharmony_cistruct __packed atto_vda_scsi_req {
10348c2ecf20Sopenharmony_ci	u32 length;
10358c2ecf20Sopenharmony_ci	u8 function;  /* VDA_FUNC_SCSI */
10368c2ecf20Sopenharmony_ci	u8 sense_len;
10378c2ecf20Sopenharmony_ci	u8 chain_offset;
10388c2ecf20Sopenharmony_ci	u8 sg_list_offset;
10398c2ecf20Sopenharmony_ci	u32 handle;
10408c2ecf20Sopenharmony_ci	u32 flags;
10418c2ecf20Sopenharmony_ci     #define FCP_CMND_LUN_MASK    0x000000FF
10428c2ecf20Sopenharmony_ci     #define FCP_CMND_TA_MASK     0x00000700
10438c2ecf20Sopenharmony_ci      #define FCP_CMND_TA_SIMPL_Q 0x00000000
10448c2ecf20Sopenharmony_ci      #define FCP_CMND_TA_HEAD_Q  0x00000100
10458c2ecf20Sopenharmony_ci      #define FCP_CMND_TA_ORDRD_Q 0x00000200
10468c2ecf20Sopenharmony_ci      #define FCP_CMND_TA_ACA     0x00000400
10478c2ecf20Sopenharmony_ci     #define FCP_CMND_PRI_MASK    0x00007800
10488c2ecf20Sopenharmony_ci     #define FCP_CMND_TM_MASK     0x00FF0000
10498c2ecf20Sopenharmony_ci      #define FCP_CMND_ATS        0x00020000
10508c2ecf20Sopenharmony_ci      #define FCP_CMND_CTS        0x00040000
10518c2ecf20Sopenharmony_ci      #define FCP_CMND_LRS        0x00100000
10528c2ecf20Sopenharmony_ci      #define FCP_CMND_TRS        0x00200000
10538c2ecf20Sopenharmony_ci      #define FCP_CMND_CLA        0x00400000
10548c2ecf20Sopenharmony_ci      #define FCP_CMND_TRM        0x00800000
10558c2ecf20Sopenharmony_ci     #define FCP_CMND_DATA_DIR    0x03000000
10568c2ecf20Sopenharmony_ci      #define FCP_CMND_WRD        0x01000000
10578c2ecf20Sopenharmony_ci      #define FCP_CMND_RDD        0x02000000
10588c2ecf20Sopenharmony_ci
10598c2ecf20Sopenharmony_ci	u8 cdb[FCP_CDB_SIZE];
10608c2ecf20Sopenharmony_ci	union {
10618c2ecf20Sopenharmony_ci		struct __packed {
10628c2ecf20Sopenharmony_ci			u64 ppsense_buf;
10638c2ecf20Sopenharmony_ci			u16 target_id;
10648c2ecf20Sopenharmony_ci			u8 iblk_cnt_prd;
10658c2ecf20Sopenharmony_ci			u8 reserved;
10668c2ecf20Sopenharmony_ci		};
10678c2ecf20Sopenharmony_ci
10688c2ecf20Sopenharmony_ci		struct atto_physical_region_description sense_buff_prd;
10698c2ecf20Sopenharmony_ci	};
10708c2ecf20Sopenharmony_ci
10718c2ecf20Sopenharmony_ci	union {
10728c2ecf20Sopenharmony_ci		struct atto_vda_sge sge[1];
10738c2ecf20Sopenharmony_ci
10748c2ecf20Sopenharmony_ci		u32 abort_handle;
10758c2ecf20Sopenharmony_ci		u32 dwords[245];
10768c2ecf20Sopenharmony_ci		struct atto_physical_region_description prd[1];
10778c2ecf20Sopenharmony_ci	} u;
10788c2ecf20Sopenharmony_ci};
10798c2ecf20Sopenharmony_ci
10808c2ecf20Sopenharmony_ci
10818c2ecf20Sopenharmony_cistruct __packed atto_vda_flash_req {
10828c2ecf20Sopenharmony_ci	u32 length;
10838c2ecf20Sopenharmony_ci	u8 function; /* VDA_FUNC_FLASH */
10848c2ecf20Sopenharmony_ci	u8 sub_func;
10858c2ecf20Sopenharmony_ci	u8 chain_offset;
10868c2ecf20Sopenharmony_ci	u8 sg_list_offset;
10878c2ecf20Sopenharmony_ci	u32 handle;
10888c2ecf20Sopenharmony_ci	u32 flash_addr;
10898c2ecf20Sopenharmony_ci	u8 checksum;
10908c2ecf20Sopenharmony_ci	u8 rsvd[3];
10918c2ecf20Sopenharmony_ci
10928c2ecf20Sopenharmony_ci	union {
10938c2ecf20Sopenharmony_ci		struct {
10948c2ecf20Sopenharmony_ci			char file_name[16]; /* 8.3 fname, NULL term, wc=* */
10958c2ecf20Sopenharmony_ci			struct atto_vda_sge sge[1];
10968c2ecf20Sopenharmony_ci		} file;
10978c2ecf20Sopenharmony_ci
10988c2ecf20Sopenharmony_ci		struct atto_vda_sge sge[1];
10998c2ecf20Sopenharmony_ci		struct atto_physical_region_description prde[2];
11008c2ecf20Sopenharmony_ci	} data;
11018c2ecf20Sopenharmony_ci};
11028c2ecf20Sopenharmony_ci
11038c2ecf20Sopenharmony_ci
11048c2ecf20Sopenharmony_cistruct __packed atto_vda_diag_req {
11058c2ecf20Sopenharmony_ci	u32 length;
11068c2ecf20Sopenharmony_ci	u8 function; /* VDA_FUNC_DIAG */
11078c2ecf20Sopenharmony_ci	u8 sub_func;
11088c2ecf20Sopenharmony_ci	#define VDA_DIAG_STATUS   0x00
11098c2ecf20Sopenharmony_ci	#define VDA_DIAG_RESET    0x01
11108c2ecf20Sopenharmony_ci	#define VDA_DIAG_PAUSE    0x02
11118c2ecf20Sopenharmony_ci	#define VDA_DIAG_RESUME   0x03
11128c2ecf20Sopenharmony_ci	#define VDA_DIAG_READ     0x04
11138c2ecf20Sopenharmony_ci	#define VDA_DIAG_WRITE    0x05
11148c2ecf20Sopenharmony_ci
11158c2ecf20Sopenharmony_ci	u8 chain_offset;
11168c2ecf20Sopenharmony_ci	u8 sg_list_offset;
11178c2ecf20Sopenharmony_ci	u32 handle;
11188c2ecf20Sopenharmony_ci	u32 rsvd;
11198c2ecf20Sopenharmony_ci	u64 local_addr;
11208c2ecf20Sopenharmony_ci	struct atto_vda_sge sge[1];
11218c2ecf20Sopenharmony_ci};
11228c2ecf20Sopenharmony_ci
11238c2ecf20Sopenharmony_ci
11248c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_req {
11258c2ecf20Sopenharmony_ci	u32 length;
11268c2ecf20Sopenharmony_ci	u8 function; /* VDA_FUNC_AE */
11278c2ecf20Sopenharmony_ci	u8 reserved1;
11288c2ecf20Sopenharmony_ci	u8 chain_offset;
11298c2ecf20Sopenharmony_ci	u8 sg_list_offset;
11308c2ecf20Sopenharmony_ci	u32 handle;
11318c2ecf20Sopenharmony_ci
11328c2ecf20Sopenharmony_ci	union {
11338c2ecf20Sopenharmony_ci		struct atto_vda_sge sge[1];
11348c2ecf20Sopenharmony_ci		struct atto_physical_region_description prde[1];
11358c2ecf20Sopenharmony_ci	};
11368c2ecf20Sopenharmony_ci};
11378c2ecf20Sopenharmony_ci
11388c2ecf20Sopenharmony_ci
11398c2ecf20Sopenharmony_cistruct __packed atto_vda_cli_req {
11408c2ecf20Sopenharmony_ci	u32 length;
11418c2ecf20Sopenharmony_ci	u8 function; /* VDA_FUNC_CLI */
11428c2ecf20Sopenharmony_ci	u8 reserved1;
11438c2ecf20Sopenharmony_ci	u8 chain_offset;
11448c2ecf20Sopenharmony_ci	u8 sg_list_offset;
11458c2ecf20Sopenharmony_ci	u32 handle;
11468c2ecf20Sopenharmony_ci	u32 cmd_rsp_len;
11478c2ecf20Sopenharmony_ci	struct atto_vda_sge sge[1];
11488c2ecf20Sopenharmony_ci};
11498c2ecf20Sopenharmony_ci
11508c2ecf20Sopenharmony_ci
11518c2ecf20Sopenharmony_cistruct __packed atto_vda_ioctl_req {
11528c2ecf20Sopenharmony_ci	u32 length;
11538c2ecf20Sopenharmony_ci	u8 function; /* VDA_FUNC_IOCTL */
11548c2ecf20Sopenharmony_ci	u8 sub_func;
11558c2ecf20Sopenharmony_ci	u8 chain_offset;
11568c2ecf20Sopenharmony_ci	u8 sg_list_offset;
11578c2ecf20Sopenharmony_ci	u32 handle;
11588c2ecf20Sopenharmony_ci
11598c2ecf20Sopenharmony_ci	union {
11608c2ecf20Sopenharmony_ci		struct atto_vda_sge reserved_sge;
11618c2ecf20Sopenharmony_ci		struct atto_physical_region_description reserved_prde;
11628c2ecf20Sopenharmony_ci	};
11638c2ecf20Sopenharmony_ci
11648c2ecf20Sopenharmony_ci	union {
11658c2ecf20Sopenharmony_ci		struct {
11668c2ecf20Sopenharmony_ci			u32 ctrl_code;
11678c2ecf20Sopenharmony_ci			u16 target_id;
11688c2ecf20Sopenharmony_ci			u8 lun;
11698c2ecf20Sopenharmony_ci			u8 reserved;
11708c2ecf20Sopenharmony_ci		} csmi;
11718c2ecf20Sopenharmony_ci	};
11728c2ecf20Sopenharmony_ci
11738c2ecf20Sopenharmony_ci	union {
11748c2ecf20Sopenharmony_ci		struct atto_vda_sge sge[1];
11758c2ecf20Sopenharmony_ci		struct atto_physical_region_description prde[1];
11768c2ecf20Sopenharmony_ci	};
11778c2ecf20Sopenharmony_ci};
11788c2ecf20Sopenharmony_ci
11798c2ecf20Sopenharmony_ci
11808c2ecf20Sopenharmony_cistruct __packed atto_vda_cfg_req {
11818c2ecf20Sopenharmony_ci	u32 length;
11828c2ecf20Sopenharmony_ci	u8 function; /* VDA_FUNC_CFG */
11838c2ecf20Sopenharmony_ci	u8 sub_func;
11848c2ecf20Sopenharmony_ci	u8 rsvd1;
11858c2ecf20Sopenharmony_ci	u8 sg_list_offset;
11868c2ecf20Sopenharmony_ci	u32 handle;
11878c2ecf20Sopenharmony_ci
11888c2ecf20Sopenharmony_ci	union {
11898c2ecf20Sopenharmony_ci		u8 bytes[116];
11908c2ecf20Sopenharmony_ci		struct atto_vda_cfg_init init;
11918c2ecf20Sopenharmony_ci		struct atto_vda_sge sge;
11928c2ecf20Sopenharmony_ci		struct atto_physical_region_description prde;
11938c2ecf20Sopenharmony_ci	} data;
11948c2ecf20Sopenharmony_ci};
11958c2ecf20Sopenharmony_ci
11968c2ecf20Sopenharmony_ci
11978c2ecf20Sopenharmony_cistruct __packed atto_vda_mgmt_req {
11988c2ecf20Sopenharmony_ci	u32 length;
11998c2ecf20Sopenharmony_ci	u8 function; /* VDA_FUNC_MGT */
12008c2ecf20Sopenharmony_ci	u8 mgt_func;
12018c2ecf20Sopenharmony_ci	u8 chain_offset;
12028c2ecf20Sopenharmony_ci	u8 sg_list_offset;
12038c2ecf20Sopenharmony_ci	u32 handle;
12048c2ecf20Sopenharmony_ci	u8 scan_generation;
12058c2ecf20Sopenharmony_ci	u8 payld_sglst_offset;
12068c2ecf20Sopenharmony_ci	u16 dev_index;
12078c2ecf20Sopenharmony_ci	u32 payld_length;
12088c2ecf20Sopenharmony_ci	u32 pad;
12098c2ecf20Sopenharmony_ci	union {
12108c2ecf20Sopenharmony_ci		struct atto_vda_sge sge[2];
12118c2ecf20Sopenharmony_ci		struct atto_physical_region_description prde[2];
12128c2ecf20Sopenharmony_ci	};
12138c2ecf20Sopenharmony_ci	struct atto_vda_sge payld_sge[1];
12148c2ecf20Sopenharmony_ci};
12158c2ecf20Sopenharmony_ci
12168c2ecf20Sopenharmony_ci
12178c2ecf20Sopenharmony_ciunion atto_vda_req {
12188c2ecf20Sopenharmony_ci	struct atto_vda_scsi_req scsi;
12198c2ecf20Sopenharmony_ci	struct atto_vda_flash_req flash;
12208c2ecf20Sopenharmony_ci	struct atto_vda_diag_req diag;
12218c2ecf20Sopenharmony_ci	struct atto_vda_ae_req ae;
12228c2ecf20Sopenharmony_ci	struct atto_vda_cli_req cli;
12238c2ecf20Sopenharmony_ci	struct atto_vda_ioctl_req ioctl;
12248c2ecf20Sopenharmony_ci	struct atto_vda_cfg_req cfg;
12258c2ecf20Sopenharmony_ci	struct atto_vda_mgmt_req mgt;
12268c2ecf20Sopenharmony_ci	u8 bytes[1024];
12278c2ecf20Sopenharmony_ci};
12288c2ecf20Sopenharmony_ci
12298c2ecf20Sopenharmony_ci/* Outbound response structures */
12308c2ecf20Sopenharmony_ci
12318c2ecf20Sopenharmony_cistruct __packed atto_vda_scsi_rsp {
12328c2ecf20Sopenharmony_ci	u8 scsi_stat;
12338c2ecf20Sopenharmony_ci	u8 sense_len;
12348c2ecf20Sopenharmony_ci	u8 rsvd[2];
12358c2ecf20Sopenharmony_ci	u32 residual_length;
12368c2ecf20Sopenharmony_ci};
12378c2ecf20Sopenharmony_ci
12388c2ecf20Sopenharmony_cistruct __packed atto_vda_flash_rsp {
12398c2ecf20Sopenharmony_ci	u32 file_size;
12408c2ecf20Sopenharmony_ci};
12418c2ecf20Sopenharmony_ci
12428c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_rsp {
12438c2ecf20Sopenharmony_ci	u32 length;
12448c2ecf20Sopenharmony_ci};
12458c2ecf20Sopenharmony_ci
12468c2ecf20Sopenharmony_cistruct __packed atto_vda_cli_rsp {
12478c2ecf20Sopenharmony_ci	u32 cmd_rsp_len;
12488c2ecf20Sopenharmony_ci};
12498c2ecf20Sopenharmony_ci
12508c2ecf20Sopenharmony_cistruct __packed atto_vda_ioctl_rsp {
12518c2ecf20Sopenharmony_ci	union {
12528c2ecf20Sopenharmony_ci		struct {
12538c2ecf20Sopenharmony_ci			u32 csmi_status;
12548c2ecf20Sopenharmony_ci			u16 target_id;
12558c2ecf20Sopenharmony_ci			u8 lun;
12568c2ecf20Sopenharmony_ci			u8 reserved;
12578c2ecf20Sopenharmony_ci		} csmi;
12588c2ecf20Sopenharmony_ci	};
12598c2ecf20Sopenharmony_ci};
12608c2ecf20Sopenharmony_ci
12618c2ecf20Sopenharmony_cistruct __packed atto_vda_cfg_rsp {
12628c2ecf20Sopenharmony_ci	u16 vda_version;
12638c2ecf20Sopenharmony_ci	u16 fw_release;
12648c2ecf20Sopenharmony_ci	u32 fw_build;
12658c2ecf20Sopenharmony_ci};
12668c2ecf20Sopenharmony_ci
12678c2ecf20Sopenharmony_cistruct __packed atto_vda_mgmt_rsp {
12688c2ecf20Sopenharmony_ci	u32 length;
12698c2ecf20Sopenharmony_ci	u16 dev_index;
12708c2ecf20Sopenharmony_ci	u8 scan_generation;
12718c2ecf20Sopenharmony_ci};
12728c2ecf20Sopenharmony_ci
12738c2ecf20Sopenharmony_ciunion atto_vda_func_rsp {
12748c2ecf20Sopenharmony_ci	struct atto_vda_scsi_rsp scsi_rsp;
12758c2ecf20Sopenharmony_ci	struct atto_vda_flash_rsp flash_rsp;
12768c2ecf20Sopenharmony_ci	struct atto_vda_ae_rsp ae_rsp;
12778c2ecf20Sopenharmony_ci	struct atto_vda_cli_rsp cli_rsp;
12788c2ecf20Sopenharmony_ci	struct atto_vda_ioctl_rsp ioctl_rsp;
12798c2ecf20Sopenharmony_ci	struct atto_vda_cfg_rsp cfg_rsp;
12808c2ecf20Sopenharmony_ci	struct atto_vda_mgmt_rsp mgt_rsp;
12818c2ecf20Sopenharmony_ci	u32 dwords[2];
12828c2ecf20Sopenharmony_ci};
12838c2ecf20Sopenharmony_ci
12848c2ecf20Sopenharmony_cistruct __packed atto_vda_ob_rsp {
12858c2ecf20Sopenharmony_ci	u32 handle;
12868c2ecf20Sopenharmony_ci	u8 req_stat;
12878c2ecf20Sopenharmony_ci	u8 rsvd[3];
12888c2ecf20Sopenharmony_ci
12898c2ecf20Sopenharmony_ci	union atto_vda_func_rsp
12908c2ecf20Sopenharmony_ci		func_rsp;
12918c2ecf20Sopenharmony_ci};
12928c2ecf20Sopenharmony_ci
12938c2ecf20Sopenharmony_cistruct __packed atto_vda_ae_data {
12948c2ecf20Sopenharmony_ci	u8 event_data[256];
12958c2ecf20Sopenharmony_ci};
12968c2ecf20Sopenharmony_ci
12978c2ecf20Sopenharmony_cistruct __packed atto_vda_mgmt_data {
12988c2ecf20Sopenharmony_ci	union {
12998c2ecf20Sopenharmony_ci		u8 bytes[112];
13008c2ecf20Sopenharmony_ci		struct atto_vda_devinfo dev_info;
13018c2ecf20Sopenharmony_ci		struct atto_vda_grp_info grp_info;
13028c2ecf20Sopenharmony_ci		struct atto_vdapart_info part_info;
13038c2ecf20Sopenharmony_ci		struct atto_vda_dh_info dev_health_info;
13048c2ecf20Sopenharmony_ci		struct atto_vda_metrics_info metrics_info;
13058c2ecf20Sopenharmony_ci		struct atto_vda_schedule_info sched_info;
13068c2ecf20Sopenharmony_ci		struct atto_vda_n_vcache_info nvcache_info;
13078c2ecf20Sopenharmony_ci		struct atto_vda_buzzer_info buzzer_info;
13088c2ecf20Sopenharmony_ci	} data;
13098c2ecf20Sopenharmony_ci};
13108c2ecf20Sopenharmony_ci
13118c2ecf20Sopenharmony_ciunion atto_vda_rsp_data {
13128c2ecf20Sopenharmony_ci	struct atto_vda_ae_data ae_data;
13138c2ecf20Sopenharmony_ci	struct atto_vda_mgmt_data mgt_data;
13148c2ecf20Sopenharmony_ci	u8 sense_data[252];
13158c2ecf20Sopenharmony_ci	#define SENSE_DATA_SZ   252;
13168c2ecf20Sopenharmony_ci	u8 bytes[256];
13178c2ecf20Sopenharmony_ci};
13188c2ecf20Sopenharmony_ci
13198c2ecf20Sopenharmony_ci#endif
1320