1c4a3e0a5SBagalkote, Sreenivas /* 2c4a3e0a5SBagalkote, Sreenivas * Linux MegaRAID driver for SAS based RAID controllers 3c4a3e0a5SBagalkote, Sreenivas * 4ae59057bSadam radford * Copyright (c) 2003-2012 LSI Corporation. 5c4a3e0a5SBagalkote, Sreenivas * 6c4a3e0a5SBagalkote, Sreenivas * This program is free software; you can redistribute it and/or 7c4a3e0a5SBagalkote, Sreenivas * modify it under the terms of the GNU General Public License 83f1530c1Sadam radford * as published by the Free Software Foundation; either version 2 93f1530c1Sadam radford * of the License, or (at your option) any later version. 103f1530c1Sadam radford * 113f1530c1Sadam radford * This program is distributed in the hope that it will be useful, 123f1530c1Sadam radford * but WITHOUT ANY WARRANTY; without even the implied warranty of 133f1530c1Sadam radford * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 143f1530c1Sadam radford * GNU General Public License for more details. 153f1530c1Sadam radford * 163f1530c1Sadam radford * You should have received a copy of the GNU General Public License 173f1530c1Sadam radford * along with this program; if not, write to the Free Software 183f1530c1Sadam radford * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19c4a3e0a5SBagalkote, Sreenivas * 20c4a3e0a5SBagalkote, Sreenivas * FILE: megaraid_sas.h 213f1530c1Sadam radford * 223f1530c1Sadam radford * Authors: LSI Corporation 233f1530c1Sadam radford * 243f1530c1Sadam radford * Send feedback to: <megaraidlinux@lsi.com> 253f1530c1Sadam radford * 263f1530c1Sadam radford * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035 273f1530c1Sadam radford * ATTN: Linuxraid 28c4a3e0a5SBagalkote, Sreenivas */ 29c4a3e0a5SBagalkote, Sreenivas 30c4a3e0a5SBagalkote, Sreenivas #ifndef LSI_MEGARAID_SAS_H 31c4a3e0a5SBagalkote, Sreenivas #define LSI_MEGARAID_SAS_H 32c4a3e0a5SBagalkote, Sreenivas 33a69b74d3SRandy Dunlap /* 34c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS Driver meta data 35c4a3e0a5SBagalkote, Sreenivas */ 365eca4a67Sadam radford #define MEGASAS_VERSION "06.506.00.00-rc1" 375eca4a67Sadam radford #define MEGASAS_RELDATE "Feb. 9, 2013" 385eca4a67Sadam radford #define MEGASAS_EXT_VERSION "Sat. Feb. 9 17:00:00 PDT 2013" 390e98936cSSumant Patro 400e98936cSSumant Patro /* 410e98936cSSumant Patro * Device IDs 420e98936cSSumant Patro */ 430e98936cSSumant Patro #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 44af7a5647Sbo yang #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C 450e98936cSSumant Patro #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 466610a6b3SYang, Bo #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078 476610a6b3SYang, Bo #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079 4887911122SYang, Bo #define PCI_DEVICE_ID_LSI_SAS0073SKINNY 0x0073 4987911122SYang, Bo #define PCI_DEVICE_ID_LSI_SAS0071SKINNY 0x0071 509c915a8cSadam radford #define PCI_DEVICE_ID_LSI_FUSION 0x005b 5136807e67Sadam radford #define PCI_DEVICE_ID_LSI_INVADER 0x005d 5221d3c710SSumit.Saxena@lsi.com #define PCI_DEVICE_ID_LSI_FURY 0x005f 530e98936cSSumant Patro 54c4a3e0a5SBagalkote, Sreenivas /* 5539b72c3cSSumit.Saxena@lsi.com * Intel HBA SSDIDs 5639b72c3cSSumit.Saxena@lsi.com */ 5739b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3DC080_SSDID 0x9360 5839b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3DC040_SSDID 0x9362 5939b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3SC008_SSDID 0x9380 6039b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3MC044_SSDID 0x9381 6139b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3WC080_SSDID 0x9341 6239b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3WC040_SSDID 0x9343 6339b72c3cSSumit.Saxena@lsi.com 6439b72c3cSSumit.Saxena@lsi.com /* 6539b72c3cSSumit.Saxena@lsi.com * Intel HBA branding 6639b72c3cSSumit.Saxena@lsi.com */ 6739b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3DC080_BRANDING \ 6839b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3DC080" 6939b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3DC040_BRANDING \ 7039b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3DC040" 7139b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3SC008_BRANDING \ 7239b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3SC008" 7339b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3MC044_BRANDING \ 7439b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3MC044" 7539b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3WC080_BRANDING \ 7639b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3WC080" 7739b72c3cSSumit.Saxena@lsi.com #define MEGARAID_INTEL_RS3WC040_BRANDING \ 7839b72c3cSSumit.Saxena@lsi.com "Intel(R) RAID Controller RS3WC040" 7939b72c3cSSumit.Saxena@lsi.com 8039b72c3cSSumit.Saxena@lsi.com /* 81c4a3e0a5SBagalkote, Sreenivas * ===================================== 82c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS MFI firmware definitions 83c4a3e0a5SBagalkote, Sreenivas * ===================================== 84c4a3e0a5SBagalkote, Sreenivas */ 85c4a3e0a5SBagalkote, Sreenivas 86c4a3e0a5SBagalkote, Sreenivas /* 87c4a3e0a5SBagalkote, Sreenivas * MFI stands for MegaRAID SAS FW Interface. This is just a moniker for 88c4a3e0a5SBagalkote, Sreenivas * protocol between the software and firmware. Commands are issued using 89c4a3e0a5SBagalkote, Sreenivas * "message frames" 90c4a3e0a5SBagalkote, Sreenivas */ 91c4a3e0a5SBagalkote, Sreenivas 92a69b74d3SRandy Dunlap /* 93c4a3e0a5SBagalkote, Sreenivas * FW posts its state in upper 4 bits of outbound_msg_0 register 94c4a3e0a5SBagalkote, Sreenivas */ 95c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_MASK 0xF0000000 96c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_UNDEFINED 0x00000000 97c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_BB_INIT 0x10000000 98c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FW_INIT 0x40000000 99c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_WAIT_HANDSHAKE 0x60000000 100c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FW_INIT_2 0x70000000 101c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_DEVICE_SCAN 0x80000000 102e3bbff9fSSumant Patro #define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000 103c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FLUSH_CACHE 0xA0000000 104c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_READY 0xB0000000 105c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_OPERATIONAL 0xC0000000 106c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FAULT 0xF0000000 10739a98554Sbo yang #define MFI_RESET_REQUIRED 0x00000001 1087e70e733Sadam radford #define MFI_RESET_ADAPTER 0x00000002 109c4a3e0a5SBagalkote, Sreenivas #define MEGAMFI_FRAME_SIZE 64 110c4a3e0a5SBagalkote, Sreenivas 111a69b74d3SRandy Dunlap /* 112c4a3e0a5SBagalkote, Sreenivas * During FW init, clear pending cmds & reset state using inbound_msg_0 113c4a3e0a5SBagalkote, Sreenivas * 114c4a3e0a5SBagalkote, Sreenivas * ABORT : Abort all pending cmds 115c4a3e0a5SBagalkote, Sreenivas * READY : Move from OPERATIONAL to READY state; discard queue info 116c4a3e0a5SBagalkote, Sreenivas * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??) 117c4a3e0a5SBagalkote, Sreenivas * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver 118e3bbff9fSSumant Patro * HOTPLUG : Resume from Hotplug 119e3bbff9fSSumant Patro * MFI_STOP_ADP : Send signal to FW to stop processing 120c4a3e0a5SBagalkote, Sreenivas */ 12139a98554Sbo yang #define WRITE_SEQUENCE_OFFSET (0x0000000FC) /* I20 */ 12239a98554Sbo yang #define HOST_DIAGNOSTIC_OFFSET (0x000000F8) /* I20 */ 12339a98554Sbo yang #define DIAG_WRITE_ENABLE (0x00000080) 12439a98554Sbo yang #define DIAG_RESET_ADAPTER (0x00000004) 12539a98554Sbo yang 12639a98554Sbo yang #define MFI_ADP_RESET 0x00000040 127e3bbff9fSSumant Patro #define MFI_INIT_ABORT 0x00000001 128c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_READY 0x00000002 129c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_MFIMODE 0x00000004 130c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_CLEAR_HANDSHAKE 0x00000008 131e3bbff9fSSumant Patro #define MFI_INIT_HOTPLUG 0x00000010 132e3bbff9fSSumant Patro #define MFI_STOP_ADP 0x00000020 133e3bbff9fSSumant Patro #define MFI_RESET_FLAGS MFI_INIT_READY| \ 134e3bbff9fSSumant Patro MFI_INIT_MFIMODE| \ 135e3bbff9fSSumant Patro MFI_INIT_ABORT 136c4a3e0a5SBagalkote, Sreenivas 137a69b74d3SRandy Dunlap /* 138c4a3e0a5SBagalkote, Sreenivas * MFI frame flags 139c4a3e0a5SBagalkote, Sreenivas */ 140c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000 141c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001 142c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SGL32 0x0000 143c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SGL64 0x0002 144c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SENSE32 0x0000 145c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SENSE64 0x0004 146c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_NONE 0x0000 147c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_WRITE 0x0008 148c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_READ 0x0010 149c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_BOTH 0x0018 150f4c9a131SYang, Bo #define MFI_FRAME_IEEE 0x0020 151c4a3e0a5SBagalkote, Sreenivas 152a69b74d3SRandy Dunlap /* 153c4a3e0a5SBagalkote, Sreenivas * Definition for cmd_status 154c4a3e0a5SBagalkote, Sreenivas */ 155c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_STATUS_POLL_MODE 0xFF 156c4a3e0a5SBagalkote, Sreenivas 157a69b74d3SRandy Dunlap /* 158c4a3e0a5SBagalkote, Sreenivas * MFI command opcodes 159c4a3e0a5SBagalkote, Sreenivas */ 160c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_INIT 0x00 161c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_READ 0x01 162c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_WRITE 0x02 163c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_SCSI_IO 0x03 164c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_PD_SCSI_IO 0x04 165c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_DCMD 0x05 166c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_ABORT 0x06 167c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_SMP 0x07 168c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_STP 0x08 169e5f93a36Sadam radford #define MFI_CMD_INVALID 0xff 170c4a3e0a5SBagalkote, Sreenivas 171c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_GET_INFO 0x01010000 172bdc6fb8dSYang, Bo #define MR_DCMD_LD_GET_LIST 0x03010000 173c4a3e0a5SBagalkote, Sreenivas 174c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000 175c4a3e0a5SBagalkote, Sreenivas #define MR_FLUSH_CTRL_CACHE 0x01 176c4a3e0a5SBagalkote, Sreenivas #define MR_FLUSH_DISK_CACHE 0x02 177c4a3e0a5SBagalkote, Sreenivas 178c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_SHUTDOWN 0x01050000 17931ea7088Sbo yang #define MR_DCMD_HIBERNATE_SHUTDOWN 0x01060000 180c4a3e0a5SBagalkote, Sreenivas #define MR_ENABLE_DRIVE_SPINDOWN 0x01 181c4a3e0a5SBagalkote, Sreenivas 182c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100 183c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_GET 0x01040300 184c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500 185c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_LD_GET_PROPERTIES 0x03030000 186c4a3e0a5SBagalkote, Sreenivas 187c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER 0x08000000 188c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100 189c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER_RESET_LD 0x08010200 19081e403ceSYang, Bo #define MR_DCMD_PD_LIST_QUERY 0x02010100 191c4a3e0a5SBagalkote, Sreenivas 192a69b74d3SRandy Dunlap /* 193bc93d425SSumit.Saxena@lsi.com * Global functions 194bc93d425SSumit.Saxena@lsi.com */ 195bc93d425SSumit.Saxena@lsi.com extern u8 MR_ValidateMapInfo(struct megasas_instance *instance); 196bc93d425SSumit.Saxena@lsi.com 197bc93d425SSumit.Saxena@lsi.com 198bc93d425SSumit.Saxena@lsi.com /* 199c4a3e0a5SBagalkote, Sreenivas * MFI command completion codes 200c4a3e0a5SBagalkote, Sreenivas */ 201c4a3e0a5SBagalkote, Sreenivas enum MFI_STAT { 202c4a3e0a5SBagalkote, Sreenivas MFI_STAT_OK = 0x00, 203c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_CMD = 0x01, 204c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_DCMD = 0x02, 205c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_PARAMETER = 0x03, 206c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04, 207c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ABORT_NOT_POSSIBLE = 0x05, 208c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06, 209c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_IN_USE = 0x07, 210c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_NOT_INITIALIZED = 0x08, 211c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ARRAY_INDEX_INVALID = 0x09, 212c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a, 213c4a3e0a5SBagalkote, Sreenivas MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b, 214c4a3e0a5SBagalkote, Sreenivas MFI_STAT_DEVICE_NOT_FOUND = 0x0c, 215c4a3e0a5SBagalkote, Sreenivas MFI_STAT_DRIVE_TOO_SMALL = 0x0d, 216c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_ALLOC_FAIL = 0x0e, 217c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_BUSY = 0x0f, 218c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_ERROR = 0x10, 219c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_IMAGE_BAD = 0x11, 220c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12, 221c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_NOT_OPEN = 0x13, 222c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_NOT_STARTED = 0x14, 223c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLUSH_FAILED = 0x15, 224c4a3e0a5SBagalkote, Sreenivas MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16, 225c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_CC_IN_PROGRESS = 0x17, 226c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_INIT_IN_PROGRESS = 0x18, 227c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19, 228c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_MAX_CONFIGURED = 0x1a, 229c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_NOT_OPTIMAL = 0x1b, 230c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c, 231c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d, 232c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e, 233c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f, 234c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20, 235c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MFC_HW_ERROR = 0x21, 236c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NO_HW_PRESENT = 0x22, 237c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NOT_FOUND = 0x23, 238c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NOT_IN_ENCL = 0x24, 239c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25, 240c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PD_TYPE_WRONG = 0x26, 241c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PR_DISABLED = 0x27, 242c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ROW_INDEX_INVALID = 0x28, 243c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29, 244c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a, 245c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b, 246c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c, 247c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d, 248c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_IO_FAILED = 0x2e, 249c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f, 250c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SHUTDOWN_FAILED = 0x30, 251c4a3e0a5SBagalkote, Sreenivas MFI_STAT_TIME_NOT_SET = 0x31, 252c4a3e0a5SBagalkote, Sreenivas MFI_STAT_WRONG_STATE = 0x32, 253c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_OFFLINE = 0x33, 254c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PEER_NOTIFICATION_REJECTED = 0x34, 255c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PEER_NOTIFICATION_FAILED = 0x35, 256c4a3e0a5SBagalkote, Sreenivas MFI_STAT_RESERVATION_IN_PROGRESS = 0x36, 257c4a3e0a5SBagalkote, Sreenivas MFI_STAT_I2C_ERRORS_DETECTED = 0x37, 258c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PCI_ERRORS_DETECTED = 0x38, 25936807e67Sadam radford MFI_STAT_CONFIG_SEQ_MISMATCH = 0x67, 260c4a3e0a5SBagalkote, Sreenivas 261c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_STATUS = 0xFF 262c4a3e0a5SBagalkote, Sreenivas }; 263c4a3e0a5SBagalkote, Sreenivas 264c4a3e0a5SBagalkote, Sreenivas /* 265c4a3e0a5SBagalkote, Sreenivas * Number of mailbox bytes in DCMD message frame 266c4a3e0a5SBagalkote, Sreenivas */ 267c4a3e0a5SBagalkote, Sreenivas #define MFI_MBOX_SIZE 12 268c4a3e0a5SBagalkote, Sreenivas 269c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_CLASS { 270c4a3e0a5SBagalkote, Sreenivas 271c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_DEBUG = -2, 272c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_PROGRESS = -1, 273c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_INFO = 0, 274c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_WARNING = 1, 275c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_CRITICAL = 2, 276c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_FATAL = 3, 277c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_DEAD = 4, 278c4a3e0a5SBagalkote, Sreenivas 279c4a3e0a5SBagalkote, Sreenivas }; 280c4a3e0a5SBagalkote, Sreenivas 281c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_LOCALE { 282c4a3e0a5SBagalkote, Sreenivas 283c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_LD = 0x0001, 284c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_PD = 0x0002, 285c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_ENCL = 0x0004, 286c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_BBU = 0x0008, 287c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_SAS = 0x0010, 288c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CTRL = 0x0020, 289c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CONFIG = 0x0040, 290c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CLUSTER = 0x0080, 291c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_ALL = 0xffff, 292c4a3e0a5SBagalkote, Sreenivas 293c4a3e0a5SBagalkote, Sreenivas }; 294c4a3e0a5SBagalkote, Sreenivas 295c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_ARGS { 296c4a3e0a5SBagalkote, Sreenivas 297c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_NONE, 298c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_CDB_SENSE, 299c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD, 300c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_COUNT, 301c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_LBA, 302c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_OWNER, 303c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_LBA_PD_LBA, 304c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_PROG, 305c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_STATE, 306c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_STRIP, 307c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD, 308c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_ERR, 309c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_LBA, 310c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_LBA_LD, 311c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_PROG, 312c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_STATE, 313c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PCI, 314c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_RATE, 315c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_STR, 316c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_TIME, 317c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_ECC, 31881e403ceSYang, Bo MR_EVT_ARGS_LD_PROP, 31981e403ceSYang, Bo MR_EVT_ARGS_PD_SPARE, 32081e403ceSYang, Bo MR_EVT_ARGS_PD_INDEX, 32181e403ceSYang, Bo MR_EVT_ARGS_DIAG_PASS, 32281e403ceSYang, Bo MR_EVT_ARGS_DIAG_FAIL, 32381e403ceSYang, Bo MR_EVT_ARGS_PD_LBA_LBA, 32481e403ceSYang, Bo MR_EVT_ARGS_PORT_PHY, 32581e403ceSYang, Bo MR_EVT_ARGS_PD_MISSING, 32681e403ceSYang, Bo MR_EVT_ARGS_PD_ADDRESS, 32781e403ceSYang, Bo MR_EVT_ARGS_BITMAP, 32881e403ceSYang, Bo MR_EVT_ARGS_CONNECTOR, 32981e403ceSYang, Bo MR_EVT_ARGS_PD_PD, 33081e403ceSYang, Bo MR_EVT_ARGS_PD_FRU, 33181e403ceSYang, Bo MR_EVT_ARGS_PD_PATHINFO, 33281e403ceSYang, Bo MR_EVT_ARGS_PD_POWER_STATE, 33381e403ceSYang, Bo MR_EVT_ARGS_GENERIC, 334c4a3e0a5SBagalkote, Sreenivas }; 335c4a3e0a5SBagalkote, Sreenivas 336c4a3e0a5SBagalkote, Sreenivas /* 33781e403ceSYang, Bo * define constants for device list query options 33881e403ceSYang, Bo */ 33981e403ceSYang, Bo enum MR_PD_QUERY_TYPE { 34081e403ceSYang, Bo MR_PD_QUERY_TYPE_ALL = 0, 34181e403ceSYang, Bo MR_PD_QUERY_TYPE_STATE = 1, 34281e403ceSYang, Bo MR_PD_QUERY_TYPE_POWER_STATE = 2, 34381e403ceSYang, Bo MR_PD_QUERY_TYPE_MEDIA_TYPE = 3, 34481e403ceSYang, Bo MR_PD_QUERY_TYPE_SPEED = 4, 34581e403ceSYang, Bo MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5, 34681e403ceSYang, Bo }; 34781e403ceSYang, Bo 3487e8a75f4SYang, Bo #define MR_EVT_CFG_CLEARED 0x0004 3497e8a75f4SYang, Bo #define MR_EVT_LD_STATE_CHANGE 0x0051 3507e8a75f4SYang, Bo #define MR_EVT_PD_INSERTED 0x005b 3517e8a75f4SYang, Bo #define MR_EVT_PD_REMOVED 0x0070 3527e8a75f4SYang, Bo #define MR_EVT_LD_CREATED 0x008a 3537e8a75f4SYang, Bo #define MR_EVT_LD_DELETED 0x008b 3547e8a75f4SYang, Bo #define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db 3557e8a75f4SYang, Bo #define MR_EVT_LD_OFFLINE 0x00fc 3567e8a75f4SYang, Bo #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152 3577e8a75f4SYang, Bo #define MAX_LOGICAL_DRIVES 64 3587e8a75f4SYang, Bo 35981e403ceSYang, Bo enum MR_PD_STATE { 36081e403ceSYang, Bo MR_PD_STATE_UNCONFIGURED_GOOD = 0x00, 36181e403ceSYang, Bo MR_PD_STATE_UNCONFIGURED_BAD = 0x01, 36281e403ceSYang, Bo MR_PD_STATE_HOT_SPARE = 0x02, 36381e403ceSYang, Bo MR_PD_STATE_OFFLINE = 0x10, 36481e403ceSYang, Bo MR_PD_STATE_FAILED = 0x11, 36581e403ceSYang, Bo MR_PD_STATE_REBUILD = 0x14, 36681e403ceSYang, Bo MR_PD_STATE_ONLINE = 0x18, 36781e403ceSYang, Bo MR_PD_STATE_COPYBACK = 0x20, 36881e403ceSYang, Bo MR_PD_STATE_SYSTEM = 0x40, 36981e403ceSYang, Bo }; 37081e403ceSYang, Bo 37181e403ceSYang, Bo 37281e403ceSYang, Bo /* 37381e403ceSYang, Bo * defines the physical drive address structure 37481e403ceSYang, Bo */ 37581e403ceSYang, Bo struct MR_PD_ADDRESS { 37681e403ceSYang, Bo u16 deviceId; 37781e403ceSYang, Bo u16 enclDeviceId; 37881e403ceSYang, Bo 37981e403ceSYang, Bo union { 38081e403ceSYang, Bo struct { 38181e403ceSYang, Bo u8 enclIndex; 38281e403ceSYang, Bo u8 slotNumber; 38381e403ceSYang, Bo } mrPdAddress; 38481e403ceSYang, Bo struct { 38581e403ceSYang, Bo u8 enclPosition; 38681e403ceSYang, Bo u8 enclConnectorIndex; 38781e403ceSYang, Bo } mrEnclAddress; 38881e403ceSYang, Bo }; 38981e403ceSYang, Bo u8 scsiDevType; 39081e403ceSYang, Bo union { 39181e403ceSYang, Bo u8 connectedPortBitmap; 39281e403ceSYang, Bo u8 connectedPortNumbers; 39381e403ceSYang, Bo }; 39481e403ceSYang, Bo u64 sasAddr[2]; 39581e403ceSYang, Bo } __packed; 39681e403ceSYang, Bo 39781e403ceSYang, Bo /* 39881e403ceSYang, Bo * defines the physical drive list structure 39981e403ceSYang, Bo */ 40081e403ceSYang, Bo struct MR_PD_LIST { 40181e403ceSYang, Bo u32 size; 40281e403ceSYang, Bo u32 count; 40381e403ceSYang, Bo struct MR_PD_ADDRESS addr[1]; 40481e403ceSYang, Bo } __packed; 40581e403ceSYang, Bo 40681e403ceSYang, Bo struct megasas_pd_list { 40781e403ceSYang, Bo u16 tid; 40881e403ceSYang, Bo u8 driveType; 40981e403ceSYang, Bo u8 driveState; 41081e403ceSYang, Bo } __packed; 41181e403ceSYang, Bo 41281e403ceSYang, Bo /* 413bdc6fb8dSYang, Bo * defines the logical drive reference structure 414bdc6fb8dSYang, Bo */ 415bdc6fb8dSYang, Bo union MR_LD_REF { 416bdc6fb8dSYang, Bo struct { 417bdc6fb8dSYang, Bo u8 targetId; 418bdc6fb8dSYang, Bo u8 reserved; 419bdc6fb8dSYang, Bo u16 seqNum; 420bdc6fb8dSYang, Bo }; 421bdc6fb8dSYang, Bo u32 ref; 422bdc6fb8dSYang, Bo } __packed; 423bdc6fb8dSYang, Bo 424bdc6fb8dSYang, Bo /* 425bdc6fb8dSYang, Bo * defines the logical drive list structure 426bdc6fb8dSYang, Bo */ 427bdc6fb8dSYang, Bo struct MR_LD_LIST { 428bdc6fb8dSYang, Bo u32 ldCount; 429bdc6fb8dSYang, Bo u32 reserved; 430bdc6fb8dSYang, Bo struct { 431bdc6fb8dSYang, Bo union MR_LD_REF ref; 432bdc6fb8dSYang, Bo u8 state; 433bdc6fb8dSYang, Bo u8 reserved[3]; 434bdc6fb8dSYang, Bo u64 size; 435bdc6fb8dSYang, Bo } ldList[MAX_LOGICAL_DRIVES]; 436bdc6fb8dSYang, Bo } __packed; 437bdc6fb8dSYang, Bo 438bdc6fb8dSYang, Bo /* 439c4a3e0a5SBagalkote, Sreenivas * SAS controller properties 440c4a3e0a5SBagalkote, Sreenivas */ 441c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_prop { 442c4a3e0a5SBagalkote, Sreenivas 443c4a3e0a5SBagalkote, Sreenivas u16 seq_num; 444c4a3e0a5SBagalkote, Sreenivas u16 pred_fail_poll_interval; 445c4a3e0a5SBagalkote, Sreenivas u16 intr_throttle_count; 446c4a3e0a5SBagalkote, Sreenivas u16 intr_throttle_timeouts; 447c4a3e0a5SBagalkote, Sreenivas u8 rebuild_rate; 448c4a3e0a5SBagalkote, Sreenivas u8 patrol_read_rate; 449c4a3e0a5SBagalkote, Sreenivas u8 bgi_rate; 450c4a3e0a5SBagalkote, Sreenivas u8 cc_rate; 451c4a3e0a5SBagalkote, Sreenivas u8 recon_rate; 452c4a3e0a5SBagalkote, Sreenivas u8 cache_flush_interval; 453c4a3e0a5SBagalkote, Sreenivas u8 spinup_drv_count; 454c4a3e0a5SBagalkote, Sreenivas u8 spinup_delay; 455c4a3e0a5SBagalkote, Sreenivas u8 cluster_enable; 456c4a3e0a5SBagalkote, Sreenivas u8 coercion_mode; 457c4a3e0a5SBagalkote, Sreenivas u8 alarm_enable; 458c4a3e0a5SBagalkote, Sreenivas u8 disable_auto_rebuild; 459c4a3e0a5SBagalkote, Sreenivas u8 disable_battery_warn; 460c4a3e0a5SBagalkote, Sreenivas u8 ecc_bucket_size; 461c4a3e0a5SBagalkote, Sreenivas u16 ecc_bucket_leak_rate; 462c4a3e0a5SBagalkote, Sreenivas u8 restore_hotspare_on_insertion; 463c4a3e0a5SBagalkote, Sreenivas u8 expose_encl_devices; 46439a98554Sbo yang u8 maintainPdFailHistory; 46539a98554Sbo yang u8 disallowHostRequestReordering; 46639a98554Sbo yang u8 abortCCOnError; 46739a98554Sbo yang u8 loadBalanceMode; 46839a98554Sbo yang u8 disableAutoDetectBackplane; 469c4a3e0a5SBagalkote, Sreenivas 47039a98554Sbo yang u8 snapVDSpace; 47139a98554Sbo yang 47239a98554Sbo yang /* 47339a98554Sbo yang * Add properties that can be controlled by 47439a98554Sbo yang * a bit in the following structure. 47539a98554Sbo yang */ 47639a98554Sbo yang struct { 47739a98554Sbo yang u32 copyBackDisabled : 1; 47839a98554Sbo yang u32 SMARTerEnabled : 1; 47939a98554Sbo yang u32 prCorrectUnconfiguredAreas : 1; 48039a98554Sbo yang u32 useFdeOnly : 1; 48139a98554Sbo yang u32 disableNCQ : 1; 48239a98554Sbo yang u32 SSDSMARTerEnabled : 1; 48339a98554Sbo yang u32 SSDPatrolReadEnabled : 1; 48439a98554Sbo yang u32 enableSpinDownUnconfigured : 1; 48539a98554Sbo yang u32 autoEnhancedImport : 1; 48639a98554Sbo yang u32 enableSecretKeyControl : 1; 48739a98554Sbo yang u32 disableOnlineCtrlReset : 1; 48839a98554Sbo yang u32 allowBootWithPinnedCache : 1; 48939a98554Sbo yang u32 disableSpinDownHS : 1; 49039a98554Sbo yang u32 enableJBOD : 1; 49139a98554Sbo yang u32 reserved :18; 49239a98554Sbo yang } OnOffProperties; 49339a98554Sbo yang u8 autoSnapVDSpace; 49439a98554Sbo yang u8 viewSpace; 49539a98554Sbo yang u16 spinDownTime; 49639a98554Sbo yang u8 reserved[24]; 49781e403ceSYang, Bo } __packed; 498c4a3e0a5SBagalkote, Sreenivas 499c4a3e0a5SBagalkote, Sreenivas /* 500c4a3e0a5SBagalkote, Sreenivas * SAS controller information 501c4a3e0a5SBagalkote, Sreenivas */ 502c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_info { 503c4a3e0a5SBagalkote, Sreenivas 504c4a3e0a5SBagalkote, Sreenivas /* 505c4a3e0a5SBagalkote, Sreenivas * PCI device information 506c4a3e0a5SBagalkote, Sreenivas */ 507c4a3e0a5SBagalkote, Sreenivas struct { 508c4a3e0a5SBagalkote, Sreenivas 509c4a3e0a5SBagalkote, Sreenivas u16 vendor_id; 510c4a3e0a5SBagalkote, Sreenivas u16 device_id; 511c4a3e0a5SBagalkote, Sreenivas u16 sub_vendor_id; 512c4a3e0a5SBagalkote, Sreenivas u16 sub_device_id; 513c4a3e0a5SBagalkote, Sreenivas u8 reserved[24]; 514c4a3e0a5SBagalkote, Sreenivas 515c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pci; 516c4a3e0a5SBagalkote, Sreenivas 517c4a3e0a5SBagalkote, Sreenivas /* 518c4a3e0a5SBagalkote, Sreenivas * Host interface information 519c4a3e0a5SBagalkote, Sreenivas */ 520c4a3e0a5SBagalkote, Sreenivas struct { 521c4a3e0a5SBagalkote, Sreenivas 522c4a3e0a5SBagalkote, Sreenivas u8 PCIX:1; 523c4a3e0a5SBagalkote, Sreenivas u8 PCIE:1; 524c4a3e0a5SBagalkote, Sreenivas u8 iSCSI:1; 525c4a3e0a5SBagalkote, Sreenivas u8 SAS_3G:1; 526c4a3e0a5SBagalkote, Sreenivas u8 reserved_0:4; 527c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[6]; 528c4a3e0a5SBagalkote, Sreenivas u8 port_count; 529c4a3e0a5SBagalkote, Sreenivas u64 port_addr[8]; 530c4a3e0a5SBagalkote, Sreenivas 531c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) host_interface; 532c4a3e0a5SBagalkote, Sreenivas 533c4a3e0a5SBagalkote, Sreenivas /* 534c4a3e0a5SBagalkote, Sreenivas * Device (backend) interface information 535c4a3e0a5SBagalkote, Sreenivas */ 536c4a3e0a5SBagalkote, Sreenivas struct { 537c4a3e0a5SBagalkote, Sreenivas 538c4a3e0a5SBagalkote, Sreenivas u8 SPI:1; 539c4a3e0a5SBagalkote, Sreenivas u8 SAS_3G:1; 540c4a3e0a5SBagalkote, Sreenivas u8 SATA_1_5G:1; 541c4a3e0a5SBagalkote, Sreenivas u8 SATA_3G:1; 542c4a3e0a5SBagalkote, Sreenivas u8 reserved_0:4; 543c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[6]; 544c4a3e0a5SBagalkote, Sreenivas u8 port_count; 545c4a3e0a5SBagalkote, Sreenivas u64 port_addr[8]; 546c4a3e0a5SBagalkote, Sreenivas 547c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) device_interface; 548c4a3e0a5SBagalkote, Sreenivas 549c4a3e0a5SBagalkote, Sreenivas /* 550c4a3e0a5SBagalkote, Sreenivas * List of components residing in flash. All str are null terminated 551c4a3e0a5SBagalkote, Sreenivas */ 552c4a3e0a5SBagalkote, Sreenivas u32 image_check_word; 553c4a3e0a5SBagalkote, Sreenivas u32 image_component_count; 554c4a3e0a5SBagalkote, Sreenivas 555c4a3e0a5SBagalkote, Sreenivas struct { 556c4a3e0a5SBagalkote, Sreenivas 557c4a3e0a5SBagalkote, Sreenivas char name[8]; 558c4a3e0a5SBagalkote, Sreenivas char version[32]; 559c4a3e0a5SBagalkote, Sreenivas char build_date[16]; 560c4a3e0a5SBagalkote, Sreenivas char built_time[16]; 561c4a3e0a5SBagalkote, Sreenivas 562c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) image_component[8]; 563c4a3e0a5SBagalkote, Sreenivas 564c4a3e0a5SBagalkote, Sreenivas /* 565c4a3e0a5SBagalkote, Sreenivas * List of flash components that have been flashed on the card, but 566c4a3e0a5SBagalkote, Sreenivas * are not in use, pending reset of the adapter. This list will be 567c4a3e0a5SBagalkote, Sreenivas * empty if a flash operation has not occurred. All stings are null 568c4a3e0a5SBagalkote, Sreenivas * terminated 569c4a3e0a5SBagalkote, Sreenivas */ 570c4a3e0a5SBagalkote, Sreenivas u32 pending_image_component_count; 571c4a3e0a5SBagalkote, Sreenivas 572c4a3e0a5SBagalkote, Sreenivas struct { 573c4a3e0a5SBagalkote, Sreenivas 574c4a3e0a5SBagalkote, Sreenivas char name[8]; 575c4a3e0a5SBagalkote, Sreenivas char version[32]; 576c4a3e0a5SBagalkote, Sreenivas char build_date[16]; 577c4a3e0a5SBagalkote, Sreenivas char build_time[16]; 578c4a3e0a5SBagalkote, Sreenivas 579c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pending_image_component[8]; 580c4a3e0a5SBagalkote, Sreenivas 581c4a3e0a5SBagalkote, Sreenivas u8 max_arms; 582c4a3e0a5SBagalkote, Sreenivas u8 max_spans; 583c4a3e0a5SBagalkote, Sreenivas u8 max_arrays; 584c4a3e0a5SBagalkote, Sreenivas u8 max_lds; 585c4a3e0a5SBagalkote, Sreenivas 586c4a3e0a5SBagalkote, Sreenivas char product_name[80]; 587c4a3e0a5SBagalkote, Sreenivas char serial_no[32]; 588c4a3e0a5SBagalkote, Sreenivas 589c4a3e0a5SBagalkote, Sreenivas /* 590c4a3e0a5SBagalkote, Sreenivas * Other physical/controller/operation information. Indicates the 591c4a3e0a5SBagalkote, Sreenivas * presence of the hardware 592c4a3e0a5SBagalkote, Sreenivas */ 593c4a3e0a5SBagalkote, Sreenivas struct { 594c4a3e0a5SBagalkote, Sreenivas 595c4a3e0a5SBagalkote, Sreenivas u32 bbu:1; 596c4a3e0a5SBagalkote, Sreenivas u32 alarm:1; 597c4a3e0a5SBagalkote, Sreenivas u32 nvram:1; 598c4a3e0a5SBagalkote, Sreenivas u32 uart:1; 599c4a3e0a5SBagalkote, Sreenivas u32 reserved:28; 600c4a3e0a5SBagalkote, Sreenivas 601c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) hw_present; 602c4a3e0a5SBagalkote, Sreenivas 603c4a3e0a5SBagalkote, Sreenivas u32 current_fw_time; 604c4a3e0a5SBagalkote, Sreenivas 605c4a3e0a5SBagalkote, Sreenivas /* 606c4a3e0a5SBagalkote, Sreenivas * Maximum data transfer sizes 607c4a3e0a5SBagalkote, Sreenivas */ 608c4a3e0a5SBagalkote, Sreenivas u16 max_concurrent_cmds; 609c4a3e0a5SBagalkote, Sreenivas u16 max_sge_count; 610c4a3e0a5SBagalkote, Sreenivas u32 max_request_size; 611c4a3e0a5SBagalkote, Sreenivas 612c4a3e0a5SBagalkote, Sreenivas /* 613c4a3e0a5SBagalkote, Sreenivas * Logical and physical device counts 614c4a3e0a5SBagalkote, Sreenivas */ 615c4a3e0a5SBagalkote, Sreenivas u16 ld_present_count; 616c4a3e0a5SBagalkote, Sreenivas u16 ld_degraded_count; 617c4a3e0a5SBagalkote, Sreenivas u16 ld_offline_count; 618c4a3e0a5SBagalkote, Sreenivas 619c4a3e0a5SBagalkote, Sreenivas u16 pd_present_count; 620c4a3e0a5SBagalkote, Sreenivas u16 pd_disk_present_count; 621c4a3e0a5SBagalkote, Sreenivas u16 pd_disk_pred_failure_count; 622c4a3e0a5SBagalkote, Sreenivas u16 pd_disk_failed_count; 623c4a3e0a5SBagalkote, Sreenivas 624c4a3e0a5SBagalkote, Sreenivas /* 625c4a3e0a5SBagalkote, Sreenivas * Memory size information 626c4a3e0a5SBagalkote, Sreenivas */ 627c4a3e0a5SBagalkote, Sreenivas u16 nvram_size; 628c4a3e0a5SBagalkote, Sreenivas u16 memory_size; 629c4a3e0a5SBagalkote, Sreenivas u16 flash_size; 630c4a3e0a5SBagalkote, Sreenivas 631c4a3e0a5SBagalkote, Sreenivas /* 632c4a3e0a5SBagalkote, Sreenivas * Error counters 633c4a3e0a5SBagalkote, Sreenivas */ 634c4a3e0a5SBagalkote, Sreenivas u16 mem_correctable_error_count; 635c4a3e0a5SBagalkote, Sreenivas u16 mem_uncorrectable_error_count; 636c4a3e0a5SBagalkote, Sreenivas 637c4a3e0a5SBagalkote, Sreenivas /* 638c4a3e0a5SBagalkote, Sreenivas * Cluster information 639c4a3e0a5SBagalkote, Sreenivas */ 640c4a3e0a5SBagalkote, Sreenivas u8 cluster_permitted; 641c4a3e0a5SBagalkote, Sreenivas u8 cluster_active; 642c4a3e0a5SBagalkote, Sreenivas 643c4a3e0a5SBagalkote, Sreenivas /* 644c4a3e0a5SBagalkote, Sreenivas * Additional max data transfer sizes 645c4a3e0a5SBagalkote, Sreenivas */ 646c4a3e0a5SBagalkote, Sreenivas u16 max_strips_per_io; 647c4a3e0a5SBagalkote, Sreenivas 648c4a3e0a5SBagalkote, Sreenivas /* 649c4a3e0a5SBagalkote, Sreenivas * Controller capabilities structures 650c4a3e0a5SBagalkote, Sreenivas */ 651c4a3e0a5SBagalkote, Sreenivas struct { 652c4a3e0a5SBagalkote, Sreenivas 653c4a3e0a5SBagalkote, Sreenivas u32 raid_level_0:1; 654c4a3e0a5SBagalkote, Sreenivas u32 raid_level_1:1; 655c4a3e0a5SBagalkote, Sreenivas u32 raid_level_5:1; 656c4a3e0a5SBagalkote, Sreenivas u32 raid_level_1E:1; 657c4a3e0a5SBagalkote, Sreenivas u32 raid_level_6:1; 658c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 659c4a3e0a5SBagalkote, Sreenivas 660c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) raid_levels; 661c4a3e0a5SBagalkote, Sreenivas 662c4a3e0a5SBagalkote, Sreenivas struct { 663c4a3e0a5SBagalkote, Sreenivas 664c4a3e0a5SBagalkote, Sreenivas u32 rbld_rate:1; 665c4a3e0a5SBagalkote, Sreenivas u32 cc_rate:1; 666c4a3e0a5SBagalkote, Sreenivas u32 bgi_rate:1; 667c4a3e0a5SBagalkote, Sreenivas u32 recon_rate:1; 668c4a3e0a5SBagalkote, Sreenivas u32 patrol_rate:1; 669c4a3e0a5SBagalkote, Sreenivas u32 alarm_control:1; 670c4a3e0a5SBagalkote, Sreenivas u32 cluster_supported:1; 671c4a3e0a5SBagalkote, Sreenivas u32 bbu:1; 672c4a3e0a5SBagalkote, Sreenivas u32 spanning_allowed:1; 673c4a3e0a5SBagalkote, Sreenivas u32 dedicated_hotspares:1; 674c4a3e0a5SBagalkote, Sreenivas u32 revertible_hotspares:1; 675c4a3e0a5SBagalkote, Sreenivas u32 foreign_config_import:1; 676c4a3e0a5SBagalkote, Sreenivas u32 self_diagnostic:1; 677c4a3e0a5SBagalkote, Sreenivas u32 mixed_redundancy_arr:1; 678c4a3e0a5SBagalkote, Sreenivas u32 global_hot_spares:1; 679c4a3e0a5SBagalkote, Sreenivas u32 reserved:17; 680c4a3e0a5SBagalkote, Sreenivas 681c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) adapter_operations; 682c4a3e0a5SBagalkote, Sreenivas 683c4a3e0a5SBagalkote, Sreenivas struct { 684c4a3e0a5SBagalkote, Sreenivas 685c4a3e0a5SBagalkote, Sreenivas u32 read_policy:1; 686c4a3e0a5SBagalkote, Sreenivas u32 write_policy:1; 687c4a3e0a5SBagalkote, Sreenivas u32 io_policy:1; 688c4a3e0a5SBagalkote, Sreenivas u32 access_policy:1; 689c4a3e0a5SBagalkote, Sreenivas u32 disk_cache_policy:1; 690c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 691c4a3e0a5SBagalkote, Sreenivas 692c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_operations; 693c4a3e0a5SBagalkote, Sreenivas 694c4a3e0a5SBagalkote, Sreenivas struct { 695c4a3e0a5SBagalkote, Sreenivas 696c4a3e0a5SBagalkote, Sreenivas u8 min; 697c4a3e0a5SBagalkote, Sreenivas u8 max; 698c4a3e0a5SBagalkote, Sreenivas u8 reserved[2]; 699c4a3e0a5SBagalkote, Sreenivas 700c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) stripe_sz_ops; 701c4a3e0a5SBagalkote, Sreenivas 702c4a3e0a5SBagalkote, Sreenivas struct { 703c4a3e0a5SBagalkote, Sreenivas 704c4a3e0a5SBagalkote, Sreenivas u32 force_online:1; 705c4a3e0a5SBagalkote, Sreenivas u32 force_offline:1; 706c4a3e0a5SBagalkote, Sreenivas u32 force_rebuild:1; 707c4a3e0a5SBagalkote, Sreenivas u32 reserved:29; 708c4a3e0a5SBagalkote, Sreenivas 709c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_operations; 710c4a3e0a5SBagalkote, Sreenivas 711c4a3e0a5SBagalkote, Sreenivas struct { 712c4a3e0a5SBagalkote, Sreenivas 713c4a3e0a5SBagalkote, Sreenivas u32 ctrl_supports_sas:1; 714c4a3e0a5SBagalkote, Sreenivas u32 ctrl_supports_sata:1; 715c4a3e0a5SBagalkote, Sreenivas u32 allow_mix_in_encl:1; 716c4a3e0a5SBagalkote, Sreenivas u32 allow_mix_in_ld:1; 717c4a3e0a5SBagalkote, Sreenivas u32 allow_sata_in_cluster:1; 718c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 719c4a3e0a5SBagalkote, Sreenivas 720c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_mix_support; 721c4a3e0a5SBagalkote, Sreenivas 722c4a3e0a5SBagalkote, Sreenivas /* 723c4a3e0a5SBagalkote, Sreenivas * Define ECC single-bit-error bucket information 724c4a3e0a5SBagalkote, Sreenivas */ 725c4a3e0a5SBagalkote, Sreenivas u8 ecc_bucket_count; 726c4a3e0a5SBagalkote, Sreenivas u8 reserved_2[11]; 727c4a3e0a5SBagalkote, Sreenivas 728c4a3e0a5SBagalkote, Sreenivas /* 729c4a3e0a5SBagalkote, Sreenivas * Include the controller properties (changeable items) 730c4a3e0a5SBagalkote, Sreenivas */ 731c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_prop properties; 732c4a3e0a5SBagalkote, Sreenivas 733c4a3e0a5SBagalkote, Sreenivas /* 734c4a3e0a5SBagalkote, Sreenivas * Define FW pkg version (set in envt v'bles on OEM basis) 735c4a3e0a5SBagalkote, Sreenivas */ 736c4a3e0a5SBagalkote, Sreenivas char package_version[0x60]; 737c4a3e0a5SBagalkote, Sreenivas 738c4a3e0a5SBagalkote, Sreenivas 739bc93d425SSumit.Saxena@lsi.com /* 740bc93d425SSumit.Saxena@lsi.com * If adapterOperations.supportMoreThan8Phys is set, 741bc93d425SSumit.Saxena@lsi.com * and deviceInterface.portCount is greater than 8, 742bc93d425SSumit.Saxena@lsi.com * SAS Addrs for first 8 ports shall be populated in 743bc93d425SSumit.Saxena@lsi.com * deviceInterface.portAddr, and the rest shall be 744bc93d425SSumit.Saxena@lsi.com * populated in deviceInterfacePortAddr2. 745bc93d425SSumit.Saxena@lsi.com */ 746bc93d425SSumit.Saxena@lsi.com u64 deviceInterfacePortAddr2[8]; /*6a0h */ 747bc93d425SSumit.Saxena@lsi.com u8 reserved3[128]; /*6e0h */ 748bc93d425SSumit.Saxena@lsi.com 749bc93d425SSumit.Saxena@lsi.com struct { /*760h */ 750bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_0:4; 751bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_0:12; 752bc93d425SSumit.Saxena@lsi.com 753bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_1:4; 754bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_1:12; 755bc93d425SSumit.Saxena@lsi.com 756bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_5:4; 757bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_5:12; 758bc93d425SSumit.Saxena@lsi.com 759bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_1E:4; 760bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_1E:12; 761bc93d425SSumit.Saxena@lsi.com 762bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_6:4; 763bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_6:12; 764bc93d425SSumit.Saxena@lsi.com 765bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_10:4; 766bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_10:12; 767bc93d425SSumit.Saxena@lsi.com 768bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_50:4; 769bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_50:12; 770bc93d425SSumit.Saxena@lsi.com 771bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_60:4; 772bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_60:12; 773bc93d425SSumit.Saxena@lsi.com 774bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_1E_RLQ0:4; 775bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_1E_RLQ0:12; 776bc93d425SSumit.Saxena@lsi.com 777bc93d425SSumit.Saxena@lsi.com u16 minPdRaidLevel_1E0_RLQ0:4; 778bc93d425SSumit.Saxena@lsi.com u16 maxPdRaidLevel_1E0_RLQ0:12; 779bc93d425SSumit.Saxena@lsi.com 780bc93d425SSumit.Saxena@lsi.com u16 reserved[6]; 781bc93d425SSumit.Saxena@lsi.com } pdsForRaidLevels; 782bc93d425SSumit.Saxena@lsi.com 783bc93d425SSumit.Saxena@lsi.com u16 maxPds; /*780h */ 784bc93d425SSumit.Saxena@lsi.com u16 maxDedHSPs; /*782h */ 785bc93d425SSumit.Saxena@lsi.com u16 maxGlobalHSPs; /*784h */ 786bc93d425SSumit.Saxena@lsi.com u16 ddfSize; /*786h */ 787bc93d425SSumit.Saxena@lsi.com u8 maxLdsPerArray; /*788h */ 788bc93d425SSumit.Saxena@lsi.com u8 partitionsInDDF; /*789h */ 789bc93d425SSumit.Saxena@lsi.com u8 lockKeyBinding; /*78ah */ 790bc93d425SSumit.Saxena@lsi.com u8 maxPITsPerLd; /*78bh */ 791bc93d425SSumit.Saxena@lsi.com u8 maxViewsPerLd; /*78ch */ 792bc93d425SSumit.Saxena@lsi.com u8 maxTargetId; /*78dh */ 793bc93d425SSumit.Saxena@lsi.com u16 maxBvlVdSize; /*78eh */ 794bc93d425SSumit.Saxena@lsi.com 795bc93d425SSumit.Saxena@lsi.com u16 maxConfigurableSSCSize; /*790h */ 796bc93d425SSumit.Saxena@lsi.com u16 currentSSCsize; /*792h */ 797bc93d425SSumit.Saxena@lsi.com 798bc93d425SSumit.Saxena@lsi.com char expanderFwVersion[12]; /*794h */ 799bc93d425SSumit.Saxena@lsi.com 800bc93d425SSumit.Saxena@lsi.com u16 PFKTrialTimeRemaining; /*7A0h */ 801bc93d425SSumit.Saxena@lsi.com 802bc93d425SSumit.Saxena@lsi.com u16 cacheMemorySize; /*7A2h */ 803bc93d425SSumit.Saxena@lsi.com 804bc93d425SSumit.Saxena@lsi.com struct { /*7A4h */ 805bc93d425SSumit.Saxena@lsi.com u32 supportPIcontroller:1; 806bc93d425SSumit.Saxena@lsi.com u32 supportLdPIType1:1; 807bc93d425SSumit.Saxena@lsi.com u32 supportLdPIType2:1; 808bc93d425SSumit.Saxena@lsi.com u32 supportLdPIType3:1; 809bc93d425SSumit.Saxena@lsi.com u32 supportLdBBMInfo:1; 810bc93d425SSumit.Saxena@lsi.com u32 supportShieldState:1; 811bc93d425SSumit.Saxena@lsi.com u32 blockSSDWriteCacheChange:1; 812bc93d425SSumit.Saxena@lsi.com u32 supportSuspendResumeBGops:1; 813bc93d425SSumit.Saxena@lsi.com u32 supportEmergencySpares:1; 814bc93d425SSumit.Saxena@lsi.com u32 supportSetLinkSpeed:1; 815bc93d425SSumit.Saxena@lsi.com u32 supportBootTimePFKChange:1; 816bc93d425SSumit.Saxena@lsi.com u32 supportJBOD:1; 817bc93d425SSumit.Saxena@lsi.com u32 disableOnlinePFKChange:1; 818bc93d425SSumit.Saxena@lsi.com u32 supportPerfTuning:1; 819bc93d425SSumit.Saxena@lsi.com u32 supportSSDPatrolRead:1; 820bc93d425SSumit.Saxena@lsi.com u32 realTimeScheduler:1; 821bc93d425SSumit.Saxena@lsi.com 822bc93d425SSumit.Saxena@lsi.com u32 supportResetNow:1; 823bc93d425SSumit.Saxena@lsi.com u32 supportEmulatedDrives:1; 824bc93d425SSumit.Saxena@lsi.com u32 headlessMode:1; 825bc93d425SSumit.Saxena@lsi.com u32 dedicatedHotSparesLimited:1; 826bc93d425SSumit.Saxena@lsi.com 827bc93d425SSumit.Saxena@lsi.com 828bc93d425SSumit.Saxena@lsi.com u32 supportUnevenSpans:1; 829bc93d425SSumit.Saxena@lsi.com u32 reserved:11; 830bc93d425SSumit.Saxena@lsi.com } adapterOperations2; 831bc93d425SSumit.Saxena@lsi.com 832bc93d425SSumit.Saxena@lsi.com u8 driverVersion[32]; /*7A8h */ 833bc93d425SSumit.Saxena@lsi.com u8 maxDAPdCountSpinup60; /*7C8h */ 834bc93d425SSumit.Saxena@lsi.com u8 temperatureROC; /*7C9h */ 835bc93d425SSumit.Saxena@lsi.com u8 temperatureCtrl; /*7CAh */ 836bc93d425SSumit.Saxena@lsi.com u8 reserved4; /*7CBh */ 837bc93d425SSumit.Saxena@lsi.com u16 maxConfigurablePds; /*7CCh */ 838bc93d425SSumit.Saxena@lsi.com 839bc93d425SSumit.Saxena@lsi.com 840bc93d425SSumit.Saxena@lsi.com u8 reserved5[2]; /*0x7CDh */ 841bc93d425SSumit.Saxena@lsi.com 842bc93d425SSumit.Saxena@lsi.com /* 843bc93d425SSumit.Saxena@lsi.com * HA cluster information 844bc93d425SSumit.Saxena@lsi.com */ 845bc93d425SSumit.Saxena@lsi.com struct { 846bc93d425SSumit.Saxena@lsi.com u32 peerIsPresent:1; 847bc93d425SSumit.Saxena@lsi.com u32 peerIsIncompatible:1; 848bc93d425SSumit.Saxena@lsi.com u32 hwIncompatible:1; 849bc93d425SSumit.Saxena@lsi.com u32 fwVersionMismatch:1; 850bc93d425SSumit.Saxena@lsi.com u32 ctrlPropIncompatible:1; 851bc93d425SSumit.Saxena@lsi.com u32 premiumFeatureMismatch:1; 852bc93d425SSumit.Saxena@lsi.com u32 reserved:26; 853bc93d425SSumit.Saxena@lsi.com } cluster; 854bc93d425SSumit.Saxena@lsi.com 855bc93d425SSumit.Saxena@lsi.com char clusterId[16]; /*7D4h */ 856bc93d425SSumit.Saxena@lsi.com 857bc93d425SSumit.Saxena@lsi.com u8 pad[0x800-0x7E4]; /*7E4 */ 85881e403ceSYang, Bo } __packed; 859c4a3e0a5SBagalkote, Sreenivas 860c4a3e0a5SBagalkote, Sreenivas /* 861c4a3e0a5SBagalkote, Sreenivas * =============================== 862c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS driver definitions 863c4a3e0a5SBagalkote, Sreenivas * =============================== 864c4a3e0a5SBagalkote, Sreenivas */ 865c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_PD_CHANNELS 2 866c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_LD_CHANNELS 2 867c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \ 868c4a3e0a5SBagalkote, Sreenivas MEGASAS_MAX_LD_CHANNELS) 869c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_DEV_PER_CHANNEL 128 870c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_DEFAULT_INIT_ID -1 871c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_LUN 8 872c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_LD 64 8736bf579a3Sadam radford #define MEGASAS_DEFAULT_CMD_PER_LUN 256 87481e403ceSYang, Bo #define MEGASAS_MAX_PD (MEGASAS_MAX_PD_CHANNELS * \ 87581e403ceSYang, Bo MEGASAS_MAX_DEV_PER_CHANNEL) 876bdc6fb8dSYang, Bo #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \ 877bdc6fb8dSYang, Bo MEGASAS_MAX_DEV_PER_CHANNEL) 878c4a3e0a5SBagalkote, Sreenivas 8791fd10685SYang, Bo #define MEGASAS_MAX_SECTORS (2*1024) 88042a8d2b3Sadam radford #define MEGASAS_MAX_SECTORS_IEEE (2*128) 881658dcedbSSumant Patro #define MEGASAS_DBG_LVL 1 882658dcedbSSumant Patro 88305e9ebbeSSumant Patro #define MEGASAS_FW_BUSY 1 88405e9ebbeSSumant Patro 885d532dbe2Sbo yang /* Frame Type */ 886d532dbe2Sbo yang #define IO_FRAME 0 887d532dbe2Sbo yang #define PTHRU_FRAME 1 888d532dbe2Sbo yang 889c4a3e0a5SBagalkote, Sreenivas /* 890c4a3e0a5SBagalkote, Sreenivas * When SCSI mid-layer calls driver's reset routine, driver waits for 891c4a3e0a5SBagalkote, Sreenivas * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note 892c4a3e0a5SBagalkote, Sreenivas * that the driver cannot _actually_ abort or reset pending commands. While 893c4a3e0a5SBagalkote, Sreenivas * it is waiting for the commands to complete, it prints a diagnostic message 894c4a3e0a5SBagalkote, Sreenivas * every MEGASAS_RESET_NOTICE_INTERVAL seconds 895c4a3e0a5SBagalkote, Sreenivas */ 896c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_RESET_WAIT_TIME 180 8972a3681e5SSumant Patro #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 898c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_RESET_NOTICE_INTERVAL 5 899c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IOCTL_CMD 0 90005e9ebbeSSumant Patro #define MEGASAS_DEFAULT_CMD_TIMEOUT 90 901c5daa6a9Sadam radford #define MEGASAS_THROTTLE_QUEUE_DEPTH 16 902c4a3e0a5SBagalkote, Sreenivas 903c4a3e0a5SBagalkote, Sreenivas /* 904c4a3e0a5SBagalkote, Sreenivas * FW reports the maximum of number of commands that it can accept (maximum 905c4a3e0a5SBagalkote, Sreenivas * commands that can be outstanding) at any time. The driver must report a 906c4a3e0a5SBagalkote, Sreenivas * lower number to the mid layer because it can issue a few internal commands 907c4a3e0a5SBagalkote, Sreenivas * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs 908c4a3e0a5SBagalkote, Sreenivas * is shown below 909c4a3e0a5SBagalkote, Sreenivas */ 910c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_INT_CMDS 32 9117bebf5c7SYang, Bo #define MEGASAS_SKINNY_INT_CMDS 5 912c4a3e0a5SBagalkote, Sreenivas 913d46a3ad6SSumit.Saxena@lsi.com #define MEGASAS_MAX_MSIX_QUEUES 128 914c4a3e0a5SBagalkote, Sreenivas /* 915c4a3e0a5SBagalkote, Sreenivas * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit 916c4a3e0a5SBagalkote, Sreenivas * SGLs based on the size of dma_addr_t 917c4a3e0a5SBagalkote, Sreenivas */ 918c4a3e0a5SBagalkote, Sreenivas #define IS_DMA64 (sizeof(dma_addr_t) == 8) 919c4a3e0a5SBagalkote, Sreenivas 92039a98554Sbo yang #define MFI_XSCALE_OMR0_CHANGE_INTERRUPT 0x00000001 92139a98554Sbo yang 92239a98554Sbo yang #define MFI_INTR_FLAG_REPLY_MESSAGE 0x00000001 92339a98554Sbo yang #define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE 0x00000002 92439a98554Sbo yang #define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT 0x00000004 92539a98554Sbo yang 926c4a3e0a5SBagalkote, Sreenivas #define MFI_OB_INTR_STATUS_MASK 0x00000002 92714faea9fSbo yang #define MFI_POLL_TIMEOUT_SECS 60 928c4a3e0a5SBagalkote, Sreenivas 929f9876f0bSSumant Patro #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 9306610a6b3SYang, Bo #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 9316610a6b3SYang, Bo #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004) 93287911122SYang, Bo #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000 93387911122SYang, Bo #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001) 9340e98936cSSumant Patro 93539a98554Sbo yang #define MFI_1068_PCSR_OFFSET 0x84 93639a98554Sbo yang #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64 93739a98554Sbo yang #define MFI_1068_FW_READY 0xDDDD0000 938d46a3ad6SSumit.Saxena@lsi.com 939d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_OFFSET 0X0000001F 940d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_EXT_OFFSET 0X003FC000 941d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14 942d46a3ad6SSumit.Saxena@lsi.com #define MR_MAX_MSIX_REG_ARRAY 16 9430e98936cSSumant Patro /* 9440e98936cSSumant Patro * register set for both 1068 and 1078 controllers 9450e98936cSSumant Patro * structure extended for 1078 registers 9460e98936cSSumant Patro */ 947c4a3e0a5SBagalkote, Sreenivas 948f9876f0bSSumant Patro struct megasas_register_set { 9499c915a8cSadam radford u32 doorbell; /*0000h*/ 9509c915a8cSadam radford u32 fusion_seq_offset; /*0004h*/ 9519c915a8cSadam radford u32 fusion_host_diag; /*0008h*/ 9529c915a8cSadam radford u32 reserved_01; /*000Ch*/ 953c4a3e0a5SBagalkote, Sreenivas 954c4a3e0a5SBagalkote, Sreenivas u32 inbound_msg_0; /*0010h*/ 955c4a3e0a5SBagalkote, Sreenivas u32 inbound_msg_1; /*0014h*/ 956c4a3e0a5SBagalkote, Sreenivas u32 outbound_msg_0; /*0018h*/ 957c4a3e0a5SBagalkote, Sreenivas u32 outbound_msg_1; /*001Ch*/ 958c4a3e0a5SBagalkote, Sreenivas 959c4a3e0a5SBagalkote, Sreenivas u32 inbound_doorbell; /*0020h*/ 960c4a3e0a5SBagalkote, Sreenivas u32 inbound_intr_status; /*0024h*/ 961c4a3e0a5SBagalkote, Sreenivas u32 inbound_intr_mask; /*0028h*/ 962c4a3e0a5SBagalkote, Sreenivas 963c4a3e0a5SBagalkote, Sreenivas u32 outbound_doorbell; /*002Ch*/ 964c4a3e0a5SBagalkote, Sreenivas u32 outbound_intr_status; /*0030h*/ 965c4a3e0a5SBagalkote, Sreenivas u32 outbound_intr_mask; /*0034h*/ 966c4a3e0a5SBagalkote, Sreenivas 967c4a3e0a5SBagalkote, Sreenivas u32 reserved_1[2]; /*0038h*/ 968c4a3e0a5SBagalkote, Sreenivas 969c4a3e0a5SBagalkote, Sreenivas u32 inbound_queue_port; /*0040h*/ 970c4a3e0a5SBagalkote, Sreenivas u32 outbound_queue_port; /*0044h*/ 971c4a3e0a5SBagalkote, Sreenivas 9729c915a8cSadam radford u32 reserved_2[9]; /*0048h*/ 9739c915a8cSadam radford u32 reply_post_host_index; /*006Ch*/ 9749c915a8cSadam radford u32 reserved_2_2[12]; /*0070h*/ 975c4a3e0a5SBagalkote, Sreenivas 976f9876f0bSSumant Patro u32 outbound_doorbell_clear; /*00A0h*/ 977f9876f0bSSumant Patro 978f9876f0bSSumant Patro u32 reserved_3[3]; /*00A4h*/ 979f9876f0bSSumant Patro 980f9876f0bSSumant Patro u32 outbound_scratch_pad ; /*00B0h*/ 9819c915a8cSadam radford u32 outbound_scratch_pad_2; /*00B4h*/ 982f9876f0bSSumant Patro 9839c915a8cSadam radford u32 reserved_4[2]; /*00B8h*/ 984f9876f0bSSumant Patro 985f9876f0bSSumant Patro u32 inbound_low_queue_port ; /*00C0h*/ 986f9876f0bSSumant Patro 987f9876f0bSSumant Patro u32 inbound_high_queue_port ; /*00C4h*/ 988f9876f0bSSumant Patro 989f9876f0bSSumant Patro u32 reserved_5; /*00C8h*/ 99039a98554Sbo yang u32 res_6[11]; /*CCh*/ 99139a98554Sbo yang u32 host_diag; 99239a98554Sbo yang u32 seq_offset; 99339a98554Sbo yang u32 index_registers[807]; /*00CCh*/ 994c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 995c4a3e0a5SBagalkote, Sreenivas 996c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 { 997c4a3e0a5SBagalkote, Sreenivas 998c4a3e0a5SBagalkote, Sreenivas u32 phys_addr; 999c4a3e0a5SBagalkote, Sreenivas u32 length; 1000c4a3e0a5SBagalkote, Sreenivas 1001c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1002c4a3e0a5SBagalkote, Sreenivas 1003c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 { 1004c4a3e0a5SBagalkote, Sreenivas 1005c4a3e0a5SBagalkote, Sreenivas u64 phys_addr; 1006c4a3e0a5SBagalkote, Sreenivas u32 length; 1007c4a3e0a5SBagalkote, Sreenivas 1008c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1009c4a3e0a5SBagalkote, Sreenivas 1010f4c9a131SYang, Bo struct megasas_sge_skinny { 1011f4c9a131SYang, Bo u64 phys_addr; 1012f4c9a131SYang, Bo u32 length; 1013f4c9a131SYang, Bo u32 flag; 1014f4c9a131SYang, Bo } __packed; 1015f4c9a131SYang, Bo 1016c4a3e0a5SBagalkote, Sreenivas union megasas_sgl { 1017c4a3e0a5SBagalkote, Sreenivas 1018c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[1]; 1019c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[1]; 1020f4c9a131SYang, Bo struct megasas_sge_skinny sge_skinny[1]; 1021c4a3e0a5SBagalkote, Sreenivas 1022c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1023c4a3e0a5SBagalkote, Sreenivas 1024c4a3e0a5SBagalkote, Sreenivas struct megasas_header { 1025c4a3e0a5SBagalkote, Sreenivas 1026c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1027c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1028c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1029c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1030c4a3e0a5SBagalkote, Sreenivas 1031c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1032c4a3e0a5SBagalkote, Sreenivas u8 lun; /*05h */ 1033c4a3e0a5SBagalkote, Sreenivas u8 cdb_len; /*06h */ 1034c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1035c4a3e0a5SBagalkote, Sreenivas 1036c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 1037c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 1038c4a3e0a5SBagalkote, Sreenivas 1039c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 1040c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 1041c4a3e0a5SBagalkote, Sreenivas u32 data_xferlen; /*14h */ 1042c4a3e0a5SBagalkote, Sreenivas 1043c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1044c4a3e0a5SBagalkote, Sreenivas 1045c4a3e0a5SBagalkote, Sreenivas union megasas_sgl_frame { 1046c4a3e0a5SBagalkote, Sreenivas 1047c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[8]; 1048c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[5]; 1049c4a3e0a5SBagalkote, Sreenivas 1050c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1051c4a3e0a5SBagalkote, Sreenivas 1052d46a3ad6SSumit.Saxena@lsi.com typedef union _MFI_CAPABILITIES { 1053d46a3ad6SSumit.Saxena@lsi.com struct { 1054d46a3ad6SSumit.Saxena@lsi.com u32 support_fp_remote_lun:1; 1055d46a3ad6SSumit.Saxena@lsi.com u32 support_additional_msix:1; 1056d46a3ad6SSumit.Saxena@lsi.com u32 reserved:30; 1057d46a3ad6SSumit.Saxena@lsi.com } mfi_capabilities; 1058d46a3ad6SSumit.Saxena@lsi.com u32 reg; 1059d46a3ad6SSumit.Saxena@lsi.com } MFI_CAPABILITIES; 1060d46a3ad6SSumit.Saxena@lsi.com 1061c4a3e0a5SBagalkote, Sreenivas struct megasas_init_frame { 1062c4a3e0a5SBagalkote, Sreenivas 1063c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1064c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1065c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1066c4a3e0a5SBagalkote, Sreenivas 1067c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*03h */ 1068d46a3ad6SSumit.Saxena@lsi.com MFI_CAPABILITIES driver_operations; /*04h*/ 1069c4a3e0a5SBagalkote, Sreenivas 1070c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 1071c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 1072c4a3e0a5SBagalkote, Sreenivas 1073c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 1074c4a3e0a5SBagalkote, Sreenivas u16 reserved_3; /*12h */ 1075c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 1076c4a3e0a5SBagalkote, Sreenivas 1077c4a3e0a5SBagalkote, Sreenivas u32 queue_info_new_phys_addr_lo; /*18h */ 1078c4a3e0a5SBagalkote, Sreenivas u32 queue_info_new_phys_addr_hi; /*1Ch */ 1079c4a3e0a5SBagalkote, Sreenivas u32 queue_info_old_phys_addr_lo; /*20h */ 1080c4a3e0a5SBagalkote, Sreenivas u32 queue_info_old_phys_addr_hi; /*24h */ 1081c4a3e0a5SBagalkote, Sreenivas 1082c4a3e0a5SBagalkote, Sreenivas u32 reserved_4[6]; /*28h */ 1083c4a3e0a5SBagalkote, Sreenivas 1084c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1085c4a3e0a5SBagalkote, Sreenivas 1086c4a3e0a5SBagalkote, Sreenivas struct megasas_init_queue_info { 1087c4a3e0a5SBagalkote, Sreenivas 1088c4a3e0a5SBagalkote, Sreenivas u32 init_flags; /*00h */ 1089c4a3e0a5SBagalkote, Sreenivas u32 reply_queue_entries; /*04h */ 1090c4a3e0a5SBagalkote, Sreenivas 1091c4a3e0a5SBagalkote, Sreenivas u32 reply_queue_start_phys_addr_lo; /*08h */ 1092c4a3e0a5SBagalkote, Sreenivas u32 reply_queue_start_phys_addr_hi; /*0Ch */ 1093c4a3e0a5SBagalkote, Sreenivas u32 producer_index_phys_addr_lo; /*10h */ 1094c4a3e0a5SBagalkote, Sreenivas u32 producer_index_phys_addr_hi; /*14h */ 1095c4a3e0a5SBagalkote, Sreenivas u32 consumer_index_phys_addr_lo; /*18h */ 1096c4a3e0a5SBagalkote, Sreenivas u32 consumer_index_phys_addr_hi; /*1Ch */ 1097c4a3e0a5SBagalkote, Sreenivas 1098c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1099c4a3e0a5SBagalkote, Sreenivas 1100c4a3e0a5SBagalkote, Sreenivas struct megasas_io_frame { 1101c4a3e0a5SBagalkote, Sreenivas 1102c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1103c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1104c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1105c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1106c4a3e0a5SBagalkote, Sreenivas 1107c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1108c4a3e0a5SBagalkote, Sreenivas u8 access_byte; /*05h */ 1109c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*06h */ 1110c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1111c4a3e0a5SBagalkote, Sreenivas 1112c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 1113c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 1114c4a3e0a5SBagalkote, Sreenivas 1115c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 1116c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 1117c4a3e0a5SBagalkote, Sreenivas u32 lba_count; /*14h */ 1118c4a3e0a5SBagalkote, Sreenivas 1119c4a3e0a5SBagalkote, Sreenivas u32 sense_buf_phys_addr_lo; /*18h */ 1120c4a3e0a5SBagalkote, Sreenivas u32 sense_buf_phys_addr_hi; /*1Ch */ 1121c4a3e0a5SBagalkote, Sreenivas 1122c4a3e0a5SBagalkote, Sreenivas u32 start_lba_lo; /*20h */ 1123c4a3e0a5SBagalkote, Sreenivas u32 start_lba_hi; /*24h */ 1124c4a3e0a5SBagalkote, Sreenivas 1125c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*28h */ 1126c4a3e0a5SBagalkote, Sreenivas 1127c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1128c4a3e0a5SBagalkote, Sreenivas 1129c4a3e0a5SBagalkote, Sreenivas struct megasas_pthru_frame { 1130c4a3e0a5SBagalkote, Sreenivas 1131c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1132c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 1133c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1134c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 1135c4a3e0a5SBagalkote, Sreenivas 1136c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1137c4a3e0a5SBagalkote, Sreenivas u8 lun; /*05h */ 1138c4a3e0a5SBagalkote, Sreenivas u8 cdb_len; /*06h */ 1139c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1140c4a3e0a5SBagalkote, Sreenivas 1141c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 1142c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 1143c4a3e0a5SBagalkote, Sreenivas 1144c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 1145c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 1146c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 1147c4a3e0a5SBagalkote, Sreenivas 1148c4a3e0a5SBagalkote, Sreenivas u32 sense_buf_phys_addr_lo; /*18h */ 1149c4a3e0a5SBagalkote, Sreenivas u32 sense_buf_phys_addr_hi; /*1Ch */ 1150c4a3e0a5SBagalkote, Sreenivas 1151c4a3e0a5SBagalkote, Sreenivas u8 cdb[16]; /*20h */ 1152c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*30h */ 1153c4a3e0a5SBagalkote, Sreenivas 1154c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1155c4a3e0a5SBagalkote, Sreenivas 1156c4a3e0a5SBagalkote, Sreenivas struct megasas_dcmd_frame { 1157c4a3e0a5SBagalkote, Sreenivas 1158c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1159c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1160c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1161c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[4]; /*03h */ 1162c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1163c4a3e0a5SBagalkote, Sreenivas 1164c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 1165c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 1166c4a3e0a5SBagalkote, Sreenivas 1167c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 1168c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 1169c4a3e0a5SBagalkote, Sreenivas 1170c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 1171c4a3e0a5SBagalkote, Sreenivas u32 opcode; /*18h */ 1172c4a3e0a5SBagalkote, Sreenivas 1173c4a3e0a5SBagalkote, Sreenivas union { /*1Ch */ 1174c4a3e0a5SBagalkote, Sreenivas u8 b[12]; 1175c4a3e0a5SBagalkote, Sreenivas u16 s[6]; 1176c4a3e0a5SBagalkote, Sreenivas u32 w[3]; 1177c4a3e0a5SBagalkote, Sreenivas } mbox; 1178c4a3e0a5SBagalkote, Sreenivas 1179c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*28h */ 1180c4a3e0a5SBagalkote, Sreenivas 1181c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1182c4a3e0a5SBagalkote, Sreenivas 1183c4a3e0a5SBagalkote, Sreenivas struct megasas_abort_frame { 1184c4a3e0a5SBagalkote, Sreenivas 1185c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1186c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 1187c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1188c4a3e0a5SBagalkote, Sreenivas 1189c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*03h */ 1190c4a3e0a5SBagalkote, Sreenivas u32 reserved_2; /*04h */ 1191c4a3e0a5SBagalkote, Sreenivas 1192c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 1193c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 1194c4a3e0a5SBagalkote, Sreenivas 1195c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 1196c4a3e0a5SBagalkote, Sreenivas u16 reserved_3; /*12h */ 1197c4a3e0a5SBagalkote, Sreenivas u32 reserved_4; /*14h */ 1198c4a3e0a5SBagalkote, Sreenivas 1199c4a3e0a5SBagalkote, Sreenivas u32 abort_context; /*18h */ 1200c4a3e0a5SBagalkote, Sreenivas u32 pad_1; /*1Ch */ 1201c4a3e0a5SBagalkote, Sreenivas 1202c4a3e0a5SBagalkote, Sreenivas u32 abort_mfi_phys_addr_lo; /*20h */ 1203c4a3e0a5SBagalkote, Sreenivas u32 abort_mfi_phys_addr_hi; /*24h */ 1204c4a3e0a5SBagalkote, Sreenivas 1205c4a3e0a5SBagalkote, Sreenivas u32 reserved_5[6]; /*28h */ 1206c4a3e0a5SBagalkote, Sreenivas 1207c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1208c4a3e0a5SBagalkote, Sreenivas 1209c4a3e0a5SBagalkote, Sreenivas struct megasas_smp_frame { 1210c4a3e0a5SBagalkote, Sreenivas 1211c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1212c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*01h */ 1213c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1214c4a3e0a5SBagalkote, Sreenivas u8 connection_status; /*03h */ 1215c4a3e0a5SBagalkote, Sreenivas 1216c4a3e0a5SBagalkote, Sreenivas u8 reserved_2[3]; /*04h */ 1217c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1218c4a3e0a5SBagalkote, Sreenivas 1219c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 1220c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 1221c4a3e0a5SBagalkote, Sreenivas 1222c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 1223c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 1224c4a3e0a5SBagalkote, Sreenivas 1225c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 1226c4a3e0a5SBagalkote, Sreenivas u64 sas_addr; /*18h */ 1227c4a3e0a5SBagalkote, Sreenivas 1228c4a3e0a5SBagalkote, Sreenivas union { 1229c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */ 1230c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */ 1231c4a3e0a5SBagalkote, Sreenivas } sgl; 1232c4a3e0a5SBagalkote, Sreenivas 1233c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1234c4a3e0a5SBagalkote, Sreenivas 1235c4a3e0a5SBagalkote, Sreenivas struct megasas_stp_frame { 1236c4a3e0a5SBagalkote, Sreenivas 1237c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 1238c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*01h */ 1239c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 1240c4a3e0a5SBagalkote, Sreenivas u8 reserved_2; /*03h */ 1241c4a3e0a5SBagalkote, Sreenivas 1242c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 1243c4a3e0a5SBagalkote, Sreenivas u8 reserved_3[2]; /*05h */ 1244c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 1245c4a3e0a5SBagalkote, Sreenivas 1246c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 1247c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 1248c4a3e0a5SBagalkote, Sreenivas 1249c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 1250c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 1251c4a3e0a5SBagalkote, Sreenivas 1252c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 1253c4a3e0a5SBagalkote, Sreenivas 1254c4a3e0a5SBagalkote, Sreenivas u16 fis[10]; /*18h */ 1255c4a3e0a5SBagalkote, Sreenivas u32 stp_flags; 1256c4a3e0a5SBagalkote, Sreenivas 1257c4a3e0a5SBagalkote, Sreenivas union { 1258c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */ 1259c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */ 1260c4a3e0a5SBagalkote, Sreenivas } sgl; 1261c4a3e0a5SBagalkote, Sreenivas 1262c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1263c4a3e0a5SBagalkote, Sreenivas 1264c4a3e0a5SBagalkote, Sreenivas union megasas_frame { 1265c4a3e0a5SBagalkote, Sreenivas 1266c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 1267c4a3e0a5SBagalkote, Sreenivas struct megasas_init_frame init; 1268c4a3e0a5SBagalkote, Sreenivas struct megasas_io_frame io; 1269c4a3e0a5SBagalkote, Sreenivas struct megasas_pthru_frame pthru; 1270c4a3e0a5SBagalkote, Sreenivas struct megasas_dcmd_frame dcmd; 1271c4a3e0a5SBagalkote, Sreenivas struct megasas_abort_frame abort; 1272c4a3e0a5SBagalkote, Sreenivas struct megasas_smp_frame smp; 1273c4a3e0a5SBagalkote, Sreenivas struct megasas_stp_frame stp; 1274c4a3e0a5SBagalkote, Sreenivas 1275c4a3e0a5SBagalkote, Sreenivas u8 raw_bytes[64]; 1276c4a3e0a5SBagalkote, Sreenivas }; 1277c4a3e0a5SBagalkote, Sreenivas 1278c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd; 1279c4a3e0a5SBagalkote, Sreenivas 1280c4a3e0a5SBagalkote, Sreenivas union megasas_evt_class_locale { 1281c4a3e0a5SBagalkote, Sreenivas 1282c4a3e0a5SBagalkote, Sreenivas struct { 1283c4a3e0a5SBagalkote, Sreenivas u16 locale; 1284c4a3e0a5SBagalkote, Sreenivas u8 reserved; 1285c4a3e0a5SBagalkote, Sreenivas s8 class; 1286c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) members; 1287c4a3e0a5SBagalkote, Sreenivas 1288c4a3e0a5SBagalkote, Sreenivas u32 word; 1289c4a3e0a5SBagalkote, Sreenivas 1290c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1291c4a3e0a5SBagalkote, Sreenivas 1292c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_log_info { 1293c4a3e0a5SBagalkote, Sreenivas u32 newest_seq_num; 1294c4a3e0a5SBagalkote, Sreenivas u32 oldest_seq_num; 1295c4a3e0a5SBagalkote, Sreenivas u32 clear_seq_num; 1296c4a3e0a5SBagalkote, Sreenivas u32 shutdown_seq_num; 1297c4a3e0a5SBagalkote, Sreenivas u32 boot_seq_num; 1298c4a3e0a5SBagalkote, Sreenivas 1299c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1300c4a3e0a5SBagalkote, Sreenivas 1301c4a3e0a5SBagalkote, Sreenivas struct megasas_progress { 1302c4a3e0a5SBagalkote, Sreenivas 1303c4a3e0a5SBagalkote, Sreenivas u16 progress; 1304c4a3e0a5SBagalkote, Sreenivas u16 elapsed_seconds; 1305c4a3e0a5SBagalkote, Sreenivas 1306c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1307c4a3e0a5SBagalkote, Sreenivas 1308c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld { 1309c4a3e0a5SBagalkote, Sreenivas 1310c4a3e0a5SBagalkote, Sreenivas u16 target_id; 1311c4a3e0a5SBagalkote, Sreenivas u8 ld_index; 1312c4a3e0a5SBagalkote, Sreenivas u8 reserved; 1313c4a3e0a5SBagalkote, Sreenivas 1314c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1315c4a3e0a5SBagalkote, Sreenivas 1316c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd { 1317c4a3e0a5SBagalkote, Sreenivas u16 device_id; 1318c4a3e0a5SBagalkote, Sreenivas u8 encl_index; 1319c4a3e0a5SBagalkote, Sreenivas u8 slot_number; 1320c4a3e0a5SBagalkote, Sreenivas 1321c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1322c4a3e0a5SBagalkote, Sreenivas 1323c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_detail { 1324c4a3e0a5SBagalkote, Sreenivas 1325c4a3e0a5SBagalkote, Sreenivas u32 seq_num; 1326c4a3e0a5SBagalkote, Sreenivas u32 time_stamp; 1327c4a3e0a5SBagalkote, Sreenivas u32 code; 1328c4a3e0a5SBagalkote, Sreenivas union megasas_evt_class_locale cl; 1329c4a3e0a5SBagalkote, Sreenivas u8 arg_type; 1330c4a3e0a5SBagalkote, Sreenivas u8 reserved1[15]; 1331c4a3e0a5SBagalkote, Sreenivas 1332c4a3e0a5SBagalkote, Sreenivas union { 1333c4a3e0a5SBagalkote, Sreenivas struct { 1334c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1335c4a3e0a5SBagalkote, Sreenivas u8 cdb_length; 1336c4a3e0a5SBagalkote, Sreenivas u8 sense_length; 1337c4a3e0a5SBagalkote, Sreenivas u8 reserved[2]; 1338c4a3e0a5SBagalkote, Sreenivas u8 cdb[16]; 1339c4a3e0a5SBagalkote, Sreenivas u8 sense[64]; 1340c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) cdbSense; 1341c4a3e0a5SBagalkote, Sreenivas 1342c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1343c4a3e0a5SBagalkote, Sreenivas 1344c4a3e0a5SBagalkote, Sreenivas struct { 1345c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1346c4a3e0a5SBagalkote, Sreenivas u64 count; 1347c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_count; 1348c4a3e0a5SBagalkote, Sreenivas 1349c4a3e0a5SBagalkote, Sreenivas struct { 1350c4a3e0a5SBagalkote, Sreenivas u64 lba; 1351c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1352c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_lba; 1353c4a3e0a5SBagalkote, Sreenivas 1354c4a3e0a5SBagalkote, Sreenivas struct { 1355c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1356c4a3e0a5SBagalkote, Sreenivas u32 prevOwner; 1357c4a3e0a5SBagalkote, Sreenivas u32 newOwner; 1358c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_owner; 1359c4a3e0a5SBagalkote, Sreenivas 1360c4a3e0a5SBagalkote, Sreenivas struct { 1361c4a3e0a5SBagalkote, Sreenivas u64 ld_lba; 1362c4a3e0a5SBagalkote, Sreenivas u64 pd_lba; 1363c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1364c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1365c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_lba_pd_lba; 1366c4a3e0a5SBagalkote, Sreenivas 1367c4a3e0a5SBagalkote, Sreenivas struct { 1368c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1369c4a3e0a5SBagalkote, Sreenivas struct megasas_progress prog; 1370c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_prog; 1371c4a3e0a5SBagalkote, Sreenivas 1372c4a3e0a5SBagalkote, Sreenivas struct { 1373c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1374c4a3e0a5SBagalkote, Sreenivas u32 prev_state; 1375c4a3e0a5SBagalkote, Sreenivas u32 new_state; 1376c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_state; 1377c4a3e0a5SBagalkote, Sreenivas 1378c4a3e0a5SBagalkote, Sreenivas struct { 1379c4a3e0a5SBagalkote, Sreenivas u64 strip; 1380c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1381c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_strip; 1382c4a3e0a5SBagalkote, Sreenivas 1383c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1384c4a3e0a5SBagalkote, Sreenivas 1385c4a3e0a5SBagalkote, Sreenivas struct { 1386c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1387c4a3e0a5SBagalkote, Sreenivas u32 err; 1388c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_err; 1389c4a3e0a5SBagalkote, Sreenivas 1390c4a3e0a5SBagalkote, Sreenivas struct { 1391c4a3e0a5SBagalkote, Sreenivas u64 lba; 1392c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1393c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_lba; 1394c4a3e0a5SBagalkote, Sreenivas 1395c4a3e0a5SBagalkote, Sreenivas struct { 1396c4a3e0a5SBagalkote, Sreenivas u64 lba; 1397c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1398c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1399c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_lba_ld; 1400c4a3e0a5SBagalkote, Sreenivas 1401c4a3e0a5SBagalkote, Sreenivas struct { 1402c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1403c4a3e0a5SBagalkote, Sreenivas struct megasas_progress prog; 1404c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_prog; 1405c4a3e0a5SBagalkote, Sreenivas 1406c4a3e0a5SBagalkote, Sreenivas struct { 1407c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1408c4a3e0a5SBagalkote, Sreenivas u32 prevState; 1409c4a3e0a5SBagalkote, Sreenivas u32 newState; 1410c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_state; 1411c4a3e0a5SBagalkote, Sreenivas 1412c4a3e0a5SBagalkote, Sreenivas struct { 1413c4a3e0a5SBagalkote, Sreenivas u16 vendorId; 1414c4a3e0a5SBagalkote, Sreenivas u16 deviceId; 1415c4a3e0a5SBagalkote, Sreenivas u16 subVendorId; 1416c4a3e0a5SBagalkote, Sreenivas u16 subDeviceId; 1417c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pci; 1418c4a3e0a5SBagalkote, Sreenivas 1419c4a3e0a5SBagalkote, Sreenivas u32 rate; 1420c4a3e0a5SBagalkote, Sreenivas char str[96]; 1421c4a3e0a5SBagalkote, Sreenivas 1422c4a3e0a5SBagalkote, Sreenivas struct { 1423c4a3e0a5SBagalkote, Sreenivas u32 rtc; 1424c4a3e0a5SBagalkote, Sreenivas u32 elapsedSeconds; 1425c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) time; 1426c4a3e0a5SBagalkote, Sreenivas 1427c4a3e0a5SBagalkote, Sreenivas struct { 1428c4a3e0a5SBagalkote, Sreenivas u32 ecar; 1429c4a3e0a5SBagalkote, Sreenivas u32 elog; 1430c4a3e0a5SBagalkote, Sreenivas char str[64]; 1431c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ecc; 1432c4a3e0a5SBagalkote, Sreenivas 1433c4a3e0a5SBagalkote, Sreenivas u8 b[96]; 1434c4a3e0a5SBagalkote, Sreenivas u16 s[48]; 1435c4a3e0a5SBagalkote, Sreenivas u32 w[24]; 1436c4a3e0a5SBagalkote, Sreenivas u64 d[12]; 1437c4a3e0a5SBagalkote, Sreenivas } args; 1438c4a3e0a5SBagalkote, Sreenivas 1439c4a3e0a5SBagalkote, Sreenivas char description[128]; 1440c4a3e0a5SBagalkote, Sreenivas 1441c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1442c4a3e0a5SBagalkote, Sreenivas 14437e8a75f4SYang, Bo struct megasas_aen_event { 1444c1d390d8SXiaotian Feng struct delayed_work hotplug_work; 14457e8a75f4SYang, Bo struct megasas_instance *instance; 14467e8a75f4SYang, Bo }; 14477e8a75f4SYang, Bo 1448c8e858feSadam radford struct megasas_irq_context { 1449c8e858feSadam radford struct megasas_instance *instance; 1450c8e858feSadam radford u32 MSIxIndex; 1451c8e858feSadam radford }; 1452c8e858feSadam radford 1453c4a3e0a5SBagalkote, Sreenivas struct megasas_instance { 1454c4a3e0a5SBagalkote, Sreenivas 1455c4a3e0a5SBagalkote, Sreenivas u32 *producer; 1456c4a3e0a5SBagalkote, Sreenivas dma_addr_t producer_h; 1457c4a3e0a5SBagalkote, Sreenivas u32 *consumer; 1458c4a3e0a5SBagalkote, Sreenivas dma_addr_t consumer_h; 1459c4a3e0a5SBagalkote, Sreenivas 1460c4a3e0a5SBagalkote, Sreenivas u32 *reply_queue; 1461c4a3e0a5SBagalkote, Sreenivas dma_addr_t reply_queue_h; 1462c4a3e0a5SBagalkote, Sreenivas 1463c4a3e0a5SBagalkote, Sreenivas unsigned long base_addr; 1464c4a3e0a5SBagalkote, Sreenivas struct megasas_register_set __iomem *reg_set; 1465d46a3ad6SSumit.Saxena@lsi.com u32 *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; 146681e403ceSYang, Bo struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; 1467bdc6fb8dSYang, Bo u8 ld_ids[MEGASAS_MAX_LD_IDS]; 1468c4a3e0a5SBagalkote, Sreenivas s8 init_id; 1469c4a3e0a5SBagalkote, Sreenivas 1470c4a3e0a5SBagalkote, Sreenivas u16 max_num_sge; 1471c4a3e0a5SBagalkote, Sreenivas u16 max_fw_cmds; 14729c915a8cSadam radford /* For Fusion its num IOCTL cmds, for others MFI based its 14739c915a8cSadam radford max_fw_cmds */ 14749c915a8cSadam radford u16 max_mfi_cmds; 1475c4a3e0a5SBagalkote, Sreenivas u32 max_sectors_per_req; 14767e8a75f4SYang, Bo struct megasas_aen_event *ev; 1477c4a3e0a5SBagalkote, Sreenivas 1478c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd **cmd_list; 1479c4a3e0a5SBagalkote, Sreenivas struct list_head cmd_pool; 148039a98554Sbo yang /* used to sync fire the cmd to fw */ 1481c4a3e0a5SBagalkote, Sreenivas spinlock_t cmd_pool_lock; 148239a98554Sbo yang /* used to sync fire the cmd to fw */ 148339a98554Sbo yang spinlock_t hba_lock; 14847343eb65Sbo yang /* used to synch producer, consumer ptrs in dpc */ 14857343eb65Sbo yang spinlock_t completion_lock; 1486c4a3e0a5SBagalkote, Sreenivas struct dma_pool *frame_dma_pool; 1487c4a3e0a5SBagalkote, Sreenivas struct dma_pool *sense_dma_pool; 1488c4a3e0a5SBagalkote, Sreenivas 1489c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_detail *evt_detail; 1490c4a3e0a5SBagalkote, Sreenivas dma_addr_t evt_detail_h; 1491c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd *aen_cmd; 1492e5a69e27SMatthias Kaehlcke struct mutex aen_mutex; 1493c4a3e0a5SBagalkote, Sreenivas struct semaphore ioctl_sem; 1494c4a3e0a5SBagalkote, Sreenivas 1495c4a3e0a5SBagalkote, Sreenivas struct Scsi_Host *host; 1496c4a3e0a5SBagalkote, Sreenivas 1497c4a3e0a5SBagalkote, Sreenivas wait_queue_head_t int_cmd_wait_q; 1498c4a3e0a5SBagalkote, Sreenivas wait_queue_head_t abort_cmd_wait_q; 1499c4a3e0a5SBagalkote, Sreenivas 1500c4a3e0a5SBagalkote, Sreenivas struct pci_dev *pdev; 1501c4a3e0a5SBagalkote, Sreenivas u32 unique_id; 150239a98554Sbo yang u32 fw_support_ieee; 1503c4a3e0a5SBagalkote, Sreenivas 1504e4a082c7SSumant Patro atomic_t fw_outstanding; 150539a98554Sbo yang atomic_t fw_reset_no_pci_access; 15061341c939SSumant Patro 15071341c939SSumant Patro struct megasas_instance_template *instancet; 15085d018ad0SSumant Patro struct tasklet_struct isr_tasklet; 150939a98554Sbo yang struct work_struct work_init; 151005e9ebbeSSumant Patro 151105e9ebbeSSumant Patro u8 flag; 1512c3518837SYang, Bo u8 unload; 1513f4c9a131SYang, Bo u8 flag_ieee; 151439a98554Sbo yang u8 issuepend_done; 151539a98554Sbo yang u8 disableOnlineCtrlReset; 1516bc93d425SSumit.Saxena@lsi.com u8 UnevenSpanSupport; 151739a98554Sbo yang u8 adprecovery; 151805e9ebbeSSumant Patro unsigned long last_time; 151939a98554Sbo yang u32 mfiStatus; 152039a98554Sbo yang u32 last_seq_num; 1521ad84db2eSbo yang 152239a98554Sbo yang struct list_head internal_reset_pending_q; 152380d9da98Sadam radford 152425985edcSLucas De Marchi /* Ptr to hba specific information */ 15259c915a8cSadam radford void *ctrl_context; 1526c8e858feSadam radford unsigned int msix_vectors; 1527c8e858feSadam radford struct msix_entry msixentry[MEGASAS_MAX_MSIX_QUEUES]; 1528c8e858feSadam radford struct megasas_irq_context irq_context[MEGASAS_MAX_MSIX_QUEUES]; 15299c915a8cSadam radford u64 map_id; 15309c915a8cSadam radford struct megasas_cmd *map_update_cmd; 1531b6d5d880Sadam radford unsigned long bar; 15329c915a8cSadam radford long reset_flags; 15339c915a8cSadam radford struct mutex reset_mutex; 1534c5daa6a9Sadam radford int throttlequeuedepth; 1535d46a3ad6SSumit.Saxena@lsi.com u8 mask_interrupts; 153639a98554Sbo yang }; 153739a98554Sbo yang 153839a98554Sbo yang enum { 153939a98554Sbo yang MEGASAS_HBA_OPERATIONAL = 0, 154039a98554Sbo yang MEGASAS_ADPRESET_SM_INFAULT = 1, 154139a98554Sbo yang MEGASAS_ADPRESET_SM_FW_RESET_SUCCESS = 2, 154239a98554Sbo yang MEGASAS_ADPRESET_SM_OPERATIONAL = 3, 154339a98554Sbo yang MEGASAS_HW_CRITICAL_ERROR = 4, 154439a98554Sbo yang MEGASAS_ADPRESET_INPROG_SIGN = 0xDEADDEAD, 1545c4a3e0a5SBagalkote, Sreenivas }; 1546c4a3e0a5SBagalkote, Sreenivas 15470c79e681SYang, Bo struct megasas_instance_template { 15480c79e681SYang, Bo void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \ 15490c79e681SYang, Bo u32, struct megasas_register_set __iomem *); 15500c79e681SYang, Bo 1551d46a3ad6SSumit.Saxena@lsi.com void (*enable_intr)(struct megasas_instance *); 1552d46a3ad6SSumit.Saxena@lsi.com void (*disable_intr)(struct megasas_instance *); 15530c79e681SYang, Bo 15540c79e681SYang, Bo int (*clear_intr)(struct megasas_register_set __iomem *); 15550c79e681SYang, Bo 15560c79e681SYang, Bo u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); 155739a98554Sbo yang int (*adp_reset)(struct megasas_instance *, \ 155839a98554Sbo yang struct megasas_register_set __iomem *); 155939a98554Sbo yang int (*check_reset)(struct megasas_instance *, \ 156039a98554Sbo yang struct megasas_register_set __iomem *); 1561cd50ba8eSadam radford irqreturn_t (*service_isr)(int irq, void *devp); 1562cd50ba8eSadam radford void (*tasklet)(unsigned long); 1563cd50ba8eSadam radford u32 (*init_adapter)(struct megasas_instance *); 1564cd50ba8eSadam radford u32 (*build_and_issue_cmd) (struct megasas_instance *, 1565cd50ba8eSadam radford struct scsi_cmnd *); 1566cd50ba8eSadam radford void (*issue_dcmd) (struct megasas_instance *instance, 1567cd50ba8eSadam radford struct megasas_cmd *cmd); 15680c79e681SYang, Bo }; 15690c79e681SYang, Bo 1570c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IS_LOGICAL(scp) \ 1571c4a3e0a5SBagalkote, Sreenivas (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 1572c4a3e0a5SBagalkote, Sreenivas 1573c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_DEV_INDEX(inst, scp) \ 1574c4a3e0a5SBagalkote, Sreenivas ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ 1575c4a3e0a5SBagalkote, Sreenivas scp->device->id 1576c4a3e0a5SBagalkote, Sreenivas 1577c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd { 1578c4a3e0a5SBagalkote, Sreenivas 1579c4a3e0a5SBagalkote, Sreenivas union megasas_frame *frame; 1580c4a3e0a5SBagalkote, Sreenivas dma_addr_t frame_phys_addr; 1581c4a3e0a5SBagalkote, Sreenivas u8 *sense; 1582c4a3e0a5SBagalkote, Sreenivas dma_addr_t sense_phys_addr; 1583c4a3e0a5SBagalkote, Sreenivas 1584c4a3e0a5SBagalkote, Sreenivas u32 index; 1585c4a3e0a5SBagalkote, Sreenivas u8 sync_cmd; 1586c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; 158739a98554Sbo yang u8 abort_aen; 158839a98554Sbo yang u8 retry_for_fw_reset; 158939a98554Sbo yang 1590c4a3e0a5SBagalkote, Sreenivas 1591c4a3e0a5SBagalkote, Sreenivas struct list_head list; 1592c4a3e0a5SBagalkote, Sreenivas struct scsi_cmnd *scmd; 1593c4a3e0a5SBagalkote, Sreenivas struct megasas_instance *instance; 15949c915a8cSadam radford union { 15959c915a8cSadam radford struct { 15969c915a8cSadam radford u16 smid; 15979c915a8cSadam radford u16 resvd; 15989c915a8cSadam radford } context; 1599c4a3e0a5SBagalkote, Sreenivas u32 frame_count; 1600c4a3e0a5SBagalkote, Sreenivas }; 16019c915a8cSadam radford }; 1602c4a3e0a5SBagalkote, Sreenivas 1603c4a3e0a5SBagalkote, Sreenivas #define MAX_MGMT_ADAPTERS 1024 1604c4a3e0a5SBagalkote, Sreenivas #define MAX_IOCTL_SGE 16 1605c4a3e0a5SBagalkote, Sreenivas 1606c4a3e0a5SBagalkote, Sreenivas struct megasas_iocpacket { 1607c4a3e0a5SBagalkote, Sreenivas 1608c4a3e0a5SBagalkote, Sreenivas u16 host_no; 1609c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 1610c4a3e0a5SBagalkote, Sreenivas u32 sgl_off; 1611c4a3e0a5SBagalkote, Sreenivas u32 sge_count; 1612c4a3e0a5SBagalkote, Sreenivas u32 sense_off; 1613c4a3e0a5SBagalkote, Sreenivas u32 sense_len; 1614c4a3e0a5SBagalkote, Sreenivas union { 1615c4a3e0a5SBagalkote, Sreenivas u8 raw[128]; 1616c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 1617c4a3e0a5SBagalkote, Sreenivas } frame; 1618c4a3e0a5SBagalkote, Sreenivas 1619c4a3e0a5SBagalkote, Sreenivas struct iovec sgl[MAX_IOCTL_SGE]; 1620c4a3e0a5SBagalkote, Sreenivas 1621c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1622c4a3e0a5SBagalkote, Sreenivas 1623c4a3e0a5SBagalkote, Sreenivas struct megasas_aen { 1624c4a3e0a5SBagalkote, Sreenivas u16 host_no; 1625c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 1626c4a3e0a5SBagalkote, Sreenivas u32 seq_num; 1627c4a3e0a5SBagalkote, Sreenivas u32 class_locale_word; 1628c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1629c4a3e0a5SBagalkote, Sreenivas 1630c4a3e0a5SBagalkote, Sreenivas #ifdef CONFIG_COMPAT 1631c4a3e0a5SBagalkote, Sreenivas struct compat_megasas_iocpacket { 1632c4a3e0a5SBagalkote, Sreenivas u16 host_no; 1633c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 1634c4a3e0a5SBagalkote, Sreenivas u32 sgl_off; 1635c4a3e0a5SBagalkote, Sreenivas u32 sge_count; 1636c4a3e0a5SBagalkote, Sreenivas u32 sense_off; 1637c4a3e0a5SBagalkote, Sreenivas u32 sense_len; 1638c4a3e0a5SBagalkote, Sreenivas union { 1639c4a3e0a5SBagalkote, Sreenivas u8 raw[128]; 1640c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 1641c4a3e0a5SBagalkote, Sreenivas } frame; 1642c4a3e0a5SBagalkote, Sreenivas struct compat_iovec sgl[MAX_IOCTL_SGE]; 1643c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1644c4a3e0a5SBagalkote, Sreenivas 16450e98936cSSumant Patro #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket) 1646c4a3e0a5SBagalkote, Sreenivas #endif 1647c4a3e0a5SBagalkote, Sreenivas 1648cb59aa6aSSumant Patro #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) 1649c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) 1650c4a3e0a5SBagalkote, Sreenivas 1651c4a3e0a5SBagalkote, Sreenivas struct megasas_mgmt_info { 1652c4a3e0a5SBagalkote, Sreenivas 1653c4a3e0a5SBagalkote, Sreenivas u16 count; 1654c4a3e0a5SBagalkote, Sreenivas struct megasas_instance *instance[MAX_MGMT_ADAPTERS]; 1655c4a3e0a5SBagalkote, Sreenivas int max_index; 1656c4a3e0a5SBagalkote, Sreenivas }; 1657c4a3e0a5SBagalkote, Sreenivas 1658c4a3e0a5SBagalkote, Sreenivas #endif /*LSI_MEGARAID_SAS_H */ 1659