1c4a3e0a5SBagalkote, Sreenivas /* 2c4a3e0a5SBagalkote, Sreenivas * 3c4a3e0a5SBagalkote, Sreenivas * Linux MegaRAID driver for SAS based RAID controllers 4c4a3e0a5SBagalkote, Sreenivas * 5c4a3e0a5SBagalkote, Sreenivas * Copyright (c) 2003-2005 LSI Logic Corporation. 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 9c4a3e0a5SBagalkote, Sreenivas * as published by the Free Software Foundation; either version 10c4a3e0a5SBagalkote, Sreenivas * 2 of the License, or (at your option) any later version. 11c4a3e0a5SBagalkote, Sreenivas * 12c4a3e0a5SBagalkote, Sreenivas * FILE : megaraid_sas.h 13c4a3e0a5SBagalkote, Sreenivas */ 14c4a3e0a5SBagalkote, Sreenivas 15c4a3e0a5SBagalkote, Sreenivas #ifndef LSI_MEGARAID_SAS_H 16c4a3e0a5SBagalkote, Sreenivas #define LSI_MEGARAID_SAS_H 17c4a3e0a5SBagalkote, Sreenivas 18c4a3e0a5SBagalkote, Sreenivas /** 19c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS Driver meta data 20c4a3e0a5SBagalkote, Sreenivas */ 210e98936cSSumant Patro #define MEGASAS_VERSION "00.00.03.01" 220e98936cSSumant Patro #define MEGASAS_RELDATE "May 14, 2006" 230e98936cSSumant Patro #define MEGASAS_EXT_VERSION "Sun May 14 22:49:52 PDT 2006" 240e98936cSSumant Patro 250e98936cSSumant Patro /* 260e98936cSSumant Patro * Device IDs 270e98936cSSumant Patro */ 280e98936cSSumant Patro #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 290e98936cSSumant Patro #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 300e98936cSSumant Patro 31c4a3e0a5SBagalkote, Sreenivas /* 32c4a3e0a5SBagalkote, Sreenivas * ===================================== 33c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS MFI firmware definitions 34c4a3e0a5SBagalkote, Sreenivas * ===================================== 35c4a3e0a5SBagalkote, Sreenivas */ 36c4a3e0a5SBagalkote, Sreenivas 37c4a3e0a5SBagalkote, Sreenivas /* 38c4a3e0a5SBagalkote, Sreenivas * MFI stands for MegaRAID SAS FW Interface. This is just a moniker for 39c4a3e0a5SBagalkote, Sreenivas * protocol between the software and firmware. Commands are issued using 40c4a3e0a5SBagalkote, Sreenivas * "message frames" 41c4a3e0a5SBagalkote, Sreenivas */ 42c4a3e0a5SBagalkote, Sreenivas 43c4a3e0a5SBagalkote, Sreenivas /** 44c4a3e0a5SBagalkote, Sreenivas * FW posts its state in upper 4 bits of outbound_msg_0 register 45c4a3e0a5SBagalkote, Sreenivas */ 46c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_MASK 0xF0000000 47c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_UNDEFINED 0x00000000 48c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_BB_INIT 0x10000000 49c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FW_INIT 0x40000000 50c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_WAIT_HANDSHAKE 0x60000000 51c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FW_INIT_2 0x70000000 52c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_DEVICE_SCAN 0x80000000 53e3bbff9fSSumant Patro #define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000 54c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FLUSH_CACHE 0xA0000000 55c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_READY 0xB0000000 56c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_OPERATIONAL 0xC0000000 57c4a3e0a5SBagalkote, Sreenivas #define MFI_STATE_FAULT 0xF0000000 58c4a3e0a5SBagalkote, Sreenivas 59c4a3e0a5SBagalkote, Sreenivas #define MEGAMFI_FRAME_SIZE 64 60c4a3e0a5SBagalkote, Sreenivas 61c4a3e0a5SBagalkote, Sreenivas /** 62c4a3e0a5SBagalkote, Sreenivas * During FW init, clear pending cmds & reset state using inbound_msg_0 63c4a3e0a5SBagalkote, Sreenivas * 64c4a3e0a5SBagalkote, Sreenivas * ABORT : Abort all pending cmds 65c4a3e0a5SBagalkote, Sreenivas * READY : Move from OPERATIONAL to READY state; discard queue info 66c4a3e0a5SBagalkote, Sreenivas * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??) 67c4a3e0a5SBagalkote, Sreenivas * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver 68e3bbff9fSSumant Patro * HOTPLUG : Resume from Hotplug 69e3bbff9fSSumant Patro * MFI_STOP_ADP : Send signal to FW to stop processing 70c4a3e0a5SBagalkote, Sreenivas */ 71e3bbff9fSSumant Patro #define MFI_INIT_ABORT 0x00000001 72c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_READY 0x00000002 73c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_MFIMODE 0x00000004 74c4a3e0a5SBagalkote, Sreenivas #define MFI_INIT_CLEAR_HANDSHAKE 0x00000008 75e3bbff9fSSumant Patro #define MFI_INIT_HOTPLUG 0x00000010 76e3bbff9fSSumant Patro #define MFI_STOP_ADP 0x00000020 77e3bbff9fSSumant Patro #define MFI_RESET_FLAGS MFI_INIT_READY| \ 78e3bbff9fSSumant Patro MFI_INIT_MFIMODE| \ 79e3bbff9fSSumant Patro MFI_INIT_ABORT 80c4a3e0a5SBagalkote, Sreenivas 81c4a3e0a5SBagalkote, Sreenivas /** 82c4a3e0a5SBagalkote, Sreenivas * MFI frame flags 83c4a3e0a5SBagalkote, Sreenivas */ 84c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000 85c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001 86c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SGL32 0x0000 87c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SGL64 0x0002 88c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SENSE32 0x0000 89c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_SENSE64 0x0004 90c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_NONE 0x0000 91c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_WRITE 0x0008 92c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_READ 0x0010 93c4a3e0a5SBagalkote, Sreenivas #define MFI_FRAME_DIR_BOTH 0x0018 94c4a3e0a5SBagalkote, Sreenivas 95c4a3e0a5SBagalkote, Sreenivas /** 96c4a3e0a5SBagalkote, Sreenivas * Definition for cmd_status 97c4a3e0a5SBagalkote, Sreenivas */ 98c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_STATUS_POLL_MODE 0xFF 99c4a3e0a5SBagalkote, Sreenivas 100c4a3e0a5SBagalkote, Sreenivas /** 101c4a3e0a5SBagalkote, Sreenivas * MFI command opcodes 102c4a3e0a5SBagalkote, Sreenivas */ 103c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_INIT 0x00 104c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_READ 0x01 105c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_WRITE 0x02 106c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_LD_SCSI_IO 0x03 107c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_PD_SCSI_IO 0x04 108c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_DCMD 0x05 109c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_ABORT 0x06 110c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_SMP 0x07 111c4a3e0a5SBagalkote, Sreenivas #define MFI_CMD_STP 0x08 112c4a3e0a5SBagalkote, Sreenivas 113c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_GET_INFO 0x01010000 114c4a3e0a5SBagalkote, Sreenivas 115c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000 116c4a3e0a5SBagalkote, Sreenivas #define MR_FLUSH_CTRL_CACHE 0x01 117c4a3e0a5SBagalkote, Sreenivas #define MR_FLUSH_DISK_CACHE 0x02 118c4a3e0a5SBagalkote, Sreenivas 119c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_SHUTDOWN 0x01050000 120c4a3e0a5SBagalkote, Sreenivas #define MR_ENABLE_DRIVE_SPINDOWN 0x01 121c4a3e0a5SBagalkote, Sreenivas 122c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100 123c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_GET 0x01040300 124c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500 125c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_LD_GET_PROPERTIES 0x03030000 126c4a3e0a5SBagalkote, Sreenivas 127c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER 0x08000000 128c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100 129c4a3e0a5SBagalkote, Sreenivas #define MR_DCMD_CLUSTER_RESET_LD 0x08010200 130c4a3e0a5SBagalkote, Sreenivas 131c4a3e0a5SBagalkote, Sreenivas /** 132c4a3e0a5SBagalkote, Sreenivas * MFI command completion codes 133c4a3e0a5SBagalkote, Sreenivas */ 134c4a3e0a5SBagalkote, Sreenivas enum MFI_STAT { 135c4a3e0a5SBagalkote, Sreenivas MFI_STAT_OK = 0x00, 136c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_CMD = 0x01, 137c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_DCMD = 0x02, 138c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_PARAMETER = 0x03, 139c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04, 140c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ABORT_NOT_POSSIBLE = 0x05, 141c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06, 142c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_IN_USE = 0x07, 143c4a3e0a5SBagalkote, Sreenivas MFI_STAT_APP_NOT_INITIALIZED = 0x08, 144c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ARRAY_INDEX_INVALID = 0x09, 145c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a, 146c4a3e0a5SBagalkote, Sreenivas MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b, 147c4a3e0a5SBagalkote, Sreenivas MFI_STAT_DEVICE_NOT_FOUND = 0x0c, 148c4a3e0a5SBagalkote, Sreenivas MFI_STAT_DRIVE_TOO_SMALL = 0x0d, 149c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_ALLOC_FAIL = 0x0e, 150c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_BUSY = 0x0f, 151c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_ERROR = 0x10, 152c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_IMAGE_BAD = 0x11, 153c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12, 154c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_NOT_OPEN = 0x13, 155c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLASH_NOT_STARTED = 0x14, 156c4a3e0a5SBagalkote, Sreenivas MFI_STAT_FLUSH_FAILED = 0x15, 157c4a3e0a5SBagalkote, Sreenivas MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16, 158c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_CC_IN_PROGRESS = 0x17, 159c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_INIT_IN_PROGRESS = 0x18, 160c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19, 161c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_MAX_CONFIGURED = 0x1a, 162c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_NOT_OPTIMAL = 0x1b, 163c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c, 164c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d, 165c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e, 166c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f, 167c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20, 168c4a3e0a5SBagalkote, Sreenivas MFI_STAT_MFC_HW_ERROR = 0x21, 169c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NO_HW_PRESENT = 0x22, 170c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NOT_FOUND = 0x23, 171c4a3e0a5SBagalkote, Sreenivas MFI_STAT_NOT_IN_ENCL = 0x24, 172c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25, 173c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PD_TYPE_WRONG = 0x26, 174c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PR_DISABLED = 0x27, 175c4a3e0a5SBagalkote, Sreenivas MFI_STAT_ROW_INDEX_INVALID = 0x28, 176c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29, 177c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a, 178c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b, 179c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c, 180c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d, 181c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_IO_FAILED = 0x2e, 182c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f, 183c4a3e0a5SBagalkote, Sreenivas MFI_STAT_SHUTDOWN_FAILED = 0x30, 184c4a3e0a5SBagalkote, Sreenivas MFI_STAT_TIME_NOT_SET = 0x31, 185c4a3e0a5SBagalkote, Sreenivas MFI_STAT_WRONG_STATE = 0x32, 186c4a3e0a5SBagalkote, Sreenivas MFI_STAT_LD_OFFLINE = 0x33, 187c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PEER_NOTIFICATION_REJECTED = 0x34, 188c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PEER_NOTIFICATION_FAILED = 0x35, 189c4a3e0a5SBagalkote, Sreenivas MFI_STAT_RESERVATION_IN_PROGRESS = 0x36, 190c4a3e0a5SBagalkote, Sreenivas MFI_STAT_I2C_ERRORS_DETECTED = 0x37, 191c4a3e0a5SBagalkote, Sreenivas MFI_STAT_PCI_ERRORS_DETECTED = 0x38, 192c4a3e0a5SBagalkote, Sreenivas 193c4a3e0a5SBagalkote, Sreenivas MFI_STAT_INVALID_STATUS = 0xFF 194c4a3e0a5SBagalkote, Sreenivas }; 195c4a3e0a5SBagalkote, Sreenivas 196c4a3e0a5SBagalkote, Sreenivas /* 197c4a3e0a5SBagalkote, Sreenivas * Number of mailbox bytes in DCMD message frame 198c4a3e0a5SBagalkote, Sreenivas */ 199c4a3e0a5SBagalkote, Sreenivas #define MFI_MBOX_SIZE 12 200c4a3e0a5SBagalkote, Sreenivas 201c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_CLASS { 202c4a3e0a5SBagalkote, Sreenivas 203c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_DEBUG = -2, 204c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_PROGRESS = -1, 205c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_INFO = 0, 206c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_WARNING = 1, 207c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_CRITICAL = 2, 208c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_FATAL = 3, 209c4a3e0a5SBagalkote, Sreenivas MR_EVT_CLASS_DEAD = 4, 210c4a3e0a5SBagalkote, Sreenivas 211c4a3e0a5SBagalkote, Sreenivas }; 212c4a3e0a5SBagalkote, Sreenivas 213c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_LOCALE { 214c4a3e0a5SBagalkote, Sreenivas 215c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_LD = 0x0001, 216c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_PD = 0x0002, 217c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_ENCL = 0x0004, 218c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_BBU = 0x0008, 219c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_SAS = 0x0010, 220c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CTRL = 0x0020, 221c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CONFIG = 0x0040, 222c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_CLUSTER = 0x0080, 223c4a3e0a5SBagalkote, Sreenivas MR_EVT_LOCALE_ALL = 0xffff, 224c4a3e0a5SBagalkote, Sreenivas 225c4a3e0a5SBagalkote, Sreenivas }; 226c4a3e0a5SBagalkote, Sreenivas 227c4a3e0a5SBagalkote, Sreenivas enum MR_EVT_ARGS { 228c4a3e0a5SBagalkote, Sreenivas 229c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_NONE, 230c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_CDB_SENSE, 231c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD, 232c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_COUNT, 233c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_LBA, 234c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_OWNER, 235c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_LBA_PD_LBA, 236c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_PROG, 237c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_STATE, 238c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_LD_STRIP, 239c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD, 240c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_ERR, 241c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_LBA, 242c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_LBA_LD, 243c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_PROG, 244c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PD_STATE, 245c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_PCI, 246c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_RATE, 247c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_STR, 248c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_TIME, 249c4a3e0a5SBagalkote, Sreenivas MR_EVT_ARGS_ECC, 250c4a3e0a5SBagalkote, Sreenivas 251c4a3e0a5SBagalkote, Sreenivas }; 252c4a3e0a5SBagalkote, Sreenivas 253c4a3e0a5SBagalkote, Sreenivas /* 254c4a3e0a5SBagalkote, Sreenivas * SAS controller properties 255c4a3e0a5SBagalkote, Sreenivas */ 256c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_prop { 257c4a3e0a5SBagalkote, Sreenivas 258c4a3e0a5SBagalkote, Sreenivas u16 seq_num; 259c4a3e0a5SBagalkote, Sreenivas u16 pred_fail_poll_interval; 260c4a3e0a5SBagalkote, Sreenivas u16 intr_throttle_count; 261c4a3e0a5SBagalkote, Sreenivas u16 intr_throttle_timeouts; 262c4a3e0a5SBagalkote, Sreenivas u8 rebuild_rate; 263c4a3e0a5SBagalkote, Sreenivas u8 patrol_read_rate; 264c4a3e0a5SBagalkote, Sreenivas u8 bgi_rate; 265c4a3e0a5SBagalkote, Sreenivas u8 cc_rate; 266c4a3e0a5SBagalkote, Sreenivas u8 recon_rate; 267c4a3e0a5SBagalkote, Sreenivas u8 cache_flush_interval; 268c4a3e0a5SBagalkote, Sreenivas u8 spinup_drv_count; 269c4a3e0a5SBagalkote, Sreenivas u8 spinup_delay; 270c4a3e0a5SBagalkote, Sreenivas u8 cluster_enable; 271c4a3e0a5SBagalkote, Sreenivas u8 coercion_mode; 272c4a3e0a5SBagalkote, Sreenivas u8 alarm_enable; 273c4a3e0a5SBagalkote, Sreenivas u8 disable_auto_rebuild; 274c4a3e0a5SBagalkote, Sreenivas u8 disable_battery_warn; 275c4a3e0a5SBagalkote, Sreenivas u8 ecc_bucket_size; 276c4a3e0a5SBagalkote, Sreenivas u16 ecc_bucket_leak_rate; 277c4a3e0a5SBagalkote, Sreenivas u8 restore_hotspare_on_insertion; 278c4a3e0a5SBagalkote, Sreenivas u8 expose_encl_devices; 279c4a3e0a5SBagalkote, Sreenivas u8 reserved[38]; 280c4a3e0a5SBagalkote, Sreenivas 281c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 282c4a3e0a5SBagalkote, Sreenivas 283c4a3e0a5SBagalkote, Sreenivas /* 284c4a3e0a5SBagalkote, Sreenivas * SAS controller information 285c4a3e0a5SBagalkote, Sreenivas */ 286c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_info { 287c4a3e0a5SBagalkote, Sreenivas 288c4a3e0a5SBagalkote, Sreenivas /* 289c4a3e0a5SBagalkote, Sreenivas * PCI device information 290c4a3e0a5SBagalkote, Sreenivas */ 291c4a3e0a5SBagalkote, Sreenivas struct { 292c4a3e0a5SBagalkote, Sreenivas 293c4a3e0a5SBagalkote, Sreenivas u16 vendor_id; 294c4a3e0a5SBagalkote, Sreenivas u16 device_id; 295c4a3e0a5SBagalkote, Sreenivas u16 sub_vendor_id; 296c4a3e0a5SBagalkote, Sreenivas u16 sub_device_id; 297c4a3e0a5SBagalkote, Sreenivas u8 reserved[24]; 298c4a3e0a5SBagalkote, Sreenivas 299c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pci; 300c4a3e0a5SBagalkote, Sreenivas 301c4a3e0a5SBagalkote, Sreenivas /* 302c4a3e0a5SBagalkote, Sreenivas * Host interface information 303c4a3e0a5SBagalkote, Sreenivas */ 304c4a3e0a5SBagalkote, Sreenivas struct { 305c4a3e0a5SBagalkote, Sreenivas 306c4a3e0a5SBagalkote, Sreenivas u8 PCIX:1; 307c4a3e0a5SBagalkote, Sreenivas u8 PCIE:1; 308c4a3e0a5SBagalkote, Sreenivas u8 iSCSI:1; 309c4a3e0a5SBagalkote, Sreenivas u8 SAS_3G:1; 310c4a3e0a5SBagalkote, Sreenivas u8 reserved_0:4; 311c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[6]; 312c4a3e0a5SBagalkote, Sreenivas u8 port_count; 313c4a3e0a5SBagalkote, Sreenivas u64 port_addr[8]; 314c4a3e0a5SBagalkote, Sreenivas 315c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) host_interface; 316c4a3e0a5SBagalkote, Sreenivas 317c4a3e0a5SBagalkote, Sreenivas /* 318c4a3e0a5SBagalkote, Sreenivas * Device (backend) interface information 319c4a3e0a5SBagalkote, Sreenivas */ 320c4a3e0a5SBagalkote, Sreenivas struct { 321c4a3e0a5SBagalkote, Sreenivas 322c4a3e0a5SBagalkote, Sreenivas u8 SPI:1; 323c4a3e0a5SBagalkote, Sreenivas u8 SAS_3G:1; 324c4a3e0a5SBagalkote, Sreenivas u8 SATA_1_5G:1; 325c4a3e0a5SBagalkote, Sreenivas u8 SATA_3G:1; 326c4a3e0a5SBagalkote, Sreenivas u8 reserved_0:4; 327c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[6]; 328c4a3e0a5SBagalkote, Sreenivas u8 port_count; 329c4a3e0a5SBagalkote, Sreenivas u64 port_addr[8]; 330c4a3e0a5SBagalkote, Sreenivas 331c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) device_interface; 332c4a3e0a5SBagalkote, Sreenivas 333c4a3e0a5SBagalkote, Sreenivas /* 334c4a3e0a5SBagalkote, Sreenivas * List of components residing in flash. All str are null terminated 335c4a3e0a5SBagalkote, Sreenivas */ 336c4a3e0a5SBagalkote, Sreenivas u32 image_check_word; 337c4a3e0a5SBagalkote, Sreenivas u32 image_component_count; 338c4a3e0a5SBagalkote, Sreenivas 339c4a3e0a5SBagalkote, Sreenivas struct { 340c4a3e0a5SBagalkote, Sreenivas 341c4a3e0a5SBagalkote, Sreenivas char name[8]; 342c4a3e0a5SBagalkote, Sreenivas char version[32]; 343c4a3e0a5SBagalkote, Sreenivas char build_date[16]; 344c4a3e0a5SBagalkote, Sreenivas char built_time[16]; 345c4a3e0a5SBagalkote, Sreenivas 346c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) image_component[8]; 347c4a3e0a5SBagalkote, Sreenivas 348c4a3e0a5SBagalkote, Sreenivas /* 349c4a3e0a5SBagalkote, Sreenivas * List of flash components that have been flashed on the card, but 350c4a3e0a5SBagalkote, Sreenivas * are not in use, pending reset of the adapter. This list will be 351c4a3e0a5SBagalkote, Sreenivas * empty if a flash operation has not occurred. All stings are null 352c4a3e0a5SBagalkote, Sreenivas * terminated 353c4a3e0a5SBagalkote, Sreenivas */ 354c4a3e0a5SBagalkote, Sreenivas u32 pending_image_component_count; 355c4a3e0a5SBagalkote, Sreenivas 356c4a3e0a5SBagalkote, Sreenivas struct { 357c4a3e0a5SBagalkote, Sreenivas 358c4a3e0a5SBagalkote, Sreenivas char name[8]; 359c4a3e0a5SBagalkote, Sreenivas char version[32]; 360c4a3e0a5SBagalkote, Sreenivas char build_date[16]; 361c4a3e0a5SBagalkote, Sreenivas char build_time[16]; 362c4a3e0a5SBagalkote, Sreenivas 363c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pending_image_component[8]; 364c4a3e0a5SBagalkote, Sreenivas 365c4a3e0a5SBagalkote, Sreenivas u8 max_arms; 366c4a3e0a5SBagalkote, Sreenivas u8 max_spans; 367c4a3e0a5SBagalkote, Sreenivas u8 max_arrays; 368c4a3e0a5SBagalkote, Sreenivas u8 max_lds; 369c4a3e0a5SBagalkote, Sreenivas 370c4a3e0a5SBagalkote, Sreenivas char product_name[80]; 371c4a3e0a5SBagalkote, Sreenivas char serial_no[32]; 372c4a3e0a5SBagalkote, Sreenivas 373c4a3e0a5SBagalkote, Sreenivas /* 374c4a3e0a5SBagalkote, Sreenivas * Other physical/controller/operation information. Indicates the 375c4a3e0a5SBagalkote, Sreenivas * presence of the hardware 376c4a3e0a5SBagalkote, Sreenivas */ 377c4a3e0a5SBagalkote, Sreenivas struct { 378c4a3e0a5SBagalkote, Sreenivas 379c4a3e0a5SBagalkote, Sreenivas u32 bbu:1; 380c4a3e0a5SBagalkote, Sreenivas u32 alarm:1; 381c4a3e0a5SBagalkote, Sreenivas u32 nvram:1; 382c4a3e0a5SBagalkote, Sreenivas u32 uart:1; 383c4a3e0a5SBagalkote, Sreenivas u32 reserved:28; 384c4a3e0a5SBagalkote, Sreenivas 385c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) hw_present; 386c4a3e0a5SBagalkote, Sreenivas 387c4a3e0a5SBagalkote, Sreenivas u32 current_fw_time; 388c4a3e0a5SBagalkote, Sreenivas 389c4a3e0a5SBagalkote, Sreenivas /* 390c4a3e0a5SBagalkote, Sreenivas * Maximum data transfer sizes 391c4a3e0a5SBagalkote, Sreenivas */ 392c4a3e0a5SBagalkote, Sreenivas u16 max_concurrent_cmds; 393c4a3e0a5SBagalkote, Sreenivas u16 max_sge_count; 394c4a3e0a5SBagalkote, Sreenivas u32 max_request_size; 395c4a3e0a5SBagalkote, Sreenivas 396c4a3e0a5SBagalkote, Sreenivas /* 397c4a3e0a5SBagalkote, Sreenivas * Logical and physical device counts 398c4a3e0a5SBagalkote, Sreenivas */ 399c4a3e0a5SBagalkote, Sreenivas u16 ld_present_count; 400c4a3e0a5SBagalkote, Sreenivas u16 ld_degraded_count; 401c4a3e0a5SBagalkote, Sreenivas u16 ld_offline_count; 402c4a3e0a5SBagalkote, Sreenivas 403c4a3e0a5SBagalkote, Sreenivas u16 pd_present_count; 404c4a3e0a5SBagalkote, Sreenivas u16 pd_disk_present_count; 405c4a3e0a5SBagalkote, Sreenivas u16 pd_disk_pred_failure_count; 406c4a3e0a5SBagalkote, Sreenivas u16 pd_disk_failed_count; 407c4a3e0a5SBagalkote, Sreenivas 408c4a3e0a5SBagalkote, Sreenivas /* 409c4a3e0a5SBagalkote, Sreenivas * Memory size information 410c4a3e0a5SBagalkote, Sreenivas */ 411c4a3e0a5SBagalkote, Sreenivas u16 nvram_size; 412c4a3e0a5SBagalkote, Sreenivas u16 memory_size; 413c4a3e0a5SBagalkote, Sreenivas u16 flash_size; 414c4a3e0a5SBagalkote, Sreenivas 415c4a3e0a5SBagalkote, Sreenivas /* 416c4a3e0a5SBagalkote, Sreenivas * Error counters 417c4a3e0a5SBagalkote, Sreenivas */ 418c4a3e0a5SBagalkote, Sreenivas u16 mem_correctable_error_count; 419c4a3e0a5SBagalkote, Sreenivas u16 mem_uncorrectable_error_count; 420c4a3e0a5SBagalkote, Sreenivas 421c4a3e0a5SBagalkote, Sreenivas /* 422c4a3e0a5SBagalkote, Sreenivas * Cluster information 423c4a3e0a5SBagalkote, Sreenivas */ 424c4a3e0a5SBagalkote, Sreenivas u8 cluster_permitted; 425c4a3e0a5SBagalkote, Sreenivas u8 cluster_active; 426c4a3e0a5SBagalkote, Sreenivas 427c4a3e0a5SBagalkote, Sreenivas /* 428c4a3e0a5SBagalkote, Sreenivas * Additional max data transfer sizes 429c4a3e0a5SBagalkote, Sreenivas */ 430c4a3e0a5SBagalkote, Sreenivas u16 max_strips_per_io; 431c4a3e0a5SBagalkote, Sreenivas 432c4a3e0a5SBagalkote, Sreenivas /* 433c4a3e0a5SBagalkote, Sreenivas * Controller capabilities structures 434c4a3e0a5SBagalkote, Sreenivas */ 435c4a3e0a5SBagalkote, Sreenivas struct { 436c4a3e0a5SBagalkote, Sreenivas 437c4a3e0a5SBagalkote, Sreenivas u32 raid_level_0:1; 438c4a3e0a5SBagalkote, Sreenivas u32 raid_level_1:1; 439c4a3e0a5SBagalkote, Sreenivas u32 raid_level_5:1; 440c4a3e0a5SBagalkote, Sreenivas u32 raid_level_1E:1; 441c4a3e0a5SBagalkote, Sreenivas u32 raid_level_6:1; 442c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 443c4a3e0a5SBagalkote, Sreenivas 444c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) raid_levels; 445c4a3e0a5SBagalkote, Sreenivas 446c4a3e0a5SBagalkote, Sreenivas struct { 447c4a3e0a5SBagalkote, Sreenivas 448c4a3e0a5SBagalkote, Sreenivas u32 rbld_rate:1; 449c4a3e0a5SBagalkote, Sreenivas u32 cc_rate:1; 450c4a3e0a5SBagalkote, Sreenivas u32 bgi_rate:1; 451c4a3e0a5SBagalkote, Sreenivas u32 recon_rate:1; 452c4a3e0a5SBagalkote, Sreenivas u32 patrol_rate:1; 453c4a3e0a5SBagalkote, Sreenivas u32 alarm_control:1; 454c4a3e0a5SBagalkote, Sreenivas u32 cluster_supported:1; 455c4a3e0a5SBagalkote, Sreenivas u32 bbu:1; 456c4a3e0a5SBagalkote, Sreenivas u32 spanning_allowed:1; 457c4a3e0a5SBagalkote, Sreenivas u32 dedicated_hotspares:1; 458c4a3e0a5SBagalkote, Sreenivas u32 revertible_hotspares:1; 459c4a3e0a5SBagalkote, Sreenivas u32 foreign_config_import:1; 460c4a3e0a5SBagalkote, Sreenivas u32 self_diagnostic:1; 461c4a3e0a5SBagalkote, Sreenivas u32 mixed_redundancy_arr:1; 462c4a3e0a5SBagalkote, Sreenivas u32 global_hot_spares:1; 463c4a3e0a5SBagalkote, Sreenivas u32 reserved:17; 464c4a3e0a5SBagalkote, Sreenivas 465c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) adapter_operations; 466c4a3e0a5SBagalkote, Sreenivas 467c4a3e0a5SBagalkote, Sreenivas struct { 468c4a3e0a5SBagalkote, Sreenivas 469c4a3e0a5SBagalkote, Sreenivas u32 read_policy:1; 470c4a3e0a5SBagalkote, Sreenivas u32 write_policy:1; 471c4a3e0a5SBagalkote, Sreenivas u32 io_policy:1; 472c4a3e0a5SBagalkote, Sreenivas u32 access_policy:1; 473c4a3e0a5SBagalkote, Sreenivas u32 disk_cache_policy:1; 474c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 475c4a3e0a5SBagalkote, Sreenivas 476c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_operations; 477c4a3e0a5SBagalkote, Sreenivas 478c4a3e0a5SBagalkote, Sreenivas struct { 479c4a3e0a5SBagalkote, Sreenivas 480c4a3e0a5SBagalkote, Sreenivas u8 min; 481c4a3e0a5SBagalkote, Sreenivas u8 max; 482c4a3e0a5SBagalkote, Sreenivas u8 reserved[2]; 483c4a3e0a5SBagalkote, Sreenivas 484c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) stripe_sz_ops; 485c4a3e0a5SBagalkote, Sreenivas 486c4a3e0a5SBagalkote, Sreenivas struct { 487c4a3e0a5SBagalkote, Sreenivas 488c4a3e0a5SBagalkote, Sreenivas u32 force_online:1; 489c4a3e0a5SBagalkote, Sreenivas u32 force_offline:1; 490c4a3e0a5SBagalkote, Sreenivas u32 force_rebuild:1; 491c4a3e0a5SBagalkote, Sreenivas u32 reserved:29; 492c4a3e0a5SBagalkote, Sreenivas 493c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_operations; 494c4a3e0a5SBagalkote, Sreenivas 495c4a3e0a5SBagalkote, Sreenivas struct { 496c4a3e0a5SBagalkote, Sreenivas 497c4a3e0a5SBagalkote, Sreenivas u32 ctrl_supports_sas:1; 498c4a3e0a5SBagalkote, Sreenivas u32 ctrl_supports_sata:1; 499c4a3e0a5SBagalkote, Sreenivas u32 allow_mix_in_encl:1; 500c4a3e0a5SBagalkote, Sreenivas u32 allow_mix_in_ld:1; 501c4a3e0a5SBagalkote, Sreenivas u32 allow_sata_in_cluster:1; 502c4a3e0a5SBagalkote, Sreenivas u32 reserved:27; 503c4a3e0a5SBagalkote, Sreenivas 504c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_mix_support; 505c4a3e0a5SBagalkote, Sreenivas 506c4a3e0a5SBagalkote, Sreenivas /* 507c4a3e0a5SBagalkote, Sreenivas * Define ECC single-bit-error bucket information 508c4a3e0a5SBagalkote, Sreenivas */ 509c4a3e0a5SBagalkote, Sreenivas u8 ecc_bucket_count; 510c4a3e0a5SBagalkote, Sreenivas u8 reserved_2[11]; 511c4a3e0a5SBagalkote, Sreenivas 512c4a3e0a5SBagalkote, Sreenivas /* 513c4a3e0a5SBagalkote, Sreenivas * Include the controller properties (changeable items) 514c4a3e0a5SBagalkote, Sreenivas */ 515c4a3e0a5SBagalkote, Sreenivas struct megasas_ctrl_prop properties; 516c4a3e0a5SBagalkote, Sreenivas 517c4a3e0a5SBagalkote, Sreenivas /* 518c4a3e0a5SBagalkote, Sreenivas * Define FW pkg version (set in envt v'bles on OEM basis) 519c4a3e0a5SBagalkote, Sreenivas */ 520c4a3e0a5SBagalkote, Sreenivas char package_version[0x60]; 521c4a3e0a5SBagalkote, Sreenivas 522c4a3e0a5SBagalkote, Sreenivas u8 pad[0x800 - 0x6a0]; 523c4a3e0a5SBagalkote, Sreenivas 524c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 525c4a3e0a5SBagalkote, Sreenivas 526c4a3e0a5SBagalkote, Sreenivas /* 527c4a3e0a5SBagalkote, Sreenivas * =============================== 528c4a3e0a5SBagalkote, Sreenivas * MegaRAID SAS driver definitions 529c4a3e0a5SBagalkote, Sreenivas * =============================== 530c4a3e0a5SBagalkote, Sreenivas */ 531c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_PD_CHANNELS 2 532c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_LD_CHANNELS 2 533c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \ 534c4a3e0a5SBagalkote, Sreenivas MEGASAS_MAX_LD_CHANNELS) 535c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_DEV_PER_CHANNEL 128 536c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_DEFAULT_INIT_ID -1 537c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_LUN 8 538c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_MAX_LD 64 539c4a3e0a5SBagalkote, Sreenivas 540658dcedbSSumant Patro #define MEGASAS_DBG_LVL 1 541658dcedbSSumant Patro 542c4a3e0a5SBagalkote, Sreenivas /* 543c4a3e0a5SBagalkote, Sreenivas * When SCSI mid-layer calls driver's reset routine, driver waits for 544c4a3e0a5SBagalkote, Sreenivas * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note 545c4a3e0a5SBagalkote, Sreenivas * that the driver cannot _actually_ abort or reset pending commands. While 546c4a3e0a5SBagalkote, Sreenivas * it is waiting for the commands to complete, it prints a diagnostic message 547c4a3e0a5SBagalkote, Sreenivas * every MEGASAS_RESET_NOTICE_INTERVAL seconds 548c4a3e0a5SBagalkote, Sreenivas */ 549c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_RESET_WAIT_TIME 180 550c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_RESET_NOTICE_INTERVAL 5 551c4a3e0a5SBagalkote, Sreenivas 552c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IOCTL_CMD 0 553c4a3e0a5SBagalkote, Sreenivas 554c4a3e0a5SBagalkote, Sreenivas /* 555c4a3e0a5SBagalkote, Sreenivas * FW reports the maximum of number of commands that it can accept (maximum 556c4a3e0a5SBagalkote, Sreenivas * commands that can be outstanding) at any time. The driver must report a 557c4a3e0a5SBagalkote, Sreenivas * lower number to the mid layer because it can issue a few internal commands 558c4a3e0a5SBagalkote, Sreenivas * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs 559c4a3e0a5SBagalkote, Sreenivas * is shown below 560c4a3e0a5SBagalkote, Sreenivas */ 561c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_INT_CMDS 32 562c4a3e0a5SBagalkote, Sreenivas 563c4a3e0a5SBagalkote, Sreenivas /* 564c4a3e0a5SBagalkote, Sreenivas * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit 565c4a3e0a5SBagalkote, Sreenivas * SGLs based on the size of dma_addr_t 566c4a3e0a5SBagalkote, Sreenivas */ 567c4a3e0a5SBagalkote, Sreenivas #define IS_DMA64 (sizeof(dma_addr_t) == 8) 568c4a3e0a5SBagalkote, Sreenivas 569c4a3e0a5SBagalkote, Sreenivas #define MFI_OB_INTR_STATUS_MASK 0x00000002 570c4a3e0a5SBagalkote, Sreenivas #define MFI_POLL_TIMEOUT_SECS 10 571c4a3e0a5SBagalkote, Sreenivas 572f9876f0bSSumant Patro #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 5730e98936cSSumant Patro 5740e98936cSSumant Patro /* 5750e98936cSSumant Patro * register set for both 1068 and 1078 controllers 5760e98936cSSumant Patro * structure extended for 1078 registers 5770e98936cSSumant Patro */ 578c4a3e0a5SBagalkote, Sreenivas 579f9876f0bSSumant Patro struct megasas_register_set { 580c4a3e0a5SBagalkote, Sreenivas u32 reserved_0[4]; /*0000h*/ 581c4a3e0a5SBagalkote, Sreenivas 582c4a3e0a5SBagalkote, Sreenivas u32 inbound_msg_0; /*0010h*/ 583c4a3e0a5SBagalkote, Sreenivas u32 inbound_msg_1; /*0014h*/ 584c4a3e0a5SBagalkote, Sreenivas u32 outbound_msg_0; /*0018h*/ 585c4a3e0a5SBagalkote, Sreenivas u32 outbound_msg_1; /*001Ch*/ 586c4a3e0a5SBagalkote, Sreenivas 587c4a3e0a5SBagalkote, Sreenivas u32 inbound_doorbell; /*0020h*/ 588c4a3e0a5SBagalkote, Sreenivas u32 inbound_intr_status; /*0024h*/ 589c4a3e0a5SBagalkote, Sreenivas u32 inbound_intr_mask; /*0028h*/ 590c4a3e0a5SBagalkote, Sreenivas 591c4a3e0a5SBagalkote, Sreenivas u32 outbound_doorbell; /*002Ch*/ 592c4a3e0a5SBagalkote, Sreenivas u32 outbound_intr_status; /*0030h*/ 593c4a3e0a5SBagalkote, Sreenivas u32 outbound_intr_mask; /*0034h*/ 594c4a3e0a5SBagalkote, Sreenivas 595c4a3e0a5SBagalkote, Sreenivas u32 reserved_1[2]; /*0038h*/ 596c4a3e0a5SBagalkote, Sreenivas 597c4a3e0a5SBagalkote, Sreenivas u32 inbound_queue_port; /*0040h*/ 598c4a3e0a5SBagalkote, Sreenivas u32 outbound_queue_port; /*0044h*/ 599c4a3e0a5SBagalkote, Sreenivas 600f9876f0bSSumant Patro u32 reserved_2[22]; /*0048h*/ 601c4a3e0a5SBagalkote, Sreenivas 602f9876f0bSSumant Patro u32 outbound_doorbell_clear; /*00A0h*/ 603f9876f0bSSumant Patro 604f9876f0bSSumant Patro u32 reserved_3[3]; /*00A4h*/ 605f9876f0bSSumant Patro 606f9876f0bSSumant Patro u32 outbound_scratch_pad ; /*00B0h*/ 607f9876f0bSSumant Patro 608f9876f0bSSumant Patro u32 reserved_4[3]; /*00B4h*/ 609f9876f0bSSumant Patro 610f9876f0bSSumant Patro u32 inbound_low_queue_port ; /*00C0h*/ 611f9876f0bSSumant Patro 612f9876f0bSSumant Patro u32 inbound_high_queue_port ; /*00C4h*/ 613f9876f0bSSumant Patro 614f9876f0bSSumant Patro u32 reserved_5; /*00C8h*/ 615f9876f0bSSumant Patro u32 index_registers[820]; /*00CCh*/ 616c4a3e0a5SBagalkote, Sreenivas 617c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 618c4a3e0a5SBagalkote, Sreenivas 619c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 { 620c4a3e0a5SBagalkote, Sreenivas 621c4a3e0a5SBagalkote, Sreenivas u32 phys_addr; 622c4a3e0a5SBagalkote, Sreenivas u32 length; 623c4a3e0a5SBagalkote, Sreenivas 624c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 625c4a3e0a5SBagalkote, Sreenivas 626c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 { 627c4a3e0a5SBagalkote, Sreenivas 628c4a3e0a5SBagalkote, Sreenivas u64 phys_addr; 629c4a3e0a5SBagalkote, Sreenivas u32 length; 630c4a3e0a5SBagalkote, Sreenivas 631c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 632c4a3e0a5SBagalkote, Sreenivas 633c4a3e0a5SBagalkote, Sreenivas union megasas_sgl { 634c4a3e0a5SBagalkote, Sreenivas 635c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[1]; 636c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[1]; 637c4a3e0a5SBagalkote, Sreenivas 638c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 639c4a3e0a5SBagalkote, Sreenivas 640c4a3e0a5SBagalkote, Sreenivas struct megasas_header { 641c4a3e0a5SBagalkote, Sreenivas 642c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 643c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 644c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 645c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 646c4a3e0a5SBagalkote, Sreenivas 647c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 648c4a3e0a5SBagalkote, Sreenivas u8 lun; /*05h */ 649c4a3e0a5SBagalkote, Sreenivas u8 cdb_len; /*06h */ 650c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 651c4a3e0a5SBagalkote, Sreenivas 652c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 653c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 654c4a3e0a5SBagalkote, Sreenivas 655c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 656c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 657c4a3e0a5SBagalkote, Sreenivas u32 data_xferlen; /*14h */ 658c4a3e0a5SBagalkote, Sreenivas 659c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 660c4a3e0a5SBagalkote, Sreenivas 661c4a3e0a5SBagalkote, Sreenivas union megasas_sgl_frame { 662c4a3e0a5SBagalkote, Sreenivas 663c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[8]; 664c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[5]; 665c4a3e0a5SBagalkote, Sreenivas 666c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 667c4a3e0a5SBagalkote, Sreenivas 668c4a3e0a5SBagalkote, Sreenivas struct megasas_init_frame { 669c4a3e0a5SBagalkote, Sreenivas 670c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 671c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 672c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 673c4a3e0a5SBagalkote, Sreenivas 674c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*03h */ 675c4a3e0a5SBagalkote, Sreenivas u32 reserved_2; /*04h */ 676c4a3e0a5SBagalkote, Sreenivas 677c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 678c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 679c4a3e0a5SBagalkote, Sreenivas 680c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 681c4a3e0a5SBagalkote, Sreenivas u16 reserved_3; /*12h */ 682c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 683c4a3e0a5SBagalkote, Sreenivas 684c4a3e0a5SBagalkote, Sreenivas u32 queue_info_new_phys_addr_lo; /*18h */ 685c4a3e0a5SBagalkote, Sreenivas u32 queue_info_new_phys_addr_hi; /*1Ch */ 686c4a3e0a5SBagalkote, Sreenivas u32 queue_info_old_phys_addr_lo; /*20h */ 687c4a3e0a5SBagalkote, Sreenivas u32 queue_info_old_phys_addr_hi; /*24h */ 688c4a3e0a5SBagalkote, Sreenivas 689c4a3e0a5SBagalkote, Sreenivas u32 reserved_4[6]; /*28h */ 690c4a3e0a5SBagalkote, Sreenivas 691c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 692c4a3e0a5SBagalkote, Sreenivas 693c4a3e0a5SBagalkote, Sreenivas struct megasas_init_queue_info { 694c4a3e0a5SBagalkote, Sreenivas 695c4a3e0a5SBagalkote, Sreenivas u32 init_flags; /*00h */ 696c4a3e0a5SBagalkote, Sreenivas u32 reply_queue_entries; /*04h */ 697c4a3e0a5SBagalkote, Sreenivas 698c4a3e0a5SBagalkote, Sreenivas u32 reply_queue_start_phys_addr_lo; /*08h */ 699c4a3e0a5SBagalkote, Sreenivas u32 reply_queue_start_phys_addr_hi; /*0Ch */ 700c4a3e0a5SBagalkote, Sreenivas u32 producer_index_phys_addr_lo; /*10h */ 701c4a3e0a5SBagalkote, Sreenivas u32 producer_index_phys_addr_hi; /*14h */ 702c4a3e0a5SBagalkote, Sreenivas u32 consumer_index_phys_addr_lo; /*18h */ 703c4a3e0a5SBagalkote, Sreenivas u32 consumer_index_phys_addr_hi; /*1Ch */ 704c4a3e0a5SBagalkote, Sreenivas 705c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 706c4a3e0a5SBagalkote, Sreenivas 707c4a3e0a5SBagalkote, Sreenivas struct megasas_io_frame { 708c4a3e0a5SBagalkote, Sreenivas 709c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 710c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 711c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 712c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 713c4a3e0a5SBagalkote, Sreenivas 714c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 715c4a3e0a5SBagalkote, Sreenivas u8 access_byte; /*05h */ 716c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*06h */ 717c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 718c4a3e0a5SBagalkote, Sreenivas 719c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 720c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 721c4a3e0a5SBagalkote, Sreenivas 722c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 723c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 724c4a3e0a5SBagalkote, Sreenivas u32 lba_count; /*14h */ 725c4a3e0a5SBagalkote, Sreenivas 726c4a3e0a5SBagalkote, Sreenivas u32 sense_buf_phys_addr_lo; /*18h */ 727c4a3e0a5SBagalkote, Sreenivas u32 sense_buf_phys_addr_hi; /*1Ch */ 728c4a3e0a5SBagalkote, Sreenivas 729c4a3e0a5SBagalkote, Sreenivas u32 start_lba_lo; /*20h */ 730c4a3e0a5SBagalkote, Sreenivas u32 start_lba_hi; /*24h */ 731c4a3e0a5SBagalkote, Sreenivas 732c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*28h */ 733c4a3e0a5SBagalkote, Sreenivas 734c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 735c4a3e0a5SBagalkote, Sreenivas 736c4a3e0a5SBagalkote, Sreenivas struct megasas_pthru_frame { 737c4a3e0a5SBagalkote, Sreenivas 738c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 739c4a3e0a5SBagalkote, Sreenivas u8 sense_len; /*01h */ 740c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 741c4a3e0a5SBagalkote, Sreenivas u8 scsi_status; /*03h */ 742c4a3e0a5SBagalkote, Sreenivas 743c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 744c4a3e0a5SBagalkote, Sreenivas u8 lun; /*05h */ 745c4a3e0a5SBagalkote, Sreenivas u8 cdb_len; /*06h */ 746c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 747c4a3e0a5SBagalkote, Sreenivas 748c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 749c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 750c4a3e0a5SBagalkote, Sreenivas 751c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 752c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 753c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 754c4a3e0a5SBagalkote, Sreenivas 755c4a3e0a5SBagalkote, Sreenivas u32 sense_buf_phys_addr_lo; /*18h */ 756c4a3e0a5SBagalkote, Sreenivas u32 sense_buf_phys_addr_hi; /*1Ch */ 757c4a3e0a5SBagalkote, Sreenivas 758c4a3e0a5SBagalkote, Sreenivas u8 cdb[16]; /*20h */ 759c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*30h */ 760c4a3e0a5SBagalkote, Sreenivas 761c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 762c4a3e0a5SBagalkote, Sreenivas 763c4a3e0a5SBagalkote, Sreenivas struct megasas_dcmd_frame { 764c4a3e0a5SBagalkote, Sreenivas 765c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 766c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 767c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 768c4a3e0a5SBagalkote, Sreenivas u8 reserved_1[4]; /*03h */ 769c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 770c4a3e0a5SBagalkote, Sreenivas 771c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 772c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 773c4a3e0a5SBagalkote, Sreenivas 774c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 775c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 776c4a3e0a5SBagalkote, Sreenivas 777c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 778c4a3e0a5SBagalkote, Sreenivas u32 opcode; /*18h */ 779c4a3e0a5SBagalkote, Sreenivas 780c4a3e0a5SBagalkote, Sreenivas union { /*1Ch */ 781c4a3e0a5SBagalkote, Sreenivas u8 b[12]; 782c4a3e0a5SBagalkote, Sreenivas u16 s[6]; 783c4a3e0a5SBagalkote, Sreenivas u32 w[3]; 784c4a3e0a5SBagalkote, Sreenivas } mbox; 785c4a3e0a5SBagalkote, Sreenivas 786c4a3e0a5SBagalkote, Sreenivas union megasas_sgl sgl; /*28h */ 787c4a3e0a5SBagalkote, Sreenivas 788c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 789c4a3e0a5SBagalkote, Sreenivas 790c4a3e0a5SBagalkote, Sreenivas struct megasas_abort_frame { 791c4a3e0a5SBagalkote, Sreenivas 792c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 793c4a3e0a5SBagalkote, Sreenivas u8 reserved_0; /*01h */ 794c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 795c4a3e0a5SBagalkote, Sreenivas 796c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*03h */ 797c4a3e0a5SBagalkote, Sreenivas u32 reserved_2; /*04h */ 798c4a3e0a5SBagalkote, Sreenivas 799c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 800c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 801c4a3e0a5SBagalkote, Sreenivas 802c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 803c4a3e0a5SBagalkote, Sreenivas u16 reserved_3; /*12h */ 804c4a3e0a5SBagalkote, Sreenivas u32 reserved_4; /*14h */ 805c4a3e0a5SBagalkote, Sreenivas 806c4a3e0a5SBagalkote, Sreenivas u32 abort_context; /*18h */ 807c4a3e0a5SBagalkote, Sreenivas u32 pad_1; /*1Ch */ 808c4a3e0a5SBagalkote, Sreenivas 809c4a3e0a5SBagalkote, Sreenivas u32 abort_mfi_phys_addr_lo; /*20h */ 810c4a3e0a5SBagalkote, Sreenivas u32 abort_mfi_phys_addr_hi; /*24h */ 811c4a3e0a5SBagalkote, Sreenivas 812c4a3e0a5SBagalkote, Sreenivas u32 reserved_5[6]; /*28h */ 813c4a3e0a5SBagalkote, Sreenivas 814c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 815c4a3e0a5SBagalkote, Sreenivas 816c4a3e0a5SBagalkote, Sreenivas struct megasas_smp_frame { 817c4a3e0a5SBagalkote, Sreenivas 818c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 819c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*01h */ 820c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 821c4a3e0a5SBagalkote, Sreenivas u8 connection_status; /*03h */ 822c4a3e0a5SBagalkote, Sreenivas 823c4a3e0a5SBagalkote, Sreenivas u8 reserved_2[3]; /*04h */ 824c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 825c4a3e0a5SBagalkote, Sreenivas 826c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 827c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 828c4a3e0a5SBagalkote, Sreenivas 829c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 830c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 831c4a3e0a5SBagalkote, Sreenivas 832c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 833c4a3e0a5SBagalkote, Sreenivas u64 sas_addr; /*18h */ 834c4a3e0a5SBagalkote, Sreenivas 835c4a3e0a5SBagalkote, Sreenivas union { 836c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */ 837c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */ 838c4a3e0a5SBagalkote, Sreenivas } sgl; 839c4a3e0a5SBagalkote, Sreenivas 840c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 841c4a3e0a5SBagalkote, Sreenivas 842c4a3e0a5SBagalkote, Sreenivas struct megasas_stp_frame { 843c4a3e0a5SBagalkote, Sreenivas 844c4a3e0a5SBagalkote, Sreenivas u8 cmd; /*00h */ 845c4a3e0a5SBagalkote, Sreenivas u8 reserved_1; /*01h */ 846c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; /*02h */ 847c4a3e0a5SBagalkote, Sreenivas u8 reserved_2; /*03h */ 848c4a3e0a5SBagalkote, Sreenivas 849c4a3e0a5SBagalkote, Sreenivas u8 target_id; /*04h */ 850c4a3e0a5SBagalkote, Sreenivas u8 reserved_3[2]; /*05h */ 851c4a3e0a5SBagalkote, Sreenivas u8 sge_count; /*07h */ 852c4a3e0a5SBagalkote, Sreenivas 853c4a3e0a5SBagalkote, Sreenivas u32 context; /*08h */ 854c4a3e0a5SBagalkote, Sreenivas u32 pad_0; /*0Ch */ 855c4a3e0a5SBagalkote, Sreenivas 856c4a3e0a5SBagalkote, Sreenivas u16 flags; /*10h */ 857c4a3e0a5SBagalkote, Sreenivas u16 timeout; /*12h */ 858c4a3e0a5SBagalkote, Sreenivas 859c4a3e0a5SBagalkote, Sreenivas u32 data_xfer_len; /*14h */ 860c4a3e0a5SBagalkote, Sreenivas 861c4a3e0a5SBagalkote, Sreenivas u16 fis[10]; /*18h */ 862c4a3e0a5SBagalkote, Sreenivas u32 stp_flags; 863c4a3e0a5SBagalkote, Sreenivas 864c4a3e0a5SBagalkote, Sreenivas union { 865c4a3e0a5SBagalkote, Sreenivas struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */ 866c4a3e0a5SBagalkote, Sreenivas struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */ 867c4a3e0a5SBagalkote, Sreenivas } sgl; 868c4a3e0a5SBagalkote, Sreenivas 869c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 870c4a3e0a5SBagalkote, Sreenivas 871c4a3e0a5SBagalkote, Sreenivas union megasas_frame { 872c4a3e0a5SBagalkote, Sreenivas 873c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 874c4a3e0a5SBagalkote, Sreenivas struct megasas_init_frame init; 875c4a3e0a5SBagalkote, Sreenivas struct megasas_io_frame io; 876c4a3e0a5SBagalkote, Sreenivas struct megasas_pthru_frame pthru; 877c4a3e0a5SBagalkote, Sreenivas struct megasas_dcmd_frame dcmd; 878c4a3e0a5SBagalkote, Sreenivas struct megasas_abort_frame abort; 879c4a3e0a5SBagalkote, Sreenivas struct megasas_smp_frame smp; 880c4a3e0a5SBagalkote, Sreenivas struct megasas_stp_frame stp; 881c4a3e0a5SBagalkote, Sreenivas 882c4a3e0a5SBagalkote, Sreenivas u8 raw_bytes[64]; 883c4a3e0a5SBagalkote, Sreenivas }; 884c4a3e0a5SBagalkote, Sreenivas 885c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd; 886c4a3e0a5SBagalkote, Sreenivas 887c4a3e0a5SBagalkote, Sreenivas union megasas_evt_class_locale { 888c4a3e0a5SBagalkote, Sreenivas 889c4a3e0a5SBagalkote, Sreenivas struct { 890c4a3e0a5SBagalkote, Sreenivas u16 locale; 891c4a3e0a5SBagalkote, Sreenivas u8 reserved; 892c4a3e0a5SBagalkote, Sreenivas s8 class; 893c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) members; 894c4a3e0a5SBagalkote, Sreenivas 895c4a3e0a5SBagalkote, Sreenivas u32 word; 896c4a3e0a5SBagalkote, Sreenivas 897c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 898c4a3e0a5SBagalkote, Sreenivas 899c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_log_info { 900c4a3e0a5SBagalkote, Sreenivas u32 newest_seq_num; 901c4a3e0a5SBagalkote, Sreenivas u32 oldest_seq_num; 902c4a3e0a5SBagalkote, Sreenivas u32 clear_seq_num; 903c4a3e0a5SBagalkote, Sreenivas u32 shutdown_seq_num; 904c4a3e0a5SBagalkote, Sreenivas u32 boot_seq_num; 905c4a3e0a5SBagalkote, Sreenivas 906c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 907c4a3e0a5SBagalkote, Sreenivas 908c4a3e0a5SBagalkote, Sreenivas struct megasas_progress { 909c4a3e0a5SBagalkote, Sreenivas 910c4a3e0a5SBagalkote, Sreenivas u16 progress; 911c4a3e0a5SBagalkote, Sreenivas u16 elapsed_seconds; 912c4a3e0a5SBagalkote, Sreenivas 913c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 914c4a3e0a5SBagalkote, Sreenivas 915c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld { 916c4a3e0a5SBagalkote, Sreenivas 917c4a3e0a5SBagalkote, Sreenivas u16 target_id; 918c4a3e0a5SBagalkote, Sreenivas u8 ld_index; 919c4a3e0a5SBagalkote, Sreenivas u8 reserved; 920c4a3e0a5SBagalkote, Sreenivas 921c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 922c4a3e0a5SBagalkote, Sreenivas 923c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd { 924c4a3e0a5SBagalkote, Sreenivas u16 device_id; 925c4a3e0a5SBagalkote, Sreenivas u8 encl_index; 926c4a3e0a5SBagalkote, Sreenivas u8 slot_number; 927c4a3e0a5SBagalkote, Sreenivas 928c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 929c4a3e0a5SBagalkote, Sreenivas 930c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_detail { 931c4a3e0a5SBagalkote, Sreenivas 932c4a3e0a5SBagalkote, Sreenivas u32 seq_num; 933c4a3e0a5SBagalkote, Sreenivas u32 time_stamp; 934c4a3e0a5SBagalkote, Sreenivas u32 code; 935c4a3e0a5SBagalkote, Sreenivas union megasas_evt_class_locale cl; 936c4a3e0a5SBagalkote, Sreenivas u8 arg_type; 937c4a3e0a5SBagalkote, Sreenivas u8 reserved1[15]; 938c4a3e0a5SBagalkote, Sreenivas 939c4a3e0a5SBagalkote, Sreenivas union { 940c4a3e0a5SBagalkote, Sreenivas struct { 941c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 942c4a3e0a5SBagalkote, Sreenivas u8 cdb_length; 943c4a3e0a5SBagalkote, Sreenivas u8 sense_length; 944c4a3e0a5SBagalkote, Sreenivas u8 reserved[2]; 945c4a3e0a5SBagalkote, Sreenivas u8 cdb[16]; 946c4a3e0a5SBagalkote, Sreenivas u8 sense[64]; 947c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) cdbSense; 948c4a3e0a5SBagalkote, Sreenivas 949c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 950c4a3e0a5SBagalkote, Sreenivas 951c4a3e0a5SBagalkote, Sreenivas struct { 952c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 953c4a3e0a5SBagalkote, Sreenivas u64 count; 954c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_count; 955c4a3e0a5SBagalkote, Sreenivas 956c4a3e0a5SBagalkote, Sreenivas struct { 957c4a3e0a5SBagalkote, Sreenivas u64 lba; 958c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 959c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_lba; 960c4a3e0a5SBagalkote, Sreenivas 961c4a3e0a5SBagalkote, Sreenivas struct { 962c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 963c4a3e0a5SBagalkote, Sreenivas u32 prevOwner; 964c4a3e0a5SBagalkote, Sreenivas u32 newOwner; 965c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_owner; 966c4a3e0a5SBagalkote, Sreenivas 967c4a3e0a5SBagalkote, Sreenivas struct { 968c4a3e0a5SBagalkote, Sreenivas u64 ld_lba; 969c4a3e0a5SBagalkote, Sreenivas u64 pd_lba; 970c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 971c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 972c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_lba_pd_lba; 973c4a3e0a5SBagalkote, Sreenivas 974c4a3e0a5SBagalkote, Sreenivas struct { 975c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 976c4a3e0a5SBagalkote, Sreenivas struct megasas_progress prog; 977c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_prog; 978c4a3e0a5SBagalkote, Sreenivas 979c4a3e0a5SBagalkote, Sreenivas struct { 980c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 981c4a3e0a5SBagalkote, Sreenivas u32 prev_state; 982c4a3e0a5SBagalkote, Sreenivas u32 new_state; 983c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_state; 984c4a3e0a5SBagalkote, Sreenivas 985c4a3e0a5SBagalkote, Sreenivas struct { 986c4a3e0a5SBagalkote, Sreenivas u64 strip; 987c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 988c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ld_strip; 989c4a3e0a5SBagalkote, Sreenivas 990c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 991c4a3e0a5SBagalkote, Sreenivas 992c4a3e0a5SBagalkote, Sreenivas struct { 993c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 994c4a3e0a5SBagalkote, Sreenivas u32 err; 995c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_err; 996c4a3e0a5SBagalkote, Sreenivas 997c4a3e0a5SBagalkote, Sreenivas struct { 998c4a3e0a5SBagalkote, Sreenivas u64 lba; 999c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1000c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_lba; 1001c4a3e0a5SBagalkote, Sreenivas 1002c4a3e0a5SBagalkote, Sreenivas struct { 1003c4a3e0a5SBagalkote, Sreenivas u64 lba; 1004c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1005c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_ld ld; 1006c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_lba_ld; 1007c4a3e0a5SBagalkote, Sreenivas 1008c4a3e0a5SBagalkote, Sreenivas struct { 1009c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1010c4a3e0a5SBagalkote, Sreenivas struct megasas_progress prog; 1011c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_prog; 1012c4a3e0a5SBagalkote, Sreenivas 1013c4a3e0a5SBagalkote, Sreenivas struct { 1014c4a3e0a5SBagalkote, Sreenivas struct megasas_evtarg_pd pd; 1015c4a3e0a5SBagalkote, Sreenivas u32 prevState; 1016c4a3e0a5SBagalkote, Sreenivas u32 newState; 1017c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pd_state; 1018c4a3e0a5SBagalkote, Sreenivas 1019c4a3e0a5SBagalkote, Sreenivas struct { 1020c4a3e0a5SBagalkote, Sreenivas u16 vendorId; 1021c4a3e0a5SBagalkote, Sreenivas u16 deviceId; 1022c4a3e0a5SBagalkote, Sreenivas u16 subVendorId; 1023c4a3e0a5SBagalkote, Sreenivas u16 subDeviceId; 1024c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) pci; 1025c4a3e0a5SBagalkote, Sreenivas 1026c4a3e0a5SBagalkote, Sreenivas u32 rate; 1027c4a3e0a5SBagalkote, Sreenivas char str[96]; 1028c4a3e0a5SBagalkote, Sreenivas 1029c4a3e0a5SBagalkote, Sreenivas struct { 1030c4a3e0a5SBagalkote, Sreenivas u32 rtc; 1031c4a3e0a5SBagalkote, Sreenivas u32 elapsedSeconds; 1032c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) time; 1033c4a3e0a5SBagalkote, Sreenivas 1034c4a3e0a5SBagalkote, Sreenivas struct { 1035c4a3e0a5SBagalkote, Sreenivas u32 ecar; 1036c4a3e0a5SBagalkote, Sreenivas u32 elog; 1037c4a3e0a5SBagalkote, Sreenivas char str[64]; 1038c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)) ecc; 1039c4a3e0a5SBagalkote, Sreenivas 1040c4a3e0a5SBagalkote, Sreenivas u8 b[96]; 1041c4a3e0a5SBagalkote, Sreenivas u16 s[48]; 1042c4a3e0a5SBagalkote, Sreenivas u32 w[24]; 1043c4a3e0a5SBagalkote, Sreenivas u64 d[12]; 1044c4a3e0a5SBagalkote, Sreenivas } args; 1045c4a3e0a5SBagalkote, Sreenivas 1046c4a3e0a5SBagalkote, Sreenivas char description[128]; 1047c4a3e0a5SBagalkote, Sreenivas 1048c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1049c4a3e0a5SBagalkote, Sreenivas 10501341c939SSumant Patro struct megasas_instance_template { 10511341c939SSumant Patro void (*fire_cmd)(dma_addr_t ,u32 ,struct megasas_register_set __iomem *); 10521341c939SSumant Patro 10531341c939SSumant Patro void (*enable_intr)(struct megasas_register_set __iomem *) ; 1054b274cab7SSumant Patro void (*disable_intr)(struct megasas_register_set __iomem *); 10551341c939SSumant Patro 10561341c939SSumant Patro int (*clear_intr)(struct megasas_register_set __iomem *); 10571341c939SSumant Patro 10581341c939SSumant Patro u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); 10591341c939SSumant Patro }; 10601341c939SSumant Patro 1061c4a3e0a5SBagalkote, Sreenivas struct megasas_instance { 1062c4a3e0a5SBagalkote, Sreenivas 1063c4a3e0a5SBagalkote, Sreenivas u32 *producer; 1064c4a3e0a5SBagalkote, Sreenivas dma_addr_t producer_h; 1065c4a3e0a5SBagalkote, Sreenivas u32 *consumer; 1066c4a3e0a5SBagalkote, Sreenivas dma_addr_t consumer_h; 1067c4a3e0a5SBagalkote, Sreenivas 1068c4a3e0a5SBagalkote, Sreenivas u32 *reply_queue; 1069c4a3e0a5SBagalkote, Sreenivas dma_addr_t reply_queue_h; 1070c4a3e0a5SBagalkote, Sreenivas 1071c4a3e0a5SBagalkote, Sreenivas unsigned long base_addr; 1072c4a3e0a5SBagalkote, Sreenivas struct megasas_register_set __iomem *reg_set; 1073c4a3e0a5SBagalkote, Sreenivas 1074c4a3e0a5SBagalkote, Sreenivas s8 init_id; 1075c4a3e0a5SBagalkote, Sreenivas u8 reserved[3]; 1076c4a3e0a5SBagalkote, Sreenivas 1077c4a3e0a5SBagalkote, Sreenivas u16 max_num_sge; 1078c4a3e0a5SBagalkote, Sreenivas u16 max_fw_cmds; 1079c4a3e0a5SBagalkote, Sreenivas u32 max_sectors_per_req; 1080c4a3e0a5SBagalkote, Sreenivas 1081c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd **cmd_list; 1082c4a3e0a5SBagalkote, Sreenivas struct list_head cmd_pool; 1083c4a3e0a5SBagalkote, Sreenivas spinlock_t cmd_pool_lock; 1084c4a3e0a5SBagalkote, Sreenivas struct dma_pool *frame_dma_pool; 1085c4a3e0a5SBagalkote, Sreenivas struct dma_pool *sense_dma_pool; 1086c4a3e0a5SBagalkote, Sreenivas 1087c4a3e0a5SBagalkote, Sreenivas struct megasas_evt_detail *evt_detail; 1088c4a3e0a5SBagalkote, Sreenivas dma_addr_t evt_detail_h; 1089c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd *aen_cmd; 1090c4a3e0a5SBagalkote, Sreenivas struct semaphore aen_mutex; 1091c4a3e0a5SBagalkote, Sreenivas struct semaphore ioctl_sem; 1092c4a3e0a5SBagalkote, Sreenivas 1093c4a3e0a5SBagalkote, Sreenivas struct Scsi_Host *host; 1094c4a3e0a5SBagalkote, Sreenivas 1095c4a3e0a5SBagalkote, Sreenivas wait_queue_head_t int_cmd_wait_q; 1096c4a3e0a5SBagalkote, Sreenivas wait_queue_head_t abort_cmd_wait_q; 1097c4a3e0a5SBagalkote, Sreenivas 1098c4a3e0a5SBagalkote, Sreenivas struct pci_dev *pdev; 1099c4a3e0a5SBagalkote, Sreenivas u32 unique_id; 1100c4a3e0a5SBagalkote, Sreenivas 1101e4a082c7SSumant Patro atomic_t fw_outstanding; 1102c4a3e0a5SBagalkote, Sreenivas u32 hw_crit_error; 11031341c939SSumant Patro 11041341c939SSumant Patro struct megasas_instance_template *instancet; 11055d018ad0SSumant Patro struct tasklet_struct isr_tasklet; 1106c4a3e0a5SBagalkote, Sreenivas }; 1107c4a3e0a5SBagalkote, Sreenivas 1108c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IS_LOGICAL(scp) \ 1109c4a3e0a5SBagalkote, Sreenivas (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 1110c4a3e0a5SBagalkote, Sreenivas 1111c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_DEV_INDEX(inst, scp) \ 1112c4a3e0a5SBagalkote, Sreenivas ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ 1113c4a3e0a5SBagalkote, Sreenivas scp->device->id 1114c4a3e0a5SBagalkote, Sreenivas 1115c4a3e0a5SBagalkote, Sreenivas struct megasas_cmd { 1116c4a3e0a5SBagalkote, Sreenivas 1117c4a3e0a5SBagalkote, Sreenivas union megasas_frame *frame; 1118c4a3e0a5SBagalkote, Sreenivas dma_addr_t frame_phys_addr; 1119c4a3e0a5SBagalkote, Sreenivas u8 *sense; 1120c4a3e0a5SBagalkote, Sreenivas dma_addr_t sense_phys_addr; 1121c4a3e0a5SBagalkote, Sreenivas 1122c4a3e0a5SBagalkote, Sreenivas u32 index; 1123c4a3e0a5SBagalkote, Sreenivas u8 sync_cmd; 1124c4a3e0a5SBagalkote, Sreenivas u8 cmd_status; 1125c4a3e0a5SBagalkote, Sreenivas u16 abort_aen; 1126c4a3e0a5SBagalkote, Sreenivas 1127c4a3e0a5SBagalkote, Sreenivas struct list_head list; 1128c4a3e0a5SBagalkote, Sreenivas struct scsi_cmnd *scmd; 1129c4a3e0a5SBagalkote, Sreenivas struct megasas_instance *instance; 1130c4a3e0a5SBagalkote, Sreenivas u32 frame_count; 1131c4a3e0a5SBagalkote, Sreenivas }; 1132c4a3e0a5SBagalkote, Sreenivas 1133c4a3e0a5SBagalkote, Sreenivas #define MAX_MGMT_ADAPTERS 1024 1134c4a3e0a5SBagalkote, Sreenivas #define MAX_IOCTL_SGE 16 1135c4a3e0a5SBagalkote, Sreenivas 1136c4a3e0a5SBagalkote, Sreenivas struct megasas_iocpacket { 1137c4a3e0a5SBagalkote, Sreenivas 1138c4a3e0a5SBagalkote, Sreenivas u16 host_no; 1139c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 1140c4a3e0a5SBagalkote, Sreenivas u32 sgl_off; 1141c4a3e0a5SBagalkote, Sreenivas u32 sge_count; 1142c4a3e0a5SBagalkote, Sreenivas u32 sense_off; 1143c4a3e0a5SBagalkote, Sreenivas u32 sense_len; 1144c4a3e0a5SBagalkote, Sreenivas union { 1145c4a3e0a5SBagalkote, Sreenivas u8 raw[128]; 1146c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 1147c4a3e0a5SBagalkote, Sreenivas } frame; 1148c4a3e0a5SBagalkote, Sreenivas 1149c4a3e0a5SBagalkote, Sreenivas struct iovec sgl[MAX_IOCTL_SGE]; 1150c4a3e0a5SBagalkote, Sreenivas 1151c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1152c4a3e0a5SBagalkote, Sreenivas 1153c4a3e0a5SBagalkote, Sreenivas struct megasas_aen { 1154c4a3e0a5SBagalkote, Sreenivas u16 host_no; 1155c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 1156c4a3e0a5SBagalkote, Sreenivas u32 seq_num; 1157c4a3e0a5SBagalkote, Sreenivas u32 class_locale_word; 1158c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1159c4a3e0a5SBagalkote, Sreenivas 1160c4a3e0a5SBagalkote, Sreenivas #ifdef CONFIG_COMPAT 1161c4a3e0a5SBagalkote, Sreenivas struct compat_megasas_iocpacket { 1162c4a3e0a5SBagalkote, Sreenivas u16 host_no; 1163c4a3e0a5SBagalkote, Sreenivas u16 __pad1; 1164c4a3e0a5SBagalkote, Sreenivas u32 sgl_off; 1165c4a3e0a5SBagalkote, Sreenivas u32 sge_count; 1166c4a3e0a5SBagalkote, Sreenivas u32 sense_off; 1167c4a3e0a5SBagalkote, Sreenivas u32 sense_len; 1168c4a3e0a5SBagalkote, Sreenivas union { 1169c4a3e0a5SBagalkote, Sreenivas u8 raw[128]; 1170c4a3e0a5SBagalkote, Sreenivas struct megasas_header hdr; 1171c4a3e0a5SBagalkote, Sreenivas } frame; 1172c4a3e0a5SBagalkote, Sreenivas struct compat_iovec sgl[MAX_IOCTL_SGE]; 1173c4a3e0a5SBagalkote, Sreenivas } __attribute__ ((packed)); 1174c4a3e0a5SBagalkote, Sreenivas 11750e98936cSSumant Patro #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket) 1176c4a3e0a5SBagalkote, Sreenivas #endif 1177c4a3e0a5SBagalkote, Sreenivas 1178cb59aa6aSSumant Patro #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) 1179c4a3e0a5SBagalkote, Sreenivas #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) 1180c4a3e0a5SBagalkote, Sreenivas 1181c4a3e0a5SBagalkote, Sreenivas struct megasas_mgmt_info { 1182c4a3e0a5SBagalkote, Sreenivas 1183c4a3e0a5SBagalkote, Sreenivas u16 count; 1184c4a3e0a5SBagalkote, Sreenivas struct megasas_instance *instance[MAX_MGMT_ADAPTERS]; 1185c4a3e0a5SBagalkote, Sreenivas int max_index; 1186c4a3e0a5SBagalkote, Sreenivas }; 1187c4a3e0a5SBagalkote, Sreenivas 1188c4a3e0a5SBagalkote, Sreenivas #endif /*LSI_MEGARAID_SAS_H */ 1189