1c4a3e0a5SBagalkote, Sreenivas /* 2c4a3e0a5SBagalkote, Sreenivas * Linux MegaRAID driver for SAS based RAID controllers 3c4a3e0a5SBagalkote, Sreenivas * 4e399065bSSumit.Saxena@avagotech.com * Copyright (c) 2003-2013 LSI Corporation 5e399065bSSumit.Saxena@avagotech.com * Copyright (c) 2013-2014 Avago Technologies 6c4a3e0a5SBagalkote, Sreenivas * 7c4a3e0a5SBagalkote, Sreenivas * This program is free software; you can redistribute it and/or 8c4a3e0a5SBagalkote, Sreenivas * modify it under the terms of the GNU General Public License 93f1530c1Sadam radford * as published by the Free Software Foundation; either version 2 103f1530c1Sadam radford * of the License, or (at your option) any later version. 113f1530c1Sadam radford * 123f1530c1Sadam radford * This program is distributed in the hope that it will be useful, 133f1530c1Sadam radford * but WITHOUT ANY WARRANTY; without even the implied warranty of 143f1530c1Sadam radford * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 153f1530c1Sadam radford * GNU General Public License for more details. 163f1530c1Sadam radford * 173f1530c1Sadam radford * You should have received a copy of the GNU General Public License 18e399065bSSumit.Saxena@avagotech.com * along with this program. If not, see <http://www.gnu.org/licenses/>. 19c4a3e0a5SBagalkote, Sreenivas * 20c4a3e0a5SBagalkote, Sreenivas * FILE: megaraid_sas.h 213f1530c1Sadam radford * 22e399065bSSumit.Saxena@avagotech.com * Authors: Avago Technologies 23e399065bSSumit.Saxena@avagotech.com * Kashyap Desai <kashyap.desai@avagotech.com> 24e399065bSSumit.Saxena@avagotech.com * Sumit Saxena <sumit.saxena@avagotech.com> 253f1530c1Sadam radford * 26e399065bSSumit.Saxena@avagotech.com * Send feedback to: megaraidlinux.pdl@avagotech.com 273f1530c1Sadam radford * 28e399065bSSumit.Saxena@avagotech.com * Mail to: Avago Technologies, 350 West Trimble Road, Building 90, 29e399065bSSumit.Saxena@avagotech.com * San Jose, California 95131 30c4a3e0a5SBagalkote, Sreenivas */ 31c4a3e0a5SBagalkote, Sreenivas 32c4a3e0a5SBagalkote, Sreenivas #ifndef LSI_MEGARAID_SAS_H 33c4a3e0a5SBagalkote, Sreenivas #define LSI_MEGARAID_SAS_H 34c4a3e0a5SBagalkote, Sreenivas 35a69b74d3SRandy Dunlap /* 36c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS Driver meta data 37c4a3e0a5SBagalkote, Sreenivas */ 38223e4b93SSasikumar Chandrasekaran #define MEGASAS_VERSION "07.700.00.00-rc1" 39223e4b93SSasikumar Chandrasekaran #define MEGASAS_RELDATE "November 29, 2016" 400e98936cSSumant Patro 410e98936cSSumant Patro /* 420e98936cSSumant Patro * Device IDs 430e98936cSSumant Patro */ 440e98936cSSumant Patro #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 45af7a5647Sbo yang #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C 460e98936cSSumant Patro #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 476610a6b3SYang, Bo #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078 486610a6b3SYang, Bo #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079 4987911122SYang, Bo #define PCI_DEVICE_ID_LSI_SAS0073SKINNY 0x0073 5087911122SYang, Bo #define PCI_DEVICE_ID_LSI_SAS0071SKINNY 0x0071 519c915a8cSadam radford #define PCI_DEVICE_ID_LSI_FUSION 0x005b 52229fe47cSadam radford #define PCI_DEVICE_ID_LSI_PLASMA 0x002f 5336807e67Sadam radford #define PCI_DEVICE_ID_LSI_INVADER 0x005d 5421d3c710SSumit.Saxena@lsi.com #define PCI_DEVICE_ID_LSI_FURY 0x005f 5590c204bcSsumit.saxena@avagotech.com #define PCI_DEVICE_ID_LSI_INTRUDER 0x00ce 5690c204bcSsumit.saxena@avagotech.com #define PCI_DEVICE_ID_LSI_INTRUDER_24 0x00cf 577364d34bSsumit.saxena@avagotech.com #define PCI_DEVICE_ID_LSI_CUTLASS_52 0x0052 587364d34bSsumit.saxena@avagotech.com #define PCI_DEVICE_ID_LSI_CUTLASS_53 0x0053 5945f4f2ebSSasikumar Chandrasekaran #define PCI_DEVICE_ID_LSI_VENTURA 0x0014 6045f4f2ebSSasikumar Chandrasekaran #define PCI_DEVICE_ID_LSI_HARPOON 0x0016 6145f4f2ebSSasikumar Chandrasekaran #define PCI_DEVICE_ID_LSI_TOMCAT 0x0017 6245f4f2ebSSasikumar Chandrasekaran #define PCI_DEVICE_ID_LSI_VENTURA_4PORT 0x001B 6345f4f2ebSSasikumar Chandrasekaran #define PCI_DEVICE_ID_LSI_CRUSADER_4PORT 0x001C 640e98936cSSumant Patro 65c4a3e0a5SBagalkote, Sreenivas /* 6639b72c3cSSumit.Saxena@lsi.com * Intel HBA SSDIDs 6739b72c3cSSumit.Saxena@lsi.com */ 6839b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3DC080_SSDID 0x9360 6939b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3DC040_SSDID 0x9362 7039b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3SC008_SSDID 0x9380 7139b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3MC044_SSDID 0x9381 7239b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3WC080_SSDID 0x9341 7339b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3WC040_SSDID 0x9343 747364d34bSsumit.saxena@avagotech.com #define MEGARAID_INTEL_RMS3BC160_SSDID 0x352B 7539b72c3cSSumit.Saxena@lsi.com 7639b72c3cSSumit.Saxena@lsi.com /* 7790c204bcSsumit.saxena@avagotech.com * Intruder HBA SSDIDs 7890c204bcSsumit.saxena@avagotech.com */ 7990c204bcSsumit.saxena@avagotech.com #define MEGARAID_INTRUDER_SSDID1 0x9371 8090c204bcSsumit.saxena@avagotech.com #define MEGARAID_INTRUDER_SSDID2 0x9390 8190c204bcSsumit.saxena@avagotech.com #define MEGARAID_INTRUDER_SSDID3 0x9370 8290c204bcSsumit.saxena@avagotech.com 8390c204bcSsumit.saxena@avagotech.com /* 8439b72c3cSSumit.Saxena@lsi.com * Intel HBA branding 8539b72c3cSSumit.Saxena@lsi.com */ 8639b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3DC080_BRANDING \ 8739b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3DC080" 8839b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3DC040_BRANDING \ 8939b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3DC040" 9039b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3SC008_BRANDING \ 9139b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3SC008" 9239b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3MC044_BRANDING \ 9339b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3MC044" 9439b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3WC080_BRANDING \ 9539b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3WC080" 9639b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3WC040_BRANDING \ 9739b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3WC040" 987364d34bSsumit.saxena@avagotech.com #define MEGARAID_INTEL_RMS3BC160_BRANDING \ 997364d34bSsumit.saxena@avagotech.com "Intel(R) Integrated RAID Module RMS3BC160" 10039b72c3cSSumit.Saxena@lsi.com 10139b72c3cSSumit.Saxena@lsi.com /* 102c4a3e0a5SBagalkote, Sreenivas * ===================================== 103c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS MFI firmware definitions 104c4a3e0a5SBagalkote, Sreenivas * ===================================== 105c4a3e0a5SBagalkote, Sreenivas */ 106c4a3e0a5SBagalkote, Sreenivas 107c4a3e0a5SBagalkote, Sreenivas /* 108c4a3e0a5SBagalkote, Sreenivas * MFI stands for MegaRAID SAS FW Interface. This is just a moniker for 109c4a3e0a5SBagalkote, Sreenivas * protocol between the software and firmware. Commands are issued using 110c4a3e0a5SBagalkote, Sreenivas * "message frames" 111c4a3e0a5SBagalkote, Sreenivas */ 112c4a3e0a5SBagalkote, Sreenivas 113a69b74d3SRandy Dunlap /* 114c4a3e0a5SBagalkote, Sreenivas * FW posts its state in upper 4 bits of outbound_msg_0 register 115c4a3e0a5SBagalkote, Sreenivas */ 116c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_MASK 0xF0000000 117c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_UNDEFINED 0x00000000 118c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_BB_INIT 0x10000000 119c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FW_INIT 0x40000000 120c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_WAIT_HANDSHAKE 0x60000000 121c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FW_INIT_2 0x70000000 122c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_DEVICE_SCAN 0x80000000 123e3bbff9fSSumant Patro #define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000 124c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FLUSH_CACHE 0xA0000000 125c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_READY 0xB0000000 126c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_OPERATIONAL 0xC0000000 127c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FAULT 0xF0000000 128fc62b3fcSSumit.Saxena@avagotech.com #define MFI_STATE_FORCE_OCR 0x00000080 129fc62b3fcSSumit.Saxena@avagotech.com #define MFI_STATE_DMADONE 0x00000008 130fc62b3fcSSumit.Saxena@avagotech.com #define MFI_STATE_CRASH_DUMP_DONE 0x00000004 13139a98554Sbo yang #define MFI_RESET_REQUIRED 0x00000001 1327e70e733Sadam radford #define MFI_RESET_ADAPTER 0x00000002 133c4a3e0a5SBagalkote, Sreenivas #define MEGAMFI_FRAME_SIZE 64 134c4a3e0a5SBagalkote, Sreenivas 135a69b74d3SRandy Dunlap /* 136c4a3e0a5SBagalkote, Sreenivas * During FW init, clear pending cmds & reset state using inbound_msg_0 137c4a3e0a5SBagalkote, Sreenivas * 138c4a3e0a5SBagalkote, Sreenivas * ABORT : Abort all pending cmds 139c4a3e0a5SBagalkote, Sreenivas * READY : Move from OPERATIONAL to READY state; discard queue info 140c4a3e0a5SBagalkote, Sreenivas * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??) 141c4a3e0a5SBagalkote, Sreenivas * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver 142e3bbff9fSSumant Patro * HOTPLUG : Resume from Hotplug 143e3bbff9fSSumant Patro * MFI_STOP_ADP : Send signal to FW to stop processing 144c4a3e0a5SBagalkote, Sreenivas */ 14539a98554Sbo yang #define WRITE_SEQUENCE_OFFSET (0x0000000FC) /* I20 */ 14639a98554Sbo yang #define HOST_DIAGNOSTIC_OFFSET (0x000000F8) /* I20 */ 14739a98554Sbo yang #define DIAG_WRITE_ENABLE (0x00000080) 14839a98554Sbo yang #define DIAG_RESET_ADAPTER (0x00000004) 14939a98554Sbo yang 15039a98554Sbo yang #define MFI_ADP_RESET 0x00000040 151e3bbff9fSSumant Patro #define MFI_INIT_ABORT 0x00000001 152c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_READY 0x00000002 153c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_MFIMODE 0x00000004 154c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_CLEAR_HANDSHAKE 0x00000008 155e3bbff9fSSumant Patro #define MFI_INIT_HOTPLUG 0x00000010 156e3bbff9fSSumant Patro #define MFI_STOP_ADP 0x00000020 157e3bbff9fSSumant Patro #define MFI_RESET_FLAGS MFI_INIT_READY| \ 158e3bbff9fSSumant Patro MFI_INIT_MFIMODE| \ 159e3bbff9fSSumant Patro MFI_INIT_ABORT 160179ac142SSumit Saxena #define MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE (0x01) 161c4a3e0a5SBagalkote, Sreenivas 162a69b74d3SRandy Dunlap /* 163c4a3e0a5SBagalkote, Sreenivas * MFI frame flags 164c4a3e0a5SBagalkote, Sreenivas */ 165c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000 166c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001 167c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SGL32 0x0000 168c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SGL64 0x0002 169c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SENSE32 0x0000 170c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SENSE64 0x0004 171c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_NONE 0x0000 172c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_WRITE 0x0008 173c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_READ 0x0010 174c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_BOTH 0x0018 175f4c9a131SYang, Bo #define MFI_FRAME_IEEE 0x0020 176c4a3e0a5SBagalkote, Sreenivas 1774026e9aaSSumit.Saxena@avagotech.com /* Driver internal */ 1784026e9aaSSumit.Saxena@avagotech.com #define DRV_DCMD_POLLED_MODE 0x1 1796d40afbcSSumit Saxena #define DRV_DCMD_SKIP_REFIRE 0x2 1804026e9aaSSumit.Saxena@avagotech.com 181a69b74d3SRandy Dunlap /* 182c4a3e0a5SBagalkote, Sreenivas * Definition for cmd_status 183c4a3e0a5SBagalkote, Sreenivas */ 184c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_STATUS_POLL_MODE 0xFF 185c4a3e0a5SBagalkote, Sreenivas 186a69b74d3SRandy Dunlap /* 187c4a3e0a5SBagalkote, Sreenivas * MFI command opcodes 188c4a3e0a5SBagalkote, Sreenivas */ 189c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_INIT 0x00 190c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_READ 0x01 191c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_WRITE 0x02 192c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_SCSI_IO 0x03 193c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_PD_SCSI_IO 0x04 194c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_DCMD 0x05 195c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_ABORT 0x06 196c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_SMP 0x07 197c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_STP 0x08 198e5f93a36Sadam radford #define MFI_CMD_INVALID 0xff 199c4a3e0a5SBagalkote, Sreenivas 200c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_GET_INFO 0x01010000 201bdc6fb8dSYang, Bo #define MR_DCMD_LD_GET_LIST 0x03010000 20221c9e160Sadam radford #define MR_DCMD_LD_LIST_QUERY 0x03010100 203c4a3e0a5SBagalkote, Sreenivas 204c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000 205c4a3e0a5SBagalkote, Sreenivas #define MR_FLUSH_CTRL_CACHE 0x01 206c4a3e0a5SBagalkote, Sreenivas #define MR_FLUSH_DISK_CACHE 0x02 207c4a3e0a5SBagalkote, Sreenivas 208c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_SHUTDOWN 0x01050000 20931ea7088Sbo yang #define MR_DCMD_HIBERNATE_SHUTDOWN 0x01060000 210c4a3e0a5SBagalkote, Sreenivas #define MR_ENABLE_DRIVE_SPINDOWN 0x01 211c4a3e0a5SBagalkote, Sreenivas 212c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100 213c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_GET 0x01040300 214c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500 215c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_LD_GET_PROPERTIES 0x03030000 216c4a3e0a5SBagalkote, Sreenivas 217c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER 0x08000000 218c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100 219c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER_RESET_LD 0x08010200 22081e403ceSYang, Bo #define MR_DCMD_PD_LIST_QUERY 0x02010100 221c4a3e0a5SBagalkote, Sreenivas 222fc62b3fcSSumit.Saxena@avagotech.com #define MR_DCMD_CTRL_SET_CRASH_DUMP_PARAMS 0x01190100 223fc62b3fcSSumit.Saxena@avagotech.com #define MR_DRIVER_SET_APP_CRASHDUMP_MODE (0xF0010000 | 0x0600) 2242216c305SSumit Saxena #define MR_DCMD_PD_GET_INFO 0x02020000 225fc62b3fcSSumit.Saxena@avagotech.com 226a69b74d3SRandy Dunlap /* 227bc93d425SSumit.Saxena@lsi.com * Global functions 228bc93d425SSumit.Saxena@lsi.com */ 229bc93d425SSumit.Saxena@lsi.com extern u8 MR_ValidateMapInfo(struct megasas_instance *instance); 230bc93d425SSumit.Saxena@lsi.com 231bc93d425SSumit.Saxena@lsi.com 232bc93d425SSumit.Saxena@lsi.com /* 233c4a3e0a5SBagalkote, Sreenivas * MFI command completion codes 234c4a3e0a5SBagalkote, Sreenivas */ 235c4a3e0a5SBagalkote, Sreenivas enum MFI_STAT { 236c4a3e0a5SBagalkote, Sreenivas MFI_STAT_OK = 0x00, 237c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_CMD = 0x01, 238c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_DCMD = 0x02, 239c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_PARAMETER = 0x03, 240c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04, 241c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ABORT_NOT_POSSIBLE = 0x05, 242c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06, 243c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_IN_USE = 0x07, 244c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_NOT_INITIALIZED = 0x08, 245c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ARRAY_INDEX_INVALID = 0x09, 246c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a, 247c4a3e0a5SBagalkote, Sreenivas MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b, 248c4a3e0a5SBagalkote, Sreenivas MFI_STAT_DEVICE_NOT_FOUND = 0x0c, 249c4a3e0a5SBagalkote, Sreenivas MFI_STAT_DRIVE_TOO_SMALL = 0x0d, 250c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_ALLOC_FAIL = 0x0e, 251c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_BUSY = 0x0f, 252c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_ERROR = 0x10, 253c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_IMAGE_BAD = 0x11, 254c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12, 255c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_NOT_OPEN = 0x13, 256c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_NOT_STARTED = 0x14, 257c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLUSH_FAILED = 0x15, 258c4a3e0a5SBagalkote, Sreenivas MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16, 259c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_CC_IN_PROGRESS = 0x17, 260c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_INIT_IN_PROGRESS = 0x18, 261c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19, 262c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_MAX_CONFIGURED = 0x1a, 263c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_NOT_OPTIMAL = 0x1b, 264c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c, 265c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d, 266c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e, 267c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f, 268c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20, 269c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MFC_HW_ERROR = 0x21, 270c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NO_HW_PRESENT = 0x22, 271c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NOT_FOUND = 0x23, 272c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NOT_IN_ENCL = 0x24, 273c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25, 274c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PD_TYPE_WRONG = 0x26, 275c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PR_DISABLED = 0x27, 276c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ROW_INDEX_INVALID = 0x28, 277c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29, 278c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a, 279c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b, 280c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c, 281c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d, 282c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_IO_FAILED = 0x2e, 283c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f, 284c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SHUTDOWN_FAILED = 0x30, 285c4a3e0a5SBagalkote, Sreenivas MFI_STAT_TIME_NOT_SET = 0x31, 286c4a3e0a5SBagalkote, Sreenivas MFI_STAT_WRONG_STATE = 0x32, 287c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_OFFLINE = 0x33, 288c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PEER_NOTIFICATION_REJECTED = 0x34, 289c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PEER_NOTIFICATION_FAILED = 0x35, 290c4a3e0a5SBagalkote, Sreenivas MFI_STAT_RESERVATION_IN_PROGRESS = 0x36, 291c4a3e0a5SBagalkote, Sreenivas MFI_STAT_I2C_ERRORS_DETECTED = 0x37, 292c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PCI_ERRORS_DETECTED = 0x38, 29336807e67Sadam radford MFI_STAT_CONFIG_SEQ_MISMATCH = 0x67, 294c4a3e0a5SBagalkote, Sreenivas 295c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_STATUS = 0xFF 296c4a3e0a5SBagalkote, Sreenivas }; 297c4a3e0a5SBagalkote, Sreenivas 298714f5177Ssumit.saxena@avagotech.com enum mfi_evt_class { 299714f5177Ssumit.saxena@avagotech.com MFI_EVT_CLASS_DEBUG = -2, 300714f5177Ssumit.saxena@avagotech.com MFI_EVT_CLASS_PROGRESS = -1, 301714f5177Ssumit.saxena@avagotech.com MFI_EVT_CLASS_INFO = 0, 302714f5177Ssumit.saxena@avagotech.com MFI_EVT_CLASS_WARNING = 1, 303714f5177Ssumit.saxena@avagotech.com MFI_EVT_CLASS_CRITICAL = 2, 304714f5177Ssumit.saxena@avagotech.com MFI_EVT_CLASS_FATAL = 3, 305714f5177Ssumit.saxena@avagotech.com MFI_EVT_CLASS_DEAD = 4 306714f5177Ssumit.saxena@avagotech.com }; 307714f5177Ssumit.saxena@avagotech.com 308c4a3e0a5SBagalkote, Sreenivas /* 309fc62b3fcSSumit.Saxena@avagotech.com * Crash dump related defines 310fc62b3fcSSumit.Saxena@avagotech.com */ 311fc62b3fcSSumit.Saxena@avagotech.com #define MAX_CRASH_DUMP_SIZE 512 312fc62b3fcSSumit.Saxena@avagotech.com #define CRASH_DMA_BUF_SIZE (1024 * 1024) 313fc62b3fcSSumit.Saxena@avagotech.com 314fc62b3fcSSumit.Saxena@avagotech.com enum MR_FW_CRASH_DUMP_STATE { 315fc62b3fcSSumit.Saxena@avagotech.com UNAVAILABLE = 0, 316fc62b3fcSSumit.Saxena@avagotech.com AVAILABLE = 1, 317fc62b3fcSSumit.Saxena@avagotech.com COPYING = 2, 318fc62b3fcSSumit.Saxena@avagotech.com COPIED = 3, 319fc62b3fcSSumit.Saxena@avagotech.com COPY_ERROR = 4, 320fc62b3fcSSumit.Saxena@avagotech.com }; 321fc62b3fcSSumit.Saxena@avagotech.com 322fc62b3fcSSumit.Saxena@avagotech.com enum _MR_CRASH_BUF_STATUS { 323fc62b3fcSSumit.Saxena@avagotech.com MR_CRASH_BUF_TURN_OFF = 0, 324fc62b3fcSSumit.Saxena@avagotech.com MR_CRASH_BUF_TURN_ON = 1, 325fc62b3fcSSumit.Saxena@avagotech.com }; 326fc62b3fcSSumit.Saxena@avagotech.com 327fc62b3fcSSumit.Saxena@avagotech.com /* 328c4a3e0a5SBagalkote, Sreenivas * Number of mailbox bytes in DCMD message frame 329c4a3e0a5SBagalkote, Sreenivas */ 330c4a3e0a5SBagalkote, Sreenivas #define MFI_MBOX_SIZE 12 331c4a3e0a5SBagalkote, Sreenivas 332c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_CLASS { 333c4a3e0a5SBagalkote, Sreenivas 334c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_DEBUG = -2, 335c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_PROGRESS = -1, 336c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_INFO = 0, 337c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_WARNING = 1, 338c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_CRITICAL = 2, 339c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_FATAL = 3, 340c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_DEAD = 4, 341c4a3e0a5SBagalkote, Sreenivas 342c4a3e0a5SBagalkote, Sreenivas }; 343c4a3e0a5SBagalkote, Sreenivas 344c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_LOCALE { 345c4a3e0a5SBagalkote, Sreenivas 346c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_LD = 0x0001, 347c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_PD = 0x0002, 348c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_ENCL = 0x0004, 349c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_BBU = 0x0008, 350c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_SAS = 0x0010, 351c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CTRL = 0x0020, 352c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CONFIG = 0x0040, 353c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CLUSTER = 0x0080, 354c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_ALL = 0xffff, 355c4a3e0a5SBagalkote, Sreenivas 356c4a3e0a5SBagalkote, Sreenivas }; 357c4a3e0a5SBagalkote, Sreenivas 358c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_ARGS { 359c4a3e0a5SBagalkote, Sreenivas 360c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_NONE, 361c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_CDB_SENSE, 362c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD, 363c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_COUNT, 364c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_LBA, 365c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_OWNER, 366c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_LBA_PD_LBA, 367c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_PROG, 368c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_STATE, 369c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_STRIP, 370c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD, 371c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_ERR, 372c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_LBA, 373c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_LBA_LD, 374c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_PROG, 375c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_STATE, 376c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PCI, 377c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_RATE, 378c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_STR, 379c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_TIME, 380c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_ECC, 38181e403ceSYang, Bo MR_EVT_ARGS_LD_PROP, 38281e403ceSYang, Bo MR_EVT_ARGS_PD_SPARE, 38381e403ceSYang, Bo MR_EVT_ARGS_PD_INDEX, 38481e403ceSYang, Bo MR_EVT_ARGS_DIAG_PASS, 38581e403ceSYang, Bo MR_EVT_ARGS_DIAG_FAIL, 38681e403ceSYang, Bo MR_EVT_ARGS_PD_LBA_LBA, 38781e403ceSYang, Bo MR_EVT_ARGS_PORT_PHY, 38881e403ceSYang, Bo MR_EVT_ARGS_PD_MISSING, 38981e403ceSYang, Bo MR_EVT_ARGS_PD_ADDRESS, 39081e403ceSYang, Bo MR_EVT_ARGS_BITMAP, 39181e403ceSYang, Bo MR_EVT_ARGS_CONNECTOR, 39281e403ceSYang, Bo MR_EVT_ARGS_PD_PD, 39381e403ceSYang, Bo MR_EVT_ARGS_PD_FRU, 39481e403ceSYang, Bo MR_EVT_ARGS_PD_PATHINFO, 39581e403ceSYang, Bo MR_EVT_ARGS_PD_POWER_STATE, 39681e403ceSYang, Bo MR_EVT_ARGS_GENERIC, 397c4a3e0a5SBagalkote, Sreenivas }; 398c4a3e0a5SBagalkote, Sreenivas 399357ae967Ssumit.saxena@avagotech.com 400357ae967Ssumit.saxena@avagotech.com #define SGE_BUFFER_SIZE 4096 4018f67c8c5SSumit Saxena #define MEGASAS_CLUSTER_ID_SIZE 16 402c4a3e0a5SBagalkote, Sreenivas /* 40381e403ceSYang, Bo * define constants for device list query options 40481e403ceSYang, Bo */ 40581e403ceSYang, Bo enum MR_PD_QUERY_TYPE { 40681e403ceSYang, Bo MR_PD_QUERY_TYPE_ALL = 0, 40781e403ceSYang, Bo MR_PD_QUERY_TYPE_STATE = 1, 40881e403ceSYang, Bo MR_PD_QUERY_TYPE_POWER_STATE = 2, 40981e403ceSYang, Bo MR_PD_QUERY_TYPE_MEDIA_TYPE = 3, 41081e403ceSYang, Bo MR_PD_QUERY_TYPE_SPEED = 4, 41181e403ceSYang, Bo MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5, 41281e403ceSYang, Bo }; 41381e403ceSYang, Bo 41421c9e160Sadam radford enum MR_LD_QUERY_TYPE { 41521c9e160Sadam radford MR_LD_QUERY_TYPE_ALL = 0, 41621c9e160Sadam radford MR_LD_QUERY_TYPE_EXPOSED_TO_HOST = 1, 41721c9e160Sadam radford MR_LD_QUERY_TYPE_USED_TGT_IDS = 2, 41821c9e160Sadam radford MR_LD_QUERY_TYPE_CLUSTER_ACCESS = 3, 41921c9e160Sadam radford MR_LD_QUERY_TYPE_CLUSTER_LOCALE = 4, 42021c9e160Sadam radford }; 42121c9e160Sadam radford 42221c9e160Sadam radford 4237e8a75f4SYang, Bo #define MR_EVT_CFG_CLEARED 0x0004 4247e8a75f4SYang, Bo #define MR_EVT_LD_STATE_CHANGE 0x0051 4257e8a75f4SYang, Bo #define MR_EVT_PD_INSERTED 0x005b 4267e8a75f4SYang, Bo #define MR_EVT_PD_REMOVED 0x0070 4277e8a75f4SYang, Bo #define MR_EVT_LD_CREATED 0x008a 4287e8a75f4SYang, Bo #define MR_EVT_LD_DELETED 0x008b 4297e8a75f4SYang, Bo #define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db 4307e8a75f4SYang, Bo #define MR_EVT_LD_OFFLINE 0x00fc 4317e8a75f4SYang, Bo #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152 432c4bd2654Ssumit.saxena@avagotech.com #define MR_EVT_CTRL_PROP_CHANGED 0x012f 4337e8a75f4SYang, Bo 43481e403ceSYang, Bo enum MR_PD_STATE { 43581e403ceSYang, Bo MR_PD_STATE_UNCONFIGURED_GOOD = 0x00, 43681e403ceSYang, Bo MR_PD_STATE_UNCONFIGURED_BAD = 0x01, 43781e403ceSYang, Bo MR_PD_STATE_HOT_SPARE = 0x02, 43881e403ceSYang, Bo MR_PD_STATE_OFFLINE = 0x10, 43981e403ceSYang, Bo MR_PD_STATE_FAILED = 0x11, 44081e403ceSYang, Bo MR_PD_STATE_REBUILD = 0x14, 44181e403ceSYang, Bo MR_PD_STATE_ONLINE = 0x18, 44281e403ceSYang, Bo MR_PD_STATE_COPYBACK = 0x20, 44381e403ceSYang, Bo MR_PD_STATE_SYSTEM = 0x40, 44481e403ceSYang, Bo }; 44581e403ceSYang, Bo 4462216c305SSumit Saxena union MR_PD_REF { 4472216c305SSumit Saxena struct { 4482216c305SSumit Saxena u16 deviceId; 4492216c305SSumit Saxena u16 seqNum; 4502216c305SSumit Saxena } mrPdRef; 4512216c305SSumit Saxena u32 ref; 4522216c305SSumit Saxena }; 4532216c305SSumit Saxena 4542216c305SSumit Saxena /* 4552216c305SSumit Saxena * define the DDF Type bit structure 4562216c305SSumit Saxena */ 4572216c305SSumit Saxena union MR_PD_DDF_TYPE { 4582216c305SSumit Saxena struct { 4592216c305SSumit Saxena union { 4602216c305SSumit Saxena struct { 4612216c305SSumit Saxena #ifndef __BIG_ENDIAN_BITFIELD 4622216c305SSumit Saxena u16 forcedPDGUID:1; 4632216c305SSumit Saxena u16 inVD:1; 4642216c305SSumit Saxena u16 isGlobalSpare:1; 4652216c305SSumit Saxena u16 isSpare:1; 4662216c305SSumit Saxena u16 isForeign:1; 4672216c305SSumit Saxena u16 reserved:7; 4682216c305SSumit Saxena u16 intf:4; 4692216c305SSumit Saxena #else 4702216c305SSumit Saxena u16 intf:4; 4712216c305SSumit Saxena u16 reserved:7; 4722216c305SSumit Saxena u16 isForeign:1; 4732216c305SSumit Saxena u16 isSpare:1; 4742216c305SSumit Saxena u16 isGlobalSpare:1; 4752216c305SSumit Saxena u16 inVD:1; 4762216c305SSumit Saxena u16 forcedPDGUID:1; 4772216c305SSumit Saxena #endif 4782216c305SSumit Saxena } pdType; 4792216c305SSumit Saxena u16 type; 4802216c305SSumit Saxena }; 4812216c305SSumit Saxena u16 reserved; 4822216c305SSumit Saxena } ddf; 4832216c305SSumit Saxena struct { 4842216c305SSumit Saxena u32 reserved; 4852216c305SSumit Saxena } nonDisk; 4862216c305SSumit Saxena u32 type; 4872216c305SSumit Saxena } __packed; 4882216c305SSumit Saxena 4892216c305SSumit Saxena /* 4902216c305SSumit Saxena * defines the progress structure 4912216c305SSumit Saxena */ 4922216c305SSumit Saxena union MR_PROGRESS { 4932216c305SSumit Saxena struct { 4942216c305SSumit Saxena u16 progress; 4952216c305SSumit Saxena union { 4962216c305SSumit Saxena u16 elapsedSecs; 4972216c305SSumit Saxena u16 elapsedSecsForLastPercent; 4982216c305SSumit Saxena }; 4992216c305SSumit Saxena } mrProgress; 5002216c305SSumit Saxena u32 w; 5012216c305SSumit Saxena } __packed; 5022216c305SSumit Saxena 5032216c305SSumit Saxena /* 5042216c305SSumit Saxena * defines the physical drive progress structure 5052216c305SSumit Saxena */ 5062216c305SSumit Saxena struct MR_PD_PROGRESS { 5072216c305SSumit Saxena struct { 5082216c305SSumit Saxena #ifndef MFI_BIG_ENDIAN 5092216c305SSumit Saxena u32 rbld:1; 5102216c305SSumit Saxena u32 patrol:1; 5112216c305SSumit Saxena u32 clear:1; 5122216c305SSumit Saxena u32 copyBack:1; 5132216c305SSumit Saxena u32 erase:1; 5142216c305SSumit Saxena u32 locate:1; 5152216c305SSumit Saxena u32 reserved:26; 5162216c305SSumit Saxena #else 5172216c305SSumit Saxena u32 reserved:26; 5182216c305SSumit Saxena u32 locate:1; 5192216c305SSumit Saxena u32 erase:1; 5202216c305SSumit Saxena u32 copyBack:1; 5212216c305SSumit Saxena u32 clear:1; 5222216c305SSumit Saxena u32 patrol:1; 5232216c305SSumit Saxena u32 rbld:1; 5242216c305SSumit Saxena #endif 5252216c305SSumit Saxena } active; 5262216c305SSumit Saxena union MR_PROGRESS rbld; 5272216c305SSumit Saxena union MR_PROGRESS patrol; 5282216c305SSumit Saxena union { 5292216c305SSumit Saxena union MR_PROGRESS clear; 5302216c305SSumit Saxena union MR_PROGRESS erase; 5312216c305SSumit Saxena }; 5322216c305SSumit Saxena 5332216c305SSumit Saxena struct { 5342216c305SSumit Saxena #ifndef MFI_BIG_ENDIAN 5352216c305SSumit Saxena u32 rbld:1; 5362216c305SSumit Saxena u32 patrol:1; 5372216c305SSumit Saxena u32 clear:1; 5382216c305SSumit Saxena u32 copyBack:1; 5392216c305SSumit Saxena u32 erase:1; 5402216c305SSumit Saxena u32 reserved:27; 5412216c305SSumit Saxena #else 5422216c305SSumit Saxena u32 reserved:27; 5432216c305SSumit Saxena u32 erase:1; 5442216c305SSumit Saxena u32 copyBack:1; 5452216c305SSumit Saxena u32 clear:1; 5462216c305SSumit Saxena u32 patrol:1; 5472216c305SSumit Saxena u32 rbld:1; 5482216c305SSumit Saxena #endif 5492216c305SSumit Saxena } pause; 5502216c305SSumit Saxena 5512216c305SSumit Saxena union MR_PROGRESS reserved[3]; 5522216c305SSumit Saxena } __packed; 5532216c305SSumit Saxena 5542216c305SSumit Saxena struct MR_PD_INFO { 5552216c305SSumit Saxena union MR_PD_REF ref; 5562216c305SSumit Saxena u8 inquiryData[96]; 5572216c305SSumit Saxena u8 vpdPage83[64]; 5582216c305SSumit Saxena u8 notSupported; 5592216c305SSumit Saxena u8 scsiDevType; 5602216c305SSumit Saxena 5612216c305SSumit Saxena union { 5622216c305SSumit Saxena u8 connectedPortBitmap; 5632216c305SSumit Saxena u8 connectedPortNumbers; 5642216c305SSumit Saxena }; 5652216c305SSumit Saxena 5662216c305SSumit Saxena u8 deviceSpeed; 5672216c305SSumit Saxena u32 mediaErrCount; 5682216c305SSumit Saxena u32 otherErrCount; 5692216c305SSumit Saxena u32 predFailCount; 5702216c305SSumit Saxena u32 lastPredFailEventSeqNum; 5712216c305SSumit Saxena 5722216c305SSumit Saxena u16 fwState; 5732216c305SSumit Saxena u8 disabledForRemoval; 5742216c305SSumit Saxena u8 linkSpeed; 5752216c305SSumit Saxena union MR_PD_DDF_TYPE state; 5762216c305SSumit Saxena 5772216c305SSumit Saxena struct { 5782216c305SSumit Saxena u8 count; 5792216c305SSumit Saxena #ifndef __BIG_ENDIAN_BITFIELD 5802216c305SSumit Saxena u8 isPathBroken:4; 5812216c305SSumit Saxena u8 reserved3:3; 5822216c305SSumit Saxena u8 widePortCapable:1; 5832216c305SSumit Saxena #else 5842216c305SSumit Saxena u8 widePortCapable:1; 5852216c305SSumit Saxena u8 reserved3:3; 5862216c305SSumit Saxena u8 isPathBroken:4; 5872216c305SSumit Saxena #endif 5882216c305SSumit Saxena 5892216c305SSumit Saxena u8 connectorIndex[2]; 5902216c305SSumit Saxena u8 reserved[4]; 5912216c305SSumit Saxena u64 sasAddr[2]; 5922216c305SSumit Saxena u8 reserved2[16]; 5932216c305SSumit Saxena } pathInfo; 5942216c305SSumit Saxena 5952216c305SSumit Saxena u64 rawSize; 5962216c305SSumit Saxena u64 nonCoercedSize; 5972216c305SSumit Saxena u64 coercedSize; 5982216c305SSumit Saxena u16 enclDeviceId; 5992216c305SSumit Saxena u8 enclIndex; 6002216c305SSumit Saxena 6012216c305SSumit Saxena union { 6022216c305SSumit Saxena u8 slotNumber; 6032216c305SSumit Saxena u8 enclConnectorIndex; 6042216c305SSumit Saxena }; 6052216c305SSumit Saxena 6062216c305SSumit Saxena struct MR_PD_PROGRESS progInfo; 6072216c305SSumit Saxena u8 badBlockTableFull; 6082216c305SSumit Saxena u8 unusableInCurrentConfig; 6092216c305SSumit Saxena u8 vpdPage83Ext[64]; 6102216c305SSumit Saxena u8 powerState; 6112216c305SSumit Saxena u8 enclPosition; 6122216c305SSumit Saxena u32 allowedOps; 6132216c305SSumit Saxena u16 copyBackPartnerId; 6142216c305SSumit Saxena u16 enclPartnerDeviceId; 6152216c305SSumit Saxena struct { 6162216c305SSumit Saxena #ifndef __BIG_ENDIAN_BITFIELD 6172216c305SSumit Saxena u16 fdeCapable:1; 6182216c305SSumit Saxena u16 fdeEnabled:1; 6192216c305SSumit Saxena u16 secured:1; 6202216c305SSumit Saxena u16 locked:1; 6212216c305SSumit Saxena u16 foreign:1; 6222216c305SSumit Saxena u16 needsEKM:1; 6232216c305SSumit Saxena u16 reserved:10; 6242216c305SSumit Saxena #else 6252216c305SSumit Saxena u16 reserved:10; 6262216c305SSumit Saxena u16 needsEKM:1; 6272216c305SSumit Saxena u16 foreign:1; 6282216c305SSumit Saxena u16 locked:1; 6292216c305SSumit Saxena u16 secured:1; 6302216c305SSumit Saxena u16 fdeEnabled:1; 6312216c305SSumit Saxena u16 fdeCapable:1; 6322216c305SSumit Saxena #endif 6332216c305SSumit Saxena } security; 6342216c305SSumit Saxena u8 mediaType; 6352216c305SSumit Saxena u8 notCertified; 6362216c305SSumit Saxena u8 bridgeVendor[8]; 6372216c305SSumit Saxena u8 bridgeProductIdentification[16]; 6382216c305SSumit Saxena u8 bridgeProductRevisionLevel[4]; 6392216c305SSumit Saxena u8 satBridgeExists; 6402216c305SSumit Saxena 6412216c305SSumit Saxena u8 interfaceType; 6422216c305SSumit Saxena u8 temperature; 6432216c305SSumit Saxena u8 emulatedBlockSize; 6442216c305SSumit Saxena u16 userDataBlockSize; 6452216c305SSumit Saxena u16 reserved2; 6462216c305SSumit Saxena 6472216c305SSumit Saxena struct { 6482216c305SSumit Saxena #ifndef __BIG_ENDIAN_BITFIELD 6492216c305SSumit Saxena u32 piType:3; 6502216c305SSumit Saxena u32 piFormatted:1; 6512216c305SSumit Saxena u32 piEligible:1; 6522216c305SSumit Saxena u32 NCQ:1; 6532216c305SSumit Saxena u32 WCE:1; 6542216c305SSumit Saxena u32 commissionedSpare:1; 6552216c305SSumit Saxena u32 emergencySpare:1; 6562216c305SSumit Saxena u32 ineligibleForSSCD:1; 6572216c305SSumit Saxena u32 ineligibleForLd:1; 6582216c305SSumit Saxena u32 useSSEraseType:1; 6592216c305SSumit Saxena u32 wceUnchanged:1; 6602216c305SSumit Saxena u32 supportScsiUnmap:1; 6612216c305SSumit Saxena u32 reserved:18; 6622216c305SSumit Saxena #else 6632216c305SSumit Saxena u32 reserved:18; 6642216c305SSumit Saxena u32 supportScsiUnmap:1; 6652216c305SSumit Saxena u32 wceUnchanged:1; 6662216c305SSumit Saxena u32 useSSEraseType:1; 6672216c305SSumit Saxena u32 ineligibleForLd:1; 6682216c305SSumit Saxena u32 ineligibleForSSCD:1; 6692216c305SSumit Saxena u32 emergencySpare:1; 6702216c305SSumit Saxena u32 commissionedSpare:1; 6712216c305SSumit Saxena u32 WCE:1; 6722216c305SSumit Saxena u32 NCQ:1; 6732216c305SSumit Saxena u32 piEligible:1; 6742216c305SSumit Saxena u32 piFormatted:1; 6752216c305SSumit Saxena u32 piType:3; 6762216c305SSumit Saxena #endif 6772216c305SSumit Saxena } properties; 6782216c305SSumit Saxena 6792216c305SSumit Saxena u64 shieldDiagCompletionTime; 6802216c305SSumit Saxena u8 shieldCounter; 6812216c305SSumit Saxena 6822216c305SSumit Saxena u8 linkSpeedOther; 6832216c305SSumit Saxena u8 reserved4[2]; 6842216c305SSumit Saxena 6852216c305SSumit Saxena struct { 6862216c305SSumit Saxena #ifndef __BIG_ENDIAN_BITFIELD 6872216c305SSumit Saxena u32 bbmErrCountSupported:1; 6882216c305SSumit Saxena u32 bbmErrCount:31; 6892216c305SSumit Saxena #else 6902216c305SSumit Saxena u32 bbmErrCount:31; 6912216c305SSumit Saxena u32 bbmErrCountSupported:1; 6922216c305SSumit Saxena #endif 6932216c305SSumit Saxena } bbmErr; 6942216c305SSumit Saxena 6952216c305SSumit Saxena u8 reserved1[512-428]; 6962216c305SSumit Saxena } __packed; 69781e403ceSYang, Bo 69881e403ceSYang, Bo /* 69996188a89SShivasharan S * Definition of structure used to expose attributes of VD or JBOD 70096188a89SShivasharan S * (this structure is to be filled by firmware when MR_DCMD_DRV_GET_TARGET_PROP 70196188a89SShivasharan S * is fired by driver) 70296188a89SShivasharan S */ 70396188a89SShivasharan S struct MR_TARGET_PROPERTIES { 70496188a89SShivasharan S u32 max_io_size_kb; 70596188a89SShivasharan S u32 device_qdepth; 70696188a89SShivasharan S u32 sector_size; 70796188a89SShivasharan S u8 reserved[500]; 70896188a89SShivasharan S } __packed; 70996188a89SShivasharan S 71096188a89SShivasharan S /* 71181e403ceSYang, Bo * defines the physical drive address structure 71281e403ceSYang, Bo */ 71381e403ceSYang, Bo struct MR_PD_ADDRESS { 7149ab9ed38SChristoph Hellwig __le16 deviceId; 71581e403ceSYang, Bo u16 enclDeviceId; 71681e403ceSYang, Bo 71781e403ceSYang, Bo union { 71881e403ceSYang, Bo struct { 71981e403ceSYang, Bo u8 enclIndex; 72081e403ceSYang, Bo u8 slotNumber; 72181e403ceSYang, Bo } mrPdAddress; 72281e403ceSYang, Bo struct { 72381e403ceSYang, Bo u8 enclPosition; 72481e403ceSYang, Bo u8 enclConnectorIndex; 72581e403ceSYang, Bo } mrEnclAddress; 72681e403ceSYang, Bo }; 72781e403ceSYang, Bo u8 scsiDevType; 72881e403ceSYang, Bo union { 72981e403ceSYang, Bo u8 connectedPortBitmap; 73081e403ceSYang, Bo u8 connectedPortNumbers; 73181e403ceSYang, Bo }; 73281e403ceSYang, Bo u64 sasAddr[2]; 73381e403ceSYang, Bo } __packed; 73481e403ceSYang, Bo 73581e403ceSYang, Bo /* 73681e403ceSYang, Bo * defines the physical drive list structure 73781e403ceSYang, Bo */ 73881e403ceSYang, Bo struct MR_PD_LIST { 7399ab9ed38SChristoph Hellwig __le32 size; 7409ab9ed38SChristoph Hellwig __le32 count; 74181e403ceSYang, Bo struct MR_PD_ADDRESS addr[1]; 74281e403ceSYang, Bo } __packed; 74381e403ceSYang, Bo 74481e403ceSYang, Bo struct megasas_pd_list { 74581e403ceSYang, Bo u16 tid; 74681e403ceSYang, Bo u8 driveType; 74781e403ceSYang, Bo u8 driveState; 74881e403ceSYang, Bo } __packed; 74981e403ceSYang, Bo 75081e403ceSYang, Bo /* 751bdc6fb8dSYang, Bo * defines the logical drive reference structure 752bdc6fb8dSYang, Bo */ 753bdc6fb8dSYang, Bo union MR_LD_REF { 754bdc6fb8dSYang, Bo struct { 755bdc6fb8dSYang, Bo u8 targetId; 756bdc6fb8dSYang, Bo u8 reserved; 7579ab9ed38SChristoph Hellwig __le16 seqNum; 758bdc6fb8dSYang, Bo }; 7599ab9ed38SChristoph Hellwig __le32 ref; 760bdc6fb8dSYang, Bo } __packed; 761bdc6fb8dSYang, Bo 762bdc6fb8dSYang, Bo /* 763bdc6fb8dSYang, Bo * defines the logical drive list structure 764bdc6fb8dSYang, Bo */ 765bdc6fb8dSYang, Bo struct MR_LD_LIST { 7669ab9ed38SChristoph Hellwig __le32 ldCount; 7679ab9ed38SChristoph Hellwig __le32 reserved; 768bdc6fb8dSYang, Bo struct { 769bdc6fb8dSYang, Bo union MR_LD_REF ref; 770bdc6fb8dSYang, Bo u8 state; 771bdc6fb8dSYang, Bo u8 reserved[3]; 7729ab9ed38SChristoph Hellwig __le64 size; 77351087a86SSumit.Saxena@avagotech.com } ldList[MAX_LOGICAL_DRIVES_EXT]; 774bdc6fb8dSYang, Bo } __packed; 775bdc6fb8dSYang, Bo 77621c9e160Sadam radford struct MR_LD_TARGETID_LIST { 7779ab9ed38SChristoph Hellwig __le32 size; 7789ab9ed38SChristoph Hellwig __le32 count; 77921c9e160Sadam radford u8 pad[3]; 78051087a86SSumit.Saxena@avagotech.com u8 targetId[MAX_LOGICAL_DRIVES_EXT]; 78121c9e160Sadam radford }; 78221c9e160Sadam radford 78321c9e160Sadam radford 784bdc6fb8dSYang, Bo /* 785c4a3e0a5SBagalkote, Sreenivas * SAS controller properties 786c4a3e0a5SBagalkote, Sreenivas */ 787c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_prop { 788c4a3e0a5SBagalkote, Sreenivas 789c4a3e0a5SBagalkote, Sreenivas u16 seq_num; 790c4a3e0a5SBagalkote, Sreenivas u16 pred_fail_poll_interval; 791c4a3e0a5SBagalkote, Sreenivas u16 intr_throttle_count; 792c4a3e0a5SBagalkote, Sreenivas u16 intr_throttle_timeouts; 793c4a3e0a5SBagalkote, Sreenivas u8 rebuild_rate; 794c4a3e0a5SBagalkote, Sreenivas u8 patrol_read_rate; 795c4a3e0a5SBagalkote, Sreenivas u8 bgi_rate; 796c4a3e0a5SBagalkote, Sreenivas u8 cc_rate; 797c4a3e0a5SBagalkote, Sreenivas u8 recon_rate; 798c4a3e0a5SBagalkote, Sreenivas u8 cache_flush_interval; 799c4a3e0a5SBagalkote, Sreenivas u8 spinup_drv_count; 800c4a3e0a5SBagalkote, Sreenivas u8 spinup_delay; 801c4a3e0a5SBagalkote, Sreenivas u8 cluster_enable; 802c4a3e0a5SBagalkote, Sreenivas u8 coercion_mode; 803c4a3e0a5SBagalkote, Sreenivas u8 alarm_enable; 804c4a3e0a5SBagalkote, Sreenivas u8 disable_auto_rebuild; 805c4a3e0a5SBagalkote, Sreenivas u8 disable_battery_warn; 806c4a3e0a5SBagalkote, Sreenivas u8 ecc_bucket_size; 807c4a3e0a5SBagalkote, Sreenivas u16 ecc_bucket_leak_rate; 808c4a3e0a5SBagalkote, Sreenivas u8 restore_hotspare_on_insertion; 809c4a3e0a5SBagalkote, Sreenivas u8 expose_encl_devices; 81039a98554Sbo yang u8 maintainPdFailHistory; 81139a98554Sbo yang u8 disallowHostRequestReordering; 81239a98554Sbo yang u8 abortCCOnError; 81339a98554Sbo yang u8 loadBalanceMode; 81439a98554Sbo yang u8 disableAutoDetectBackplane; 815c4a3e0a5SBagalkote, Sreenivas 81639a98554Sbo yang u8 snapVDSpace; 81739a98554Sbo yang 81839a98554Sbo yang /* 81939a98554Sbo yang * Add properties that can be controlled by 82039a98554Sbo yang * a bit in the following structure. 82139a98554Sbo yang */ 82239a98554Sbo yang struct { 82394cd65ddSSumit.Saxena@lsi.com #if defined(__BIG_ENDIAN_BITFIELD) 82494cd65ddSSumit.Saxena@lsi.com u32 reserved:18; 82594cd65ddSSumit.Saxena@lsi.com u32 enableJBOD:1; 82694cd65ddSSumit.Saxena@lsi.com u32 disableSpinDownHS:1; 82794cd65ddSSumit.Saxena@lsi.com u32 allowBootWithPinnedCache:1; 82894cd65ddSSumit.Saxena@lsi.com u32 disableOnlineCtrlReset:1; 82994cd65ddSSumit.Saxena@lsi.com u32 enableSecretKeyControl:1; 83094cd65ddSSumit.Saxena@lsi.com u32 autoEnhancedImport:1; 83194cd65ddSSumit.Saxena@lsi.com u32 enableSpinDownUnconfigured:1; 83294cd65ddSSumit.Saxena@lsi.com u32 SSDPatrolReadEnabled:1; 83394cd65ddSSumit.Saxena@lsi.com u32 SSDSMARTerEnabled:1; 83494cd65ddSSumit.Saxena@lsi.com u32 disableNCQ:1; 83594cd65ddSSumit.Saxena@lsi.com u32 useFdeOnly:1; 83694cd65ddSSumit.Saxena@lsi.com u32 prCorrectUnconfiguredAreas:1; 83794cd65ddSSumit.Saxena@lsi.com u32 SMARTerEnabled:1; 83894cd65ddSSumit.Saxena@lsi.com u32 copyBackDisabled:1; 83994cd65ddSSumit.Saxena@lsi.com #else 84039a98554Sbo yang u32 copyBackDisabled:1; 84139a98554Sbo yang u32 SMARTerEnabled:1; 84239a98554Sbo yang u32 prCorrectUnconfiguredAreas:1; 84339a98554Sbo yang u32 useFdeOnly:1; 84439a98554Sbo yang u32 disableNCQ:1; 84539a98554Sbo yang u32 SSDSMARTerEnabled:1; 84639a98554Sbo yang u32 SSDPatrolReadEnabled:1; 84739a98554Sbo yang u32 enableSpinDownUnconfigured:1; 84839a98554Sbo yang u32 autoEnhancedImport:1; 84939a98554Sbo yang u32 enableSecretKeyControl:1; 85039a98554Sbo yang u32 disableOnlineCtrlReset:1; 85139a98554Sbo yang u32 allowBootWithPinnedCache:1; 85239a98554Sbo yang u32 disableSpinDownHS:1; 85339a98554Sbo yang u32 enableJBOD:1; 85439a98554Sbo yang u32 reserved:18; 85594cd65ddSSumit.Saxena@lsi.com #endif 85639a98554Sbo yang } OnOffProperties; 85739a98554Sbo yang u8 autoSnapVDSpace; 85839a98554Sbo yang u8 viewSpace; 8599ab9ed38SChristoph Hellwig __le16 spinDownTime; 86039a98554Sbo yang u8 reserved[24]; 86181e403ceSYang, Bo } __packed; 862c4a3e0a5SBagalkote, Sreenivas 863c4a3e0a5SBagalkote, Sreenivas /* 864c4a3e0a5SBagalkote, Sreenivas * SAS controller information 865c4a3e0a5SBagalkote, Sreenivas */ 866c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_info { 867c4a3e0a5SBagalkote, Sreenivas 868c4a3e0a5SBagalkote, Sreenivas /* 869c4a3e0a5SBagalkote, Sreenivas * PCI device information 870c4a3e0a5SBagalkote, Sreenivas */ 871c4a3e0a5SBagalkote, Sreenivas struct { 872c4a3e0a5SBagalkote, Sreenivas 8739ab9ed38SChristoph Hellwig __le16 vendor_id; 8749ab9ed38SChristoph Hellwig __le16 device_id; 8759ab9ed38SChristoph Hellwig __le16 sub_vendor_id; 8769ab9ed38SChristoph Hellwig __le16 sub_device_id; 877c4a3e0a5SBagalkote, Sreenivas u8 reserved[24]; 878c4a3e0a5SBagalkote, Sreenivas 879c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pci; 880c4a3e0a5SBagalkote, Sreenivas 881c4a3e0a5SBagalkote, Sreenivas /* 882c4a3e0a5SBagalkote, Sreenivas * Host interface information 883c4a3e0a5SBagalkote, Sreenivas */ 884c4a3e0a5SBagalkote, Sreenivas struct { 885c4a3e0a5SBagalkote, Sreenivas 886c4a3e0a5SBagalkote, Sreenivas u8 PCIX:1; 887c4a3e0a5SBagalkote, Sreenivas u8 PCIE:1; 888c4a3e0a5SBagalkote, Sreenivas u8 iSCSI:1; 889c4a3e0a5SBagalkote, Sreenivas u8 SAS_3G:1; 890229fe47cSadam radford u8 SRIOV:1; 891229fe47cSadam radford u8 reserved_0:3; 892c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[6]; 893c4a3e0a5SBagalkote, Sreenivas u8 port_count; 894c4a3e0a5SBagalkote, Sreenivas u64 port_addr[8]; 895c4a3e0a5SBagalkote, Sreenivas 896c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) host_interface; 897c4a3e0a5SBagalkote, Sreenivas 898c4a3e0a5SBagalkote, Sreenivas /* 899c4a3e0a5SBagalkote, Sreenivas * Device (backend) interface information 900c4a3e0a5SBagalkote, Sreenivas */ 901c4a3e0a5SBagalkote, Sreenivas struct { 902c4a3e0a5SBagalkote, Sreenivas 903c4a3e0a5SBagalkote, Sreenivas u8 SPI:1; 904c4a3e0a5SBagalkote, Sreenivas u8 SAS_3G:1; 905c4a3e0a5SBagalkote, Sreenivas u8 SATA_1_5G:1; 906c4a3e0a5SBagalkote, Sreenivas u8 SATA_3G:1; 907c4a3e0a5SBagalkote, Sreenivas u8 reserved_0:4; 908c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[6]; 909c4a3e0a5SBagalkote, Sreenivas u8 port_count; 910c4a3e0a5SBagalkote, Sreenivas u64 port_addr[8]; 911c4a3e0a5SBagalkote, Sreenivas 912c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) device_interface; 913c4a3e0a5SBagalkote, Sreenivas 914c4a3e0a5SBagalkote, Sreenivas /* 915c4a3e0a5SBagalkote, Sreenivas * List of components residing in flash. All str are null terminated 916c4a3e0a5SBagalkote, Sreenivas */ 9179ab9ed38SChristoph Hellwig __le32 image_check_word; 9189ab9ed38SChristoph Hellwig __le32 image_component_count; 919c4a3e0a5SBagalkote, Sreenivas 920c4a3e0a5SBagalkote, Sreenivas struct { 921c4a3e0a5SBagalkote, Sreenivas 922c4a3e0a5SBagalkote, Sreenivas char name[8]; 923c4a3e0a5SBagalkote, Sreenivas char version[32]; 924c4a3e0a5SBagalkote, Sreenivas char build_date[16]; 925c4a3e0a5SBagalkote, Sreenivas char built_time[16]; 926c4a3e0a5SBagalkote, Sreenivas 927c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) image_component[8]; 928c4a3e0a5SBagalkote, Sreenivas 929c4a3e0a5SBagalkote, Sreenivas /* 930c4a3e0a5SBagalkote, Sreenivas * List of flash components that have been flashed on the card, but 931c4a3e0a5SBagalkote, Sreenivas * are not in use, pending reset of the adapter. This list will be 932c4a3e0a5SBagalkote, Sreenivas * empty if a flash operation has not occurred. All stings are null 933c4a3e0a5SBagalkote, Sreenivas * terminated 934c4a3e0a5SBagalkote, Sreenivas */ 9359ab9ed38SChristoph Hellwig __le32 pending_image_component_count; 936c4a3e0a5SBagalkote, Sreenivas 937c4a3e0a5SBagalkote, Sreenivas struct { 938c4a3e0a5SBagalkote, Sreenivas 939c4a3e0a5SBagalkote, Sreenivas char name[8]; 940c4a3e0a5SBagalkote, Sreenivas char version[32]; 941c4a3e0a5SBagalkote, Sreenivas char build_date[16]; 942c4a3e0a5SBagalkote, Sreenivas char build_time[16]; 943c4a3e0a5SBagalkote, Sreenivas 944c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pending_image_component[8]; 945c4a3e0a5SBagalkote, Sreenivas 946c4a3e0a5SBagalkote, Sreenivas u8 max_arms; 947c4a3e0a5SBagalkote, Sreenivas u8 max_spans; 948c4a3e0a5SBagalkote, Sreenivas u8 max_arrays; 949c4a3e0a5SBagalkote, Sreenivas u8 max_lds; 950c4a3e0a5SBagalkote, Sreenivas 951c4a3e0a5SBagalkote, Sreenivas char product_name[80]; 952c4a3e0a5SBagalkote, Sreenivas char serial_no[32]; 953c4a3e0a5SBagalkote, Sreenivas 954c4a3e0a5SBagalkote, Sreenivas /* 955c4a3e0a5SBagalkote, Sreenivas * Other physical/controller/operation information. Indicates the 956c4a3e0a5SBagalkote, Sreenivas * presence of the hardware 957c4a3e0a5SBagalkote, Sreenivas */ 958c4a3e0a5SBagalkote, Sreenivas struct { 959c4a3e0a5SBagalkote, Sreenivas 960c4a3e0a5SBagalkote, Sreenivas u32 bbu:1; 961c4a3e0a5SBagalkote, Sreenivas u32 alarm:1; 962c4a3e0a5SBagalkote, Sreenivas u32 nvram:1; 963c4a3e0a5SBagalkote, Sreenivas u32 uart:1; 964c4a3e0a5SBagalkote, Sreenivas u32 reserved:28; 965c4a3e0a5SBagalkote, Sreenivas 966c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) hw_present; 967c4a3e0a5SBagalkote, Sreenivas 9689ab9ed38SChristoph Hellwig __le32 current_fw_time; 969c4a3e0a5SBagalkote, Sreenivas 970c4a3e0a5SBagalkote, Sreenivas /* 971c4a3e0a5SBagalkote, Sreenivas * Maximum data transfer sizes 972c4a3e0a5SBagalkote, Sreenivas */ 9739ab9ed38SChristoph Hellwig __le16 max_concurrent_cmds; 9749ab9ed38SChristoph Hellwig __le16 max_sge_count; 9759ab9ed38SChristoph Hellwig __le32 max_request_size; 976c4a3e0a5SBagalkote, Sreenivas 977c4a3e0a5SBagalkote, Sreenivas /* 978c4a3e0a5SBagalkote, Sreenivas * Logical and physical device counts 979c4a3e0a5SBagalkote, Sreenivas */ 9809ab9ed38SChristoph Hellwig __le16 ld_present_count; 9819ab9ed38SChristoph Hellwig __le16 ld_degraded_count; 9829ab9ed38SChristoph Hellwig __le16 ld_offline_count; 983c4a3e0a5SBagalkote, Sreenivas 9849ab9ed38SChristoph Hellwig __le16 pd_present_count; 9859ab9ed38SChristoph Hellwig __le16 pd_disk_present_count; 9869ab9ed38SChristoph Hellwig __le16 pd_disk_pred_failure_count; 9879ab9ed38SChristoph Hellwig __le16 pd_disk_failed_count; 988c4a3e0a5SBagalkote, Sreenivas 989c4a3e0a5SBagalkote, Sreenivas /* 990c4a3e0a5SBagalkote, Sreenivas * Memory size information 991c4a3e0a5SBagalkote, Sreenivas */ 9929ab9ed38SChristoph Hellwig __le16 nvram_size; 9939ab9ed38SChristoph Hellwig __le16 memory_size; 9949ab9ed38SChristoph Hellwig __le16 flash_size; 995c4a3e0a5SBagalkote, Sreenivas 996c4a3e0a5SBagalkote, Sreenivas /* 997c4a3e0a5SBagalkote, Sreenivas * Error counters 998c4a3e0a5SBagalkote, Sreenivas */ 9999ab9ed38SChristoph Hellwig __le16 mem_correctable_error_count; 10009ab9ed38SChristoph Hellwig __le16 mem_uncorrectable_error_count; 1001c4a3e0a5SBagalkote, Sreenivas 1002c4a3e0a5SBagalkote, Sreenivas /* 1003c4a3e0a5SBagalkote, Sreenivas * Cluster information 1004c4a3e0a5SBagalkote, Sreenivas */ 1005c4a3e0a5SBagalkote, Sreenivas u8 cluster_permitted; 1006c4a3e0a5SBagalkote, Sreenivas u8 cluster_active; 1007c4a3e0a5SBagalkote, Sreenivas 1008c4a3e0a5SBagalkote, Sreenivas /* 1009c4a3e0a5SBagalkote, Sreenivas * Additional max data transfer sizes 1010c4a3e0a5SBagalkote, Sreenivas */ 10119ab9ed38SChristoph Hellwig __le16 max_strips_per_io; 1012c4a3e0a5SBagalkote, Sreenivas 1013c4a3e0a5SBagalkote, Sreenivas /* 1014c4a3e0a5SBagalkote, Sreenivas * Controller capabilities structures 1015c4a3e0a5SBagalkote, Sreenivas */ 1016c4a3e0a5SBagalkote, Sreenivas struct { 1017c4a3e0a5SBagalkote, Sreenivas 1018c4a3e0a5SBagalkote, Sreenivas u32 raid_level_0:1; 1019c4a3e0a5SBagalkote, Sreenivas u32 raid_level_1:1; 1020c4a3e0a5SBagalkote, Sreenivas u32 raid_level_5:1; 1021c4a3e0a5SBagalkote, Sreenivas u32 raid_level_1E:1; 1022c4a3e0a5SBagalkote, Sreenivas u32 raid_level_6:1; 1023c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 1024c4a3e0a5SBagalkote, Sreenivas 1025c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) raid_levels; 1026c4a3e0a5SBagalkote, Sreenivas 1027c4a3e0a5SBagalkote, Sreenivas struct { 1028c4a3e0a5SBagalkote, Sreenivas 1029c4a3e0a5SBagalkote, Sreenivas u32 rbld_rate:1; 1030c4a3e0a5SBagalkote, Sreenivas u32 cc_rate:1; 1031c4a3e0a5SBagalkote, Sreenivas u32 bgi_rate:1; 1032c4a3e0a5SBagalkote, Sreenivas u32 recon_rate:1; 1033c4a3e0a5SBagalkote, Sreenivas u32 patrol_rate:1; 1034c4a3e0a5SBagalkote, Sreenivas u32 alarm_control:1; 1035c4a3e0a5SBagalkote, Sreenivas u32 cluster_supported:1; 1036c4a3e0a5SBagalkote, Sreenivas u32 bbu:1; 1037c4a3e0a5SBagalkote, Sreenivas u32 spanning_allowed:1; 1038c4a3e0a5SBagalkote, Sreenivas u32 dedicated_hotspares:1; 1039c4a3e0a5SBagalkote, Sreenivas u32 revertible_hotspares:1; 1040c4a3e0a5SBagalkote, Sreenivas u32 foreign_config_import:1; 1041c4a3e0a5SBagalkote, Sreenivas u32 self_diagnostic:1; 1042c4a3e0a5SBagalkote, Sreenivas u32 mixed_redundancy_arr:1; 1043c4a3e0a5SBagalkote, Sreenivas u32 global_hot_spares:1; 1044c4a3e0a5SBagalkote, Sreenivas u32 reserved:17; 1045c4a3e0a5SBagalkote, Sreenivas 1046c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) adapter_operations; 1047c4a3e0a5SBagalkote, Sreenivas 1048c4a3e0a5SBagalkote, Sreenivas struct { 1049c4a3e0a5SBagalkote, Sreenivas 1050c4a3e0a5SBagalkote, Sreenivas u32 read_policy:1; 1051c4a3e0a5SBagalkote, Sreenivas u32 write_policy:1; 1052c4a3e0a5SBagalkote, Sreenivas u32 io_policy:1; 1053c4a3e0a5SBagalkote, Sreenivas u32 access_policy:1; 1054c4a3e0a5SBagalkote, Sreenivas u32 disk_cache_policy:1; 1055c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 1056c4a3e0a5SBagalkote, Sreenivas 1057c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_operations; 1058c4a3e0a5SBagalkote, Sreenivas 1059c4a3e0a5SBagalkote, Sreenivas struct { 1060c4a3e0a5SBagalkote, Sreenivas 1061c4a3e0a5SBagalkote, Sreenivas u8 min; 1062c4a3e0a5SBagalkote, Sreenivas u8 max; 1063c4a3e0a5SBagalkote, Sreenivas u8 reserved[2]; 1064c4a3e0a5SBagalkote, Sreenivas 1065c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) stripe_sz_ops; 1066c4a3e0a5SBagalkote, Sreenivas 1067c4a3e0a5SBagalkote, Sreenivas struct { 1068c4a3e0a5SBagalkote, Sreenivas 1069c4a3e0a5SBagalkote, Sreenivas u32 force_online:1; 1070c4a3e0a5SBagalkote, Sreenivas u32 force_offline:1; 1071c4a3e0a5SBagalkote, Sreenivas u32 force_rebuild:1; 1072c4a3e0a5SBagalkote, Sreenivas u32 reserved:29; 1073c4a3e0a5SBagalkote, Sreenivas 1074c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_operations; 1075c4a3e0a5SBagalkote, Sreenivas 1076c4a3e0a5SBagalkote, Sreenivas struct { 1077c4a3e0a5SBagalkote, Sreenivas 1078c4a3e0a5SBagalkote, Sreenivas u32 ctrl_supports_sas:1; 1079c4a3e0a5SBagalkote, Sreenivas u32 ctrl_supports_sata:1; 1080c4a3e0a5SBagalkote, Sreenivas u32 allow_mix_in_encl:1; 1081c4a3e0a5SBagalkote, Sreenivas u32 allow_mix_in_ld:1; 1082c4a3e0a5SBagalkote, Sreenivas u32 allow_sata_in_cluster:1; 1083c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 1084c4a3e0a5SBagalkote, Sreenivas 1085c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_mix_support; 1086c4a3e0a5SBagalkote, Sreenivas 1087c4a3e0a5SBagalkote, Sreenivas /* 1088c4a3e0a5SBagalkote, Sreenivas * Define ECC single-bit-error bucket information 1089c4a3e0a5SBagalkote, Sreenivas */ 1090c4a3e0a5SBagalkote, Sreenivas u8 ecc_bucket_count; 1091c4a3e0a5SBagalkote, Sreenivas u8 reserved_2[11]; 1092c4a3e0a5SBagalkote, Sreenivas 1093c4a3e0a5SBagalkote, Sreenivas /* 1094c4a3e0a5SBagalkote, Sreenivas * Include the controller properties (changeable items) 1095c4a3e0a5SBagalkote, Sreenivas */ 1096c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_prop properties; 1097c4a3e0a5SBagalkote, Sreenivas 1098c4a3e0a5SBagalkote, Sreenivas /* 1099c4a3e0a5SBagalkote, Sreenivas * Define FW pkg version (set in envt v'bles on OEM basis) 1100c4a3e0a5SBagalkote, Sreenivas */ 1101c4a3e0a5SBagalkote, Sreenivas char package_version[0x60]; 1102c4a3e0a5SBagalkote, Sreenivas 1103c4a3e0a5SBagalkote, Sreenivas 1104bc93d425SSumit.Saxena@lsi.com /* 1105bc93d425SSumit.Saxena@lsi.com * If adapterOperations.supportMoreThan8Phys is set, 1106bc93d425SSumit.Saxena@lsi.com * and deviceInterface.portCount is greater than 8, 1107bc93d425SSumit.Saxena@lsi.com * SAS Addrs for first 8 ports shall be populated in 1108bc93d425SSumit.Saxena@lsi.com * deviceInterface.portAddr, and the rest shall be 1109bc93d425SSumit.Saxena@lsi.com * populated in deviceInterfacePortAddr2. 1110bc93d425SSumit.Saxena@lsi.com */ 11119ab9ed38SChristoph Hellwig __le64 deviceInterfacePortAddr2[8]; /*6a0h */ 1112bc93d425SSumit.Saxena@lsi.com u8 reserved3[128]; /*6e0h */ 1113bc93d425SSumit.Saxena@lsi.com 1114bc93d425SSumit.Saxena@lsi.com struct { /*760h */ 1115bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_0:4; 1116bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_0:12; 1117bc93d425SSumit.Saxena@lsi.com 1118bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_1:4; 1119bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_1:12; 1120bc93d425SSumit.Saxena@lsi.com 1121bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_5:4; 1122bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_5:12; 1123bc93d425SSumit.Saxena@lsi.com 1124bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_1E:4; 1125bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_1E:12; 1126bc93d425SSumit.Saxena@lsi.com 1127bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_6:4; 1128bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_6:12; 1129bc93d425SSumit.Saxena@lsi.com 1130bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_10:4; 1131bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_10:12; 1132bc93d425SSumit.Saxena@lsi.com 1133bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_50:4; 1134bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_50:12; 1135bc93d425SSumit.Saxena@lsi.com 1136bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_60:4; 1137bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_60:12; 1138bc93d425SSumit.Saxena@lsi.com 1139bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_1E_RLQ0:4; 1140bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_1E_RLQ0:12; 1141bc93d425SSumit.Saxena@lsi.com 1142bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_1E0_RLQ0:4; 1143bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_1E0_RLQ0:12; 1144bc93d425SSumit.Saxena@lsi.com 1145bc93d425SSumit.Saxena@lsi.com u16 reserved[6]; 1146bc93d425SSumit.Saxena@lsi.com } pdsForRaidLevels; 1147bc93d425SSumit.Saxena@lsi.com 11489ab9ed38SChristoph Hellwig __le16 maxPds; /*780h */ 11499ab9ed38SChristoph Hellwig __le16 maxDedHSPs; /*782h */ 11509ab9ed38SChristoph Hellwig __le16 maxGlobalHSP; /*784h */ 11519ab9ed38SChristoph Hellwig __le16 ddfSize; /*786h */ 1152bc93d425SSumit.Saxena@lsi.com u8 maxLdsPerArray; /*788h */ 1153bc93d425SSumit.Saxena@lsi.com u8 partitionsInDDF; /*789h */ 1154bc93d425SSumit.Saxena@lsi.com u8 lockKeyBinding; /*78ah */ 1155bc93d425SSumit.Saxena@lsi.com u8 maxPITsPerLd; /*78bh */ 1156bc93d425SSumit.Saxena@lsi.com u8 maxViewsPerLd; /*78ch */ 1157bc93d425SSumit.Saxena@lsi.com u8 maxTargetId; /*78dh */ 11589ab9ed38SChristoph Hellwig __le16 maxBvlVdSize; /*78eh */ 1159bc93d425SSumit.Saxena@lsi.com 11609ab9ed38SChristoph Hellwig __le16 maxConfigurableSSCSize; /*790h */ 11619ab9ed38SChristoph Hellwig __le16 currentSSCsize; /*792h */ 1162bc93d425SSumit.Saxena@lsi.com 1163bc93d425SSumit.Saxena@lsi.com char expanderFwVersion[12]; /*794h */ 1164bc93d425SSumit.Saxena@lsi.com 11659ab9ed38SChristoph Hellwig __le16 PFKTrialTimeRemaining; /*7A0h */ 1166bc93d425SSumit.Saxena@lsi.com 11679ab9ed38SChristoph Hellwig __le16 cacheMemorySize; /*7A2h */ 1168bc93d425SSumit.Saxena@lsi.com 1169bc93d425SSumit.Saxena@lsi.com struct { /*7A4h */ 117094cd65ddSSumit.Saxena@lsi.com #if defined(__BIG_ENDIAN_BITFIELD) 1171229fe47cSadam radford u32 reserved:5; 1172229fe47cSadam radford u32 activePassive:2; 1173229fe47cSadam radford u32 supportConfigAutoBalance:1; 1174229fe47cSadam radford u32 mpio:1; 1175229fe47cSadam radford u32 supportDataLDonSSCArray:1; 1176229fe47cSadam radford u32 supportPointInTimeProgress:1; 117794cd65ddSSumit.Saxena@lsi.com u32 supportUnevenSpans:1; 117894cd65ddSSumit.Saxena@lsi.com u32 dedicatedHotSparesLimited:1; 117994cd65ddSSumit.Saxena@lsi.com u32 headlessMode:1; 118094cd65ddSSumit.Saxena@lsi.com u32 supportEmulatedDrives:1; 118194cd65ddSSumit.Saxena@lsi.com u32 supportResetNow:1; 118294cd65ddSSumit.Saxena@lsi.com u32 realTimeScheduler:1; 118394cd65ddSSumit.Saxena@lsi.com u32 supportSSDPatrolRead:1; 118494cd65ddSSumit.Saxena@lsi.com u32 supportPerfTuning:1; 118594cd65ddSSumit.Saxena@lsi.com u32 disableOnlinePFKChange:1; 118694cd65ddSSumit.Saxena@lsi.com u32 supportJBOD:1; 118794cd65ddSSumit.Saxena@lsi.com u32 supportBootTimePFKChange:1; 118894cd65ddSSumit.Saxena@lsi.com u32 supportSetLinkSpeed:1; 118994cd65ddSSumit.Saxena@lsi.com u32 supportEmergencySpares:1; 119094cd65ddSSumit.Saxena@lsi.com u32 supportSuspendResumeBGops:1; 119194cd65ddSSumit.Saxena@lsi.com u32 blockSSDWriteCacheChange:1; 119294cd65ddSSumit.Saxena@lsi.com u32 supportShieldState:1; 119394cd65ddSSumit.Saxena@lsi.com u32 supportLdBBMInfo:1; 119494cd65ddSSumit.Saxena@lsi.com u32 supportLdPIType3:1; 119594cd65ddSSumit.Saxena@lsi.com u32 supportLdPIType2:1; 119694cd65ddSSumit.Saxena@lsi.com u32 supportLdPIType1:1; 119794cd65ddSSumit.Saxena@lsi.com u32 supportPIcontroller:1; 119894cd65ddSSumit.Saxena@lsi.com #else 1199bc93d425SSumit.Saxena@lsi.com u32 supportPIcontroller:1; 1200bc93d425SSumit.Saxena@lsi.com u32 supportLdPIType1:1; 1201bc93d425SSumit.Saxena@lsi.com u32 supportLdPIType2:1; 1202bc93d425SSumit.Saxena@lsi.com u32 supportLdPIType3:1; 1203bc93d425SSumit.Saxena@lsi.com u32 supportLdBBMInfo:1; 1204bc93d425SSumit.Saxena@lsi.com u32 supportShieldState:1; 1205bc93d425SSumit.Saxena@lsi.com u32 blockSSDWriteCacheChange:1; 1206bc93d425SSumit.Saxena@lsi.com u32 supportSuspendResumeBGops:1; 1207bc93d425SSumit.Saxena@lsi.com u32 supportEmergencySpares:1; 1208bc93d425SSumit.Saxena@lsi.com u32 supportSetLinkSpeed:1; 1209bc93d425SSumit.Saxena@lsi.com u32 supportBootTimePFKChange:1; 1210bc93d425SSumit.Saxena@lsi.com u32 supportJBOD:1; 1211bc93d425SSumit.Saxena@lsi.com u32 disableOnlinePFKChange:1; 1212bc93d425SSumit.Saxena@lsi.com u32 supportPerfTuning:1; 1213bc93d425SSumit.Saxena@lsi.com u32 supportSSDPatrolRead:1; 1214bc93d425SSumit.Saxena@lsi.com u32 realTimeScheduler:1; 1215bc93d425SSumit.Saxena@lsi.com 1216bc93d425SSumit.Saxena@lsi.com u32 supportResetNow:1; 1217bc93d425SSumit.Saxena@lsi.com u32 supportEmulatedDrives:1; 1218bc93d425SSumit.Saxena@lsi.com u32 headlessMode:1; 1219bc93d425SSumit.Saxena@lsi.com u32 dedicatedHotSparesLimited:1; 1220bc93d425SSumit.Saxena@lsi.com 1221bc93d425SSumit.Saxena@lsi.com 1222bc93d425SSumit.Saxena@lsi.com u32 supportUnevenSpans:1; 1223229fe47cSadam radford u32 supportPointInTimeProgress:1; 1224229fe47cSadam radford u32 supportDataLDonSSCArray:1; 1225229fe47cSadam radford u32 mpio:1; 1226229fe47cSadam radford u32 supportConfigAutoBalance:1; 1227229fe47cSadam radford u32 activePassive:2; 1228229fe47cSadam radford u32 reserved:5; 122994cd65ddSSumit.Saxena@lsi.com #endif 1230bc93d425SSumit.Saxena@lsi.com } adapterOperations2; 1231bc93d425SSumit.Saxena@lsi.com 1232bc93d425SSumit.Saxena@lsi.com u8 driverVersion[32]; /*7A8h */ 1233bc93d425SSumit.Saxena@lsi.com u8 maxDAPdCountSpinup60; /*7C8h */ 1234bc93d425SSumit.Saxena@lsi.com u8 temperatureROC; /*7C9h */ 1235bc93d425SSumit.Saxena@lsi.com u8 temperatureCtrl; /*7CAh */ 1236bc93d425SSumit.Saxena@lsi.com u8 reserved4; /*7CBh */ 12379ab9ed38SChristoph Hellwig __le16 maxConfigurablePds; /*7CCh */ 1238bc93d425SSumit.Saxena@lsi.com 1239bc93d425SSumit.Saxena@lsi.com 1240bc93d425SSumit.Saxena@lsi.com u8 reserved5[2]; /*0x7CDh */ 1241bc93d425SSumit.Saxena@lsi.com 1242bc93d425SSumit.Saxena@lsi.com /* 1243bc93d425SSumit.Saxena@lsi.com * HA cluster information 1244bc93d425SSumit.Saxena@lsi.com */ 1245bc93d425SSumit.Saxena@lsi.com struct { 124651087a86SSumit.Saxena@avagotech.com #if defined(__BIG_ENDIAN_BITFIELD) 12478f67c8c5SSumit Saxena u32 reserved:25; 12488f67c8c5SSumit Saxena u32 passive:1; 124951087a86SSumit.Saxena@avagotech.com u32 premiumFeatureMismatch:1; 125051087a86SSumit.Saxena@avagotech.com u32 ctrlPropIncompatible:1; 125151087a86SSumit.Saxena@avagotech.com u32 fwVersionMismatch:1; 125251087a86SSumit.Saxena@avagotech.com u32 hwIncompatible:1; 125351087a86SSumit.Saxena@avagotech.com u32 peerIsIncompatible:1; 125451087a86SSumit.Saxena@avagotech.com u32 peerIsPresent:1; 125551087a86SSumit.Saxena@avagotech.com #else 1256bc93d425SSumit.Saxena@lsi.com u32 peerIsPresent:1; 1257bc93d425SSumit.Saxena@lsi.com u32 peerIsIncompatible:1; 1258bc93d425SSumit.Saxena@lsi.com u32 hwIncompatible:1; 1259bc93d425SSumit.Saxena@lsi.com u32 fwVersionMismatch:1; 1260bc93d425SSumit.Saxena@lsi.com u32 ctrlPropIncompatible:1; 1261bc93d425SSumit.Saxena@lsi.com u32 premiumFeatureMismatch:1; 12628f67c8c5SSumit Saxena u32 passive:1; 12638f67c8c5SSumit Saxena u32 reserved:25; 126451087a86SSumit.Saxena@avagotech.com #endif 1265bc93d425SSumit.Saxena@lsi.com } cluster; 1266bc93d425SSumit.Saxena@lsi.com 12678f67c8c5SSumit Saxena char clusterId[MEGASAS_CLUSTER_ID_SIZE]; /*0x7D4 */ 1268229fe47cSadam radford struct { 1269229fe47cSadam radford u8 maxVFsSupported; /*0x7E4*/ 1270229fe47cSadam radford u8 numVFsEnabled; /*0x7E5*/ 1271229fe47cSadam radford u8 requestorId; /*0x7E6 0:PF, 1:VF1, 2:VF2*/ 1272229fe47cSadam radford u8 reserved; /*0x7E7*/ 1273229fe47cSadam radford } iov; 1274bc93d425SSumit.Saxena@lsi.com 1275fc62b3fcSSumit.Saxena@avagotech.com struct { 1276fc62b3fcSSumit.Saxena@avagotech.com #if defined(__BIG_ENDIAN_BITFIELD) 12773761cb4cSsumit.saxena@avagotech.com u32 reserved:7; 12783761cb4cSsumit.saxena@avagotech.com u32 useSeqNumJbodFP:1; 12790be3f4c9Ssumit.saxena@avagotech.com u32 supportExtendedSSCSize:1; 12800be3f4c9Ssumit.saxena@avagotech.com u32 supportDiskCacheSettingForSysPDs:1; 12810be3f4c9Ssumit.saxena@avagotech.com u32 supportCPLDUpdate:1; 12820be3f4c9Ssumit.saxena@avagotech.com u32 supportTTYLogCompression:1; 12837497cde8SSumit.Saxena@avagotech.com u32 discardCacheDuringLDDelete:1; 12847497cde8SSumit.Saxena@avagotech.com u32 supportSecurityonJBOD:1; 12857497cde8SSumit.Saxena@avagotech.com u32 supportCacheBypassModes:1; 12867497cde8SSumit.Saxena@avagotech.com u32 supportDisableSESMonitoring:1; 12877497cde8SSumit.Saxena@avagotech.com u32 supportForceFlash:1; 12887497cde8SSumit.Saxena@avagotech.com u32 supportNVDRAM:1; 12897497cde8SSumit.Saxena@avagotech.com u32 supportDrvActivityLEDSetting:1; 12907497cde8SSumit.Saxena@avagotech.com u32 supportAllowedOpsforDrvRemoval:1; 12917497cde8SSumit.Saxena@avagotech.com u32 supportHOQRebuild:1; 12927497cde8SSumit.Saxena@avagotech.com u32 supportForceTo512e:1; 12937497cde8SSumit.Saxena@avagotech.com u32 supportNVCacheErase:1; 12947497cde8SSumit.Saxena@avagotech.com u32 supportDebugQueue:1; 12957497cde8SSumit.Saxena@avagotech.com u32 supportSwZone:1; 1296fc62b3fcSSumit.Saxena@avagotech.com u32 supportCrashDump:1; 129751087a86SSumit.Saxena@avagotech.com u32 supportMaxExtLDs:1; 129851087a86SSumit.Saxena@avagotech.com u32 supportT10RebuildAssist:1; 129951087a86SSumit.Saxena@avagotech.com u32 supportDisableImmediateIO:1; 130051087a86SSumit.Saxena@avagotech.com u32 supportThermalPollInterval:1; 130151087a86SSumit.Saxena@avagotech.com u32 supportPersonalityChange:2; 1302fc62b3fcSSumit.Saxena@avagotech.com #else 130351087a86SSumit.Saxena@avagotech.com u32 supportPersonalityChange:2; 130451087a86SSumit.Saxena@avagotech.com u32 supportThermalPollInterval:1; 130551087a86SSumit.Saxena@avagotech.com u32 supportDisableImmediateIO:1; 130651087a86SSumit.Saxena@avagotech.com u32 supportT10RebuildAssist:1; 130751087a86SSumit.Saxena@avagotech.com u32 supportMaxExtLDs:1; 1308fc62b3fcSSumit.Saxena@avagotech.com u32 supportCrashDump:1; 13097497cde8SSumit.Saxena@avagotech.com u32 supportSwZone:1; 13107497cde8SSumit.Saxena@avagotech.com u32 supportDebugQueue:1; 13117497cde8SSumit.Saxena@avagotech.com u32 supportNVCacheErase:1; 13127497cde8SSumit.Saxena@avagotech.com u32 supportForceTo512e:1; 13137497cde8SSumit.Saxena@avagotech.com u32 supportHOQRebuild:1; 13147497cde8SSumit.Saxena@avagotech.com u32 supportAllowedOpsforDrvRemoval:1; 13157497cde8SSumit.Saxena@avagotech.com u32 supportDrvActivityLEDSetting:1; 13167497cde8SSumit.Saxena@avagotech.com u32 supportNVDRAM:1; 13177497cde8SSumit.Saxena@avagotech.com u32 supportForceFlash:1; 13187497cde8SSumit.Saxena@avagotech.com u32 supportDisableSESMonitoring:1; 13197497cde8SSumit.Saxena@avagotech.com u32 supportCacheBypassModes:1; 13207497cde8SSumit.Saxena@avagotech.com u32 supportSecurityonJBOD:1; 13217497cde8SSumit.Saxena@avagotech.com u32 discardCacheDuringLDDelete:1; 13220be3f4c9Ssumit.saxena@avagotech.com u32 supportTTYLogCompression:1; 13230be3f4c9Ssumit.saxena@avagotech.com u32 supportCPLDUpdate:1; 13240be3f4c9Ssumit.saxena@avagotech.com u32 supportDiskCacheSettingForSysPDs:1; 13250be3f4c9Ssumit.saxena@avagotech.com u32 supportExtendedSSCSize:1; 13263761cb4cSsumit.saxena@avagotech.com u32 useSeqNumJbodFP:1; 13273761cb4cSsumit.saxena@avagotech.com u32 reserved:7; 1328fc62b3fcSSumit.Saxena@avagotech.com #endif 1329fc62b3fcSSumit.Saxena@avagotech.com } adapterOperations3; 1330fc62b3fcSSumit.Saxena@avagotech.com 1331ede7c3ceSSasikumar Chandrasekaran struct { 1332ede7c3ceSSasikumar Chandrasekaran #if defined(__BIG_ENDIAN_BITFIELD) 1333ede7c3ceSSasikumar Chandrasekaran u8 reserved:7; 1334ede7c3ceSSasikumar Chandrasekaran /* Indicates whether the CPLD image is part of 1335ede7c3ceSSasikumar Chandrasekaran * the package and stored in flash 1336ede7c3ceSSasikumar Chandrasekaran */ 1337ede7c3ceSSasikumar Chandrasekaran u8 cpld_in_flash:1; 1338ede7c3ceSSasikumar Chandrasekaran #else 1339ede7c3ceSSasikumar Chandrasekaran u8 cpld_in_flash:1; 1340ede7c3ceSSasikumar Chandrasekaran u8 reserved:7; 1341ede7c3ceSSasikumar Chandrasekaran #endif 1342ede7c3ceSSasikumar Chandrasekaran u8 reserved1[3]; 1343ede7c3ceSSasikumar Chandrasekaran /* Null terminated string. Has the version 1344ede7c3ceSSasikumar Chandrasekaran * information if cpld_in_flash = FALSE 1345ede7c3ceSSasikumar Chandrasekaran */ 1346ede7c3ceSSasikumar Chandrasekaran u8 userCodeDefinition[12]; 1347ede7c3ceSSasikumar Chandrasekaran } cpld; /* Valid only if upgradableCPLD is TRUE */ 1348ede7c3ceSSasikumar Chandrasekaran 1349ede7c3ceSSasikumar Chandrasekaran struct { 1350ede7c3ceSSasikumar Chandrasekaran #if defined(__BIG_ENDIAN_BITFIELD) 1351ede7c3ceSSasikumar Chandrasekaran u16 reserved:8; 1352ede7c3ceSSasikumar Chandrasekaran u16 fw_swaps_bbu_vpd_info:1; 1353ede7c3ceSSasikumar Chandrasekaran u16 support_pd_map_target_id:1; 1354ede7c3ceSSasikumar Chandrasekaran u16 support_ses_ctrl_in_multipathcfg:1; 1355ede7c3ceSSasikumar Chandrasekaran u16 image_upload_supported:1; 1356ede7c3ceSSasikumar Chandrasekaran u16 support_encrypted_mfc:1; 1357ede7c3ceSSasikumar Chandrasekaran u16 supported_enc_algo:1; 1358ede7c3ceSSasikumar Chandrasekaran u16 support_ibutton_less:1; 1359ede7c3ceSSasikumar Chandrasekaran u16 ctrl_info_ext_supported:1; 1360ede7c3ceSSasikumar Chandrasekaran #else 1361ede7c3ceSSasikumar Chandrasekaran 1362ede7c3ceSSasikumar Chandrasekaran u16 ctrl_info_ext_supported:1; 1363ede7c3ceSSasikumar Chandrasekaran u16 support_ibutton_less:1; 1364ede7c3ceSSasikumar Chandrasekaran u16 supported_enc_algo:1; 1365ede7c3ceSSasikumar Chandrasekaran u16 support_encrypted_mfc:1; 1366ede7c3ceSSasikumar Chandrasekaran u16 image_upload_supported:1; 1367ede7c3ceSSasikumar Chandrasekaran /* FW supports LUN based association and target port based */ 1368ede7c3ceSSasikumar Chandrasekaran u16 support_ses_ctrl_in_multipathcfg:1; 1369ede7c3ceSSasikumar Chandrasekaran /* association for the SES device connected in multipath mode */ 1370ede7c3ceSSasikumar Chandrasekaran /* FW defines Jbod target Id within MR_PD_CFG_SEQ */ 1371ede7c3ceSSasikumar Chandrasekaran u16 support_pd_map_target_id:1; 1372ede7c3ceSSasikumar Chandrasekaran /* FW swaps relevant fields in MR_BBU_VPD_INFO_FIXED to 1373ede7c3ceSSasikumar Chandrasekaran * provide the data in little endian order 1374ede7c3ceSSasikumar Chandrasekaran */ 1375ede7c3ceSSasikumar Chandrasekaran u16 fw_swaps_bbu_vpd_info:1; 1376ede7c3ceSSasikumar Chandrasekaran u16 reserved:8; 1377ede7c3ceSSasikumar Chandrasekaran #endif 1378ede7c3ceSSasikumar Chandrasekaran } adapter_operations4; 1379ede7c3ceSSasikumar Chandrasekaran u8 pad[0x800-0x7FE]; /* 0x7FE pad to 2K for expansion */ 138081e403ceSYang, Bo } __packed; 1381c4a3e0a5SBagalkote, Sreenivas 1382c4a3e0a5SBagalkote, Sreenivas /* 1383c4a3e0a5SBagalkote, Sreenivas * =============================== 1384c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS driver definitions 1385c4a3e0a5SBagalkote, Sreenivas * =============================== 1386c4a3e0a5SBagalkote, Sreenivas */ 1387c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_PD_CHANNELS 2 138851087a86SSumit.Saxena@avagotech.com #define MEGASAS_MAX_LD_CHANNELS 2 1389c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \ 1390c4a3e0a5SBagalkote, Sreenivas MEGASAS_MAX_LD_CHANNELS) 1391c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_DEV_PER_CHANNEL 128 1392c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_DEFAULT_INIT_ID -1 1393c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_LUN 8 13946bf579a3Sadam radford #define MEGASAS_DEFAULT_CMD_PER_LUN 256 139581e403ceSYang, Bo #define MEGASAS_MAX_PD (MEGASAS_MAX_PD_CHANNELS * \ 139681e403ceSYang, Bo MEGASAS_MAX_DEV_PER_CHANNEL) 1397bdc6fb8dSYang, Bo #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \ 1398bdc6fb8dSYang, Bo MEGASAS_MAX_DEV_PER_CHANNEL) 1399c4a3e0a5SBagalkote, Sreenivas 14001fd10685SYang, Bo #define MEGASAS_MAX_SECTORS (2*1024) 140142a8d2b3Sadam radford #define MEGASAS_MAX_SECTORS_IEEE (2*128) 1402658dcedbSSumant Patro #define MEGASAS_DBG_LVL 1 1403658dcedbSSumant Patro 140405e9ebbeSSumant Patro #define MEGASAS_FW_BUSY 1 140505e9ebbeSSumant Patro 140651087a86SSumit.Saxena@avagotech.com #define VD_EXT_DEBUG 0 140751087a86SSumit.Saxena@avagotech.com 140811c71cb4SSumit Saxena #define SCAN_PD_CHANNEL 0x1 140911c71cb4SSumit Saxena #define SCAN_VD_CHANNEL 0x2 141090dc9d98SSumit.Saxena@avagotech.com 1411c3e385a1SSumit Saxena #define MEGASAS_KDUMP_QUEUE_DEPTH 100 1412c3e385a1SSumit Saxena 14137497cde8SSumit.Saxena@avagotech.com enum MR_SCSI_CMD_TYPE { 14147497cde8SSumit.Saxena@avagotech.com READ_WRITE_LDIO = 0, 14157497cde8SSumit.Saxena@avagotech.com NON_READ_WRITE_LDIO = 1, 14167497cde8SSumit.Saxena@avagotech.com READ_WRITE_SYSPDIO = 2, 14177497cde8SSumit.Saxena@avagotech.com NON_READ_WRITE_SYSPDIO = 3, 14187497cde8SSumit.Saxena@avagotech.com }; 14197497cde8SSumit.Saxena@avagotech.com 14206d40afbcSSumit Saxena enum DCMD_TIMEOUT_ACTION { 14216d40afbcSSumit Saxena INITIATE_OCR = 0, 14226d40afbcSSumit Saxena KILL_ADAPTER = 1, 14236d40afbcSSumit Saxena IGNORE_TIMEOUT = 2, 14246d40afbcSSumit Saxena }; 1425308ec459SSumit Saxena 1426308ec459SSumit Saxena enum FW_BOOT_CONTEXT { 1427308ec459SSumit Saxena PROBE_CONTEXT = 0, 1428308ec459SSumit Saxena OCR_CONTEXT = 1, 1429308ec459SSumit Saxena }; 1430308ec459SSumit Saxena 1431d532dbe2Sbo yang /* Frame Type */ 1432d532dbe2Sbo yang #define IO_FRAME 0 1433d532dbe2Sbo yang #define PTHRU_FRAME 1 1434d532dbe2Sbo yang 1435c4a3e0a5SBagalkote, Sreenivas /* 1436c4a3e0a5SBagalkote, Sreenivas * When SCSI mid-layer calls driver's reset routine, driver waits for 1437c4a3e0a5SBagalkote, Sreenivas * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note 1438c4a3e0a5SBagalkote, Sreenivas * that the driver cannot _actually_ abort or reset pending commands. While 1439c4a3e0a5SBagalkote, Sreenivas * it is waiting for the commands to complete, it prints a diagnostic message 1440c4a3e0a5SBagalkote, Sreenivas * every MEGASAS_RESET_NOTICE_INTERVAL seconds 1441c4a3e0a5SBagalkote, Sreenivas */ 1442c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_RESET_WAIT_TIME 180 14432a3681e5SSumant Patro #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 1444c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_RESET_NOTICE_INTERVAL 5 1445c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IOCTL_CMD 0 144605e9ebbeSSumant Patro #define MEGASAS_DEFAULT_CMD_TIMEOUT 90 1447c5daa6a9Sadam radford #define MEGASAS_THROTTLE_QUEUE_DEPTH 16 144890dc9d98SSumit.Saxena@avagotech.com #define MEGASAS_BLOCKED_CMD_TIMEOUT 60 1449c4a3e0a5SBagalkote, Sreenivas /* 1450c4a3e0a5SBagalkote, Sreenivas * FW reports the maximum of number of commands that it can accept (maximum 1451c4a3e0a5SBagalkote, Sreenivas * commands that can be outstanding) at any time. The driver must report a 1452c4a3e0a5SBagalkote, Sreenivas * lower number to the mid layer because it can issue a few internal commands 1453c4a3e0a5SBagalkote, Sreenivas * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs 1454c4a3e0a5SBagalkote, Sreenivas * is shown below 1455c4a3e0a5SBagalkote, Sreenivas */ 1456c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_INT_CMDS 32 14577bebf5c7SYang, Bo #define MEGASAS_SKINNY_INT_CMDS 5 1458ae09a6c1SSumit.Saxena@avagotech.com #define MEGASAS_FUSION_INTERNAL_CMDS 5 1459ae09a6c1SSumit.Saxena@avagotech.com #define MEGASAS_FUSION_IOCTL_CMDS 3 1460f26ac3a1SSumit.Saxena@avagotech.com #define MEGASAS_MFI_IOCTL_CMDS 27 1461c4a3e0a5SBagalkote, Sreenivas 1462d46a3ad6SSumit.Saxena@lsi.com #define MEGASAS_MAX_MSIX_QUEUES 128 1463c4a3e0a5SBagalkote, Sreenivas /* 1464c4a3e0a5SBagalkote, Sreenivas * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit 1465c4a3e0a5SBagalkote, Sreenivas * SGLs based on the size of dma_addr_t 1466c4a3e0a5SBagalkote, Sreenivas */ 1467c4a3e0a5SBagalkote, Sreenivas #define IS_DMA64 (sizeof(dma_addr_t) == 8) 1468c4a3e0a5SBagalkote, Sreenivas 146939a98554Sbo yang #define MFI_XSCALE_OMR0_CHANGE_INTERRUPT 0x00000001 147039a98554Sbo yang 147139a98554Sbo yang #define MFI_INTR_FLAG_REPLY_MESSAGE 0x00000001 147239a98554Sbo yang #define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE 0x00000002 147339a98554Sbo yang #define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT 0x00000004 147439a98554Sbo yang 1475c4a3e0a5SBagalkote, Sreenivas #define MFI_OB_INTR_STATUS_MASK 0x00000002 147614faea9fSbo yang #define MFI_POLL_TIMEOUT_SECS 60 14776d40afbcSSumit Saxena #define MFI_IO_TIMEOUT_SECS 180 1478229fe47cSadam radford #define MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF (5 * HZ) 1479229fe47cSadam radford #define MEGASAS_OCR_SETTLE_TIME_VF (1000 * 30) 1480229fe47cSadam radford #define MEGASAS_ROUTINE_WAIT_TIME_VF 300 1481f9876f0bSSumant Patro #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 14826610a6b3SYang, Bo #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 14836610a6b3SYang, Bo #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004) 148487911122SYang, Bo #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000 148587911122SYang, Bo #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001) 14860e98936cSSumant Patro 148739a98554Sbo yang #define MFI_1068_PCSR_OFFSET 0x84 148839a98554Sbo yang #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64 148939a98554Sbo yang #define MFI_1068_FW_READY 0xDDDD0000 1490d46a3ad6SSumit.Saxena@lsi.com 1491d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_OFFSET 0X0000001F 1492d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_EXT_OFFSET 0X003FC000 1493d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14 1494d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_MSIX_REG_ARRAY 16 1495179ac142SSumit Saxena #define MR_RDPQ_MODE_OFFSET 0X00800000 1496d889344eSSasikumar Chandrasekaran 1497d889344eSSasikumar Chandrasekaran #define MR_MAX_RAID_MAP_SIZE_OFFSET_SHIFT 16 1498d889344eSSasikumar Chandrasekaran #define MR_MAX_RAID_MAP_SIZE_MASK 0x1FF 1499d889344eSSasikumar Chandrasekaran #define MR_MIN_MAP_SIZE 0x10000 1500d889344eSSasikumar Chandrasekaran /* 64k */ 1501d889344eSSasikumar Chandrasekaran 1502d0fc91d6SKashyap Desai #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 1503d0fc91d6SKashyap Desai 15040e98936cSSumant Patro /* 15050e98936cSSumant Patro * register set for both 1068 and 1078 controllers 15060e98936cSSumant Patro * structure extended for 1078 registers 15070e98936cSSumant Patro */ 1508c4a3e0a5SBagalkote, Sreenivas 1509f9876f0bSSumant Patro struct megasas_register_set { 15109c915a8cSadam radford u32 doorbell; /*0000h*/ 15119c915a8cSadam radford u32 fusion_seq_offset; /*0004h*/ 15129c915a8cSadam radford u32 fusion_host_diag; /*0008h*/ 15139c915a8cSadam radford u32 reserved_01; /*000Ch*/ 1514c4a3e0a5SBagalkote, Sreenivas 1515c4a3e0a5SBagalkote, Sreenivas u32 inbound_msg_0; /*0010h*/ 1516c4a3e0a5SBagalkote, Sreenivas u32 inbound_msg_1; /*0014h*/ 1517c4a3e0a5SBagalkote, Sreenivas u32 outbound_msg_0; /*0018h*/ 1518c4a3e0a5SBagalkote, Sreenivas u32 outbound_msg_1; /*001Ch*/ 1519c4a3e0a5SBagalkote, Sreenivas 1520c4a3e0a5SBagalkote, Sreenivas u32 inbound_doorbell; /*0020h*/ 1521c4a3e0a5SBagalkote, Sreenivas u32 inbound_intr_status; /*0024h*/ 1522c4a3e0a5SBagalkote, Sreenivas u32 inbound_intr_mask; /*0028h*/ 1523c4a3e0a5SBagalkote, Sreenivas 1524c4a3e0a5SBagalkote, Sreenivas u32 outbound_doorbell; /*002Ch*/ 1525c4a3e0a5SBagalkote, Sreenivas u32 outbound_intr_status; /*0030h*/ 1526c4a3e0a5SBagalkote, Sreenivas u32 outbound_intr_mask; /*0034h*/ 1527c4a3e0a5SBagalkote, Sreenivas 1528c4a3e0a5SBagalkote, Sreenivas u32 reserved_1[2]; /*0038h*/ 1529c4a3e0a5SBagalkote, Sreenivas 1530c4a3e0a5SBagalkote, Sreenivas u32 inbound_queue_port; /*0040h*/ 1531c4a3e0a5SBagalkote, Sreenivas u32 outbound_queue_port; /*0044h*/ 1532c4a3e0a5SBagalkote, Sreenivas 15339c915a8cSadam radford u32 reserved_2[9]; /*0048h*/ 15349c915a8cSadam radford u32 reply_post_host_index; /*006Ch*/ 15359c915a8cSadam radford u32 reserved_2_2[12]; /*0070h*/ 1536c4a3e0a5SBagalkote, Sreenivas 1537f9876f0bSSumant Patro u32 outbound_doorbell_clear; /*00A0h*/ 1538f9876f0bSSumant Patro 1539f9876f0bSSumant Patro u32 reserved_3[3]; /*00A4h*/ 1540f9876f0bSSumant Patro 1541f9876f0bSSumant Patro u32 outbound_scratch_pad ; /*00B0h*/ 15429c915a8cSadam radford u32 outbound_scratch_pad_2; /*00B4h*/ 1543179ac142SSumit Saxena u32 outbound_scratch_pad_3; /*00B8h*/ 154415dd0381SShivasharan S u32 outbound_scratch_pad_4; /*00BCh*/ 1545f9876f0bSSumant Patro 1546f9876f0bSSumant Patro 1547f9876f0bSSumant Patro u32 inbound_low_queue_port ; /*00C0h*/ 1548f9876f0bSSumant Patro 1549f9876f0bSSumant Patro u32 inbound_high_queue_port ; /*00C4h*/ 1550f9876f0bSSumant Patro 155145f4f2ebSSasikumar Chandrasekaran u32 inbound_single_queue_port; /*00C8h*/ 155239a98554Sbo yang u32 res_6[11]; /*CCh*/ 155339a98554Sbo yang u32 host_diag; 155439a98554Sbo yang u32 seq_offset; 155539a98554Sbo yang u32 index_registers[807]; /*00CCh*/ 1556c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1557c4a3e0a5SBagalkote, Sreenivas 1558c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 { 1559c4a3e0a5SBagalkote, Sreenivas 15609ab9ed38SChristoph Hellwig __le32 phys_addr; 15619ab9ed38SChristoph Hellwig __le32 length; 1562c4a3e0a5SBagalkote, Sreenivas 1563c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1564c4a3e0a5SBagalkote, Sreenivas 1565c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 { 1566c4a3e0a5SBagalkote, Sreenivas 15679ab9ed38SChristoph Hellwig __le64 phys_addr; 15689ab9ed38SChristoph Hellwig __le32 length; 1569c4a3e0a5SBagalkote, Sreenivas 1570c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1571c4a3e0a5SBagalkote, Sreenivas 1572f4c9a131SYang, Bo struct megasas_sge_skinny { 15739ab9ed38SChristoph Hellwig __le64 phys_addr; 15749ab9ed38SChristoph Hellwig __le32 length; 15759ab9ed38SChristoph Hellwig __le32 flag; 1576f4c9a131SYang, Bo } __packed; 1577f4c9a131SYang, Bo 1578c4a3e0a5SBagalkote, Sreenivas union megasas_sgl { 1579c4a3e0a5SBagalkote, Sreenivas 1580c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[1]; 1581c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[1]; 1582f4c9a131SYang, Bo struct megasas_sge_skinny sge_skinny[1]; 1583c4a3e0a5SBagalkote, Sreenivas 1584c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1585c4a3e0a5SBagalkote, Sreenivas 1586c4a3e0a5SBagalkote, Sreenivas struct megasas_header { 1587c4a3e0a5SBagalkote, Sreenivas 1588c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1589c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1590c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1591c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1592c4a3e0a5SBagalkote, Sreenivas 1593c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1594c4a3e0a5SBagalkote, Sreenivas u8 lun; /*05h */ 1595c4a3e0a5SBagalkote, Sreenivas u8 cdb_len; /*06h */ 1596c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1597c4a3e0a5SBagalkote, Sreenivas 15989ab9ed38SChristoph Hellwig __le32 context; /*08h */ 15999ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1600c4a3e0a5SBagalkote, Sreenivas 16019ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 16029ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 16039ab9ed38SChristoph Hellwig __le32 data_xferlen; /*14h */ 1604c4a3e0a5SBagalkote, Sreenivas 1605c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1606c4a3e0a5SBagalkote, Sreenivas 1607c4a3e0a5SBagalkote, Sreenivas union megasas_sgl_frame { 1608c4a3e0a5SBagalkote, Sreenivas 1609c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[8]; 1610c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[5]; 1611c4a3e0a5SBagalkote, Sreenivas 1612c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1613c4a3e0a5SBagalkote, Sreenivas 1614d46a3ad6SSumit.Saxena@lsi.com typedef union _MFI_CAPABILITIES { 1615d46a3ad6SSumit.Saxena@lsi.com struct { 161694cd65ddSSumit.Saxena@lsi.com #if defined(__BIG_ENDIAN_BITFIELD) 1617ede7c3ceSSasikumar Chandrasekaran u32 reserved:19; 1618ede7c3ceSSasikumar Chandrasekaran u32 support_pd_map_target_id:1; 161952b62ac7SSumit Saxena u32 support_qd_throttling:1; 16208f05024cSSumit Saxena u32 support_fp_rlbypass:1; 16218f05024cSSumit Saxena u32 support_vfid_in_ioframe:1; 1622bd5f9484Ssumit.saxena@avagotech.com u32 support_ext_io_size:1; 16230be3f4c9Ssumit.saxena@avagotech.com u32 support_ext_queue_depth:1; 16247497cde8SSumit.Saxena@avagotech.com u32 security_protocol_cmds_fw:1; 16257497cde8SSumit.Saxena@avagotech.com u32 support_core_affinity:1; 1626d2552ebeSSumit.Saxena@avagotech.com u32 support_ndrive_r1_lb:1; 162751087a86SSumit.Saxena@avagotech.com u32 support_max_255lds:1; 16287497cde8SSumit.Saxena@avagotech.com u32 support_fastpath_wb:1; 162994cd65ddSSumit.Saxena@lsi.com u32 support_additional_msix:1; 163094cd65ddSSumit.Saxena@lsi.com u32 support_fp_remote_lun:1; 163194cd65ddSSumit.Saxena@lsi.com #else 1632d46a3ad6SSumit.Saxena@lsi.com u32 support_fp_remote_lun:1; 1633d46a3ad6SSumit.Saxena@lsi.com u32 support_additional_msix:1; 16347497cde8SSumit.Saxena@avagotech.com u32 support_fastpath_wb:1; 163551087a86SSumit.Saxena@avagotech.com u32 support_max_255lds:1; 1636d2552ebeSSumit.Saxena@avagotech.com u32 support_ndrive_r1_lb:1; 16377497cde8SSumit.Saxena@avagotech.com u32 support_core_affinity:1; 16387497cde8SSumit.Saxena@avagotech.com u32 security_protocol_cmds_fw:1; 16390be3f4c9Ssumit.saxena@avagotech.com u32 support_ext_queue_depth:1; 1640bd5f9484Ssumit.saxena@avagotech.com u32 support_ext_io_size:1; 16418f05024cSSumit Saxena u32 support_vfid_in_ioframe:1; 16428f05024cSSumit Saxena u32 support_fp_rlbypass:1; 164352b62ac7SSumit Saxena u32 support_qd_throttling:1; 1644ede7c3ceSSasikumar Chandrasekaran u32 support_pd_map_target_id:1; 1645ede7c3ceSSasikumar Chandrasekaran u32 reserved:19; 164694cd65ddSSumit.Saxena@lsi.com #endif 1647d46a3ad6SSumit.Saxena@lsi.com } mfi_capabilities; 16489ab9ed38SChristoph Hellwig __le32 reg; 1649d46a3ad6SSumit.Saxena@lsi.com } MFI_CAPABILITIES; 1650d46a3ad6SSumit.Saxena@lsi.com 1651c4a3e0a5SBagalkote, Sreenivas struct megasas_init_frame { 1652c4a3e0a5SBagalkote, Sreenivas 1653c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1654c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1655c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1656c4a3e0a5SBagalkote, Sreenivas 1657c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*03h */ 1658d46a3ad6SSumit.Saxena@lsi.com MFI_CAPABILITIES driver_operations; /*04h*/ 1659c4a3e0a5SBagalkote, Sreenivas 16609ab9ed38SChristoph Hellwig __le32 context; /*08h */ 16619ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1662c4a3e0a5SBagalkote, Sreenivas 16639ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 16649ab9ed38SChristoph Hellwig __le16 reserved_3; /*12h */ 16659ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 1666c4a3e0a5SBagalkote, Sreenivas 16679ab9ed38SChristoph Hellwig __le32 queue_info_new_phys_addr_lo; /*18h */ 16689ab9ed38SChristoph Hellwig __le32 queue_info_new_phys_addr_hi; /*1Ch */ 16699ab9ed38SChristoph Hellwig __le32 queue_info_old_phys_addr_lo; /*20h */ 16709ab9ed38SChristoph Hellwig __le32 queue_info_old_phys_addr_hi; /*24h */ 16719ab9ed38SChristoph Hellwig __le32 reserved_4[2]; /*28h */ 16729ab9ed38SChristoph Hellwig __le32 system_info_lo; /*30h */ 16739ab9ed38SChristoph Hellwig __le32 system_info_hi; /*34h */ 16749ab9ed38SChristoph Hellwig __le32 reserved_5[2]; /*38h */ 1675c4a3e0a5SBagalkote, Sreenivas 1676c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1677c4a3e0a5SBagalkote, Sreenivas 1678c4a3e0a5SBagalkote, Sreenivas struct megasas_init_queue_info { 1679c4a3e0a5SBagalkote, Sreenivas 16809ab9ed38SChristoph Hellwig __le32 init_flags; /*00h */ 16819ab9ed38SChristoph Hellwig __le32 reply_queue_entries; /*04h */ 1682c4a3e0a5SBagalkote, Sreenivas 16839ab9ed38SChristoph Hellwig __le32 reply_queue_start_phys_addr_lo; /*08h */ 16849ab9ed38SChristoph Hellwig __le32 reply_queue_start_phys_addr_hi; /*0Ch */ 16859ab9ed38SChristoph Hellwig __le32 producer_index_phys_addr_lo; /*10h */ 16869ab9ed38SChristoph Hellwig __le32 producer_index_phys_addr_hi; /*14h */ 16879ab9ed38SChristoph Hellwig __le32 consumer_index_phys_addr_lo; /*18h */ 16889ab9ed38SChristoph Hellwig __le32 consumer_index_phys_addr_hi; /*1Ch */ 1689c4a3e0a5SBagalkote, Sreenivas 1690c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1691c4a3e0a5SBagalkote, Sreenivas 1692c4a3e0a5SBagalkote, Sreenivas struct megasas_io_frame { 1693c4a3e0a5SBagalkote, Sreenivas 1694c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1695c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1696c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1697c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1698c4a3e0a5SBagalkote, Sreenivas 1699c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1700c4a3e0a5SBagalkote, Sreenivas u8 access_byte; /*05h */ 1701c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*06h */ 1702c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1703c4a3e0a5SBagalkote, Sreenivas 17049ab9ed38SChristoph Hellwig __le32 context; /*08h */ 17059ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1706c4a3e0a5SBagalkote, Sreenivas 17079ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 17089ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 17099ab9ed38SChristoph Hellwig __le32 lba_count; /*14h */ 1710c4a3e0a5SBagalkote, Sreenivas 17119ab9ed38SChristoph Hellwig __le32 sense_buf_phys_addr_lo; /*18h */ 17129ab9ed38SChristoph Hellwig __le32 sense_buf_phys_addr_hi; /*1Ch */ 1713c4a3e0a5SBagalkote, Sreenivas 17149ab9ed38SChristoph Hellwig __le32 start_lba_lo; /*20h */ 17159ab9ed38SChristoph Hellwig __le32 start_lba_hi; /*24h */ 1716c4a3e0a5SBagalkote, Sreenivas 1717c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*28h */ 1718c4a3e0a5SBagalkote, Sreenivas 1719c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1720c4a3e0a5SBagalkote, Sreenivas 1721c4a3e0a5SBagalkote, Sreenivas struct megasas_pthru_frame { 1722c4a3e0a5SBagalkote, Sreenivas 1723c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1724c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1725c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1726c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1727c4a3e0a5SBagalkote, Sreenivas 1728c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1729c4a3e0a5SBagalkote, Sreenivas u8 lun; /*05h */ 1730c4a3e0a5SBagalkote, Sreenivas u8 cdb_len; /*06h */ 1731c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1732c4a3e0a5SBagalkote, Sreenivas 17339ab9ed38SChristoph Hellwig __le32 context; /*08h */ 17349ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1735c4a3e0a5SBagalkote, Sreenivas 17369ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 17379ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 17389ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 1739c4a3e0a5SBagalkote, Sreenivas 17409ab9ed38SChristoph Hellwig __le32 sense_buf_phys_addr_lo; /*18h */ 17419ab9ed38SChristoph Hellwig __le32 sense_buf_phys_addr_hi; /*1Ch */ 1742c4a3e0a5SBagalkote, Sreenivas 1743c4a3e0a5SBagalkote, Sreenivas u8 cdb[16]; /*20h */ 1744c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*30h */ 1745c4a3e0a5SBagalkote, Sreenivas 1746c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1747c4a3e0a5SBagalkote, Sreenivas 1748c4a3e0a5SBagalkote, Sreenivas struct megasas_dcmd_frame { 1749c4a3e0a5SBagalkote, Sreenivas 1750c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1751c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1752c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1753c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[4]; /*03h */ 1754c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1755c4a3e0a5SBagalkote, Sreenivas 17569ab9ed38SChristoph Hellwig __le32 context; /*08h */ 17579ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1758c4a3e0a5SBagalkote, Sreenivas 17599ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 17609ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 1761c4a3e0a5SBagalkote, Sreenivas 17629ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 17639ab9ed38SChristoph Hellwig __le32 opcode; /*18h */ 1764c4a3e0a5SBagalkote, Sreenivas 1765c4a3e0a5SBagalkote, Sreenivas union { /*1Ch */ 1766c4a3e0a5SBagalkote, Sreenivas u8 b[12]; 17679ab9ed38SChristoph Hellwig __le16 s[6]; 17689ab9ed38SChristoph Hellwig __le32 w[3]; 1769c4a3e0a5SBagalkote, Sreenivas } mbox; 1770c4a3e0a5SBagalkote, Sreenivas 1771c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*28h */ 1772c4a3e0a5SBagalkote, Sreenivas 1773c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1774c4a3e0a5SBagalkote, Sreenivas 1775c4a3e0a5SBagalkote, Sreenivas struct megasas_abort_frame { 1776c4a3e0a5SBagalkote, Sreenivas 1777c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1778c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1779c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1780c4a3e0a5SBagalkote, Sreenivas 1781c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*03h */ 17829ab9ed38SChristoph Hellwig __le32 reserved_2; /*04h */ 1783c4a3e0a5SBagalkote, Sreenivas 17849ab9ed38SChristoph Hellwig __le32 context; /*08h */ 17859ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1786c4a3e0a5SBagalkote, Sreenivas 17879ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 17889ab9ed38SChristoph Hellwig __le16 reserved_3; /*12h */ 17899ab9ed38SChristoph Hellwig __le32 reserved_4; /*14h */ 1790c4a3e0a5SBagalkote, Sreenivas 17919ab9ed38SChristoph Hellwig __le32 abort_context; /*18h */ 17929ab9ed38SChristoph Hellwig __le32 pad_1; /*1Ch */ 1793c4a3e0a5SBagalkote, Sreenivas 17949ab9ed38SChristoph Hellwig __le32 abort_mfi_phys_addr_lo; /*20h */ 17959ab9ed38SChristoph Hellwig __le32 abort_mfi_phys_addr_hi; /*24h */ 1796c4a3e0a5SBagalkote, Sreenivas 17979ab9ed38SChristoph Hellwig __le32 reserved_5[6]; /*28h */ 1798c4a3e0a5SBagalkote, Sreenivas 1799c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1800c4a3e0a5SBagalkote, Sreenivas 1801c4a3e0a5SBagalkote, Sreenivas struct megasas_smp_frame { 1802c4a3e0a5SBagalkote, Sreenivas 1803c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1804c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*01h */ 1805c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1806c4a3e0a5SBagalkote, Sreenivas u8 connection_status; /*03h */ 1807c4a3e0a5SBagalkote, Sreenivas 1808c4a3e0a5SBagalkote, Sreenivas u8 reserved_2[3]; /*04h */ 1809c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1810c4a3e0a5SBagalkote, Sreenivas 18119ab9ed38SChristoph Hellwig __le32 context; /*08h */ 18129ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1813c4a3e0a5SBagalkote, Sreenivas 18149ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 18159ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 1816c4a3e0a5SBagalkote, Sreenivas 18179ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 18189ab9ed38SChristoph Hellwig __le64 sas_addr; /*18h */ 1819c4a3e0a5SBagalkote, Sreenivas 1820c4a3e0a5SBagalkote, Sreenivas union { 1821c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */ 1822c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */ 1823c4a3e0a5SBagalkote, Sreenivas } sgl; 1824c4a3e0a5SBagalkote, Sreenivas 1825c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1826c4a3e0a5SBagalkote, Sreenivas 1827c4a3e0a5SBagalkote, Sreenivas struct megasas_stp_frame { 1828c4a3e0a5SBagalkote, Sreenivas 1829c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1830c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*01h */ 1831c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1832c4a3e0a5SBagalkote, Sreenivas u8 reserved_2; /*03h */ 1833c4a3e0a5SBagalkote, Sreenivas 1834c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1835c4a3e0a5SBagalkote, Sreenivas u8 reserved_3[2]; /*05h */ 1836c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1837c4a3e0a5SBagalkote, Sreenivas 18389ab9ed38SChristoph Hellwig __le32 context; /*08h */ 18399ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1840c4a3e0a5SBagalkote, Sreenivas 18419ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 18429ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 1843c4a3e0a5SBagalkote, Sreenivas 18449ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 1845c4a3e0a5SBagalkote, Sreenivas 18469ab9ed38SChristoph Hellwig __le16 fis[10]; /*18h */ 18479ab9ed38SChristoph Hellwig __le32 stp_flags; 1848c4a3e0a5SBagalkote, Sreenivas 1849c4a3e0a5SBagalkote, Sreenivas union { 1850c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */ 1851c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */ 1852c4a3e0a5SBagalkote, Sreenivas } sgl; 1853c4a3e0a5SBagalkote, Sreenivas 1854c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1855c4a3e0a5SBagalkote, Sreenivas 1856c4a3e0a5SBagalkote, Sreenivas union megasas_frame { 1857c4a3e0a5SBagalkote, Sreenivas 1858c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 1859c4a3e0a5SBagalkote, Sreenivas struct megasas_init_frame init; 1860c4a3e0a5SBagalkote, Sreenivas struct megasas_io_frame io; 1861c4a3e0a5SBagalkote, Sreenivas struct megasas_pthru_frame pthru; 1862c4a3e0a5SBagalkote, Sreenivas struct megasas_dcmd_frame dcmd; 1863c4a3e0a5SBagalkote, Sreenivas struct megasas_abort_frame abort; 1864c4a3e0a5SBagalkote, Sreenivas struct megasas_smp_frame smp; 1865c4a3e0a5SBagalkote, Sreenivas struct megasas_stp_frame stp; 1866c4a3e0a5SBagalkote, Sreenivas 1867c4a3e0a5SBagalkote, Sreenivas u8 raw_bytes[64]; 1868c4a3e0a5SBagalkote, Sreenivas }; 1869c4a3e0a5SBagalkote, Sreenivas 187018365b13SSumit Saxena /** 187118365b13SSumit Saxena * struct MR_PRIV_DEVICE - sdev private hostdata 187218365b13SSumit Saxena * @is_tm_capable: firmware managed tm_capable flag 187318365b13SSumit Saxena * @tm_busy: TM request is in progress 187418365b13SSumit Saxena */ 187518365b13SSumit Saxena struct MR_PRIV_DEVICE { 187618365b13SSumit Saxena bool is_tm_capable; 187718365b13SSumit Saxena bool tm_busy; 187815dd0381SShivasharan S u8 interface_type; 187918365b13SSumit Saxena }; 1880c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd; 1881c4a3e0a5SBagalkote, Sreenivas 1882c4a3e0a5SBagalkote, Sreenivas union megasas_evt_class_locale { 1883c4a3e0a5SBagalkote, Sreenivas 1884c4a3e0a5SBagalkote, Sreenivas struct { 1885be26374bSSumit.Saxena@lsi.com #ifndef __BIG_ENDIAN_BITFIELD 1886c4a3e0a5SBagalkote, Sreenivas u16 locale; 1887c4a3e0a5SBagalkote, Sreenivas u8 reserved; 1888c4a3e0a5SBagalkote, Sreenivas s8 class; 1889be26374bSSumit.Saxena@lsi.com #else 1890be26374bSSumit.Saxena@lsi.com s8 class; 1891be26374bSSumit.Saxena@lsi.com u8 reserved; 1892be26374bSSumit.Saxena@lsi.com u16 locale; 1893be26374bSSumit.Saxena@lsi.com #endif 1894c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) members; 1895c4a3e0a5SBagalkote, Sreenivas 1896c4a3e0a5SBagalkote, Sreenivas u32 word; 1897c4a3e0a5SBagalkote, Sreenivas 1898c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1899c4a3e0a5SBagalkote, Sreenivas 1900c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_log_info { 19019ab9ed38SChristoph Hellwig __le32 newest_seq_num; 19029ab9ed38SChristoph Hellwig __le32 oldest_seq_num; 19039ab9ed38SChristoph Hellwig __le32 clear_seq_num; 19049ab9ed38SChristoph Hellwig __le32 shutdown_seq_num; 19059ab9ed38SChristoph Hellwig __le32 boot_seq_num; 1906c4a3e0a5SBagalkote, Sreenivas 1907c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1908c4a3e0a5SBagalkote, Sreenivas 1909c4a3e0a5SBagalkote, Sreenivas struct megasas_progress { 1910c4a3e0a5SBagalkote, Sreenivas 19119ab9ed38SChristoph Hellwig __le16 progress; 19129ab9ed38SChristoph Hellwig __le16 elapsed_seconds; 1913c4a3e0a5SBagalkote, Sreenivas 1914c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1915c4a3e0a5SBagalkote, Sreenivas 1916c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld { 1917c4a3e0a5SBagalkote, Sreenivas 1918c4a3e0a5SBagalkote, Sreenivas u16 target_id; 1919c4a3e0a5SBagalkote, Sreenivas u8 ld_index; 1920c4a3e0a5SBagalkote, Sreenivas u8 reserved; 1921c4a3e0a5SBagalkote, Sreenivas 1922c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1923c4a3e0a5SBagalkote, Sreenivas 1924c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd { 1925c4a3e0a5SBagalkote, Sreenivas u16 device_id; 1926c4a3e0a5SBagalkote, Sreenivas u8 encl_index; 1927c4a3e0a5SBagalkote, Sreenivas u8 slot_number; 1928c4a3e0a5SBagalkote, Sreenivas 1929c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1930c4a3e0a5SBagalkote, Sreenivas 1931c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_detail { 1932c4a3e0a5SBagalkote, Sreenivas 19339ab9ed38SChristoph Hellwig __le32 seq_num; 19349ab9ed38SChristoph Hellwig __le32 time_stamp; 19359ab9ed38SChristoph Hellwig __le32 code; 1936c4a3e0a5SBagalkote, Sreenivas union megasas_evt_class_locale cl; 1937c4a3e0a5SBagalkote, Sreenivas u8 arg_type; 1938c4a3e0a5SBagalkote, Sreenivas u8 reserved1[15]; 1939c4a3e0a5SBagalkote, Sreenivas 1940c4a3e0a5SBagalkote, Sreenivas union { 1941c4a3e0a5SBagalkote, Sreenivas struct { 1942c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1943c4a3e0a5SBagalkote, Sreenivas u8 cdb_length; 1944c4a3e0a5SBagalkote, Sreenivas u8 sense_length; 1945c4a3e0a5SBagalkote, Sreenivas u8 reserved[2]; 1946c4a3e0a5SBagalkote, Sreenivas u8 cdb[16]; 1947c4a3e0a5SBagalkote, Sreenivas u8 sense[64]; 1948c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) cdbSense; 1949c4a3e0a5SBagalkote, Sreenivas 1950c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1951c4a3e0a5SBagalkote, Sreenivas 1952c4a3e0a5SBagalkote, Sreenivas struct { 1953c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 19549ab9ed38SChristoph Hellwig __le64 count; 1955c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_count; 1956c4a3e0a5SBagalkote, Sreenivas 1957c4a3e0a5SBagalkote, Sreenivas struct { 19589ab9ed38SChristoph Hellwig __le64 lba; 1959c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1960c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_lba; 1961c4a3e0a5SBagalkote, Sreenivas 1962c4a3e0a5SBagalkote, Sreenivas struct { 1963c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 19649ab9ed38SChristoph Hellwig __le32 prevOwner; 19659ab9ed38SChristoph Hellwig __le32 newOwner; 1966c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_owner; 1967c4a3e0a5SBagalkote, Sreenivas 1968c4a3e0a5SBagalkote, Sreenivas struct { 1969c4a3e0a5SBagalkote, Sreenivas u64 ld_lba; 1970c4a3e0a5SBagalkote, Sreenivas u64 pd_lba; 1971c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1972c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1973c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_lba_pd_lba; 1974c4a3e0a5SBagalkote, Sreenivas 1975c4a3e0a5SBagalkote, Sreenivas struct { 1976c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1977c4a3e0a5SBagalkote, Sreenivas struct megasas_progress prog; 1978c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_prog; 1979c4a3e0a5SBagalkote, Sreenivas 1980c4a3e0a5SBagalkote, Sreenivas struct { 1981c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1982c4a3e0a5SBagalkote, Sreenivas u32 prev_state; 1983c4a3e0a5SBagalkote, Sreenivas u32 new_state; 1984c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_state; 1985c4a3e0a5SBagalkote, Sreenivas 1986c4a3e0a5SBagalkote, Sreenivas struct { 1987c4a3e0a5SBagalkote, Sreenivas u64 strip; 1988c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1989c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_strip; 1990c4a3e0a5SBagalkote, Sreenivas 1991c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1992c4a3e0a5SBagalkote, Sreenivas 1993c4a3e0a5SBagalkote, Sreenivas struct { 1994c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1995c4a3e0a5SBagalkote, Sreenivas u32 err; 1996c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_err; 1997c4a3e0a5SBagalkote, Sreenivas 1998c4a3e0a5SBagalkote, Sreenivas struct { 1999c4a3e0a5SBagalkote, Sreenivas u64 lba; 2000c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2001c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_lba; 2002c4a3e0a5SBagalkote, Sreenivas 2003c4a3e0a5SBagalkote, Sreenivas struct { 2004c4a3e0a5SBagalkote, Sreenivas u64 lba; 2005c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2006c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 2007c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_lba_ld; 2008c4a3e0a5SBagalkote, Sreenivas 2009c4a3e0a5SBagalkote, Sreenivas struct { 2010c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2011c4a3e0a5SBagalkote, Sreenivas struct megasas_progress prog; 2012c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_prog; 2013c4a3e0a5SBagalkote, Sreenivas 2014c4a3e0a5SBagalkote, Sreenivas struct { 2015c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2016c4a3e0a5SBagalkote, Sreenivas u32 prevState; 2017c4a3e0a5SBagalkote, Sreenivas u32 newState; 2018c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_state; 2019c4a3e0a5SBagalkote, Sreenivas 2020c4a3e0a5SBagalkote, Sreenivas struct { 2021c4a3e0a5SBagalkote, Sreenivas u16 vendorId; 20229ab9ed38SChristoph Hellwig __le16 deviceId; 2023c4a3e0a5SBagalkote, Sreenivas u16 subVendorId; 2024c4a3e0a5SBagalkote, Sreenivas u16 subDeviceId; 2025c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pci; 2026c4a3e0a5SBagalkote, Sreenivas 2027c4a3e0a5SBagalkote, Sreenivas u32 rate; 2028c4a3e0a5SBagalkote, Sreenivas char str[96]; 2029c4a3e0a5SBagalkote, Sreenivas 2030c4a3e0a5SBagalkote, Sreenivas struct { 2031c4a3e0a5SBagalkote, Sreenivas u32 rtc; 2032c4a3e0a5SBagalkote, Sreenivas u32 elapsedSeconds; 2033c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) time; 2034c4a3e0a5SBagalkote, Sreenivas 2035c4a3e0a5SBagalkote, Sreenivas struct { 2036c4a3e0a5SBagalkote, Sreenivas u32 ecar; 2037c4a3e0a5SBagalkote, Sreenivas u32 elog; 2038c4a3e0a5SBagalkote, Sreenivas char str[64]; 2039c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ecc; 2040c4a3e0a5SBagalkote, Sreenivas 2041c4a3e0a5SBagalkote, Sreenivas u8 b[96]; 20429ab9ed38SChristoph Hellwig __le16 s[48]; 20439ab9ed38SChristoph Hellwig __le32 w[24]; 20449ab9ed38SChristoph Hellwig __le64 d[12]; 2045c4a3e0a5SBagalkote, Sreenivas } args; 2046c4a3e0a5SBagalkote, Sreenivas 2047c4a3e0a5SBagalkote, Sreenivas char description[128]; 2048c4a3e0a5SBagalkote, Sreenivas 2049c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 2050c4a3e0a5SBagalkote, Sreenivas 20517e8a75f4SYang, Bo struct megasas_aen_event { 2052c1d390d8SXiaotian Feng struct delayed_work hotplug_work; 20537e8a75f4SYang, Bo struct megasas_instance *instance; 20547e8a75f4SYang, Bo }; 20557e8a75f4SYang, Bo 2056c8e858feSadam radford struct megasas_irq_context { 2057c8e858feSadam radford struct megasas_instance *instance; 2058c8e858feSadam radford u32 MSIxIndex; 2059c8e858feSadam radford }; 2060c8e858feSadam radford 20615765c5b8SSumit.Saxena@avagotech.com struct MR_DRV_SYSTEM_INFO { 20625765c5b8SSumit.Saxena@avagotech.com u8 infoVersion; 20635765c5b8SSumit.Saxena@avagotech.com u8 systemIdLength; 20645765c5b8SSumit.Saxena@avagotech.com u16 reserved0; 20655765c5b8SSumit.Saxena@avagotech.com u8 systemId[64]; 20665765c5b8SSumit.Saxena@avagotech.com u8 reserved[1980]; 20675765c5b8SSumit.Saxena@avagotech.com }; 20685765c5b8SSumit.Saxena@avagotech.com 20692216c305SSumit Saxena enum MR_PD_TYPE { 20702216c305SSumit Saxena UNKNOWN_DRIVE = 0, 20712216c305SSumit Saxena PARALLEL_SCSI = 1, 20722216c305SSumit Saxena SAS_PD = 2, 20732216c305SSumit Saxena SATA_PD = 3, 20742216c305SSumit Saxena FC_PD = 4, 207515dd0381SShivasharan S NVME_PD = 5, 20762216c305SSumit Saxena }; 20772216c305SSumit Saxena 20782216c305SSumit Saxena /* JBOD Queue depth definitions */ 20792216c305SSumit Saxena #define MEGASAS_SATA_QD 32 20802216c305SSumit Saxena #define MEGASAS_SAS_QD 64 20812216c305SSumit Saxena #define MEGASAS_DEFAULT_PD_QD 64 208215dd0381SShivasharan S #define MEGASAS_NVME_QD 32 208315dd0381SShivasharan S 208415dd0381SShivasharan S #define MR_DEFAULT_NVME_PAGE_SIZE 4096 208515dd0381SShivasharan S #define MR_DEFAULT_NVME_PAGE_SHIFT 12 208615dd0381SShivasharan S #define MR_DEFAULT_NVME_MDTS_KB 128 208715dd0381SShivasharan S #define MR_NVME_PAGE_SIZE_MASK 0x000000FF 20882216c305SSumit Saxena 2089c4a3e0a5SBagalkote, Sreenivas struct megasas_instance { 2090c4a3e0a5SBagalkote, Sreenivas 20919ab9ed38SChristoph Hellwig __le32 *producer; 2092c4a3e0a5SBagalkote, Sreenivas dma_addr_t producer_h; 20939ab9ed38SChristoph Hellwig __le32 *consumer; 2094c4a3e0a5SBagalkote, Sreenivas dma_addr_t consumer_h; 20955765c5b8SSumit.Saxena@avagotech.com struct MR_DRV_SYSTEM_INFO *system_info_buf; 20965765c5b8SSumit.Saxena@avagotech.com dma_addr_t system_info_h; 2097229fe47cSadam radford struct MR_LD_VF_AFFILIATION *vf_affiliation; 2098229fe47cSadam radford dma_addr_t vf_affiliation_h; 2099229fe47cSadam radford struct MR_LD_VF_AFFILIATION_111 *vf_affiliation_111; 2100229fe47cSadam radford dma_addr_t vf_affiliation_111_h; 2101229fe47cSadam radford struct MR_CTRL_HB_HOST_MEM *hb_host_mem; 2102229fe47cSadam radford dma_addr_t hb_host_mem_h; 21032216c305SSumit Saxena struct MR_PD_INFO *pd_info; 21042216c305SSumit Saxena dma_addr_t pd_info_h; 210596188a89SShivasharan S struct MR_TARGET_PROPERTIES *tgt_prop; 210696188a89SShivasharan S dma_addr_t tgt_prop_h; 2107c4a3e0a5SBagalkote, Sreenivas 21089ab9ed38SChristoph Hellwig __le32 *reply_queue; 2109c4a3e0a5SBagalkote, Sreenivas dma_addr_t reply_queue_h; 2110c4a3e0a5SBagalkote, Sreenivas 2111fc62b3fcSSumit.Saxena@avagotech.com u32 *crash_dump_buf; 2112fc62b3fcSSumit.Saxena@avagotech.com dma_addr_t crash_dump_h; 2113fc62b3fcSSumit.Saxena@avagotech.com void *crash_buf[MAX_CRASH_DUMP_SIZE]; 2114fc62b3fcSSumit.Saxena@avagotech.com u32 crash_buf_pages; 2115fc62b3fcSSumit.Saxena@avagotech.com unsigned int fw_crash_buffer_size; 2116fc62b3fcSSumit.Saxena@avagotech.com unsigned int fw_crash_state; 2117fc62b3fcSSumit.Saxena@avagotech.com unsigned int fw_crash_buffer_offset; 2118fc62b3fcSSumit.Saxena@avagotech.com u32 drv_buf_index; 2119fc62b3fcSSumit.Saxena@avagotech.com u32 drv_buf_alloc; 2120fc62b3fcSSumit.Saxena@avagotech.com u32 crash_dump_fw_support; 2121fc62b3fcSSumit.Saxena@avagotech.com u32 crash_dump_drv_support; 2122fc62b3fcSSumit.Saxena@avagotech.com u32 crash_dump_app_support; 21237497cde8SSumit.Saxena@avagotech.com u32 secure_jbod_support; 2124ede7c3ceSSasikumar Chandrasekaran u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */ 21253761cb4cSsumit.saxena@avagotech.com bool use_seqnum_jbod_fp; /* Added for PD sequence */ 2126fc62b3fcSSumit.Saxena@avagotech.com spinlock_t crashdump_lock; 2127fc62b3fcSSumit.Saxena@avagotech.com 2128c4a3e0a5SBagalkote, Sreenivas struct megasas_register_set __iomem *reg_set; 21298a232bb3SChristoph Hellwig u32 __iomem *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; 213081e403ceSYang, Bo struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; 2131999ece0aSSumit.Saxena@lsi.com struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD]; 2132bdc6fb8dSYang, Bo u8 ld_ids[MEGASAS_MAX_LD_IDS]; 2133c4a3e0a5SBagalkote, Sreenivas s8 init_id; 2134c4a3e0a5SBagalkote, Sreenivas 2135c4a3e0a5SBagalkote, Sreenivas u16 max_num_sge; 2136c4a3e0a5SBagalkote, Sreenivas u16 max_fw_cmds; 213769c337c0SSasikumar Chandrasekaran u16 max_mpt_cmds; 21389c915a8cSadam radford u16 max_mfi_cmds; 2139ae09a6c1SSumit.Saxena@avagotech.com u16 max_scsi_cmds; 2140308ec459SSumit Saxena u16 ldio_threshold; 2141308ec459SSumit Saxena u16 cur_can_queue; 2142c4a3e0a5SBagalkote, Sreenivas u32 max_sectors_per_req; 21437e8a75f4SYang, Bo struct megasas_aen_event *ev; 2144c4a3e0a5SBagalkote, Sreenivas 2145c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd **cmd_list; 2146c4a3e0a5SBagalkote, Sreenivas struct list_head cmd_pool; 214739a98554Sbo yang /* used to sync fire the cmd to fw */ 214890dc9d98SSumit.Saxena@avagotech.com spinlock_t mfi_pool_lock; 214939a98554Sbo yang /* used to sync fire the cmd to fw */ 215039a98554Sbo yang spinlock_t hba_lock; 21517343eb65Sbo yang /* used to synch producer, consumer ptrs in dpc */ 2152fdd84e25SSasikumar Chandrasekaran spinlock_t stream_lock; 21537343eb65Sbo yang spinlock_t completion_lock; 2154c4a3e0a5SBagalkote, Sreenivas struct dma_pool *frame_dma_pool; 2155c4a3e0a5SBagalkote, Sreenivas struct dma_pool *sense_dma_pool; 2156c4a3e0a5SBagalkote, Sreenivas 2157c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_detail *evt_detail; 2158c4a3e0a5SBagalkote, Sreenivas dma_addr_t evt_detail_h; 2159c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd *aen_cmd; 21602216c305SSumit Saxena struct mutex hba_mutex; 2161c4a3e0a5SBagalkote, Sreenivas struct semaphore ioctl_sem; 2162c4a3e0a5SBagalkote, Sreenivas 2163c4a3e0a5SBagalkote, Sreenivas struct Scsi_Host *host; 2164c4a3e0a5SBagalkote, Sreenivas 2165c4a3e0a5SBagalkote, Sreenivas wait_queue_head_t int_cmd_wait_q; 2166c4a3e0a5SBagalkote, Sreenivas wait_queue_head_t abort_cmd_wait_q; 2167c4a3e0a5SBagalkote, Sreenivas 2168c4a3e0a5SBagalkote, Sreenivas struct pci_dev *pdev; 2169c4a3e0a5SBagalkote, Sreenivas u32 unique_id; 217039a98554Sbo yang u32 fw_support_ieee; 2171c4a3e0a5SBagalkote, Sreenivas 2172e4a082c7SSumant Patro atomic_t fw_outstanding; 2173308ec459SSumit Saxena atomic_t ldio_outstanding; 217439a98554Sbo yang atomic_t fw_reset_no_pci_access; 217533203bc4SShivasharan S atomic_t ieee_sgl; 217633203bc4SShivasharan S atomic_t prp_sgl; 217733203bc4SShivasharan S atomic_t sge_holes_type1; 217833203bc4SShivasharan S atomic_t sge_holes_type2; 217933203bc4SShivasharan S atomic_t sge_holes_type3; 21801341c939SSumant Patro 21811341c939SSumant Patro struct megasas_instance_template *instancet; 21825d018ad0SSumant Patro struct tasklet_struct isr_tasklet; 218339a98554Sbo yang struct work_struct work_init; 2184fc62b3fcSSumit.Saxena@avagotech.com struct work_struct crash_init; 218505e9ebbeSSumant Patro 218605e9ebbeSSumant Patro u8 flag; 2187c3518837SYang, Bo u8 unload; 2188f4c9a131SYang, Bo u8 flag_ieee; 218939a98554Sbo yang u8 issuepend_done; 219039a98554Sbo yang u8 disableOnlineCtrlReset; 2191bc93d425SSumit.Saxena@lsi.com u8 UnevenSpanSupport; 219251087a86SSumit.Saxena@avagotech.com 219351087a86SSumit.Saxena@avagotech.com u8 supportmax256vd; 219430845586SSumit Saxena u8 pd_list_not_supported; 219551087a86SSumit.Saxena@avagotech.com u16 fw_supported_vd_count; 219651087a86SSumit.Saxena@avagotech.com u16 fw_supported_pd_count; 219751087a86SSumit.Saxena@avagotech.com 219851087a86SSumit.Saxena@avagotech.com u16 drv_supported_vd_count; 219951087a86SSumit.Saxena@avagotech.com u16 drv_supported_pd_count; 220051087a86SSumit.Saxena@avagotech.com 22018a01a41dSSumit Saxena atomic_t adprecovery; 220205e9ebbeSSumant Patro unsigned long last_time; 220339a98554Sbo yang u32 mfiStatus; 220439a98554Sbo yang u32 last_seq_num; 2205ad84db2eSbo yang 220639a98554Sbo yang struct list_head internal_reset_pending_q; 220780d9da98Sadam radford 220825985edcSLucas De Marchi /* Ptr to hba specific information */ 22099c915a8cSadam radford void *ctrl_context; 221051087a86SSumit.Saxena@avagotech.com u32 ctrl_context_pages; 221151087a86SSumit.Saxena@avagotech.com struct megasas_ctrl_info *ctrl_info; 2212c8e858feSadam radford unsigned int msix_vectors; 2213c8e858feSadam radford struct megasas_irq_context irq_context[MEGASAS_MAX_MSIX_QUEUES]; 22149c915a8cSadam radford u64 map_id; 22153761cb4cSsumit.saxena@avagotech.com u64 pd_seq_map_id; 22169c915a8cSadam radford struct megasas_cmd *map_update_cmd; 22173761cb4cSsumit.saxena@avagotech.com struct megasas_cmd *jbod_seq_cmd; 2218b6d5d880Sadam radford unsigned long bar; 22199c915a8cSadam radford long reset_flags; 22209c915a8cSadam radford struct mutex reset_mutex; 2221229fe47cSadam radford struct timer_list sriov_heartbeat_timer; 2222229fe47cSadam radford char skip_heartbeat_timer_del; 2223229fe47cSadam radford u8 requestorId; 2224229fe47cSadam radford char PlasmaFW111; 22258f67c8c5SSumit Saxena char clusterId[MEGASAS_CLUSTER_ID_SIZE]; 22268f67c8c5SSumit Saxena u8 peerIsPresent; 22278f67c8c5SSumit Saxena u8 passive; 2228ae09a6c1SSumit.Saxena@avagotech.com u16 throttlequeuedepth; 2229d46a3ad6SSumit.Saxena@lsi.com u8 mask_interrupts; 2230bd5f9484Ssumit.saxena@avagotech.com u16 max_chain_frame_sz; 2231404a8a1aSSumit.Saxena@lsi.com u8 is_imr; 2232179ac142SSumit Saxena u8 is_rdpq; 22335765c5b8SSumit.Saxena@avagotech.com bool dev_handle; 2234d0fc91d6SKashyap Desai bool fw_sync_cache_support; 223545f4f2ebSSasikumar Chandrasekaran bool is_ventura; 22362493c67eSSasikumar Chandrasekaran bool msix_combined; 2237d889344eSSasikumar Chandrasekaran u16 max_raid_mapsize; 223815dd0381SShivasharan S u32 nvme_page_size; 223939a98554Sbo yang }; 2240229fe47cSadam radford struct MR_LD_VF_MAP { 2241229fe47cSadam radford u32 size; 2242229fe47cSadam radford union MR_LD_REF ref; 2243229fe47cSadam radford u8 ldVfCount; 2244229fe47cSadam radford u8 reserved[6]; 2245229fe47cSadam radford u8 policy[1]; 2246229fe47cSadam radford }; 2247229fe47cSadam radford 2248229fe47cSadam radford struct MR_LD_VF_AFFILIATION { 2249229fe47cSadam radford u32 size; 2250229fe47cSadam radford u8 ldCount; 2251229fe47cSadam radford u8 vfCount; 2252229fe47cSadam radford u8 thisVf; 2253229fe47cSadam radford u8 reserved[9]; 2254229fe47cSadam radford struct MR_LD_VF_MAP map[1]; 2255229fe47cSadam radford }; 2256229fe47cSadam radford 2257229fe47cSadam radford /* Plasma 1.11 FW backward compatibility structures */ 2258229fe47cSadam radford #define IOV_111_OFFSET 0x7CE 2259229fe47cSadam radford #define MAX_VIRTUAL_FUNCTIONS 8 22604cbfea88SAdam Radford #define MR_LD_ACCESS_HIDDEN 15 2261229fe47cSadam radford 2262229fe47cSadam radford struct IOV_111 { 2263229fe47cSadam radford u8 maxVFsSupported; 2264229fe47cSadam radford u8 numVFsEnabled; 2265229fe47cSadam radford u8 requestorId; 2266229fe47cSadam radford u8 reserved[5]; 2267229fe47cSadam radford }; 2268229fe47cSadam radford 2269229fe47cSadam radford struct MR_LD_VF_MAP_111 { 2270229fe47cSadam radford u8 targetId; 2271229fe47cSadam radford u8 reserved[3]; 2272229fe47cSadam radford u8 policy[MAX_VIRTUAL_FUNCTIONS]; 2273229fe47cSadam radford }; 2274229fe47cSadam radford 2275229fe47cSadam radford struct MR_LD_VF_AFFILIATION_111 { 2276229fe47cSadam radford u8 vdCount; 2277229fe47cSadam radford u8 vfCount; 2278229fe47cSadam radford u8 thisVf; 2279229fe47cSadam radford u8 reserved[5]; 2280229fe47cSadam radford struct MR_LD_VF_MAP_111 map[MAX_LOGICAL_DRIVES]; 2281229fe47cSadam radford }; 2282229fe47cSadam radford 2283229fe47cSadam radford struct MR_CTRL_HB_HOST_MEM { 2284229fe47cSadam radford struct { 2285229fe47cSadam radford u32 fwCounter; /* Firmware heart beat counter */ 2286229fe47cSadam radford struct { 2287229fe47cSadam radford u32 debugmode:1; /* 1=Firmware is in debug mode. 2288229fe47cSadam radford Heart beat will not be updated. */ 2289229fe47cSadam radford u32 reserved:31; 2290229fe47cSadam radford } debug; 2291229fe47cSadam radford u32 reserved_fw[6]; 2292229fe47cSadam radford u32 driverCounter; /* Driver heart beat counter. 0x20 */ 2293229fe47cSadam radford u32 reserved_driver[7]; 2294229fe47cSadam radford } HB; 2295229fe47cSadam radford u8 pad[0x400-0x40]; 2296229fe47cSadam radford }; 229739a98554Sbo yang 229839a98554Sbo yang enum { 229939a98554Sbo yang MEGASAS_HBA_OPERATIONAL = 0, 230039a98554Sbo yang MEGASAS_ADPRESET_SM_INFAULT = 1, 230139a98554Sbo yang MEGASAS_ADPRESET_SM_FW_RESET_SUCCESS = 2, 230239a98554Sbo yang MEGASAS_ADPRESET_SM_OPERATIONAL = 3, 230339a98554Sbo yang MEGASAS_HW_CRITICAL_ERROR = 4, 2304229fe47cSadam radford MEGASAS_ADPRESET_SM_POLLING = 5, 230539a98554Sbo yang MEGASAS_ADPRESET_INPROG_SIGN = 0xDEADDEAD, 2306c4a3e0a5SBagalkote, Sreenivas }; 2307c4a3e0a5SBagalkote, Sreenivas 23080c79e681SYang, Bo struct megasas_instance_template { 23090c79e681SYang, Bo void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \ 23100c79e681SYang, Bo u32, struct megasas_register_set __iomem *); 23110c79e681SYang, Bo 2312d46a3ad6SSumit.Saxena@lsi.com void (*enable_intr)(struct megasas_instance *); 2313d46a3ad6SSumit.Saxena@lsi.com void (*disable_intr)(struct megasas_instance *); 23140c79e681SYang, Bo 23150c79e681SYang, Bo int (*clear_intr)(struct megasas_register_set __iomem *); 23160c79e681SYang, Bo 23170c79e681SYang, Bo u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); 231839a98554Sbo yang int (*adp_reset)(struct megasas_instance *, \ 231939a98554Sbo yang struct megasas_register_set __iomem *); 232039a98554Sbo yang int (*check_reset)(struct megasas_instance *, \ 232139a98554Sbo yang struct megasas_register_set __iomem *); 2322cd50ba8eSadam radford irqreturn_t (*service_isr)(int irq, void *devp); 2323cd50ba8eSadam radford void (*tasklet)(unsigned long); 2324cd50ba8eSadam radford u32 (*init_adapter)(struct megasas_instance *); 2325cd50ba8eSadam radford u32 (*build_and_issue_cmd) (struct megasas_instance *, 2326cd50ba8eSadam radford struct scsi_cmnd *); 2327f4fc2093SShivasharan S void (*issue_dcmd)(struct megasas_instance *instance, 2328cd50ba8eSadam radford struct megasas_cmd *cmd); 23290c79e681SYang, Bo }; 23300c79e681SYang, Bo 23313cabd162SShivasharan S #define MEGASAS_IS_LOGICAL(sdev) \ 23323cabd162SShivasharan S ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) 2333c4a3e0a5SBagalkote, Sreenivas 23344a5c814dSSumit.Saxena@avagotech.com #define MEGASAS_DEV_INDEX(scp) \ 23354a5c814dSSumit.Saxena@avagotech.com (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ 23364a5c814dSSumit.Saxena@avagotech.com scp->device->id) 23374a5c814dSSumit.Saxena@avagotech.com 23384a5c814dSSumit.Saxena@avagotech.com #define MEGASAS_PD_INDEX(scp) \ 23394a5c814dSSumit.Saxena@avagotech.com ((scp->device->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + \ 23404a5c814dSSumit.Saxena@avagotech.com scp->device->id) 2341c4a3e0a5SBagalkote, Sreenivas 2342c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd { 2343c4a3e0a5SBagalkote, Sreenivas 2344c4a3e0a5SBagalkote, Sreenivas union megasas_frame *frame; 2345c4a3e0a5SBagalkote, Sreenivas dma_addr_t frame_phys_addr; 2346c4a3e0a5SBagalkote, Sreenivas u8 *sense; 2347c4a3e0a5SBagalkote, Sreenivas dma_addr_t sense_phys_addr; 2348c4a3e0a5SBagalkote, Sreenivas 2349c4a3e0a5SBagalkote, Sreenivas u32 index; 2350c4a3e0a5SBagalkote, Sreenivas u8 sync_cmd; 23512be2a988SSumit.Saxena@avagotech.com u8 cmd_status_drv; 235239a98554Sbo yang u8 abort_aen; 235339a98554Sbo yang u8 retry_for_fw_reset; 235439a98554Sbo yang 2355c4a3e0a5SBagalkote, Sreenivas 2356c4a3e0a5SBagalkote, Sreenivas struct list_head list; 2357c4a3e0a5SBagalkote, Sreenivas struct scsi_cmnd *scmd; 23584026e9aaSSumit.Saxena@avagotech.com u8 flags; 235990dc9d98SSumit.Saxena@avagotech.com 2360c4a3e0a5SBagalkote, Sreenivas struct megasas_instance *instance; 23619c915a8cSadam radford union { 23629c915a8cSadam radford struct { 23639c915a8cSadam radford u16 smid; 23649c915a8cSadam radford u16 resvd; 23659c915a8cSadam radford } context; 2366c4a3e0a5SBagalkote, Sreenivas u32 frame_count; 2367c4a3e0a5SBagalkote, Sreenivas }; 23689c915a8cSadam radford }; 2369c4a3e0a5SBagalkote, Sreenivas 2370c4a3e0a5SBagalkote, Sreenivas #define MAX_MGMT_ADAPTERS 1024 2371c4a3e0a5SBagalkote, Sreenivas #define MAX_IOCTL_SGE 16 2372c4a3e0a5SBagalkote, Sreenivas 2373c4a3e0a5SBagalkote, Sreenivas struct megasas_iocpacket { 2374c4a3e0a5SBagalkote, Sreenivas 2375c4a3e0a5SBagalkote, Sreenivas u16 host_no; 2376c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 2377c4a3e0a5SBagalkote, Sreenivas u32 sgl_off; 2378c4a3e0a5SBagalkote, Sreenivas u32 sge_count; 2379c4a3e0a5SBagalkote, Sreenivas u32 sense_off; 2380c4a3e0a5SBagalkote, Sreenivas u32 sense_len; 2381c4a3e0a5SBagalkote, Sreenivas union { 2382c4a3e0a5SBagalkote, Sreenivas u8 raw[128]; 2383c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 2384c4a3e0a5SBagalkote, Sreenivas } frame; 2385c4a3e0a5SBagalkote, Sreenivas 2386c4a3e0a5SBagalkote, Sreenivas struct iovec sgl[MAX_IOCTL_SGE]; 2387c4a3e0a5SBagalkote, Sreenivas 2388c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 2389c4a3e0a5SBagalkote, Sreenivas 2390c4a3e0a5SBagalkote, Sreenivas struct megasas_aen { 2391c4a3e0a5SBagalkote, Sreenivas u16 host_no; 2392c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 2393c4a3e0a5SBagalkote, Sreenivas u32 seq_num; 2394c4a3e0a5SBagalkote, Sreenivas u32 class_locale_word; 2395c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 2396c4a3e0a5SBagalkote, Sreenivas 2397c4a3e0a5SBagalkote, Sreenivas #ifdef CONFIG_COMPAT 2398c4a3e0a5SBagalkote, Sreenivas struct compat_megasas_iocpacket { 2399c4a3e0a5SBagalkote, Sreenivas u16 host_no; 2400c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 2401c4a3e0a5SBagalkote, Sreenivas u32 sgl_off; 2402c4a3e0a5SBagalkote, Sreenivas u32 sge_count; 2403c4a3e0a5SBagalkote, Sreenivas u32 sense_off; 2404c4a3e0a5SBagalkote, Sreenivas u32 sense_len; 2405c4a3e0a5SBagalkote, Sreenivas union { 2406c4a3e0a5SBagalkote, Sreenivas u8 raw[128]; 2407c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 2408c4a3e0a5SBagalkote, Sreenivas } frame; 2409c4a3e0a5SBagalkote, Sreenivas struct compat_iovec sgl[MAX_IOCTL_SGE]; 2410c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 2411c4a3e0a5SBagalkote, Sreenivas 24120e98936cSSumant Patro #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket) 2413c4a3e0a5SBagalkote, Sreenivas #endif 2414c4a3e0a5SBagalkote, Sreenivas 2415cb59aa6aSSumant Patro #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) 2416c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) 2417c4a3e0a5SBagalkote, Sreenivas 2418c4a3e0a5SBagalkote, Sreenivas struct megasas_mgmt_info { 2419c4a3e0a5SBagalkote, Sreenivas 2420c4a3e0a5SBagalkote, Sreenivas u16 count; 2421c4a3e0a5SBagalkote, Sreenivas struct megasas_instance *instance[MAX_MGMT_ADAPTERS]; 2422c4a3e0a5SBagalkote, Sreenivas int max_index; 2423c4a3e0a5SBagalkote, Sreenivas }; 2424c4a3e0a5SBagalkote, Sreenivas 24256d40afbcSSumit Saxena enum MEGASAS_OCR_CAUSE { 24266d40afbcSSumit Saxena FW_FAULT_OCR = 0, 24276d40afbcSSumit Saxena SCSIIO_TIMEOUT_OCR = 1, 24286d40afbcSSumit Saxena MFI_IO_TIMEOUT_OCR = 2, 24296d40afbcSSumit Saxena }; 24306d40afbcSSumit Saxena 24316d40afbcSSumit Saxena enum DCMD_RETURN_STATUS { 24326d40afbcSSumit Saxena DCMD_SUCCESS = 0, 24336d40afbcSSumit Saxena DCMD_TIMEOUT = 1, 24346d40afbcSSumit Saxena DCMD_FAILED = 2, 24356d40afbcSSumit Saxena DCMD_NOT_FIRED = 3, 24366d40afbcSSumit Saxena }; 24376d40afbcSSumit Saxena 243821c9e160Sadam radford u8 243921c9e160Sadam radford MR_BuildRaidContext(struct megasas_instance *instance, 244021c9e160Sadam radford struct IO_REQUEST_INFO *io_info, 244121c9e160Sadam radford struct RAID_CONTEXT *pRAID_Context, 244251087a86SSumit.Saxena@avagotech.com struct MR_DRV_RAID_MAP_ALL *map, u8 **raidLUN); 244351087a86SSumit.Saxena@avagotech.com u8 MR_TargetIdToLdGet(u32 ldTgtId, struct MR_DRV_RAID_MAP_ALL *map); 244451087a86SSumit.Saxena@avagotech.com struct MR_LD_RAID *MR_LdRaidGet(u32 ld, struct MR_DRV_RAID_MAP_ALL *map); 244551087a86SSumit.Saxena@avagotech.com u16 MR_ArPdGet(u32 ar, u32 arm, struct MR_DRV_RAID_MAP_ALL *map); 244651087a86SSumit.Saxena@avagotech.com u16 MR_LdSpanArrayGet(u32 ld, u32 span, struct MR_DRV_RAID_MAP_ALL *map); 24479ab9ed38SChristoph Hellwig __le16 MR_PdDevHandleGet(u32 pd, struct MR_DRV_RAID_MAP_ALL *map); 244851087a86SSumit.Saxena@avagotech.com u16 MR_GetLDTgtId(u32 ld, struct MR_DRV_RAID_MAP_ALL *map); 244921c9e160Sadam radford 24509ab9ed38SChristoph Hellwig __le16 get_updated_dev_handle(struct megasas_instance *instance, 245133203bc4SShivasharan S struct LD_LOAD_BALANCE_INFO *lbInfo, 245233203bc4SShivasharan S struct IO_REQUEST_INFO *in_info, 245333203bc4SShivasharan S struct MR_DRV_RAID_MAP_ALL *drv_map); 245451087a86SSumit.Saxena@avagotech.com void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *map, 245551087a86SSumit.Saxena@avagotech.com struct LD_LOAD_BALANCE_INFO *lbInfo); 2456d009b576SSumit.Saxena@avagotech.com int megasas_get_ctrl_info(struct megasas_instance *instance); 24573761cb4cSsumit.saxena@avagotech.com /* PD sequence */ 24583761cb4cSsumit.saxena@avagotech.com int 24593761cb4cSsumit.saxena@avagotech.com megasas_sync_pd_seq_num(struct megasas_instance *instance, bool pend); 246015dd0381SShivasharan S void megasas_set_dynamic_target_properties(struct scsi_device *sdev); 2461fc62b3fcSSumit.Saxena@avagotech.com int megasas_set_crash_dump_params(struct megasas_instance *instance, 2462fc62b3fcSSumit.Saxena@avagotech.com u8 crash_buf_state); 2463fc62b3fcSSumit.Saxena@avagotech.com void megasas_free_host_crash_buffer(struct megasas_instance *instance); 2464fc62b3fcSSumit.Saxena@avagotech.com void megasas_fusion_crash_dump_wq(struct work_struct *work); 246551087a86SSumit.Saxena@avagotech.com 246690dc9d98SSumit.Saxena@avagotech.com void megasas_return_cmd_fusion(struct megasas_instance *instance, 246790dc9d98SSumit.Saxena@avagotech.com struct megasas_cmd_fusion *cmd); 246890dc9d98SSumit.Saxena@avagotech.com int megasas_issue_blocked_cmd(struct megasas_instance *instance, 246990dc9d98SSumit.Saxena@avagotech.com struct megasas_cmd *cmd, int timeout); 247090dc9d98SSumit.Saxena@avagotech.com void __megasas_return_cmd(struct megasas_instance *instance, 247190dc9d98SSumit.Saxena@avagotech.com struct megasas_cmd *cmd); 247290dc9d98SSumit.Saxena@avagotech.com 247390dc9d98SSumit.Saxena@avagotech.com void megasas_return_mfi_mpt_pthr(struct megasas_instance *instance, 247490dc9d98SSumit.Saxena@avagotech.com struct megasas_cmd *cmd_mfi, struct megasas_cmd_fusion *cmd_fusion); 24757497cde8SSumit.Saxena@avagotech.com int megasas_cmd_type(struct scsi_cmnd *cmd); 24763761cb4cSsumit.saxena@avagotech.com void megasas_setup_jbod_map(struct megasas_instance *instance); 247790dc9d98SSumit.Saxena@avagotech.com 247818365b13SSumit Saxena void megasas_update_sdev_properties(struct scsi_device *sdev); 247918365b13SSumit Saxena int megasas_reset_fusion(struct Scsi_Host *shost, int reason); 248018365b13SSumit Saxena int megasas_task_abort_fusion(struct scsi_cmnd *scmd); 248118365b13SSumit Saxena int megasas_reset_target_fusion(struct scsi_cmnd *scmd); 248233203bc4SShivasharan S u32 mega_mod64(u64 dividend, u32 divisor); 2483c4a3e0a5SBagalkote, Sreenivas #endif /*LSI_MEGARAID_SAS_H */ 2484