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 1408def0eab3SShivasharan S /* Driver's internal Logging levels*/ 1409def0eab3SShivasharan S #define OCR_LOGS (1 << 0) 1410def0eab3SShivasharan S 141111c71cb4SSumit Saxena #define SCAN_PD_CHANNEL 0x1 141211c71cb4SSumit Saxena #define SCAN_VD_CHANNEL 0x2 141390dc9d98SSumit.Saxena@avagotech.com 1414c3e385a1SSumit Saxena #define MEGASAS_KDUMP_QUEUE_DEPTH 100 1415a48ba0ecSShivasharan S #define MR_LARGE_IO_MIN_SIZE (32 * 1024) 1416a48ba0ecSShivasharan S #define MR_R1_LDIO_PIGGYBACK_DEFAULT 4 1417c3e385a1SSumit Saxena 14187497cde8SSumit.Saxena@avagotech.com enum MR_SCSI_CMD_TYPE { 14197497cde8SSumit.Saxena@avagotech.com READ_WRITE_LDIO = 0, 14207497cde8SSumit.Saxena@avagotech.com NON_READ_WRITE_LDIO = 1, 14217497cde8SSumit.Saxena@avagotech.com READ_WRITE_SYSPDIO = 2, 14227497cde8SSumit.Saxena@avagotech.com NON_READ_WRITE_SYSPDIO = 3, 14237497cde8SSumit.Saxena@avagotech.com }; 14247497cde8SSumit.Saxena@avagotech.com 14256d40afbcSSumit Saxena enum DCMD_TIMEOUT_ACTION { 14266d40afbcSSumit Saxena INITIATE_OCR = 0, 14276d40afbcSSumit Saxena KILL_ADAPTER = 1, 14286d40afbcSSumit Saxena IGNORE_TIMEOUT = 2, 14296d40afbcSSumit Saxena }; 1430308ec459SSumit Saxena 1431308ec459SSumit Saxena enum FW_BOOT_CONTEXT { 1432308ec459SSumit Saxena PROBE_CONTEXT = 0, 1433308ec459SSumit Saxena OCR_CONTEXT = 1, 1434308ec459SSumit Saxena }; 1435308ec459SSumit Saxena 1436d532dbe2Sbo yang /* Frame Type */ 1437d532dbe2Sbo yang #define IO_FRAME 0 1438d532dbe2Sbo yang #define PTHRU_FRAME 1 1439d532dbe2Sbo yang 1440c4a3e0a5SBagalkote, Sreenivas /* 1441c4a3e0a5SBagalkote, Sreenivas * When SCSI mid-layer calls driver's reset routine, driver waits for 1442c4a3e0a5SBagalkote, Sreenivas * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note 1443c4a3e0a5SBagalkote, Sreenivas * that the driver cannot _actually_ abort or reset pending commands. While 1444c4a3e0a5SBagalkote, Sreenivas * it is waiting for the commands to complete, it prints a diagnostic message 1445c4a3e0a5SBagalkote, Sreenivas * every MEGASAS_RESET_NOTICE_INTERVAL seconds 1446c4a3e0a5SBagalkote, Sreenivas */ 1447c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_RESET_WAIT_TIME 180 14482a3681e5SSumant Patro #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 1449c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_RESET_NOTICE_INTERVAL 5 1450c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IOCTL_CMD 0 145105e9ebbeSSumant Patro #define MEGASAS_DEFAULT_CMD_TIMEOUT 90 1452c5daa6a9Sadam radford #define MEGASAS_THROTTLE_QUEUE_DEPTH 16 145390dc9d98SSumit.Saxena@avagotech.com #define MEGASAS_BLOCKED_CMD_TIMEOUT 60 1454c4a3e0a5SBagalkote, Sreenivas /* 1455c4a3e0a5SBagalkote, Sreenivas * FW reports the maximum of number of commands that it can accept (maximum 1456c4a3e0a5SBagalkote, Sreenivas * commands that can be outstanding) at any time. The driver must report a 1457c4a3e0a5SBagalkote, Sreenivas * lower number to the mid layer because it can issue a few internal commands 1458c4a3e0a5SBagalkote, Sreenivas * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs 1459c4a3e0a5SBagalkote, Sreenivas * is shown below 1460c4a3e0a5SBagalkote, Sreenivas */ 1461c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_INT_CMDS 32 14627bebf5c7SYang, Bo #define MEGASAS_SKINNY_INT_CMDS 5 1463ae09a6c1SSumit.Saxena@avagotech.com #define MEGASAS_FUSION_INTERNAL_CMDS 5 1464ae09a6c1SSumit.Saxena@avagotech.com #define MEGASAS_FUSION_IOCTL_CMDS 3 1465f26ac3a1SSumit.Saxena@avagotech.com #define MEGASAS_MFI_IOCTL_CMDS 27 1466c4a3e0a5SBagalkote, Sreenivas 1467d46a3ad6SSumit.Saxena@lsi.com #define MEGASAS_MAX_MSIX_QUEUES 128 1468c4a3e0a5SBagalkote, Sreenivas /* 1469c4a3e0a5SBagalkote, Sreenivas * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit 1470c4a3e0a5SBagalkote, Sreenivas * SGLs based on the size of dma_addr_t 1471c4a3e0a5SBagalkote, Sreenivas */ 1472c4a3e0a5SBagalkote, Sreenivas #define IS_DMA64 (sizeof(dma_addr_t) == 8) 1473c4a3e0a5SBagalkote, Sreenivas 147439a98554Sbo yang #define MFI_XSCALE_OMR0_CHANGE_INTERRUPT 0x00000001 147539a98554Sbo yang 147639a98554Sbo yang #define MFI_INTR_FLAG_REPLY_MESSAGE 0x00000001 147739a98554Sbo yang #define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE 0x00000002 147839a98554Sbo yang #define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT 0x00000004 147939a98554Sbo yang 1480c4a3e0a5SBagalkote, Sreenivas #define MFI_OB_INTR_STATUS_MASK 0x00000002 148114faea9fSbo yang #define MFI_POLL_TIMEOUT_SECS 60 14826d40afbcSSumit Saxena #define MFI_IO_TIMEOUT_SECS 180 1483229fe47cSadam radford #define MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF (5 * HZ) 1484229fe47cSadam radford #define MEGASAS_OCR_SETTLE_TIME_VF (1000 * 30) 1485229fe47cSadam radford #define MEGASAS_ROUTINE_WAIT_TIME_VF 300 1486f9876f0bSSumant Patro #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 14876610a6b3SYang, Bo #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 14886610a6b3SYang, Bo #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004) 148987911122SYang, Bo #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000 149087911122SYang, Bo #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001) 14910e98936cSSumant Patro 149239a98554Sbo yang #define MFI_1068_PCSR_OFFSET 0x84 149339a98554Sbo yang #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64 149439a98554Sbo yang #define MFI_1068_FW_READY 0xDDDD0000 1495d46a3ad6SSumit.Saxena@lsi.com 1496d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_OFFSET 0X0000001F 1497d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_EXT_OFFSET 0X003FC000 1498d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14 1499d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_MSIX_REG_ARRAY 16 1500179ac142SSumit Saxena #define MR_RDPQ_MODE_OFFSET 0X00800000 1501d889344eSSasikumar Chandrasekaran 1502d889344eSSasikumar Chandrasekaran #define MR_MAX_RAID_MAP_SIZE_OFFSET_SHIFT 16 1503d889344eSSasikumar Chandrasekaran #define MR_MAX_RAID_MAP_SIZE_MASK 0x1FF 1504d889344eSSasikumar Chandrasekaran #define MR_MIN_MAP_SIZE 0x10000 1505d889344eSSasikumar Chandrasekaran /* 64k */ 1506d889344eSSasikumar Chandrasekaran 1507d0fc91d6SKashyap Desai #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 1508d0fc91d6SKashyap Desai 15090e98936cSSumant Patro /* 15100e98936cSSumant Patro * register set for both 1068 and 1078 controllers 15110e98936cSSumant Patro * structure extended for 1078 registers 15120e98936cSSumant Patro */ 1513c4a3e0a5SBagalkote, Sreenivas 1514f9876f0bSSumant Patro struct megasas_register_set { 15159c915a8cSadam radford u32 doorbell; /*0000h*/ 15169c915a8cSadam radford u32 fusion_seq_offset; /*0004h*/ 15179c915a8cSadam radford u32 fusion_host_diag; /*0008h*/ 15189c915a8cSadam radford u32 reserved_01; /*000Ch*/ 1519c4a3e0a5SBagalkote, Sreenivas 1520c4a3e0a5SBagalkote, Sreenivas u32 inbound_msg_0; /*0010h*/ 1521c4a3e0a5SBagalkote, Sreenivas u32 inbound_msg_1; /*0014h*/ 1522c4a3e0a5SBagalkote, Sreenivas u32 outbound_msg_0; /*0018h*/ 1523c4a3e0a5SBagalkote, Sreenivas u32 outbound_msg_1; /*001Ch*/ 1524c4a3e0a5SBagalkote, Sreenivas 1525c4a3e0a5SBagalkote, Sreenivas u32 inbound_doorbell; /*0020h*/ 1526c4a3e0a5SBagalkote, Sreenivas u32 inbound_intr_status; /*0024h*/ 1527c4a3e0a5SBagalkote, Sreenivas u32 inbound_intr_mask; /*0028h*/ 1528c4a3e0a5SBagalkote, Sreenivas 1529c4a3e0a5SBagalkote, Sreenivas u32 outbound_doorbell; /*002Ch*/ 1530c4a3e0a5SBagalkote, Sreenivas u32 outbound_intr_status; /*0030h*/ 1531c4a3e0a5SBagalkote, Sreenivas u32 outbound_intr_mask; /*0034h*/ 1532c4a3e0a5SBagalkote, Sreenivas 1533c4a3e0a5SBagalkote, Sreenivas u32 reserved_1[2]; /*0038h*/ 1534c4a3e0a5SBagalkote, Sreenivas 1535c4a3e0a5SBagalkote, Sreenivas u32 inbound_queue_port; /*0040h*/ 1536c4a3e0a5SBagalkote, Sreenivas u32 outbound_queue_port; /*0044h*/ 1537c4a3e0a5SBagalkote, Sreenivas 15389c915a8cSadam radford u32 reserved_2[9]; /*0048h*/ 15399c915a8cSadam radford u32 reply_post_host_index; /*006Ch*/ 15409c915a8cSadam radford u32 reserved_2_2[12]; /*0070h*/ 1541c4a3e0a5SBagalkote, Sreenivas 1542f9876f0bSSumant Patro u32 outbound_doorbell_clear; /*00A0h*/ 1543f9876f0bSSumant Patro 1544f9876f0bSSumant Patro u32 reserved_3[3]; /*00A4h*/ 1545f9876f0bSSumant Patro 1546f9876f0bSSumant Patro u32 outbound_scratch_pad ; /*00B0h*/ 15479c915a8cSadam radford u32 outbound_scratch_pad_2; /*00B4h*/ 1548179ac142SSumit Saxena u32 outbound_scratch_pad_3; /*00B8h*/ 154915dd0381SShivasharan S u32 outbound_scratch_pad_4; /*00BCh*/ 1550f9876f0bSSumant Patro 1551f9876f0bSSumant Patro 1552f9876f0bSSumant Patro u32 inbound_low_queue_port ; /*00C0h*/ 1553f9876f0bSSumant Patro 1554f9876f0bSSumant Patro u32 inbound_high_queue_port ; /*00C4h*/ 1555f9876f0bSSumant Patro 155645f4f2ebSSasikumar Chandrasekaran u32 inbound_single_queue_port; /*00C8h*/ 155739a98554Sbo yang u32 res_6[11]; /*CCh*/ 155839a98554Sbo yang u32 host_diag; 155939a98554Sbo yang u32 seq_offset; 156039a98554Sbo yang u32 index_registers[807]; /*00CCh*/ 1561c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1562c4a3e0a5SBagalkote, Sreenivas 1563c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 { 1564c4a3e0a5SBagalkote, Sreenivas 15659ab9ed38SChristoph Hellwig __le32 phys_addr; 15669ab9ed38SChristoph Hellwig __le32 length; 1567c4a3e0a5SBagalkote, Sreenivas 1568c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1569c4a3e0a5SBagalkote, Sreenivas 1570c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 { 1571c4a3e0a5SBagalkote, Sreenivas 15729ab9ed38SChristoph Hellwig __le64 phys_addr; 15739ab9ed38SChristoph Hellwig __le32 length; 1574c4a3e0a5SBagalkote, Sreenivas 1575c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1576c4a3e0a5SBagalkote, Sreenivas 1577f4c9a131SYang, Bo struct megasas_sge_skinny { 15789ab9ed38SChristoph Hellwig __le64 phys_addr; 15799ab9ed38SChristoph Hellwig __le32 length; 15809ab9ed38SChristoph Hellwig __le32 flag; 1581f4c9a131SYang, Bo } __packed; 1582f4c9a131SYang, Bo 1583c4a3e0a5SBagalkote, Sreenivas union megasas_sgl { 1584c4a3e0a5SBagalkote, Sreenivas 1585c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[1]; 1586c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[1]; 1587f4c9a131SYang, Bo struct megasas_sge_skinny sge_skinny[1]; 1588c4a3e0a5SBagalkote, Sreenivas 1589c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1590c4a3e0a5SBagalkote, Sreenivas 1591c4a3e0a5SBagalkote, Sreenivas struct megasas_header { 1592c4a3e0a5SBagalkote, Sreenivas 1593c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1594c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1595c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1596c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1597c4a3e0a5SBagalkote, Sreenivas 1598c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1599c4a3e0a5SBagalkote, Sreenivas u8 lun; /*05h */ 1600c4a3e0a5SBagalkote, Sreenivas u8 cdb_len; /*06h */ 1601c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1602c4a3e0a5SBagalkote, Sreenivas 16039ab9ed38SChristoph Hellwig __le32 context; /*08h */ 16049ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1605c4a3e0a5SBagalkote, Sreenivas 16069ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 16079ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 16089ab9ed38SChristoph Hellwig __le32 data_xferlen; /*14h */ 1609c4a3e0a5SBagalkote, Sreenivas 1610c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1611c4a3e0a5SBagalkote, Sreenivas 1612c4a3e0a5SBagalkote, Sreenivas union megasas_sgl_frame { 1613c4a3e0a5SBagalkote, Sreenivas 1614c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[8]; 1615c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[5]; 1616c4a3e0a5SBagalkote, Sreenivas 1617c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1618c4a3e0a5SBagalkote, Sreenivas 1619d46a3ad6SSumit.Saxena@lsi.com typedef union _MFI_CAPABILITIES { 1620d46a3ad6SSumit.Saxena@lsi.com struct { 162194cd65ddSSumit.Saxena@lsi.com #if defined(__BIG_ENDIAN_BITFIELD) 1622ede7c3ceSSasikumar Chandrasekaran u32 reserved:19; 1623ede7c3ceSSasikumar Chandrasekaran u32 support_pd_map_target_id:1; 162452b62ac7SSumit Saxena u32 support_qd_throttling:1; 16258f05024cSSumit Saxena u32 support_fp_rlbypass:1; 16268f05024cSSumit Saxena u32 support_vfid_in_ioframe:1; 1627bd5f9484Ssumit.saxena@avagotech.com u32 support_ext_io_size:1; 16280be3f4c9Ssumit.saxena@avagotech.com u32 support_ext_queue_depth:1; 16297497cde8SSumit.Saxena@avagotech.com u32 security_protocol_cmds_fw:1; 16307497cde8SSumit.Saxena@avagotech.com u32 support_core_affinity:1; 1631d2552ebeSSumit.Saxena@avagotech.com u32 support_ndrive_r1_lb:1; 163251087a86SSumit.Saxena@avagotech.com u32 support_max_255lds:1; 16337497cde8SSumit.Saxena@avagotech.com u32 support_fastpath_wb:1; 163494cd65ddSSumit.Saxena@lsi.com u32 support_additional_msix:1; 163594cd65ddSSumit.Saxena@lsi.com u32 support_fp_remote_lun:1; 163694cd65ddSSumit.Saxena@lsi.com #else 1637d46a3ad6SSumit.Saxena@lsi.com u32 support_fp_remote_lun:1; 1638d46a3ad6SSumit.Saxena@lsi.com u32 support_additional_msix:1; 16397497cde8SSumit.Saxena@avagotech.com u32 support_fastpath_wb:1; 164051087a86SSumit.Saxena@avagotech.com u32 support_max_255lds:1; 1641d2552ebeSSumit.Saxena@avagotech.com u32 support_ndrive_r1_lb:1; 16427497cde8SSumit.Saxena@avagotech.com u32 support_core_affinity:1; 16437497cde8SSumit.Saxena@avagotech.com u32 security_protocol_cmds_fw:1; 16440be3f4c9Ssumit.saxena@avagotech.com u32 support_ext_queue_depth:1; 1645bd5f9484Ssumit.saxena@avagotech.com u32 support_ext_io_size:1; 16468f05024cSSumit Saxena u32 support_vfid_in_ioframe:1; 16478f05024cSSumit Saxena u32 support_fp_rlbypass:1; 164852b62ac7SSumit Saxena u32 support_qd_throttling:1; 1649ede7c3ceSSasikumar Chandrasekaran u32 support_pd_map_target_id:1; 1650ede7c3ceSSasikumar Chandrasekaran u32 reserved:19; 165194cd65ddSSumit.Saxena@lsi.com #endif 1652d46a3ad6SSumit.Saxena@lsi.com } mfi_capabilities; 16539ab9ed38SChristoph Hellwig __le32 reg; 1654d46a3ad6SSumit.Saxena@lsi.com } MFI_CAPABILITIES; 1655d46a3ad6SSumit.Saxena@lsi.com 1656c4a3e0a5SBagalkote, Sreenivas struct megasas_init_frame { 1657c4a3e0a5SBagalkote, Sreenivas 1658c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1659c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1660c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1661c4a3e0a5SBagalkote, Sreenivas 1662c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*03h */ 1663d46a3ad6SSumit.Saxena@lsi.com MFI_CAPABILITIES driver_operations; /*04h*/ 1664c4a3e0a5SBagalkote, Sreenivas 16659ab9ed38SChristoph Hellwig __le32 context; /*08h */ 16669ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1667c4a3e0a5SBagalkote, Sreenivas 16689ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 16699ab9ed38SChristoph Hellwig __le16 reserved_3; /*12h */ 16709ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 1671c4a3e0a5SBagalkote, Sreenivas 16729ab9ed38SChristoph Hellwig __le32 queue_info_new_phys_addr_lo; /*18h */ 16739ab9ed38SChristoph Hellwig __le32 queue_info_new_phys_addr_hi; /*1Ch */ 16749ab9ed38SChristoph Hellwig __le32 queue_info_old_phys_addr_lo; /*20h */ 16759ab9ed38SChristoph Hellwig __le32 queue_info_old_phys_addr_hi; /*24h */ 16769ab9ed38SChristoph Hellwig __le32 reserved_4[2]; /*28h */ 16779ab9ed38SChristoph Hellwig __le32 system_info_lo; /*30h */ 16789ab9ed38SChristoph Hellwig __le32 system_info_hi; /*34h */ 16799ab9ed38SChristoph Hellwig __le32 reserved_5[2]; /*38h */ 1680c4a3e0a5SBagalkote, Sreenivas 1681c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1682c4a3e0a5SBagalkote, Sreenivas 1683c4a3e0a5SBagalkote, Sreenivas struct megasas_init_queue_info { 1684c4a3e0a5SBagalkote, Sreenivas 16859ab9ed38SChristoph Hellwig __le32 init_flags; /*00h */ 16869ab9ed38SChristoph Hellwig __le32 reply_queue_entries; /*04h */ 1687c4a3e0a5SBagalkote, Sreenivas 16889ab9ed38SChristoph Hellwig __le32 reply_queue_start_phys_addr_lo; /*08h */ 16899ab9ed38SChristoph Hellwig __le32 reply_queue_start_phys_addr_hi; /*0Ch */ 16909ab9ed38SChristoph Hellwig __le32 producer_index_phys_addr_lo; /*10h */ 16919ab9ed38SChristoph Hellwig __le32 producer_index_phys_addr_hi; /*14h */ 16929ab9ed38SChristoph Hellwig __le32 consumer_index_phys_addr_lo; /*18h */ 16939ab9ed38SChristoph Hellwig __le32 consumer_index_phys_addr_hi; /*1Ch */ 1694c4a3e0a5SBagalkote, Sreenivas 1695c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1696c4a3e0a5SBagalkote, Sreenivas 1697c4a3e0a5SBagalkote, Sreenivas struct megasas_io_frame { 1698c4a3e0a5SBagalkote, Sreenivas 1699c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1700c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1701c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1702c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1703c4a3e0a5SBagalkote, Sreenivas 1704c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1705c4a3e0a5SBagalkote, Sreenivas u8 access_byte; /*05h */ 1706c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*06h */ 1707c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1708c4a3e0a5SBagalkote, Sreenivas 17099ab9ed38SChristoph Hellwig __le32 context; /*08h */ 17109ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1711c4a3e0a5SBagalkote, Sreenivas 17129ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 17139ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 17149ab9ed38SChristoph Hellwig __le32 lba_count; /*14h */ 1715c4a3e0a5SBagalkote, Sreenivas 17169ab9ed38SChristoph Hellwig __le32 sense_buf_phys_addr_lo; /*18h */ 17179ab9ed38SChristoph Hellwig __le32 sense_buf_phys_addr_hi; /*1Ch */ 1718c4a3e0a5SBagalkote, Sreenivas 17199ab9ed38SChristoph Hellwig __le32 start_lba_lo; /*20h */ 17209ab9ed38SChristoph Hellwig __le32 start_lba_hi; /*24h */ 1721c4a3e0a5SBagalkote, Sreenivas 1722c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*28h */ 1723c4a3e0a5SBagalkote, Sreenivas 1724c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1725c4a3e0a5SBagalkote, Sreenivas 1726c4a3e0a5SBagalkote, Sreenivas struct megasas_pthru_frame { 1727c4a3e0a5SBagalkote, Sreenivas 1728c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1729c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1730c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1731c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1732c4a3e0a5SBagalkote, Sreenivas 1733c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1734c4a3e0a5SBagalkote, Sreenivas u8 lun; /*05h */ 1735c4a3e0a5SBagalkote, Sreenivas u8 cdb_len; /*06h */ 1736c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1737c4a3e0a5SBagalkote, Sreenivas 17389ab9ed38SChristoph Hellwig __le32 context; /*08h */ 17399ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1740c4a3e0a5SBagalkote, Sreenivas 17419ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 17429ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 17439ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 1744c4a3e0a5SBagalkote, Sreenivas 17459ab9ed38SChristoph Hellwig __le32 sense_buf_phys_addr_lo; /*18h */ 17469ab9ed38SChristoph Hellwig __le32 sense_buf_phys_addr_hi; /*1Ch */ 1747c4a3e0a5SBagalkote, Sreenivas 1748c4a3e0a5SBagalkote, Sreenivas u8 cdb[16]; /*20h */ 1749c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*30h */ 1750c4a3e0a5SBagalkote, Sreenivas 1751c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1752c4a3e0a5SBagalkote, Sreenivas 1753c4a3e0a5SBagalkote, Sreenivas struct megasas_dcmd_frame { 1754c4a3e0a5SBagalkote, Sreenivas 1755c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1756c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1757c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1758c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[4]; /*03h */ 1759c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1760c4a3e0a5SBagalkote, Sreenivas 17619ab9ed38SChristoph Hellwig __le32 context; /*08h */ 17629ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1763c4a3e0a5SBagalkote, Sreenivas 17649ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 17659ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 1766c4a3e0a5SBagalkote, Sreenivas 17679ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 17689ab9ed38SChristoph Hellwig __le32 opcode; /*18h */ 1769c4a3e0a5SBagalkote, Sreenivas 1770c4a3e0a5SBagalkote, Sreenivas union { /*1Ch */ 1771c4a3e0a5SBagalkote, Sreenivas u8 b[12]; 17729ab9ed38SChristoph Hellwig __le16 s[6]; 17739ab9ed38SChristoph Hellwig __le32 w[3]; 1774c4a3e0a5SBagalkote, Sreenivas } mbox; 1775c4a3e0a5SBagalkote, Sreenivas 1776c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*28h */ 1777c4a3e0a5SBagalkote, Sreenivas 1778c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1779c4a3e0a5SBagalkote, Sreenivas 1780c4a3e0a5SBagalkote, Sreenivas struct megasas_abort_frame { 1781c4a3e0a5SBagalkote, Sreenivas 1782c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1783c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1784c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1785c4a3e0a5SBagalkote, Sreenivas 1786c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*03h */ 17879ab9ed38SChristoph Hellwig __le32 reserved_2; /*04h */ 1788c4a3e0a5SBagalkote, Sreenivas 17899ab9ed38SChristoph Hellwig __le32 context; /*08h */ 17909ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1791c4a3e0a5SBagalkote, Sreenivas 17929ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 17939ab9ed38SChristoph Hellwig __le16 reserved_3; /*12h */ 17949ab9ed38SChristoph Hellwig __le32 reserved_4; /*14h */ 1795c4a3e0a5SBagalkote, Sreenivas 17969ab9ed38SChristoph Hellwig __le32 abort_context; /*18h */ 17979ab9ed38SChristoph Hellwig __le32 pad_1; /*1Ch */ 1798c4a3e0a5SBagalkote, Sreenivas 17999ab9ed38SChristoph Hellwig __le32 abort_mfi_phys_addr_lo; /*20h */ 18009ab9ed38SChristoph Hellwig __le32 abort_mfi_phys_addr_hi; /*24h */ 1801c4a3e0a5SBagalkote, Sreenivas 18029ab9ed38SChristoph Hellwig __le32 reserved_5[6]; /*28h */ 1803c4a3e0a5SBagalkote, Sreenivas 1804c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1805c4a3e0a5SBagalkote, Sreenivas 1806c4a3e0a5SBagalkote, Sreenivas struct megasas_smp_frame { 1807c4a3e0a5SBagalkote, Sreenivas 1808c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1809c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*01h */ 1810c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1811c4a3e0a5SBagalkote, Sreenivas u8 connection_status; /*03h */ 1812c4a3e0a5SBagalkote, Sreenivas 1813c4a3e0a5SBagalkote, Sreenivas u8 reserved_2[3]; /*04h */ 1814c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1815c4a3e0a5SBagalkote, Sreenivas 18169ab9ed38SChristoph Hellwig __le32 context; /*08h */ 18179ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1818c4a3e0a5SBagalkote, Sreenivas 18199ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 18209ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 1821c4a3e0a5SBagalkote, Sreenivas 18229ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 18239ab9ed38SChristoph Hellwig __le64 sas_addr; /*18h */ 1824c4a3e0a5SBagalkote, Sreenivas 1825c4a3e0a5SBagalkote, Sreenivas union { 1826c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */ 1827c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */ 1828c4a3e0a5SBagalkote, Sreenivas } sgl; 1829c4a3e0a5SBagalkote, Sreenivas 1830c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1831c4a3e0a5SBagalkote, Sreenivas 1832c4a3e0a5SBagalkote, Sreenivas struct megasas_stp_frame { 1833c4a3e0a5SBagalkote, Sreenivas 1834c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1835c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*01h */ 1836c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1837c4a3e0a5SBagalkote, Sreenivas u8 reserved_2; /*03h */ 1838c4a3e0a5SBagalkote, Sreenivas 1839c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1840c4a3e0a5SBagalkote, Sreenivas u8 reserved_3[2]; /*05h */ 1841c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1842c4a3e0a5SBagalkote, Sreenivas 18439ab9ed38SChristoph Hellwig __le32 context; /*08h */ 18449ab9ed38SChristoph Hellwig __le32 pad_0; /*0Ch */ 1845c4a3e0a5SBagalkote, Sreenivas 18469ab9ed38SChristoph Hellwig __le16 flags; /*10h */ 18479ab9ed38SChristoph Hellwig __le16 timeout; /*12h */ 1848c4a3e0a5SBagalkote, Sreenivas 18499ab9ed38SChristoph Hellwig __le32 data_xfer_len; /*14h */ 1850c4a3e0a5SBagalkote, Sreenivas 18519ab9ed38SChristoph Hellwig __le16 fis[10]; /*18h */ 18529ab9ed38SChristoph Hellwig __le32 stp_flags; 1853c4a3e0a5SBagalkote, Sreenivas 1854c4a3e0a5SBagalkote, Sreenivas union { 1855c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */ 1856c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */ 1857c4a3e0a5SBagalkote, Sreenivas } sgl; 1858c4a3e0a5SBagalkote, Sreenivas 1859c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1860c4a3e0a5SBagalkote, Sreenivas 1861c4a3e0a5SBagalkote, Sreenivas union megasas_frame { 1862c4a3e0a5SBagalkote, Sreenivas 1863c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 1864c4a3e0a5SBagalkote, Sreenivas struct megasas_init_frame init; 1865c4a3e0a5SBagalkote, Sreenivas struct megasas_io_frame io; 1866c4a3e0a5SBagalkote, Sreenivas struct megasas_pthru_frame pthru; 1867c4a3e0a5SBagalkote, Sreenivas struct megasas_dcmd_frame dcmd; 1868c4a3e0a5SBagalkote, Sreenivas struct megasas_abort_frame abort; 1869c4a3e0a5SBagalkote, Sreenivas struct megasas_smp_frame smp; 1870c4a3e0a5SBagalkote, Sreenivas struct megasas_stp_frame stp; 1871c4a3e0a5SBagalkote, Sreenivas 1872c4a3e0a5SBagalkote, Sreenivas u8 raw_bytes[64]; 1873c4a3e0a5SBagalkote, Sreenivas }; 1874c4a3e0a5SBagalkote, Sreenivas 187518365b13SSumit Saxena /** 187618365b13SSumit Saxena * struct MR_PRIV_DEVICE - sdev private hostdata 187718365b13SSumit Saxena * @is_tm_capable: firmware managed tm_capable flag 187818365b13SSumit Saxena * @tm_busy: TM request is in progress 187918365b13SSumit Saxena */ 188018365b13SSumit Saxena struct MR_PRIV_DEVICE { 188118365b13SSumit Saxena bool is_tm_capable; 188218365b13SSumit Saxena bool tm_busy; 1883a48ba0ecSShivasharan S atomic_t r1_ldio_hint; 188415dd0381SShivasharan S u8 interface_type; 188518365b13SSumit Saxena }; 1886c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd; 1887c4a3e0a5SBagalkote, Sreenivas 1888c4a3e0a5SBagalkote, Sreenivas union megasas_evt_class_locale { 1889c4a3e0a5SBagalkote, Sreenivas 1890c4a3e0a5SBagalkote, Sreenivas struct { 1891be26374bSSumit.Saxena@lsi.com #ifndef __BIG_ENDIAN_BITFIELD 1892c4a3e0a5SBagalkote, Sreenivas u16 locale; 1893c4a3e0a5SBagalkote, Sreenivas u8 reserved; 1894c4a3e0a5SBagalkote, Sreenivas s8 class; 1895be26374bSSumit.Saxena@lsi.com #else 1896be26374bSSumit.Saxena@lsi.com s8 class; 1897be26374bSSumit.Saxena@lsi.com u8 reserved; 1898be26374bSSumit.Saxena@lsi.com u16 locale; 1899be26374bSSumit.Saxena@lsi.com #endif 1900c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) members; 1901c4a3e0a5SBagalkote, Sreenivas 1902c4a3e0a5SBagalkote, Sreenivas u32 word; 1903c4a3e0a5SBagalkote, Sreenivas 1904c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1905c4a3e0a5SBagalkote, Sreenivas 1906c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_log_info { 19079ab9ed38SChristoph Hellwig __le32 newest_seq_num; 19089ab9ed38SChristoph Hellwig __le32 oldest_seq_num; 19099ab9ed38SChristoph Hellwig __le32 clear_seq_num; 19109ab9ed38SChristoph Hellwig __le32 shutdown_seq_num; 19119ab9ed38SChristoph Hellwig __le32 boot_seq_num; 1912c4a3e0a5SBagalkote, Sreenivas 1913c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1914c4a3e0a5SBagalkote, Sreenivas 1915c4a3e0a5SBagalkote, Sreenivas struct megasas_progress { 1916c4a3e0a5SBagalkote, Sreenivas 19179ab9ed38SChristoph Hellwig __le16 progress; 19189ab9ed38SChristoph Hellwig __le16 elapsed_seconds; 1919c4a3e0a5SBagalkote, Sreenivas 1920c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1921c4a3e0a5SBagalkote, Sreenivas 1922c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld { 1923c4a3e0a5SBagalkote, Sreenivas 1924c4a3e0a5SBagalkote, Sreenivas u16 target_id; 1925c4a3e0a5SBagalkote, Sreenivas u8 ld_index; 1926c4a3e0a5SBagalkote, Sreenivas u8 reserved; 1927c4a3e0a5SBagalkote, Sreenivas 1928c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1929c4a3e0a5SBagalkote, Sreenivas 1930c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd { 1931c4a3e0a5SBagalkote, Sreenivas u16 device_id; 1932c4a3e0a5SBagalkote, Sreenivas u8 encl_index; 1933c4a3e0a5SBagalkote, Sreenivas u8 slot_number; 1934c4a3e0a5SBagalkote, Sreenivas 1935c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1936c4a3e0a5SBagalkote, Sreenivas 1937c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_detail { 1938c4a3e0a5SBagalkote, Sreenivas 19399ab9ed38SChristoph Hellwig __le32 seq_num; 19409ab9ed38SChristoph Hellwig __le32 time_stamp; 19419ab9ed38SChristoph Hellwig __le32 code; 1942c4a3e0a5SBagalkote, Sreenivas union megasas_evt_class_locale cl; 1943c4a3e0a5SBagalkote, Sreenivas u8 arg_type; 1944c4a3e0a5SBagalkote, Sreenivas u8 reserved1[15]; 1945c4a3e0a5SBagalkote, Sreenivas 1946c4a3e0a5SBagalkote, Sreenivas union { 1947c4a3e0a5SBagalkote, Sreenivas struct { 1948c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1949c4a3e0a5SBagalkote, Sreenivas u8 cdb_length; 1950c4a3e0a5SBagalkote, Sreenivas u8 sense_length; 1951c4a3e0a5SBagalkote, Sreenivas u8 reserved[2]; 1952c4a3e0a5SBagalkote, Sreenivas u8 cdb[16]; 1953c4a3e0a5SBagalkote, Sreenivas u8 sense[64]; 1954c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) cdbSense; 1955c4a3e0a5SBagalkote, Sreenivas 1956c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1957c4a3e0a5SBagalkote, Sreenivas 1958c4a3e0a5SBagalkote, Sreenivas struct { 1959c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 19609ab9ed38SChristoph Hellwig __le64 count; 1961c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_count; 1962c4a3e0a5SBagalkote, Sreenivas 1963c4a3e0a5SBagalkote, Sreenivas struct { 19649ab9ed38SChristoph Hellwig __le64 lba; 1965c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1966c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_lba; 1967c4a3e0a5SBagalkote, Sreenivas 1968c4a3e0a5SBagalkote, Sreenivas struct { 1969c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 19709ab9ed38SChristoph Hellwig __le32 prevOwner; 19719ab9ed38SChristoph Hellwig __le32 newOwner; 1972c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_owner; 1973c4a3e0a5SBagalkote, Sreenivas 1974c4a3e0a5SBagalkote, Sreenivas struct { 1975c4a3e0a5SBagalkote, Sreenivas u64 ld_lba; 1976c4a3e0a5SBagalkote, Sreenivas u64 pd_lba; 1977c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1978c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1979c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_lba_pd_lba; 1980c4a3e0a5SBagalkote, Sreenivas 1981c4a3e0a5SBagalkote, Sreenivas struct { 1982c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1983c4a3e0a5SBagalkote, Sreenivas struct megasas_progress prog; 1984c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_prog; 1985c4a3e0a5SBagalkote, Sreenivas 1986c4a3e0a5SBagalkote, Sreenivas struct { 1987c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1988c4a3e0a5SBagalkote, Sreenivas u32 prev_state; 1989c4a3e0a5SBagalkote, Sreenivas u32 new_state; 1990c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_state; 1991c4a3e0a5SBagalkote, Sreenivas 1992c4a3e0a5SBagalkote, Sreenivas struct { 1993c4a3e0a5SBagalkote, Sreenivas u64 strip; 1994c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1995c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_strip; 1996c4a3e0a5SBagalkote, Sreenivas 1997c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1998c4a3e0a5SBagalkote, Sreenivas 1999c4a3e0a5SBagalkote, Sreenivas struct { 2000c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2001c4a3e0a5SBagalkote, Sreenivas u32 err; 2002c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_err; 2003c4a3e0a5SBagalkote, Sreenivas 2004c4a3e0a5SBagalkote, Sreenivas struct { 2005c4a3e0a5SBagalkote, Sreenivas u64 lba; 2006c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2007c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_lba; 2008c4a3e0a5SBagalkote, Sreenivas 2009c4a3e0a5SBagalkote, Sreenivas struct { 2010c4a3e0a5SBagalkote, Sreenivas u64 lba; 2011c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2012c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 2013c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_lba_ld; 2014c4a3e0a5SBagalkote, Sreenivas 2015c4a3e0a5SBagalkote, Sreenivas struct { 2016c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2017c4a3e0a5SBagalkote, Sreenivas struct megasas_progress prog; 2018c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_prog; 2019c4a3e0a5SBagalkote, Sreenivas 2020c4a3e0a5SBagalkote, Sreenivas struct { 2021c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 2022c4a3e0a5SBagalkote, Sreenivas u32 prevState; 2023c4a3e0a5SBagalkote, Sreenivas u32 newState; 2024c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_state; 2025c4a3e0a5SBagalkote, Sreenivas 2026c4a3e0a5SBagalkote, Sreenivas struct { 2027c4a3e0a5SBagalkote, Sreenivas u16 vendorId; 20289ab9ed38SChristoph Hellwig __le16 deviceId; 2029c4a3e0a5SBagalkote, Sreenivas u16 subVendorId; 2030c4a3e0a5SBagalkote, Sreenivas u16 subDeviceId; 2031c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pci; 2032c4a3e0a5SBagalkote, Sreenivas 2033c4a3e0a5SBagalkote, Sreenivas u32 rate; 2034c4a3e0a5SBagalkote, Sreenivas char str[96]; 2035c4a3e0a5SBagalkote, Sreenivas 2036c4a3e0a5SBagalkote, Sreenivas struct { 2037c4a3e0a5SBagalkote, Sreenivas u32 rtc; 2038c4a3e0a5SBagalkote, Sreenivas u32 elapsedSeconds; 2039c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) time; 2040c4a3e0a5SBagalkote, Sreenivas 2041c4a3e0a5SBagalkote, Sreenivas struct { 2042c4a3e0a5SBagalkote, Sreenivas u32 ecar; 2043c4a3e0a5SBagalkote, Sreenivas u32 elog; 2044c4a3e0a5SBagalkote, Sreenivas char str[64]; 2045c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ecc; 2046c4a3e0a5SBagalkote, Sreenivas 2047c4a3e0a5SBagalkote, Sreenivas u8 b[96]; 20489ab9ed38SChristoph Hellwig __le16 s[48]; 20499ab9ed38SChristoph Hellwig __le32 w[24]; 20509ab9ed38SChristoph Hellwig __le64 d[12]; 2051c4a3e0a5SBagalkote, Sreenivas } args; 2052c4a3e0a5SBagalkote, Sreenivas 2053c4a3e0a5SBagalkote, Sreenivas char description[128]; 2054c4a3e0a5SBagalkote, Sreenivas 2055c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 2056c4a3e0a5SBagalkote, Sreenivas 20577e8a75f4SYang, Bo struct megasas_aen_event { 2058c1d390d8SXiaotian Feng struct delayed_work hotplug_work; 20597e8a75f4SYang, Bo struct megasas_instance *instance; 20607e8a75f4SYang, Bo }; 20617e8a75f4SYang, Bo 2062c8e858feSadam radford struct megasas_irq_context { 2063c8e858feSadam radford struct megasas_instance *instance; 2064c8e858feSadam radford u32 MSIxIndex; 2065c8e858feSadam radford }; 2066c8e858feSadam radford 20675765c5b8SSumit.Saxena@avagotech.com struct MR_DRV_SYSTEM_INFO { 20685765c5b8SSumit.Saxena@avagotech.com u8 infoVersion; 20695765c5b8SSumit.Saxena@avagotech.com u8 systemIdLength; 20705765c5b8SSumit.Saxena@avagotech.com u16 reserved0; 20715765c5b8SSumit.Saxena@avagotech.com u8 systemId[64]; 20725765c5b8SSumit.Saxena@avagotech.com u8 reserved[1980]; 20735765c5b8SSumit.Saxena@avagotech.com }; 20745765c5b8SSumit.Saxena@avagotech.com 20752216c305SSumit Saxena enum MR_PD_TYPE { 20762216c305SSumit Saxena UNKNOWN_DRIVE = 0, 20772216c305SSumit Saxena PARALLEL_SCSI = 1, 20782216c305SSumit Saxena SAS_PD = 2, 20792216c305SSumit Saxena SATA_PD = 3, 20802216c305SSumit Saxena FC_PD = 4, 208115dd0381SShivasharan S NVME_PD = 5, 20822216c305SSumit Saxena }; 20832216c305SSumit Saxena 20842216c305SSumit Saxena /* JBOD Queue depth definitions */ 20852216c305SSumit Saxena #define MEGASAS_SATA_QD 32 20862216c305SSumit Saxena #define MEGASAS_SAS_QD 64 20872216c305SSumit Saxena #define MEGASAS_DEFAULT_PD_QD 64 208815dd0381SShivasharan S #define MEGASAS_NVME_QD 32 208915dd0381SShivasharan S 209015dd0381SShivasharan S #define MR_DEFAULT_NVME_PAGE_SIZE 4096 209115dd0381SShivasharan S #define MR_DEFAULT_NVME_PAGE_SHIFT 12 209215dd0381SShivasharan S #define MR_DEFAULT_NVME_MDTS_KB 128 209315dd0381SShivasharan S #define MR_NVME_PAGE_SIZE_MASK 0x000000FF 20942216c305SSumit Saxena 2095c4a3e0a5SBagalkote, Sreenivas struct megasas_instance { 2096c4a3e0a5SBagalkote, Sreenivas 20979ab9ed38SChristoph Hellwig __le32 *producer; 2098c4a3e0a5SBagalkote, Sreenivas dma_addr_t producer_h; 20999ab9ed38SChristoph Hellwig __le32 *consumer; 2100c4a3e0a5SBagalkote, Sreenivas dma_addr_t consumer_h; 21015765c5b8SSumit.Saxena@avagotech.com struct MR_DRV_SYSTEM_INFO *system_info_buf; 21025765c5b8SSumit.Saxena@avagotech.com dma_addr_t system_info_h; 2103229fe47cSadam radford struct MR_LD_VF_AFFILIATION *vf_affiliation; 2104229fe47cSadam radford dma_addr_t vf_affiliation_h; 2105229fe47cSadam radford struct MR_LD_VF_AFFILIATION_111 *vf_affiliation_111; 2106229fe47cSadam radford dma_addr_t vf_affiliation_111_h; 2107229fe47cSadam radford struct MR_CTRL_HB_HOST_MEM *hb_host_mem; 2108229fe47cSadam radford dma_addr_t hb_host_mem_h; 21092216c305SSumit Saxena struct MR_PD_INFO *pd_info; 21102216c305SSumit Saxena dma_addr_t pd_info_h; 211196188a89SShivasharan S struct MR_TARGET_PROPERTIES *tgt_prop; 211296188a89SShivasharan S dma_addr_t tgt_prop_h; 2113c4a3e0a5SBagalkote, Sreenivas 21149ab9ed38SChristoph Hellwig __le32 *reply_queue; 2115c4a3e0a5SBagalkote, Sreenivas dma_addr_t reply_queue_h; 2116c4a3e0a5SBagalkote, Sreenivas 2117fc62b3fcSSumit.Saxena@avagotech.com u32 *crash_dump_buf; 2118fc62b3fcSSumit.Saxena@avagotech.com dma_addr_t crash_dump_h; 2119fc62b3fcSSumit.Saxena@avagotech.com void *crash_buf[MAX_CRASH_DUMP_SIZE]; 2120fc62b3fcSSumit.Saxena@avagotech.com u32 crash_buf_pages; 2121fc62b3fcSSumit.Saxena@avagotech.com unsigned int fw_crash_buffer_size; 2122fc62b3fcSSumit.Saxena@avagotech.com unsigned int fw_crash_state; 2123fc62b3fcSSumit.Saxena@avagotech.com unsigned int fw_crash_buffer_offset; 2124fc62b3fcSSumit.Saxena@avagotech.com u32 drv_buf_index; 2125fc62b3fcSSumit.Saxena@avagotech.com u32 drv_buf_alloc; 2126fc62b3fcSSumit.Saxena@avagotech.com u32 crash_dump_fw_support; 2127fc62b3fcSSumit.Saxena@avagotech.com u32 crash_dump_drv_support; 2128fc62b3fcSSumit.Saxena@avagotech.com u32 crash_dump_app_support; 21297497cde8SSumit.Saxena@avagotech.com u32 secure_jbod_support; 2130ede7c3ceSSasikumar Chandrasekaran u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */ 21313761cb4cSsumit.saxena@avagotech.com bool use_seqnum_jbod_fp; /* Added for PD sequence */ 2132fc62b3fcSSumit.Saxena@avagotech.com spinlock_t crashdump_lock; 2133fc62b3fcSSumit.Saxena@avagotech.com 2134c4a3e0a5SBagalkote, Sreenivas struct megasas_register_set __iomem *reg_set; 21358a232bb3SChristoph Hellwig u32 __iomem *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; 213681e403ceSYang, Bo struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; 2137999ece0aSSumit.Saxena@lsi.com struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD]; 2138bdc6fb8dSYang, Bo u8 ld_ids[MEGASAS_MAX_LD_IDS]; 2139c4a3e0a5SBagalkote, Sreenivas s8 init_id; 2140c4a3e0a5SBagalkote, Sreenivas 2141c4a3e0a5SBagalkote, Sreenivas u16 max_num_sge; 2142c4a3e0a5SBagalkote, Sreenivas u16 max_fw_cmds; 214369c337c0SSasikumar Chandrasekaran u16 max_mpt_cmds; 21449c915a8cSadam radford u16 max_mfi_cmds; 2145ae09a6c1SSumit.Saxena@avagotech.com u16 max_scsi_cmds; 2146308ec459SSumit Saxena u16 ldio_threshold; 2147308ec459SSumit Saxena u16 cur_can_queue; 2148c4a3e0a5SBagalkote, Sreenivas u32 max_sectors_per_req; 21497e8a75f4SYang, Bo struct megasas_aen_event *ev; 2150c4a3e0a5SBagalkote, Sreenivas 2151c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd **cmd_list; 2152c4a3e0a5SBagalkote, Sreenivas struct list_head cmd_pool; 215339a98554Sbo yang /* used to sync fire the cmd to fw */ 215490dc9d98SSumit.Saxena@avagotech.com spinlock_t mfi_pool_lock; 215539a98554Sbo yang /* used to sync fire the cmd to fw */ 215639a98554Sbo yang spinlock_t hba_lock; 21577343eb65Sbo yang /* used to synch producer, consumer ptrs in dpc */ 2158fdd84e25SSasikumar Chandrasekaran spinlock_t stream_lock; 21597343eb65Sbo yang spinlock_t completion_lock; 2160c4a3e0a5SBagalkote, Sreenivas struct dma_pool *frame_dma_pool; 2161c4a3e0a5SBagalkote, Sreenivas struct dma_pool *sense_dma_pool; 2162c4a3e0a5SBagalkote, Sreenivas 2163c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_detail *evt_detail; 2164c4a3e0a5SBagalkote, Sreenivas dma_addr_t evt_detail_h; 2165c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd *aen_cmd; 21662216c305SSumit Saxena struct mutex hba_mutex; 2167c4a3e0a5SBagalkote, Sreenivas struct semaphore ioctl_sem; 2168c4a3e0a5SBagalkote, Sreenivas 2169c4a3e0a5SBagalkote, Sreenivas struct Scsi_Host *host; 2170c4a3e0a5SBagalkote, Sreenivas 2171c4a3e0a5SBagalkote, Sreenivas wait_queue_head_t int_cmd_wait_q; 2172c4a3e0a5SBagalkote, Sreenivas wait_queue_head_t abort_cmd_wait_q; 2173c4a3e0a5SBagalkote, Sreenivas 2174c4a3e0a5SBagalkote, Sreenivas struct pci_dev *pdev; 2175c4a3e0a5SBagalkote, Sreenivas u32 unique_id; 217639a98554Sbo yang u32 fw_support_ieee; 2177c4a3e0a5SBagalkote, Sreenivas 2178e4a082c7SSumant Patro atomic_t fw_outstanding; 2179308ec459SSumit Saxena atomic_t ldio_outstanding; 218039a98554Sbo yang atomic_t fw_reset_no_pci_access; 218133203bc4SShivasharan S atomic_t ieee_sgl; 218233203bc4SShivasharan S atomic_t prp_sgl; 218333203bc4SShivasharan S atomic_t sge_holes_type1; 218433203bc4SShivasharan S atomic_t sge_holes_type2; 218533203bc4SShivasharan S atomic_t sge_holes_type3; 21861341c939SSumant Patro 21871341c939SSumant Patro struct megasas_instance_template *instancet; 21885d018ad0SSumant Patro struct tasklet_struct isr_tasklet; 218939a98554Sbo yang struct work_struct work_init; 2190fc62b3fcSSumit.Saxena@avagotech.com struct work_struct crash_init; 219105e9ebbeSSumant Patro 219205e9ebbeSSumant Patro u8 flag; 2193c3518837SYang, Bo u8 unload; 2194f4c9a131SYang, Bo u8 flag_ieee; 219539a98554Sbo yang u8 issuepend_done; 219639a98554Sbo yang u8 disableOnlineCtrlReset; 2197bc93d425SSumit.Saxena@lsi.com u8 UnevenSpanSupport; 219851087a86SSumit.Saxena@avagotech.com 219951087a86SSumit.Saxena@avagotech.com u8 supportmax256vd; 220030845586SSumit Saxena u8 pd_list_not_supported; 220151087a86SSumit.Saxena@avagotech.com u16 fw_supported_vd_count; 220251087a86SSumit.Saxena@avagotech.com u16 fw_supported_pd_count; 220351087a86SSumit.Saxena@avagotech.com 220451087a86SSumit.Saxena@avagotech.com u16 drv_supported_vd_count; 220551087a86SSumit.Saxena@avagotech.com u16 drv_supported_pd_count; 220651087a86SSumit.Saxena@avagotech.com 22078a01a41dSSumit Saxena atomic_t adprecovery; 220805e9ebbeSSumant Patro unsigned long last_time; 220939a98554Sbo yang u32 mfiStatus; 221039a98554Sbo yang u32 last_seq_num; 2211ad84db2eSbo yang 221239a98554Sbo yang struct list_head internal_reset_pending_q; 221380d9da98Sadam radford 221425985edcSLucas De Marchi /* Ptr to hba specific information */ 22159c915a8cSadam radford void *ctrl_context; 221651087a86SSumit.Saxena@avagotech.com u32 ctrl_context_pages; 221751087a86SSumit.Saxena@avagotech.com struct megasas_ctrl_info *ctrl_info; 2218c8e858feSadam radford unsigned int msix_vectors; 2219c8e858feSadam radford struct megasas_irq_context irq_context[MEGASAS_MAX_MSIX_QUEUES]; 22209c915a8cSadam radford u64 map_id; 22213761cb4cSsumit.saxena@avagotech.com u64 pd_seq_map_id; 22229c915a8cSadam radford struct megasas_cmd *map_update_cmd; 22233761cb4cSsumit.saxena@avagotech.com struct megasas_cmd *jbod_seq_cmd; 2224b6d5d880Sadam radford unsigned long bar; 22259c915a8cSadam radford long reset_flags; 22269c915a8cSadam radford struct mutex reset_mutex; 2227229fe47cSadam radford struct timer_list sriov_heartbeat_timer; 2228229fe47cSadam radford char skip_heartbeat_timer_del; 2229229fe47cSadam radford u8 requestorId; 2230229fe47cSadam radford char PlasmaFW111; 22318f67c8c5SSumit Saxena char clusterId[MEGASAS_CLUSTER_ID_SIZE]; 22328f67c8c5SSumit Saxena u8 peerIsPresent; 22338f67c8c5SSumit Saxena u8 passive; 2234ae09a6c1SSumit.Saxena@avagotech.com u16 throttlequeuedepth; 2235d46a3ad6SSumit.Saxena@lsi.com u8 mask_interrupts; 2236bd5f9484Ssumit.saxena@avagotech.com u16 max_chain_frame_sz; 2237404a8a1aSSumit.Saxena@lsi.com u8 is_imr; 2238179ac142SSumit Saxena u8 is_rdpq; 22395765c5b8SSumit.Saxena@avagotech.com bool dev_handle; 2240d0fc91d6SKashyap Desai bool fw_sync_cache_support; 224121c34006SShivasharan S u32 mfi_frame_size; 224245f4f2ebSSasikumar Chandrasekaran bool is_ventura; 22432493c67eSSasikumar Chandrasekaran bool msix_combined; 2244d889344eSSasikumar Chandrasekaran u16 max_raid_mapsize; 2245a48ba0ecSShivasharan S /* preffered count to send as LDIO irrspective of FP capable.*/ 2246a48ba0ecSShivasharan S u8 r1_ldio_hint_default; 224715dd0381SShivasharan S u32 nvme_page_size; 224839a98554Sbo yang }; 2249229fe47cSadam radford struct MR_LD_VF_MAP { 2250229fe47cSadam radford u32 size; 2251229fe47cSadam radford union MR_LD_REF ref; 2252229fe47cSadam radford u8 ldVfCount; 2253229fe47cSadam radford u8 reserved[6]; 2254229fe47cSadam radford u8 policy[1]; 2255229fe47cSadam radford }; 2256229fe47cSadam radford 2257229fe47cSadam radford struct MR_LD_VF_AFFILIATION { 2258229fe47cSadam radford u32 size; 2259229fe47cSadam radford u8 ldCount; 2260229fe47cSadam radford u8 vfCount; 2261229fe47cSadam radford u8 thisVf; 2262229fe47cSadam radford u8 reserved[9]; 2263229fe47cSadam radford struct MR_LD_VF_MAP map[1]; 2264229fe47cSadam radford }; 2265229fe47cSadam radford 2266229fe47cSadam radford /* Plasma 1.11 FW backward compatibility structures */ 2267229fe47cSadam radford #define IOV_111_OFFSET 0x7CE 2268229fe47cSadam radford #define MAX_VIRTUAL_FUNCTIONS 8 22694cbfea88SAdam Radford #define MR_LD_ACCESS_HIDDEN 15 2270229fe47cSadam radford 2271229fe47cSadam radford struct IOV_111 { 2272229fe47cSadam radford u8 maxVFsSupported; 2273229fe47cSadam radford u8 numVFsEnabled; 2274229fe47cSadam radford u8 requestorId; 2275229fe47cSadam radford u8 reserved[5]; 2276229fe47cSadam radford }; 2277229fe47cSadam radford 2278229fe47cSadam radford struct MR_LD_VF_MAP_111 { 2279229fe47cSadam radford u8 targetId; 2280229fe47cSadam radford u8 reserved[3]; 2281229fe47cSadam radford u8 policy[MAX_VIRTUAL_FUNCTIONS]; 2282229fe47cSadam radford }; 2283229fe47cSadam radford 2284229fe47cSadam radford struct MR_LD_VF_AFFILIATION_111 { 2285229fe47cSadam radford u8 vdCount; 2286229fe47cSadam radford u8 vfCount; 2287229fe47cSadam radford u8 thisVf; 2288229fe47cSadam radford u8 reserved[5]; 2289229fe47cSadam radford struct MR_LD_VF_MAP_111 map[MAX_LOGICAL_DRIVES]; 2290229fe47cSadam radford }; 2291229fe47cSadam radford 2292229fe47cSadam radford struct MR_CTRL_HB_HOST_MEM { 2293229fe47cSadam radford struct { 2294229fe47cSadam radford u32 fwCounter; /* Firmware heart beat counter */ 2295229fe47cSadam radford struct { 2296229fe47cSadam radford u32 debugmode:1; /* 1=Firmware is in debug mode. 2297229fe47cSadam radford Heart beat will not be updated. */ 2298229fe47cSadam radford u32 reserved:31; 2299229fe47cSadam radford } debug; 2300229fe47cSadam radford u32 reserved_fw[6]; 2301229fe47cSadam radford u32 driverCounter; /* Driver heart beat counter. 0x20 */ 2302229fe47cSadam radford u32 reserved_driver[7]; 2303229fe47cSadam radford } HB; 2304229fe47cSadam radford u8 pad[0x400-0x40]; 2305229fe47cSadam radford }; 230639a98554Sbo yang 230739a98554Sbo yang enum { 230839a98554Sbo yang MEGASAS_HBA_OPERATIONAL = 0, 230939a98554Sbo yang MEGASAS_ADPRESET_SM_INFAULT = 1, 231039a98554Sbo yang MEGASAS_ADPRESET_SM_FW_RESET_SUCCESS = 2, 231139a98554Sbo yang MEGASAS_ADPRESET_SM_OPERATIONAL = 3, 231239a98554Sbo yang MEGASAS_HW_CRITICAL_ERROR = 4, 2313229fe47cSadam radford MEGASAS_ADPRESET_SM_POLLING = 5, 231439a98554Sbo yang MEGASAS_ADPRESET_INPROG_SIGN = 0xDEADDEAD, 2315c4a3e0a5SBagalkote, Sreenivas }; 2316c4a3e0a5SBagalkote, Sreenivas 23170c79e681SYang, Bo struct megasas_instance_template { 23180c79e681SYang, Bo void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \ 23190c79e681SYang, Bo u32, struct megasas_register_set __iomem *); 23200c79e681SYang, Bo 2321d46a3ad6SSumit.Saxena@lsi.com void (*enable_intr)(struct megasas_instance *); 2322d46a3ad6SSumit.Saxena@lsi.com void (*disable_intr)(struct megasas_instance *); 23230c79e681SYang, Bo 23240c79e681SYang, Bo int (*clear_intr)(struct megasas_register_set __iomem *); 23250c79e681SYang, Bo 23260c79e681SYang, Bo u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); 232739a98554Sbo yang int (*adp_reset)(struct megasas_instance *, \ 232839a98554Sbo yang struct megasas_register_set __iomem *); 232939a98554Sbo yang int (*check_reset)(struct megasas_instance *, \ 233039a98554Sbo yang struct megasas_register_set __iomem *); 2331cd50ba8eSadam radford irqreturn_t (*service_isr)(int irq, void *devp); 2332cd50ba8eSadam radford void (*tasklet)(unsigned long); 2333cd50ba8eSadam radford u32 (*init_adapter)(struct megasas_instance *); 2334cd50ba8eSadam radford u32 (*build_and_issue_cmd) (struct megasas_instance *, 2335cd50ba8eSadam radford struct scsi_cmnd *); 2336f4fc2093SShivasharan S void (*issue_dcmd)(struct megasas_instance *instance, 2337cd50ba8eSadam radford struct megasas_cmd *cmd); 23380c79e681SYang, Bo }; 23390c79e681SYang, Bo 23403cabd162SShivasharan S #define MEGASAS_IS_LOGICAL(sdev) \ 23413cabd162SShivasharan S ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) 2342c4a3e0a5SBagalkote, Sreenivas 23434a5c814dSSumit.Saxena@avagotech.com #define MEGASAS_DEV_INDEX(scp) \ 23444a5c814dSSumit.Saxena@avagotech.com (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ 23454a5c814dSSumit.Saxena@avagotech.com scp->device->id) 23464a5c814dSSumit.Saxena@avagotech.com 23474a5c814dSSumit.Saxena@avagotech.com #define MEGASAS_PD_INDEX(scp) \ 23484a5c814dSSumit.Saxena@avagotech.com ((scp->device->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + \ 23494a5c814dSSumit.Saxena@avagotech.com scp->device->id) 2350c4a3e0a5SBagalkote, Sreenivas 2351c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd { 2352c4a3e0a5SBagalkote, Sreenivas 2353c4a3e0a5SBagalkote, Sreenivas union megasas_frame *frame; 2354c4a3e0a5SBagalkote, Sreenivas dma_addr_t frame_phys_addr; 2355c4a3e0a5SBagalkote, Sreenivas u8 *sense; 2356c4a3e0a5SBagalkote, Sreenivas dma_addr_t sense_phys_addr; 2357c4a3e0a5SBagalkote, Sreenivas 2358c4a3e0a5SBagalkote, Sreenivas u32 index; 2359c4a3e0a5SBagalkote, Sreenivas u8 sync_cmd; 23602be2a988SSumit.Saxena@avagotech.com u8 cmd_status_drv; 236139a98554Sbo yang u8 abort_aen; 236239a98554Sbo yang u8 retry_for_fw_reset; 236339a98554Sbo yang 2364c4a3e0a5SBagalkote, Sreenivas 2365c4a3e0a5SBagalkote, Sreenivas struct list_head list; 2366c4a3e0a5SBagalkote, Sreenivas struct scsi_cmnd *scmd; 23674026e9aaSSumit.Saxena@avagotech.com u8 flags; 236890dc9d98SSumit.Saxena@avagotech.com 2369c4a3e0a5SBagalkote, Sreenivas struct megasas_instance *instance; 23709c915a8cSadam radford union { 23719c915a8cSadam radford struct { 23729c915a8cSadam radford u16 smid; 23739c915a8cSadam radford u16 resvd; 23749c915a8cSadam radford } context; 2375c4a3e0a5SBagalkote, Sreenivas u32 frame_count; 2376c4a3e0a5SBagalkote, Sreenivas }; 23779c915a8cSadam radford }; 2378c4a3e0a5SBagalkote, Sreenivas 2379c4a3e0a5SBagalkote, Sreenivas #define MAX_MGMT_ADAPTERS 1024 2380c4a3e0a5SBagalkote, Sreenivas #define MAX_IOCTL_SGE 16 2381c4a3e0a5SBagalkote, Sreenivas 2382c4a3e0a5SBagalkote, Sreenivas struct megasas_iocpacket { 2383c4a3e0a5SBagalkote, Sreenivas 2384c4a3e0a5SBagalkote, Sreenivas u16 host_no; 2385c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 2386c4a3e0a5SBagalkote, Sreenivas u32 sgl_off; 2387c4a3e0a5SBagalkote, Sreenivas u32 sge_count; 2388c4a3e0a5SBagalkote, Sreenivas u32 sense_off; 2389c4a3e0a5SBagalkote, Sreenivas u32 sense_len; 2390c4a3e0a5SBagalkote, Sreenivas union { 2391c4a3e0a5SBagalkote, Sreenivas u8 raw[128]; 2392c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 2393c4a3e0a5SBagalkote, Sreenivas } frame; 2394c4a3e0a5SBagalkote, Sreenivas 2395c4a3e0a5SBagalkote, Sreenivas struct iovec sgl[MAX_IOCTL_SGE]; 2396c4a3e0a5SBagalkote, Sreenivas 2397c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 2398c4a3e0a5SBagalkote, Sreenivas 2399c4a3e0a5SBagalkote, Sreenivas struct megasas_aen { 2400c4a3e0a5SBagalkote, Sreenivas u16 host_no; 2401c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 2402c4a3e0a5SBagalkote, Sreenivas u32 seq_num; 2403c4a3e0a5SBagalkote, Sreenivas u32 class_locale_word; 2404c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 2405c4a3e0a5SBagalkote, Sreenivas 2406c4a3e0a5SBagalkote, Sreenivas #ifdef CONFIG_COMPAT 2407c4a3e0a5SBagalkote, Sreenivas struct compat_megasas_iocpacket { 2408c4a3e0a5SBagalkote, Sreenivas u16 host_no; 2409c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 2410c4a3e0a5SBagalkote, Sreenivas u32 sgl_off; 2411c4a3e0a5SBagalkote, Sreenivas u32 sge_count; 2412c4a3e0a5SBagalkote, Sreenivas u32 sense_off; 2413c4a3e0a5SBagalkote, Sreenivas u32 sense_len; 2414c4a3e0a5SBagalkote, Sreenivas union { 2415c4a3e0a5SBagalkote, Sreenivas u8 raw[128]; 2416c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 2417c4a3e0a5SBagalkote, Sreenivas } frame; 2418c4a3e0a5SBagalkote, Sreenivas struct compat_iovec sgl[MAX_IOCTL_SGE]; 2419c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 2420c4a3e0a5SBagalkote, Sreenivas 24210e98936cSSumant Patro #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket) 2422c4a3e0a5SBagalkote, Sreenivas #endif 2423c4a3e0a5SBagalkote, Sreenivas 2424cb59aa6aSSumant Patro #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) 2425c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) 2426c4a3e0a5SBagalkote, Sreenivas 2427c4a3e0a5SBagalkote, Sreenivas struct megasas_mgmt_info { 2428c4a3e0a5SBagalkote, Sreenivas 2429c4a3e0a5SBagalkote, Sreenivas u16 count; 2430c4a3e0a5SBagalkote, Sreenivas struct megasas_instance *instance[MAX_MGMT_ADAPTERS]; 2431c4a3e0a5SBagalkote, Sreenivas int max_index; 2432c4a3e0a5SBagalkote, Sreenivas }; 2433c4a3e0a5SBagalkote, Sreenivas 24346d40afbcSSumit Saxena enum MEGASAS_OCR_CAUSE { 24356d40afbcSSumit Saxena FW_FAULT_OCR = 0, 24366d40afbcSSumit Saxena SCSIIO_TIMEOUT_OCR = 1, 24376d40afbcSSumit Saxena MFI_IO_TIMEOUT_OCR = 2, 24386d40afbcSSumit Saxena }; 24396d40afbcSSumit Saxena 24406d40afbcSSumit Saxena enum DCMD_RETURN_STATUS { 24416d40afbcSSumit Saxena DCMD_SUCCESS = 0, 24426d40afbcSSumit Saxena DCMD_TIMEOUT = 1, 24436d40afbcSSumit Saxena DCMD_FAILED = 2, 24446d40afbcSSumit Saxena DCMD_NOT_FIRED = 3, 24456d40afbcSSumit Saxena }; 24466d40afbcSSumit Saxena 244721c9e160Sadam radford u8 244821c9e160Sadam radford MR_BuildRaidContext(struct megasas_instance *instance, 244921c9e160Sadam radford struct IO_REQUEST_INFO *io_info, 245021c9e160Sadam radford struct RAID_CONTEXT *pRAID_Context, 245151087a86SSumit.Saxena@avagotech.com struct MR_DRV_RAID_MAP_ALL *map, u8 **raidLUN); 2452d2d0358bSShivasharan S u16 MR_TargetIdToLdGet(u32 ldTgtId, struct MR_DRV_RAID_MAP_ALL *map); 245351087a86SSumit.Saxena@avagotech.com struct MR_LD_RAID *MR_LdRaidGet(u32 ld, struct MR_DRV_RAID_MAP_ALL *map); 245451087a86SSumit.Saxena@avagotech.com u16 MR_ArPdGet(u32 ar, u32 arm, struct MR_DRV_RAID_MAP_ALL *map); 245551087a86SSumit.Saxena@avagotech.com u16 MR_LdSpanArrayGet(u32 ld, u32 span, struct MR_DRV_RAID_MAP_ALL *map); 24569ab9ed38SChristoph Hellwig __le16 MR_PdDevHandleGet(u32 pd, struct MR_DRV_RAID_MAP_ALL *map); 245751087a86SSumit.Saxena@avagotech.com u16 MR_GetLDTgtId(u32 ld, struct MR_DRV_RAID_MAP_ALL *map); 245821c9e160Sadam radford 24599ab9ed38SChristoph Hellwig __le16 get_updated_dev_handle(struct megasas_instance *instance, 246033203bc4SShivasharan S struct LD_LOAD_BALANCE_INFO *lbInfo, 246133203bc4SShivasharan S struct IO_REQUEST_INFO *in_info, 246233203bc4SShivasharan S struct MR_DRV_RAID_MAP_ALL *drv_map); 246351087a86SSumit.Saxena@avagotech.com void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *map, 246451087a86SSumit.Saxena@avagotech.com struct LD_LOAD_BALANCE_INFO *lbInfo); 2465d009b576SSumit.Saxena@avagotech.com int megasas_get_ctrl_info(struct megasas_instance *instance); 24663761cb4cSsumit.saxena@avagotech.com /* PD sequence */ 24673761cb4cSsumit.saxena@avagotech.com int 24683761cb4cSsumit.saxena@avagotech.com megasas_sync_pd_seq_num(struct megasas_instance *instance, bool pend); 246915dd0381SShivasharan S void megasas_set_dynamic_target_properties(struct scsi_device *sdev); 2470fc62b3fcSSumit.Saxena@avagotech.com int megasas_set_crash_dump_params(struct megasas_instance *instance, 2471fc62b3fcSSumit.Saxena@avagotech.com u8 crash_buf_state); 2472fc62b3fcSSumit.Saxena@avagotech.com void megasas_free_host_crash_buffer(struct megasas_instance *instance); 2473fc62b3fcSSumit.Saxena@avagotech.com void megasas_fusion_crash_dump_wq(struct work_struct *work); 247451087a86SSumit.Saxena@avagotech.com 247590dc9d98SSumit.Saxena@avagotech.com void megasas_return_cmd_fusion(struct megasas_instance *instance, 247690dc9d98SSumit.Saxena@avagotech.com struct megasas_cmd_fusion *cmd); 247790dc9d98SSumit.Saxena@avagotech.com int megasas_issue_blocked_cmd(struct megasas_instance *instance, 247890dc9d98SSumit.Saxena@avagotech.com struct megasas_cmd *cmd, int timeout); 247990dc9d98SSumit.Saxena@avagotech.com void __megasas_return_cmd(struct megasas_instance *instance, 248090dc9d98SSumit.Saxena@avagotech.com struct megasas_cmd *cmd); 248190dc9d98SSumit.Saxena@avagotech.com 248290dc9d98SSumit.Saxena@avagotech.com void megasas_return_mfi_mpt_pthr(struct megasas_instance *instance, 248390dc9d98SSumit.Saxena@avagotech.com struct megasas_cmd *cmd_mfi, struct megasas_cmd_fusion *cmd_fusion); 24847497cde8SSumit.Saxena@avagotech.com int megasas_cmd_type(struct scsi_cmnd *cmd); 24853761cb4cSsumit.saxena@avagotech.com void megasas_setup_jbod_map(struct megasas_instance *instance); 248690dc9d98SSumit.Saxena@avagotech.com 248718365b13SSumit Saxena void megasas_update_sdev_properties(struct scsi_device *sdev); 248818365b13SSumit Saxena int megasas_reset_fusion(struct Scsi_Host *shost, int reason); 248918365b13SSumit Saxena int megasas_task_abort_fusion(struct scsi_cmnd *scmd); 249018365b13SSumit Saxena int megasas_reset_target_fusion(struct scsi_cmnd *scmd); 249133203bc4SShivasharan S u32 mega_mod64(u64 dividend, u32 divisor); 24925fc499b6SShivasharan S int megasas_alloc_fusion_context(struct megasas_instance *instance); 24935fc499b6SShivasharan S void megasas_free_fusion_context(struct megasas_instance *instance); 2494c4a3e0a5SBagalkote, Sreenivas #endif /*LSI_MEGARAID_SAS_H */ 2495