19440SSusan.Scheufele@Sun.COM /* 29440SSusan.Scheufele@Sun.COM * mr_sas.h: header for mr_sas 39440SSusan.Scheufele@Sun.COM * 49440SSusan.Scheufele@Sun.COM * Solaris MegaRAID driver for SAS2.0 controllers 59440SSusan.Scheufele@Sun.COM * Copyright (c) 2008-2009, LSI Logic Corporation. 69440SSusan.Scheufele@Sun.COM * All rights reserved. 79440SSusan.Scheufele@Sun.COM * 89440SSusan.Scheufele@Sun.COM * Redistribution and use in source and binary forms, with or without 99440SSusan.Scheufele@Sun.COM * modification, are permitted provided that the following conditions are met: 109440SSusan.Scheufele@Sun.COM * 119440SSusan.Scheufele@Sun.COM * 1. Redistributions of source code must retain the above copyright notice, 129440SSusan.Scheufele@Sun.COM * this list of conditions and the following disclaimer. 139440SSusan.Scheufele@Sun.COM * 149440SSusan.Scheufele@Sun.COM * 2. Redistributions in binary form must reproduce the above copyright notice, 159440SSusan.Scheufele@Sun.COM * this list of conditions and the following disclaimer in the documentation 169440SSusan.Scheufele@Sun.COM * and/or other materials provided with the distribution. 179440SSusan.Scheufele@Sun.COM * 189440SSusan.Scheufele@Sun.COM * 3. Neither the name of the author nor the names of its contributors may be 199440SSusan.Scheufele@Sun.COM * used to endorse or promote products derived from this software without 209440SSusan.Scheufele@Sun.COM * specific prior written permission. 219440SSusan.Scheufele@Sun.COM * 229440SSusan.Scheufele@Sun.COM * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 239440SSusan.Scheufele@Sun.COM * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 249440SSusan.Scheufele@Sun.COM * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 259440SSusan.Scheufele@Sun.COM * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 269440SSusan.Scheufele@Sun.COM * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 279440SSusan.Scheufele@Sun.COM * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 289440SSusan.Scheufele@Sun.COM * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 299440SSusan.Scheufele@Sun.COM * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 309440SSusan.Scheufele@Sun.COM * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 319440SSusan.Scheufele@Sun.COM * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 329440SSusan.Scheufele@Sun.COM * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 339440SSusan.Scheufele@Sun.COM * DAMAGE. 349440SSusan.Scheufele@Sun.COM */ 359440SSusan.Scheufele@Sun.COM 369440SSusan.Scheufele@Sun.COM /* 3712244SYu.Wu@Sun.COM * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 389440SSusan.Scheufele@Sun.COM */ 399440SSusan.Scheufele@Sun.COM #ifndef _MR_SAS_H_ 409440SSusan.Scheufele@Sun.COM #define _MR_SAS_H_ 419440SSusan.Scheufele@Sun.COM 429440SSusan.Scheufele@Sun.COM #ifdef __cplusplus 439440SSusan.Scheufele@Sun.COM extern "C" { 449440SSusan.Scheufele@Sun.COM #endif 459440SSusan.Scheufele@Sun.COM 469440SSusan.Scheufele@Sun.COM #include <sys/scsi/scsi.h> 479440SSusan.Scheufele@Sun.COM #include "mr_sas_list.h" 489440SSusan.Scheufele@Sun.COM 499440SSusan.Scheufele@Sun.COM /* 509440SSusan.Scheufele@Sun.COM * MegaRAID SAS2.0 Driver meta data 519440SSusan.Scheufele@Sun.COM */ 5212638SSusan.Scheufele@Sun.COM #define MRSAS_VERSION "LSIv2.7" 5312244SYu.Wu@Sun.COM #define MRSAS_RELDATE "Apr 21, 2010" 549440SSusan.Scheufele@Sun.COM 559440SSusan.Scheufele@Sun.COM #define MRSAS_TRUE 1 569440SSusan.Scheufele@Sun.COM #define MRSAS_FALSE 0 579440SSusan.Scheufele@Sun.COM 5812244SYu.Wu@Sun.COM #define ADAPTER_RESET_NOT_REQUIRED 0 5912244SYu.Wu@Sun.COM #define ADAPTER_RESET_REQUIRED 1 6012244SYu.Wu@Sun.COM 619440SSusan.Scheufele@Sun.COM /* 629440SSusan.Scheufele@Sun.COM * MegaRAID SAS2.0 device id conversion definitions. 639440SSusan.Scheufele@Sun.COM */ 649440SSusan.Scheufele@Sun.COM #define INST2LSIRDCTL(x) ((x) << INST_MINOR_SHIFT) 659440SSusan.Scheufele@Sun.COM 669440SSusan.Scheufele@Sun.COM /* 679440SSusan.Scheufele@Sun.COM * MegaRAID SAS2.0 supported controllers 689440SSusan.Scheufele@Sun.COM */ 699440SSusan.Scheufele@Sun.COM #define PCI_DEVICE_ID_LSI_2108VDE 0x0078 709440SSusan.Scheufele@Sun.COM #define PCI_DEVICE_ID_LSI_2108V 0x0079 719440SSusan.Scheufele@Sun.COM 729440SSusan.Scheufele@Sun.COM /* 739440SSusan.Scheufele@Sun.COM * Register Index for 2108 Controllers. 749440SSusan.Scheufele@Sun.COM */ 759440SSusan.Scheufele@Sun.COM #define REGISTER_SET_IO_2108 (2) 769440SSusan.Scheufele@Sun.COM 779440SSusan.Scheufele@Sun.COM #define MRSAS_MAX_SGE_CNT 0x50 789440SSusan.Scheufele@Sun.COM 799440SSusan.Scheufele@Sun.COM #define MRSAS_IOCTL_DRIVER 0x12341234 809440SSusan.Scheufele@Sun.COM #define MRSAS_IOCTL_FIRMWARE 0x12345678 819440SSusan.Scheufele@Sun.COM #define MRSAS_IOCTL_AEN 0x87654321 829440SSusan.Scheufele@Sun.COM 839440SSusan.Scheufele@Sun.COM #define MRSAS_1_SECOND 1000000 849440SSusan.Scheufele@Sun.COM 859440SSusan.Scheufele@Sun.COM /* Dynamic Enumeration Flags */ 869440SSusan.Scheufele@Sun.COM #define MRSAS_PD_LUN 1 879440SSusan.Scheufele@Sun.COM #define MRSAS_LD_LUN 0 889440SSusan.Scheufele@Sun.COM #define MRSAS_PD_TGT_MAX 255 899440SSusan.Scheufele@Sun.COM #define MRSAS_GET_PD_MAX(s) ((s)->mr_pd_max) 909440SSusan.Scheufele@Sun.COM #define WWN_STRLEN 17 9112244SYu.Wu@Sun.COM #define APP_RESERVE_CMDS 32 929440SSusan.Scheufele@Sun.COM /* 939440SSusan.Scheufele@Sun.COM * ===================================== 949440SSusan.Scheufele@Sun.COM * MegaRAID SAS2.0 MFI firmware definitions 959440SSusan.Scheufele@Sun.COM * ===================================== 969440SSusan.Scheufele@Sun.COM */ 979440SSusan.Scheufele@Sun.COM /* 989440SSusan.Scheufele@Sun.COM * MFI stands for MegaRAID SAS2.0 FW Interface. This is just a moniker for 999440SSusan.Scheufele@Sun.COM * protocol between the software and firmware. Commands are issued using 1009440SSusan.Scheufele@Sun.COM * "message frames" 1019440SSusan.Scheufele@Sun.COM */ 1029440SSusan.Scheufele@Sun.COM 1039440SSusan.Scheufele@Sun.COM /* 1049440SSusan.Scheufele@Sun.COM * FW posts its state in upper 4 bits of outbound_msg_0 register 1059440SSusan.Scheufele@Sun.COM */ 1069440SSusan.Scheufele@Sun.COM #define MFI_STATE_SHIFT 28 1079440SSusan.Scheufele@Sun.COM #define MFI_STATE_MASK ((uint32_t)0xF<<MFI_STATE_SHIFT) 1089440SSusan.Scheufele@Sun.COM #define MFI_STATE_UNDEFINED ((uint32_t)0x0<<MFI_STATE_SHIFT) 1099440SSusan.Scheufele@Sun.COM #define MFI_STATE_BB_INIT ((uint32_t)0x1<<MFI_STATE_SHIFT) 1109440SSusan.Scheufele@Sun.COM #define MFI_STATE_FW_INIT ((uint32_t)0x4<<MFI_STATE_SHIFT) 1119440SSusan.Scheufele@Sun.COM #define MFI_STATE_WAIT_HANDSHAKE ((uint32_t)0x6<<MFI_STATE_SHIFT) 1129440SSusan.Scheufele@Sun.COM #define MFI_STATE_FW_INIT_2 ((uint32_t)0x7<<MFI_STATE_SHIFT) 1139440SSusan.Scheufele@Sun.COM #define MFI_STATE_DEVICE_SCAN ((uint32_t)0x8<<MFI_STATE_SHIFT) 1149440SSusan.Scheufele@Sun.COM #define MFI_STATE_BOOT_MESSAGE_PENDING ((uint32_t)0x9<<MFI_STATE_SHIFT) 1159440SSusan.Scheufele@Sun.COM #define MFI_STATE_FLUSH_CACHE ((uint32_t)0xA<<MFI_STATE_SHIFT) 1169440SSusan.Scheufele@Sun.COM #define MFI_STATE_READY ((uint32_t)0xB<<MFI_STATE_SHIFT) 1179440SSusan.Scheufele@Sun.COM #define MFI_STATE_OPERATIONAL ((uint32_t)0xC<<MFI_STATE_SHIFT) 1189440SSusan.Scheufele@Sun.COM #define MFI_STATE_FAULT ((uint32_t)0xF<<MFI_STATE_SHIFT) 1199440SSusan.Scheufele@Sun.COM 1209440SSusan.Scheufele@Sun.COM #define MRMFI_FRAME_SIZE 64 1219440SSusan.Scheufele@Sun.COM 1229440SSusan.Scheufele@Sun.COM /* 1239440SSusan.Scheufele@Sun.COM * During FW init, clear pending cmds & reset state using inbound_msg_0 1249440SSusan.Scheufele@Sun.COM * 1259440SSusan.Scheufele@Sun.COM * ABORT : Abort all pending cmds 1269440SSusan.Scheufele@Sun.COM * READY : Move from OPERATIONAL to READY state; discard queue info 1279440SSusan.Scheufele@Sun.COM * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??) 1289440SSusan.Scheufele@Sun.COM * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver 1299440SSusan.Scheufele@Sun.COM */ 1309440SSusan.Scheufele@Sun.COM #define MFI_INIT_ABORT 0x00000001 1319440SSusan.Scheufele@Sun.COM #define MFI_INIT_READY 0x00000002 1329440SSusan.Scheufele@Sun.COM #define MFI_INIT_MFIMODE 0x00000004 1339440SSusan.Scheufele@Sun.COM #define MFI_INIT_CLEAR_HANDSHAKE 0x00000008 1349440SSusan.Scheufele@Sun.COM #define MFI_INIT_HOTPLUG 0x00000010 1359440SSusan.Scheufele@Sun.COM #define MFI_STOP_ADP 0x00000020 1369440SSusan.Scheufele@Sun.COM #define MFI_RESET_FLAGS MFI_INIT_READY|MFI_INIT_MFIMODE|MFI_INIT_ABORT 1379440SSusan.Scheufele@Sun.COM 1389440SSusan.Scheufele@Sun.COM /* 1399440SSusan.Scheufele@Sun.COM * MFI frame flags 1409440SSusan.Scheufele@Sun.COM */ 1419440SSusan.Scheufele@Sun.COM #define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000 1429440SSusan.Scheufele@Sun.COM #define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001 1439440SSusan.Scheufele@Sun.COM #define MFI_FRAME_SGL32 0x0000 1449440SSusan.Scheufele@Sun.COM #define MFI_FRAME_SGL64 0x0002 1459440SSusan.Scheufele@Sun.COM #define MFI_FRAME_SENSE32 0x0000 1469440SSusan.Scheufele@Sun.COM #define MFI_FRAME_SENSE64 0x0004 1479440SSusan.Scheufele@Sun.COM #define MFI_FRAME_DIR_NONE 0x0000 1489440SSusan.Scheufele@Sun.COM #define MFI_FRAME_DIR_WRITE 0x0008 1499440SSusan.Scheufele@Sun.COM #define MFI_FRAME_DIR_READ 0x0010 1509440SSusan.Scheufele@Sun.COM #define MFI_FRAME_DIR_BOTH 0x0018 15112244SYu.Wu@Sun.COM #define MFI_FRAME_IEEE 0x0020 1529440SSusan.Scheufele@Sun.COM 1539440SSusan.Scheufele@Sun.COM /* 1549440SSusan.Scheufele@Sun.COM * Definition for cmd_status 1559440SSusan.Scheufele@Sun.COM */ 1569440SSusan.Scheufele@Sun.COM #define MFI_CMD_STATUS_POLL_MODE 0xFF 1579440SSusan.Scheufele@Sun.COM #define MFI_CMD_STATUS_SYNC_MODE 0xFF 1589440SSusan.Scheufele@Sun.COM 1599440SSusan.Scheufele@Sun.COM /* 1609440SSusan.Scheufele@Sun.COM * MFI command opcodes 1619440SSusan.Scheufele@Sun.COM */ 1629440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_INIT 0x00 1639440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_LD_READ 0x01 1649440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_LD_WRITE 0x02 1659440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_LD_SCSI 0x03 1669440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_PD_SCSI 0x04 1679440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_DCMD 0x05 1689440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_ABORT 0x06 1699440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_SMP 0x07 1709440SSusan.Scheufele@Sun.COM #define MFI_CMD_OP_STP 0x08 1719440SSusan.Scheufele@Sun.COM 1729440SSusan.Scheufele@Sun.COM #define MR_DCMD_CTRL_GET_INFO 0x01010000 1739440SSusan.Scheufele@Sun.COM 1749440SSusan.Scheufele@Sun.COM #define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000 1759440SSusan.Scheufele@Sun.COM #define MR_FLUSH_CTRL_CACHE 0x01 1769440SSusan.Scheufele@Sun.COM #define MR_FLUSH_DISK_CACHE 0x02 1779440SSusan.Scheufele@Sun.COM 1789440SSusan.Scheufele@Sun.COM #define MR_DCMD_CTRL_SHUTDOWN 0x01050000 1799440SSusan.Scheufele@Sun.COM #define MRSAS_ENABLE_DRIVE_SPINDOWN 0x01 1809440SSusan.Scheufele@Sun.COM 1819440SSusan.Scheufele@Sun.COM #define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100 1829440SSusan.Scheufele@Sun.COM #define MR_DCMD_CTRL_EVENT_GET 0x01040300 1839440SSusan.Scheufele@Sun.COM #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500 1849440SSusan.Scheufele@Sun.COM #define MR_DCMD_LD_GET_PROPERTIES 0x03030000 1859440SSusan.Scheufele@Sun.COM #define MR_DCMD_PD_GET_INFO 0x02020000 1869440SSusan.Scheufele@Sun.COM 1879440SSusan.Scheufele@Sun.COM /* 1889440SSusan.Scheufele@Sun.COM * Solaris Specific MAX values 1899440SSusan.Scheufele@Sun.COM */ 1909440SSusan.Scheufele@Sun.COM #define MAX_SGL 24 1919440SSusan.Scheufele@Sun.COM /* 1929440SSusan.Scheufele@Sun.COM * MFI command completion codes 1939440SSusan.Scheufele@Sun.COM */ 1949440SSusan.Scheufele@Sun.COM enum MFI_STAT { 1959440SSusan.Scheufele@Sun.COM MFI_STAT_OK = 0x00, 1969440SSusan.Scheufele@Sun.COM MFI_STAT_INVALID_CMD = 0x01, 1979440SSusan.Scheufele@Sun.COM MFI_STAT_INVALID_DCMD = 0x02, 1989440SSusan.Scheufele@Sun.COM MFI_STAT_INVALID_PARAMETER = 0x03, 1999440SSusan.Scheufele@Sun.COM MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04, 2009440SSusan.Scheufele@Sun.COM MFI_STAT_ABORT_NOT_POSSIBLE = 0x05, 2019440SSusan.Scheufele@Sun.COM MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06, 2029440SSusan.Scheufele@Sun.COM MFI_STAT_APP_IN_USE = 0x07, 2039440SSusan.Scheufele@Sun.COM MFI_STAT_APP_NOT_INITIALIZED = 0x08, 2049440SSusan.Scheufele@Sun.COM MFI_STAT_ARRAY_INDEX_INVALID = 0x09, 2059440SSusan.Scheufele@Sun.COM MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a, 2069440SSusan.Scheufele@Sun.COM MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b, 2079440SSusan.Scheufele@Sun.COM MFI_STAT_DEVICE_NOT_FOUND = 0x0c, 2089440SSusan.Scheufele@Sun.COM MFI_STAT_DRIVE_TOO_SMALL = 0x0d, 2099440SSusan.Scheufele@Sun.COM MFI_STAT_FLASH_ALLOC_FAIL = 0x0e, 2109440SSusan.Scheufele@Sun.COM MFI_STAT_FLASH_BUSY = 0x0f, 2119440SSusan.Scheufele@Sun.COM MFI_STAT_FLASH_ERROR = 0x10, 2129440SSusan.Scheufele@Sun.COM MFI_STAT_FLASH_IMAGE_BAD = 0x11, 2139440SSusan.Scheufele@Sun.COM MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12, 2149440SSusan.Scheufele@Sun.COM MFI_STAT_FLASH_NOT_OPEN = 0x13, 2159440SSusan.Scheufele@Sun.COM MFI_STAT_FLASH_NOT_STARTED = 0x14, 2169440SSusan.Scheufele@Sun.COM MFI_STAT_FLUSH_FAILED = 0x15, 2179440SSusan.Scheufele@Sun.COM MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16, 2189440SSusan.Scheufele@Sun.COM MFI_STAT_LD_CC_IN_PROGRESS = 0x17, 2199440SSusan.Scheufele@Sun.COM MFI_STAT_LD_INIT_IN_PROGRESS = 0x18, 2209440SSusan.Scheufele@Sun.COM MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19, 2219440SSusan.Scheufele@Sun.COM MFI_STAT_LD_MAX_CONFIGURED = 0x1a, 2229440SSusan.Scheufele@Sun.COM MFI_STAT_LD_NOT_OPTIMAL = 0x1b, 2239440SSusan.Scheufele@Sun.COM MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c, 2249440SSusan.Scheufele@Sun.COM MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d, 2259440SSusan.Scheufele@Sun.COM MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e, 2269440SSusan.Scheufele@Sun.COM MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f, 2279440SSusan.Scheufele@Sun.COM MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20, 2289440SSusan.Scheufele@Sun.COM MFI_STAT_MFC_HW_ERROR = 0x21, 2299440SSusan.Scheufele@Sun.COM MFI_STAT_NO_HW_PRESENT = 0x22, 2309440SSusan.Scheufele@Sun.COM MFI_STAT_NOT_FOUND = 0x23, 2319440SSusan.Scheufele@Sun.COM MFI_STAT_NOT_IN_ENCL = 0x24, 2329440SSusan.Scheufele@Sun.COM MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25, 2339440SSusan.Scheufele@Sun.COM MFI_STAT_PD_TYPE_WRONG = 0x26, 2349440SSusan.Scheufele@Sun.COM MFI_STAT_PR_DISABLED = 0x27, 2359440SSusan.Scheufele@Sun.COM MFI_STAT_ROW_INDEX_INVALID = 0x28, 2369440SSusan.Scheufele@Sun.COM MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29, 2379440SSusan.Scheufele@Sun.COM MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a, 2389440SSusan.Scheufele@Sun.COM MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b, 2399440SSusan.Scheufele@Sun.COM MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c, 2409440SSusan.Scheufele@Sun.COM MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d, 2419440SSusan.Scheufele@Sun.COM MFI_STAT_SCSI_IO_FAILED = 0x2e, 2429440SSusan.Scheufele@Sun.COM MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f, 2439440SSusan.Scheufele@Sun.COM MFI_STAT_SHUTDOWN_FAILED = 0x30, 2449440SSusan.Scheufele@Sun.COM MFI_STAT_TIME_NOT_SET = 0x31, 2459440SSusan.Scheufele@Sun.COM MFI_STAT_WRONG_STATE = 0x32, 2469440SSusan.Scheufele@Sun.COM MFI_STAT_LD_OFFLINE = 0x33, 2479440SSusan.Scheufele@Sun.COM /* UNUSED: 0x34 to 0xfe */ 2489440SSusan.Scheufele@Sun.COM MFI_STAT_INVALID_STATUS = 0xFF 2499440SSusan.Scheufele@Sun.COM }; 2509440SSusan.Scheufele@Sun.COM 2519440SSusan.Scheufele@Sun.COM enum MR_EVT_CLASS { 2529440SSusan.Scheufele@Sun.COM MR_EVT_CLASS_DEBUG = -2, 2539440SSusan.Scheufele@Sun.COM MR_EVT_CLASS_PROGRESS = -1, 2549440SSusan.Scheufele@Sun.COM MR_EVT_CLASS_INFO = 0, 2559440SSusan.Scheufele@Sun.COM MR_EVT_CLASS_WARNING = 1, 2569440SSusan.Scheufele@Sun.COM MR_EVT_CLASS_CRITICAL = 2, 2579440SSusan.Scheufele@Sun.COM MR_EVT_CLASS_FATAL = 3, 2589440SSusan.Scheufele@Sun.COM MR_EVT_CLASS_DEAD = 4 2599440SSusan.Scheufele@Sun.COM }; 2609440SSusan.Scheufele@Sun.COM 2619440SSusan.Scheufele@Sun.COM enum MR_EVT_LOCALE { 2629440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_LD = 0x0001, 2639440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_PD = 0x0002, 2649440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_ENCL = 0x0004, 2659440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_BBU = 0x0008, 2669440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_SAS = 0x0010, 2679440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_CTRL = 0x0020, 2689440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_CONFIG = 0x0040, 2699440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_CLUSTER = 0x0080, 2709440SSusan.Scheufele@Sun.COM MR_EVT_LOCALE_ALL = 0xffff 2719440SSusan.Scheufele@Sun.COM }; 2729440SSusan.Scheufele@Sun.COM 2739440SSusan.Scheufele@Sun.COM #define MR_EVT_CFG_CLEARED 0x0004 2749440SSusan.Scheufele@Sun.COM #define MR_EVT_LD_CREATED 0x008a 2759440SSusan.Scheufele@Sun.COM #define MR_EVT_LD_DELETED 0x008b 2769440SSusan.Scheufele@Sun.COM #define MR_EVT_PD_REMOVED_EXT 0x00f8 2779440SSusan.Scheufele@Sun.COM #define MR_EVT_PD_INSERTED_EXT 0x00f7 2789440SSusan.Scheufele@Sun.COM 2799440SSusan.Scheufele@Sun.COM enum LD_STATE { 2809440SSusan.Scheufele@Sun.COM LD_OFFLINE = 0, 2819440SSusan.Scheufele@Sun.COM LD_PARTIALLY_DEGRADED = 1, 2829440SSusan.Scheufele@Sun.COM LD_DEGRADED = 2, 2839440SSusan.Scheufele@Sun.COM LD_OPTIMAL = 3, 2849440SSusan.Scheufele@Sun.COM LD_INVALID = 0xFF 2859440SSusan.Scheufele@Sun.COM }; 2869440SSusan.Scheufele@Sun.COM 2879440SSusan.Scheufele@Sun.COM enum MRSAS_EVT { 2889440SSusan.Scheufele@Sun.COM MRSAS_EVT_CONFIG_TGT = 0, 2899440SSusan.Scheufele@Sun.COM MRSAS_EVT_UNCONFIG_TGT = 1, 2909440SSusan.Scheufele@Sun.COM MRSAS_EVT_UNCONFIG_SMP = 2 2919440SSusan.Scheufele@Sun.COM }; 2929440SSusan.Scheufele@Sun.COM 2939440SSusan.Scheufele@Sun.COM #define DMA_OBJ_ALLOCATED 1 2949440SSusan.Scheufele@Sun.COM #define DMA_OBJ_REALLOCATED 2 2959440SSusan.Scheufele@Sun.COM #define DMA_OBJ_FREED 3 2969440SSusan.Scheufele@Sun.COM 2979440SSusan.Scheufele@Sun.COM /* 2989440SSusan.Scheufele@Sun.COM * dma_obj_t - Our DMA object 2999440SSusan.Scheufele@Sun.COM * @param buffer : kernel virtual address 3009440SSusan.Scheufele@Sun.COM * @param size : size of the data to be allocated 3019440SSusan.Scheufele@Sun.COM * @param acc_handle : access handle 3029440SSusan.Scheufele@Sun.COM * @param dma_handle : dma handle 3039440SSusan.Scheufele@Sun.COM * @param dma_cookie : scatter-gather list 3049440SSusan.Scheufele@Sun.COM * @param dma_attr : dma attributes for this buffer 3059440SSusan.Scheufele@Sun.COM * Our DMA object. The caller must initialize the size and dma attributes 3069440SSusan.Scheufele@Sun.COM * (dma_attr) fields before allocating the resources. 3079440SSusan.Scheufele@Sun.COM */ 3089440SSusan.Scheufele@Sun.COM typedef struct { 3099440SSusan.Scheufele@Sun.COM caddr_t buffer; 3109440SSusan.Scheufele@Sun.COM uint32_t size; 3119440SSusan.Scheufele@Sun.COM ddi_acc_handle_t acc_handle; 3129440SSusan.Scheufele@Sun.COM ddi_dma_handle_t dma_handle; 3139440SSusan.Scheufele@Sun.COM ddi_dma_cookie_t dma_cookie[MRSAS_MAX_SGE_CNT]; 3149440SSusan.Scheufele@Sun.COM ddi_dma_attr_t dma_attr; 3159440SSusan.Scheufele@Sun.COM uint8_t status; 3169440SSusan.Scheufele@Sun.COM uint8_t reserved[3]; 3179440SSusan.Scheufele@Sun.COM } dma_obj_t; 3189440SSusan.Scheufele@Sun.COM 3199440SSusan.Scheufele@Sun.COM struct mrsas_eventinfo { 3209440SSusan.Scheufele@Sun.COM struct mrsas_instance *instance; 3219440SSusan.Scheufele@Sun.COM int tgt; 3229440SSusan.Scheufele@Sun.COM int lun; 3239440SSusan.Scheufele@Sun.COM int event; 3249440SSusan.Scheufele@Sun.COM }; 3259440SSusan.Scheufele@Sun.COM 3269440SSusan.Scheufele@Sun.COM struct mrsas_ld { 3279440SSusan.Scheufele@Sun.COM dev_info_t *dip; 3289440SSusan.Scheufele@Sun.COM uint8_t lun_type; 3299440SSusan.Scheufele@Sun.COM uint8_t reserved[3]; 3309440SSusan.Scheufele@Sun.COM }; 3319440SSusan.Scheufele@Sun.COM 3329440SSusan.Scheufele@Sun.COM struct mrsas_pd { 3339440SSusan.Scheufele@Sun.COM dev_info_t *dip; 3349440SSusan.Scheufele@Sun.COM uint8_t lun_type; 3359440SSusan.Scheufele@Sun.COM uint8_t dev_id; 3369440SSusan.Scheufele@Sun.COM uint8_t flags; 3379440SSusan.Scheufele@Sun.COM uint8_t reserved; 3389440SSusan.Scheufele@Sun.COM }; 3399440SSusan.Scheufele@Sun.COM 3409440SSusan.Scheufele@Sun.COM struct mrsas_pd_info { 3419440SSusan.Scheufele@Sun.COM uint16_t deviceId; 3429440SSusan.Scheufele@Sun.COM uint16_t seqNum; 3439440SSusan.Scheufele@Sun.COM uint8_t inquiryData[96]; 3449440SSusan.Scheufele@Sun.COM uint8_t vpdPage83[64]; 3459440SSusan.Scheufele@Sun.COM uint8_t notSupported; 3469440SSusan.Scheufele@Sun.COM uint8_t scsiDevType; 3479440SSusan.Scheufele@Sun.COM uint8_t a; 3489440SSusan.Scheufele@Sun.COM uint8_t device_speed; 3499440SSusan.Scheufele@Sun.COM uint32_t mediaerrcnt; 3509440SSusan.Scheufele@Sun.COM uint32_t other; 3519440SSusan.Scheufele@Sun.COM uint32_t pred; 3529440SSusan.Scheufele@Sun.COM uint32_t lastpred; 3539440SSusan.Scheufele@Sun.COM uint16_t fwState; 3549440SSusan.Scheufele@Sun.COM uint8_t disabled; 3559440SSusan.Scheufele@Sun.COM uint8_t linkspwwd; 3569440SSusan.Scheufele@Sun.COM uint32_t ddfType; 3579440SSusan.Scheufele@Sun.COM struct { 3589440SSusan.Scheufele@Sun.COM uint8_t count; 3599440SSusan.Scheufele@Sun.COM uint8_t isPathBroken; 3609440SSusan.Scheufele@Sun.COM uint8_t connectorIndex[2]; 3619440SSusan.Scheufele@Sun.COM uint8_t reserved[4]; 3629440SSusan.Scheufele@Sun.COM uint64_t sasAddr[2]; 3639440SSusan.Scheufele@Sun.COM uint8_t reserved2[16]; 3649440SSusan.Scheufele@Sun.COM } pathInfo; 3659440SSusan.Scheufele@Sun.COM }; 3669440SSusan.Scheufele@Sun.COM 3679440SSusan.Scheufele@Sun.COM typedef struct mrsas_instance { 3689440SSusan.Scheufele@Sun.COM uint32_t *producer; 3699440SSusan.Scheufele@Sun.COM uint32_t *consumer; 3709440SSusan.Scheufele@Sun.COM 3719440SSusan.Scheufele@Sun.COM uint32_t *reply_queue; 3729440SSusan.Scheufele@Sun.COM dma_obj_t mfi_internal_dma_obj; 37312244SYu.Wu@Sun.COM uint16_t adapterresetinprogress; 37412244SYu.Wu@Sun.COM uint16_t deadadapter; 3759440SSusan.Scheufele@Sun.COM uint8_t init_id; 37611856SYu.Wu@Sun.COM uint8_t flag_ieee; 37712244SYu.Wu@Sun.COM uint8_t disable_online_ctrl_reset; 37812244SYu.Wu@Sun.COM uint8_t fw_fault_count_after_ocr; 3799440SSusan.Scheufele@Sun.COM 3809440SSusan.Scheufele@Sun.COM uint16_t max_num_sge; 3819440SSusan.Scheufele@Sun.COM uint16_t max_fw_cmds; 3829440SSusan.Scheufele@Sun.COM uint32_t max_sectors_per_req; 3839440SSusan.Scheufele@Sun.COM 3849440SSusan.Scheufele@Sun.COM struct mrsas_cmd **cmd_list; 3859440SSusan.Scheufele@Sun.COM mlist_t cmd_pool_list; 3869440SSusan.Scheufele@Sun.COM kmutex_t cmd_pool_mtx; 3879440SSusan.Scheufele@Sun.COM 38812244SYu.Wu@Sun.COM mlist_t app_cmd_pool_list; 38912244SYu.Wu@Sun.COM kmutex_t app_cmd_pool_mtx; 3909440SSusan.Scheufele@Sun.COM mlist_t cmd_pend_list; 3919440SSusan.Scheufele@Sun.COM kmutex_t cmd_pend_mtx; 3929440SSusan.Scheufele@Sun.COM 3939440SSusan.Scheufele@Sun.COM dma_obj_t mfi_evt_detail_obj; 3949440SSusan.Scheufele@Sun.COM struct mrsas_cmd *aen_cmd; 3959440SSusan.Scheufele@Sun.COM 3969440SSusan.Scheufele@Sun.COM uint32_t aen_seq_num; 3979440SSusan.Scheufele@Sun.COM uint32_t aen_class_locale_word; 3989440SSusan.Scheufele@Sun.COM 3999440SSusan.Scheufele@Sun.COM scsi_hba_tran_t *tran; 4009440SSusan.Scheufele@Sun.COM 4019440SSusan.Scheufele@Sun.COM kcondvar_t int_cmd_cv; 4029440SSusan.Scheufele@Sun.COM kmutex_t int_cmd_mtx; 4039440SSusan.Scheufele@Sun.COM 4049440SSusan.Scheufele@Sun.COM kcondvar_t aen_cmd_cv; 4059440SSusan.Scheufele@Sun.COM kmutex_t aen_cmd_mtx; 4069440SSusan.Scheufele@Sun.COM 4079440SSusan.Scheufele@Sun.COM kcondvar_t abort_cmd_cv; 4089440SSusan.Scheufele@Sun.COM kmutex_t abort_cmd_mtx; 4099440SSusan.Scheufele@Sun.COM 4109440SSusan.Scheufele@Sun.COM dev_info_t *dip; 4119440SSusan.Scheufele@Sun.COM ddi_acc_handle_t pci_handle; 4129440SSusan.Scheufele@Sun.COM 4139440SSusan.Scheufele@Sun.COM timeout_id_t timeout_id; 4149440SSusan.Scheufele@Sun.COM uint32_t unique_id; 4159440SSusan.Scheufele@Sun.COM uint16_t fw_outstanding; 4169440SSusan.Scheufele@Sun.COM caddr_t regmap; 4179440SSusan.Scheufele@Sun.COM ddi_acc_handle_t regmap_handle; 4189440SSusan.Scheufele@Sun.COM uint8_t isr_level; 4199440SSusan.Scheufele@Sun.COM ddi_iblock_cookie_t iblock_cookie; 4209440SSusan.Scheufele@Sun.COM ddi_iblock_cookie_t soft_iblock_cookie; 4219440SSusan.Scheufele@Sun.COM ddi_softintr_t soft_intr_id; 4229440SSusan.Scheufele@Sun.COM uint8_t softint_running; 4239440SSusan.Scheufele@Sun.COM kmutex_t completed_pool_mtx; 4249440SSusan.Scheufele@Sun.COM mlist_t completed_pool_list; 4259440SSusan.Scheufele@Sun.COM 4269440SSusan.Scheufele@Sun.COM caddr_t internal_buf; 4279440SSusan.Scheufele@Sun.COM uint32_t internal_buf_dmac_add; 4289440SSusan.Scheufele@Sun.COM uint32_t internal_buf_size; 4299440SSusan.Scheufele@Sun.COM 4309440SSusan.Scheufele@Sun.COM uint16_t vendor_id; 4319440SSusan.Scheufele@Sun.COM uint16_t device_id; 4329440SSusan.Scheufele@Sun.COM uint16_t subsysvid; 4339440SSusan.Scheufele@Sun.COM uint16_t subsysid; 4349440SSusan.Scheufele@Sun.COM int instance; 4359440SSusan.Scheufele@Sun.COM int baseaddress; 4369440SSusan.Scheufele@Sun.COM char iocnode[16]; 4379440SSusan.Scheufele@Sun.COM 4389440SSusan.Scheufele@Sun.COM int fm_capabilities; 4399440SSusan.Scheufele@Sun.COM 4409440SSusan.Scheufele@Sun.COM struct mrsas_func_ptr *func_ptr; 4419440SSusan.Scheufele@Sun.COM /* MSI interrupts specific */ 4429440SSusan.Scheufele@Sun.COM ddi_intr_handle_t *intr_htable; 4439440SSusan.Scheufele@Sun.COM int intr_type; 4449440SSusan.Scheufele@Sun.COM int intr_cnt; 4459440SSusan.Scheufele@Sun.COM size_t intr_size; 4469440SSusan.Scheufele@Sun.COM uint_t intr_pri; 4479440SSusan.Scheufele@Sun.COM int intr_cap; 4489440SSusan.Scheufele@Sun.COM 4499440SSusan.Scheufele@Sun.COM ddi_taskq_t *taskq; 4509440SSusan.Scheufele@Sun.COM struct mrsas_ld *mr_ld_list; 45112244SYu.Wu@Sun.COM kmutex_t ocr_flags_mtx; 4529440SSusan.Scheufele@Sun.COM } mrsas_t; 4539440SSusan.Scheufele@Sun.COM 4549440SSusan.Scheufele@Sun.COM struct mrsas_func_ptr { 4559440SSusan.Scheufele@Sun.COM int (*read_fw_status_reg)(struct mrsas_instance *); 4569440SSusan.Scheufele@Sun.COM void (*issue_cmd)(struct mrsas_cmd *, struct mrsas_instance *); 4579440SSusan.Scheufele@Sun.COM int (*issue_cmd_in_sync_mode)(struct mrsas_instance *, 4589440SSusan.Scheufele@Sun.COM struct mrsas_cmd *); 4599440SSusan.Scheufele@Sun.COM int (*issue_cmd_in_poll_mode)(struct mrsas_instance *, 4609440SSusan.Scheufele@Sun.COM struct mrsas_cmd *); 4619440SSusan.Scheufele@Sun.COM void (*enable_intr)(struct mrsas_instance *); 4629440SSusan.Scheufele@Sun.COM void (*disable_intr)(struct mrsas_instance *); 4639440SSusan.Scheufele@Sun.COM int (*intr_ack)(struct mrsas_instance *); 4649440SSusan.Scheufele@Sun.COM }; 4659440SSusan.Scheufele@Sun.COM 4669440SSusan.Scheufele@Sun.COM /* 4679440SSusan.Scheufele@Sun.COM * ### Helper routines ### 4689440SSusan.Scheufele@Sun.COM */ 4699440SSusan.Scheufele@Sun.COM 4709440SSusan.Scheufele@Sun.COM /* 4719440SSusan.Scheufele@Sun.COM * con_log() - console log routine 4729440SSusan.Scheufele@Sun.COM * @param level : indicates the severity of the message. 4739440SSusan.Scheufele@Sun.COM * @fparam mt : format string 4749440SSusan.Scheufele@Sun.COM * 4759440SSusan.Scheufele@Sun.COM * con_log displays the error messages on the console based on the current 4769440SSusan.Scheufele@Sun.COM * debug level. Also it attaches the appropriate kernel severity level with 4779440SSusan.Scheufele@Sun.COM * the message. 4789440SSusan.Scheufele@Sun.COM * 4799440SSusan.Scheufele@Sun.COM * 4809440SSusan.Scheufele@Sun.COM * console messages debug levels 4819440SSusan.Scheufele@Sun.COM */ 4829440SSusan.Scheufele@Sun.COM #define CL_NONE 0 /* No debug information */ 48312244SYu.Wu@Sun.COM #define CL_TEST_OCR 1 48412244SYu.Wu@Sun.COM #define CL_ANN 2 /* print unconditionally, announcements */ 48512244SYu.Wu@Sun.COM #define CL_ANN1 3 /* No o/p */ 48612244SYu.Wu@Sun.COM #define CL_DLEVEL1 4 /* debug level 1, informative */ 48712244SYu.Wu@Sun.COM #define CL_DLEVEL2 5 /* debug level 2, verbose */ 48812244SYu.Wu@Sun.COM #define CL_DLEVEL3 6 /* debug level 3, very verbose */ 48912244SYu.Wu@Sun.COM 4909440SSusan.Scheufele@Sun.COM 4919440SSusan.Scheufele@Sun.COM #ifdef __SUNPRO_C 4929440SSusan.Scheufele@Sun.COM #define __func__ "" 4939440SSusan.Scheufele@Sun.COM #endif 4949440SSusan.Scheufele@Sun.COM 4959440SSusan.Scheufele@Sun.COM #define con_log(level, fmt) { if (debug_level_g >= level) cmn_err fmt; } 4969440SSusan.Scheufele@Sun.COM 4979440SSusan.Scheufele@Sun.COM /* 4989440SSusan.Scheufele@Sun.COM * ### SCSA definitions ### 4999440SSusan.Scheufele@Sun.COM */ 5009440SSusan.Scheufele@Sun.COM #define PKT2TGT(pkt) ((pkt)->pkt_address.a_target) 5019440SSusan.Scheufele@Sun.COM #define PKT2LUN(pkt) ((pkt)->pkt_address.a_lun) 5029440SSusan.Scheufele@Sun.COM #define PKT2TRAN(pkt) ((pkt)->pkt_adress.a_hba_tran) 5039440SSusan.Scheufele@Sun.COM #define ADDR2TRAN(ap) ((ap)->a_hba_tran) 5049440SSusan.Scheufele@Sun.COM 5059440SSusan.Scheufele@Sun.COM #define TRAN2MR(tran) (struct mrsas_instance *)(tran)->tran_hba_private) 5069440SSusan.Scheufele@Sun.COM #define ADDR2MR(ap) (TRAN2MR(ADDR2TRAN(ap)) 5079440SSusan.Scheufele@Sun.COM 5089440SSusan.Scheufele@Sun.COM #define PKT2CMD(pkt) ((struct scsa_cmd *)(pkt)->pkt_ha_private) 5099440SSusan.Scheufele@Sun.COM #define CMD2PKT(sp) ((sp)->cmd_pkt) 5109440SSusan.Scheufele@Sun.COM #define PKT2REQ(pkt) (&(PKT2CMD(pkt)->request)) 5119440SSusan.Scheufele@Sun.COM 5129440SSusan.Scheufele@Sun.COM #define CMD2ADDR(cmd) (&CMD2PKT(cmd)->pkt_address) 5139440SSusan.Scheufele@Sun.COM #define CMD2TRAN(cmd) (CMD2PKT(cmd)->pkt_address.a_hba_tran) 5149440SSusan.Scheufele@Sun.COM #define CMD2MR(cmd) (TRAN2MR(CMD2TRAN(cmd))) 5159440SSusan.Scheufele@Sun.COM 5169440SSusan.Scheufele@Sun.COM #define CFLAG_DMAVALID 0x0001 /* requires a dma operation */ 5179440SSusan.Scheufele@Sun.COM #define CFLAG_DMASEND 0x0002 /* Transfer from the device */ 5189440SSusan.Scheufele@Sun.COM #define CFLAG_CONSISTENT 0x0040 /* consistent data transfer */ 5199440SSusan.Scheufele@Sun.COM 5209440SSusan.Scheufele@Sun.COM /* 5219440SSusan.Scheufele@Sun.COM * ### Data structures for ioctl inteface and internal commands ### 5229440SSusan.Scheufele@Sun.COM */ 5239440SSusan.Scheufele@Sun.COM 5249440SSusan.Scheufele@Sun.COM /* 5259440SSusan.Scheufele@Sun.COM * Data direction flags 5269440SSusan.Scheufele@Sun.COM */ 5279440SSusan.Scheufele@Sun.COM #define UIOC_RD 0x00001 5289440SSusan.Scheufele@Sun.COM #define UIOC_WR 0x00002 5299440SSusan.Scheufele@Sun.COM 5309440SSusan.Scheufele@Sun.COM #define SCP2HOST(scp) (scp)->device->host /* to host */ 5319440SSusan.Scheufele@Sun.COM #define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata /* to soft state */ 5329440SSusan.Scheufele@Sun.COM #define SCP2CHANNEL(scp) (scp)->device->channel /* to channel */ 5339440SSusan.Scheufele@Sun.COM #define SCP2TARGET(scp) (scp)->device->id /* to target */ 5349440SSusan.Scheufele@Sun.COM #define SCP2LUN(scp) (scp)->device->lun /* to LUN */ 5359440SSusan.Scheufele@Sun.COM 5369440SSusan.Scheufele@Sun.COM #define SCSIHOST2ADAP(host) (((caddr_t *)(host->hostdata))[0]) 5379440SSusan.Scheufele@Sun.COM #define SCP2ADAPTER(scp) \ 5389440SSusan.Scheufele@Sun.COM (struct mrsas_instance *)SCSIHOST2ADAP(SCP2HOST(scp)) 5399440SSusan.Scheufele@Sun.COM 5409440SSusan.Scheufele@Sun.COM #define MRDRV_IS_LOGICAL_SCSA(instance, acmd) \ 5419440SSusan.Scheufele@Sun.COM (acmd->device_id < MRDRV_MAX_LD) ? 1 : 0 5429440SSusan.Scheufele@Sun.COM #define MRDRV_IS_LOGICAL(ap) \ 5439440SSusan.Scheufele@Sun.COM ((ap->a_target < MRDRV_MAX_LD) && (ap->a_lun == 0)) ? 1 : 0 5449440SSusan.Scheufele@Sun.COM #define MAP_DEVICE_ID(instance, ap) \ 5459440SSusan.Scheufele@Sun.COM (ap->a_target) 5469440SSusan.Scheufele@Sun.COM 5479440SSusan.Scheufele@Sun.COM #define HIGH_LEVEL_INTR 1 5489440SSusan.Scheufele@Sun.COM #define NORMAL_LEVEL_INTR 0 5499440SSusan.Scheufele@Sun.COM 55012244SYu.Wu@Sun.COM #define IO_RETRY_COUNT 3 55112244SYu.Wu@Sun.COM #define MAX_FW_RESET_COUNT 3 55212244SYu.Wu@Sun.COM 5539440SSusan.Scheufele@Sun.COM /* 5549440SSusan.Scheufele@Sun.COM * scsa_cmd - Per-command mr private data 5559440SSusan.Scheufele@Sun.COM * @param cmd_dmahandle : dma handle 5569440SSusan.Scheufele@Sun.COM * @param cmd_dmacookies : current dma cookies 5579440SSusan.Scheufele@Sun.COM * @param cmd_pkt : scsi_pkt reference 5589440SSusan.Scheufele@Sun.COM * @param cmd_dmacount : dma count 5599440SSusan.Scheufele@Sun.COM * @param cmd_cookie : next cookie 5609440SSusan.Scheufele@Sun.COM * @param cmd_ncookies : cookies per window 5619440SSusan.Scheufele@Sun.COM * @param cmd_cookiecnt : cookies per sub-win 5629440SSusan.Scheufele@Sun.COM * @param cmd_nwin : number of dma windows 5639440SSusan.Scheufele@Sun.COM * @param cmd_curwin : current dma window 5649440SSusan.Scheufele@Sun.COM * @param cmd_dma_offset : current window offset 5659440SSusan.Scheufele@Sun.COM * @param cmd_dma_len : current window length 5669440SSusan.Scheufele@Sun.COM * @param cmd_flags : private flags 5679440SSusan.Scheufele@Sun.COM * @param cmd_cdblen : length of cdb 5689440SSusan.Scheufele@Sun.COM * @param cmd_scblen : length of scb 5699440SSusan.Scheufele@Sun.COM * @param cmd_buf : command buffer 5709440SSusan.Scheufele@Sun.COM * @param channel : channel for scsi sub-system 5719440SSusan.Scheufele@Sun.COM * @param target : target for scsi sub-system 5729440SSusan.Scheufele@Sun.COM * @param lun : LUN for scsi sub-system 5739440SSusan.Scheufele@Sun.COM * 5749440SSusan.Scheufele@Sun.COM * - Allocated at same time as scsi_pkt by scsi_hba_pkt_alloc(9E) 5759440SSusan.Scheufele@Sun.COM * - Pointed to by pkt_ha_private field in scsi_pkt 5769440SSusan.Scheufele@Sun.COM */ 5779440SSusan.Scheufele@Sun.COM struct scsa_cmd { 5789440SSusan.Scheufele@Sun.COM ddi_dma_handle_t cmd_dmahandle; 5799440SSusan.Scheufele@Sun.COM ddi_dma_cookie_t cmd_dmacookies[MRSAS_MAX_SGE_CNT]; 5809440SSusan.Scheufele@Sun.COM struct scsi_pkt *cmd_pkt; 5819440SSusan.Scheufele@Sun.COM ulong_t cmd_dmacount; 5829440SSusan.Scheufele@Sun.COM uint_t cmd_cookie; 5839440SSusan.Scheufele@Sun.COM uint_t cmd_ncookies; 5849440SSusan.Scheufele@Sun.COM uint_t cmd_cookiecnt; 5859440SSusan.Scheufele@Sun.COM uint_t cmd_nwin; 5869440SSusan.Scheufele@Sun.COM uint_t cmd_curwin; 5879440SSusan.Scheufele@Sun.COM off_t cmd_dma_offset; 5889440SSusan.Scheufele@Sun.COM ulong_t cmd_dma_len; 5899440SSusan.Scheufele@Sun.COM ulong_t cmd_flags; 5909440SSusan.Scheufele@Sun.COM uint_t cmd_cdblen; 5919440SSusan.Scheufele@Sun.COM uint_t cmd_scblen; 5929440SSusan.Scheufele@Sun.COM struct buf *cmd_buf; 5939440SSusan.Scheufele@Sun.COM ushort_t device_id; 5949440SSusan.Scheufele@Sun.COM uchar_t islogical; 5959440SSusan.Scheufele@Sun.COM uchar_t lun; 5969440SSusan.Scheufele@Sun.COM struct mrsas_device *mrsas_dev; 5979440SSusan.Scheufele@Sun.COM }; 5989440SSusan.Scheufele@Sun.COM 5999440SSusan.Scheufele@Sun.COM 6009440SSusan.Scheufele@Sun.COM struct mrsas_cmd { 6019440SSusan.Scheufele@Sun.COM union mrsas_frame *frame; 6029440SSusan.Scheufele@Sun.COM uint32_t frame_phys_addr; 6039440SSusan.Scheufele@Sun.COM uint8_t *sense; 6049440SSusan.Scheufele@Sun.COM uint32_t sense_phys_addr; 6059440SSusan.Scheufele@Sun.COM dma_obj_t frame_dma_obj; 6069440SSusan.Scheufele@Sun.COM uint8_t frame_dma_obj_status; 6079440SSusan.Scheufele@Sun.COM 6089440SSusan.Scheufele@Sun.COM uint32_t index; 6099440SSusan.Scheufele@Sun.COM uint8_t sync_cmd; 6109440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 6119440SSusan.Scheufele@Sun.COM uint16_t abort_aen; 6129440SSusan.Scheufele@Sun.COM mlist_t list; 6139440SSusan.Scheufele@Sun.COM uint32_t frame_count; 6149440SSusan.Scheufele@Sun.COM struct scsa_cmd *cmd; 6159440SSusan.Scheufele@Sun.COM struct scsi_pkt *pkt; 61612244SYu.Wu@Sun.COM uint16_t retry_count_for_ocr; 61712244SYu.Wu@Sun.COM uint16_t drv_pkt_time; 6189440SSusan.Scheufele@Sun.COM }; 6199440SSusan.Scheufele@Sun.COM 6209440SSusan.Scheufele@Sun.COM #define MAX_MGMT_ADAPTERS 1024 6219440SSusan.Scheufele@Sun.COM #define IOC_SIGNATURE "MR-SAS" 6229440SSusan.Scheufele@Sun.COM 6239440SSusan.Scheufele@Sun.COM #define IOC_CMD_FIRMWARE 0x0 6249440SSusan.Scheufele@Sun.COM #define MRSAS_DRIVER_IOCTL_COMMON 0xF0010000 6259440SSusan.Scheufele@Sun.COM #define MRSAS_DRIVER_IOCTL_DRIVER_VERSION 0xF0010100 6269440SSusan.Scheufele@Sun.COM #define MRSAS_DRIVER_IOCTL_PCI_INFORMATION 0xF0010200 6279440SSusan.Scheufele@Sun.COM #define MRSAS_DRIVER_IOCTL_MRRAID_STATISTICS 0xF0010300 6289440SSusan.Scheufele@Sun.COM 6299440SSusan.Scheufele@Sun.COM 6309440SSusan.Scheufele@Sun.COM #define MRSAS_MAX_SENSE_LENGTH 32 6319440SSusan.Scheufele@Sun.COM 6329440SSusan.Scheufele@Sun.COM struct mrsas_mgmt_info { 6339440SSusan.Scheufele@Sun.COM 6349440SSusan.Scheufele@Sun.COM uint16_t count; 6359440SSusan.Scheufele@Sun.COM struct mrsas_instance *instance[MAX_MGMT_ADAPTERS]; 6369440SSusan.Scheufele@Sun.COM uint16_t map[MAX_MGMT_ADAPTERS]; 6379440SSusan.Scheufele@Sun.COM int max_index; 6389440SSusan.Scheufele@Sun.COM }; 6399440SSusan.Scheufele@Sun.COM 6409440SSusan.Scheufele@Sun.COM #pragma pack(1) 6419440SSusan.Scheufele@Sun.COM 6429440SSusan.Scheufele@Sun.COM /* 6439440SSusan.Scheufele@Sun.COM * SAS controller properties 6449440SSusan.Scheufele@Sun.COM */ 6459440SSusan.Scheufele@Sun.COM struct mrsas_ctrl_prop { 6469440SSusan.Scheufele@Sun.COM uint16_t seq_num; 6479440SSusan.Scheufele@Sun.COM uint16_t pred_fail_poll_interval; 6489440SSusan.Scheufele@Sun.COM uint16_t intr_throttle_count; 6499440SSusan.Scheufele@Sun.COM uint16_t intr_throttle_timeouts; 6509440SSusan.Scheufele@Sun.COM 6519440SSusan.Scheufele@Sun.COM uint8_t rebuild_rate; 6529440SSusan.Scheufele@Sun.COM uint8_t patrol_read_rate; 6539440SSusan.Scheufele@Sun.COM uint8_t bgi_rate; 6549440SSusan.Scheufele@Sun.COM uint8_t cc_rate; 6559440SSusan.Scheufele@Sun.COM uint8_t recon_rate; 6569440SSusan.Scheufele@Sun.COM 6579440SSusan.Scheufele@Sun.COM uint8_t cache_flush_interval; 6589440SSusan.Scheufele@Sun.COM 6599440SSusan.Scheufele@Sun.COM uint8_t spinup_drv_count; 6609440SSusan.Scheufele@Sun.COM uint8_t spinup_delay; 6619440SSusan.Scheufele@Sun.COM 6629440SSusan.Scheufele@Sun.COM uint8_t cluster_enable; 6639440SSusan.Scheufele@Sun.COM uint8_t coercion_mode; 6649440SSusan.Scheufele@Sun.COM uint8_t alarm_enable; 66512244SYu.Wu@Sun.COM uint8_t reserved_1[13]; 666*12757SYu.Wu@Sun.COM uint32_t on_off_properties; 66712244SYu.Wu@Sun.COM uint8_t reserved_4[28]; 6689440SSusan.Scheufele@Sun.COM }; 6699440SSusan.Scheufele@Sun.COM 67012244SYu.Wu@Sun.COM 6719440SSusan.Scheufele@Sun.COM /* 6729440SSusan.Scheufele@Sun.COM * SAS controller information 6739440SSusan.Scheufele@Sun.COM */ 6749440SSusan.Scheufele@Sun.COM struct mrsas_ctrl_info { 6759440SSusan.Scheufele@Sun.COM /* PCI device information */ 6769440SSusan.Scheufele@Sun.COM struct { 6779440SSusan.Scheufele@Sun.COM uint16_t vendor_id; 6789440SSusan.Scheufele@Sun.COM uint16_t device_id; 6799440SSusan.Scheufele@Sun.COM uint16_t sub_vendor_id; 6809440SSusan.Scheufele@Sun.COM uint16_t sub_device_id; 6819440SSusan.Scheufele@Sun.COM uint8_t reserved[24]; 6829440SSusan.Scheufele@Sun.COM } pci; 6839440SSusan.Scheufele@Sun.COM 6849440SSusan.Scheufele@Sun.COM /* Host interface information */ 6859440SSusan.Scheufele@Sun.COM struct { 6869440SSusan.Scheufele@Sun.COM uint8_t PCIX : 1; 6879440SSusan.Scheufele@Sun.COM uint8_t PCIE : 1; 6889440SSusan.Scheufele@Sun.COM uint8_t iSCSI : 1; 6899440SSusan.Scheufele@Sun.COM uint8_t SAS_3G : 1; 6909440SSusan.Scheufele@Sun.COM uint8_t reserved_0 : 4; 6919440SSusan.Scheufele@Sun.COM uint8_t reserved_1[6]; 6929440SSusan.Scheufele@Sun.COM uint8_t port_count; 6939440SSusan.Scheufele@Sun.COM uint64_t port_addr[8]; 6949440SSusan.Scheufele@Sun.COM } host_interface; 6959440SSusan.Scheufele@Sun.COM 6969440SSusan.Scheufele@Sun.COM /* Device (backend) interface information */ 6979440SSusan.Scheufele@Sun.COM struct { 6989440SSusan.Scheufele@Sun.COM uint8_t SPI : 1; 6999440SSusan.Scheufele@Sun.COM uint8_t SAS_3G : 1; 7009440SSusan.Scheufele@Sun.COM uint8_t SATA_1_5G : 1; 7019440SSusan.Scheufele@Sun.COM uint8_t SATA_3G : 1; 7029440SSusan.Scheufele@Sun.COM uint8_t reserved_0 : 4; 7039440SSusan.Scheufele@Sun.COM uint8_t reserved_1[6]; 7049440SSusan.Scheufele@Sun.COM uint8_t port_count; 7059440SSusan.Scheufele@Sun.COM uint64_t port_addr[8]; 7069440SSusan.Scheufele@Sun.COM } device_interface; 7079440SSusan.Scheufele@Sun.COM 7089440SSusan.Scheufele@Sun.COM /* List of components residing in flash. All str are null terminated */ 7099440SSusan.Scheufele@Sun.COM uint32_t image_check_word; 7109440SSusan.Scheufele@Sun.COM uint32_t image_component_count; 7119440SSusan.Scheufele@Sun.COM 7129440SSusan.Scheufele@Sun.COM struct { 7139440SSusan.Scheufele@Sun.COM char name[8]; 7149440SSusan.Scheufele@Sun.COM char version[32]; 7159440SSusan.Scheufele@Sun.COM char build_date[16]; 7169440SSusan.Scheufele@Sun.COM char built_time[16]; 7179440SSusan.Scheufele@Sun.COM } image_component[8]; 7189440SSusan.Scheufele@Sun.COM 7199440SSusan.Scheufele@Sun.COM /* 7209440SSusan.Scheufele@Sun.COM * List of flash components that have been flashed on the card, but 7219440SSusan.Scheufele@Sun.COM * are not in use, pending reset of the adapter. This list will be 7229440SSusan.Scheufele@Sun.COM * empty if a flash operation has not occurred. All stings are null 7239440SSusan.Scheufele@Sun.COM * terminated 7249440SSusan.Scheufele@Sun.COM */ 7259440SSusan.Scheufele@Sun.COM uint32_t pending_image_component_count; 7269440SSusan.Scheufele@Sun.COM 7279440SSusan.Scheufele@Sun.COM struct { 7289440SSusan.Scheufele@Sun.COM char name[8]; 7299440SSusan.Scheufele@Sun.COM char version[32]; 7309440SSusan.Scheufele@Sun.COM char build_date[16]; 7319440SSusan.Scheufele@Sun.COM char build_time[16]; 7329440SSusan.Scheufele@Sun.COM } pending_image_component[8]; 7339440SSusan.Scheufele@Sun.COM 7349440SSusan.Scheufele@Sun.COM uint8_t max_arms; 7359440SSusan.Scheufele@Sun.COM uint8_t max_spans; 7369440SSusan.Scheufele@Sun.COM uint8_t max_arrays; 7379440SSusan.Scheufele@Sun.COM uint8_t max_lds; 7389440SSusan.Scheufele@Sun.COM 7399440SSusan.Scheufele@Sun.COM char product_name[80]; 7409440SSusan.Scheufele@Sun.COM char serial_no[32]; 7419440SSusan.Scheufele@Sun.COM 7429440SSusan.Scheufele@Sun.COM /* 7439440SSusan.Scheufele@Sun.COM * Other physical/controller/operation information. Indicates the 7449440SSusan.Scheufele@Sun.COM * presence of the hardware 7459440SSusan.Scheufele@Sun.COM */ 7469440SSusan.Scheufele@Sun.COM struct { 7479440SSusan.Scheufele@Sun.COM uint32_t bbu : 1; 7489440SSusan.Scheufele@Sun.COM uint32_t alarm : 1; 7499440SSusan.Scheufele@Sun.COM uint32_t nvram : 1; 7509440SSusan.Scheufele@Sun.COM uint32_t uart : 1; 7519440SSusan.Scheufele@Sun.COM uint32_t reserved : 28; 7529440SSusan.Scheufele@Sun.COM } hw_present; 7539440SSusan.Scheufele@Sun.COM 7549440SSusan.Scheufele@Sun.COM uint32_t current_fw_time; 7559440SSusan.Scheufele@Sun.COM 7569440SSusan.Scheufele@Sun.COM /* Maximum data transfer sizes */ 7579440SSusan.Scheufele@Sun.COM uint16_t max_concurrent_cmds; 7589440SSusan.Scheufele@Sun.COM uint16_t max_sge_count; 7599440SSusan.Scheufele@Sun.COM uint32_t max_request_size; 7609440SSusan.Scheufele@Sun.COM 7619440SSusan.Scheufele@Sun.COM /* Logical and physical device counts */ 7629440SSusan.Scheufele@Sun.COM uint16_t ld_present_count; 7639440SSusan.Scheufele@Sun.COM uint16_t ld_degraded_count; 7649440SSusan.Scheufele@Sun.COM uint16_t ld_offline_count; 7659440SSusan.Scheufele@Sun.COM 7669440SSusan.Scheufele@Sun.COM uint16_t pd_present_count; 7679440SSusan.Scheufele@Sun.COM uint16_t pd_disk_present_count; 7689440SSusan.Scheufele@Sun.COM uint16_t pd_disk_pred_failure_count; 7699440SSusan.Scheufele@Sun.COM uint16_t pd_disk_failed_count; 7709440SSusan.Scheufele@Sun.COM 7719440SSusan.Scheufele@Sun.COM /* Memory size information */ 7729440SSusan.Scheufele@Sun.COM uint16_t nvram_size; 7739440SSusan.Scheufele@Sun.COM uint16_t memory_size; 7749440SSusan.Scheufele@Sun.COM uint16_t flash_size; 7759440SSusan.Scheufele@Sun.COM 7769440SSusan.Scheufele@Sun.COM /* Error counters */ 7779440SSusan.Scheufele@Sun.COM uint16_t mem_correctable_error_count; 7789440SSusan.Scheufele@Sun.COM uint16_t mem_uncorrectable_error_count; 7799440SSusan.Scheufele@Sun.COM 7809440SSusan.Scheufele@Sun.COM /* Cluster information */ 7819440SSusan.Scheufele@Sun.COM uint8_t cluster_permitted; 7829440SSusan.Scheufele@Sun.COM uint8_t cluster_active; 7839440SSusan.Scheufele@Sun.COM uint8_t reserved_1[2]; 7849440SSusan.Scheufele@Sun.COM 7859440SSusan.Scheufele@Sun.COM /* Controller capabilities structures */ 7869440SSusan.Scheufele@Sun.COM struct { 7879440SSusan.Scheufele@Sun.COM uint32_t raid_level_0 : 1; 7889440SSusan.Scheufele@Sun.COM uint32_t raid_level_1 : 1; 7899440SSusan.Scheufele@Sun.COM uint32_t raid_level_5 : 1; 7909440SSusan.Scheufele@Sun.COM uint32_t raid_level_1E : 1; 7919440SSusan.Scheufele@Sun.COM uint32_t reserved : 28; 7929440SSusan.Scheufele@Sun.COM } raid_levels; 7939440SSusan.Scheufele@Sun.COM 7949440SSusan.Scheufele@Sun.COM struct { 7959440SSusan.Scheufele@Sun.COM uint32_t rbld_rate : 1; 7969440SSusan.Scheufele@Sun.COM uint32_t cc_rate : 1; 7979440SSusan.Scheufele@Sun.COM uint32_t bgi_rate : 1; 7989440SSusan.Scheufele@Sun.COM uint32_t recon_rate : 1; 7999440SSusan.Scheufele@Sun.COM uint32_t patrol_rate : 1; 8009440SSusan.Scheufele@Sun.COM uint32_t alarm_control : 1; 8019440SSusan.Scheufele@Sun.COM uint32_t cluster_supported : 1; 8029440SSusan.Scheufele@Sun.COM uint32_t bbu : 1; 8039440SSusan.Scheufele@Sun.COM uint32_t spanning_allowed : 1; 8049440SSusan.Scheufele@Sun.COM uint32_t dedicated_hotspares : 1; 8059440SSusan.Scheufele@Sun.COM uint32_t revertible_hotspares : 1; 8069440SSusan.Scheufele@Sun.COM uint32_t foreign_config_import : 1; 8079440SSusan.Scheufele@Sun.COM uint32_t self_diagnostic : 1; 8089440SSusan.Scheufele@Sun.COM uint32_t reserved : 19; 8099440SSusan.Scheufele@Sun.COM } adapter_operations; 8109440SSusan.Scheufele@Sun.COM 8119440SSusan.Scheufele@Sun.COM struct { 8129440SSusan.Scheufele@Sun.COM uint32_t read_policy : 1; 8139440SSusan.Scheufele@Sun.COM uint32_t write_policy : 1; 8149440SSusan.Scheufele@Sun.COM uint32_t io_policy : 1; 8159440SSusan.Scheufele@Sun.COM uint32_t access_policy : 1; 8169440SSusan.Scheufele@Sun.COM uint32_t reserved : 28; 8179440SSusan.Scheufele@Sun.COM } ld_operations; 8189440SSusan.Scheufele@Sun.COM 8199440SSusan.Scheufele@Sun.COM struct { 8209440SSusan.Scheufele@Sun.COM uint8_t min; 8219440SSusan.Scheufele@Sun.COM uint8_t max; 8229440SSusan.Scheufele@Sun.COM uint8_t reserved[2]; 8239440SSusan.Scheufele@Sun.COM } stripe_size_operations; 8249440SSusan.Scheufele@Sun.COM 8259440SSusan.Scheufele@Sun.COM struct { 8269440SSusan.Scheufele@Sun.COM uint32_t force_online : 1; 8279440SSusan.Scheufele@Sun.COM uint32_t force_offline : 1; 8289440SSusan.Scheufele@Sun.COM uint32_t force_rebuild : 1; 8299440SSusan.Scheufele@Sun.COM uint32_t reserved : 29; 8309440SSusan.Scheufele@Sun.COM } pd_operations; 8319440SSusan.Scheufele@Sun.COM 8329440SSusan.Scheufele@Sun.COM struct { 8339440SSusan.Scheufele@Sun.COM uint32_t ctrl_supports_sas : 1; 8349440SSusan.Scheufele@Sun.COM uint32_t ctrl_supports_sata : 1; 8359440SSusan.Scheufele@Sun.COM uint32_t allow_mix_in_encl : 1; 8369440SSusan.Scheufele@Sun.COM uint32_t allow_mix_in_ld : 1; 8379440SSusan.Scheufele@Sun.COM uint32_t allow_sata_in_cluster : 1; 8389440SSusan.Scheufele@Sun.COM uint32_t reserved : 27; 8399440SSusan.Scheufele@Sun.COM } pd_mix_support; 8409440SSusan.Scheufele@Sun.COM 8419440SSusan.Scheufele@Sun.COM /* Include the controller properties (changeable items) */ 8429440SSusan.Scheufele@Sun.COM uint8_t reserved_2[12]; 8439440SSusan.Scheufele@Sun.COM struct mrsas_ctrl_prop properties; 8449440SSusan.Scheufele@Sun.COM 8459440SSusan.Scheufele@Sun.COM uint8_t pad[0x800 - 0x640]; 8469440SSusan.Scheufele@Sun.COM }; 8479440SSusan.Scheufele@Sun.COM 8489440SSusan.Scheufele@Sun.COM /* 8499440SSusan.Scheufele@Sun.COM * ================================== 8509440SSusan.Scheufele@Sun.COM * MegaRAID SAS2.0 driver definitions 8519440SSusan.Scheufele@Sun.COM * ================================== 8529440SSusan.Scheufele@Sun.COM */ 8539440SSusan.Scheufele@Sun.COM #define MRDRV_MAX_NUM_CMD 1024 8549440SSusan.Scheufele@Sun.COM 8559440SSusan.Scheufele@Sun.COM #define MRDRV_MAX_PD_CHANNELS 2 8569440SSusan.Scheufele@Sun.COM #define MRDRV_MAX_LD_CHANNELS 2 8579440SSusan.Scheufele@Sun.COM #define MRDRV_MAX_CHANNELS (MRDRV_MAX_PD_CHANNELS + \ 8589440SSusan.Scheufele@Sun.COM MRDRV_MAX_LD_CHANNELS) 8599440SSusan.Scheufele@Sun.COM #define MRDRV_MAX_DEV_PER_CHANNEL 128 8609440SSusan.Scheufele@Sun.COM #define MRDRV_DEFAULT_INIT_ID -1 8619440SSusan.Scheufele@Sun.COM #define MRDRV_MAX_CMD_PER_LUN 1000 8629440SSusan.Scheufele@Sun.COM #define MRDRV_MAX_LUN 1 8639440SSusan.Scheufele@Sun.COM #define MRDRV_MAX_LD 64 8649440SSusan.Scheufele@Sun.COM 8659440SSusan.Scheufele@Sun.COM #define MRDRV_RESET_WAIT_TIME 300 8669440SSusan.Scheufele@Sun.COM #define MRDRV_RESET_NOTICE_INTERVAL 5 8679440SSusan.Scheufele@Sun.COM 8689440SSusan.Scheufele@Sun.COM #define MRSAS_IOCTL_CMD 0 8699440SSusan.Scheufele@Sun.COM 8709440SSusan.Scheufele@Sun.COM /* 8719440SSusan.Scheufele@Sun.COM * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit 8729440SSusan.Scheufele@Sun.COM * SGLs based on the size of dma_addr_t 8739440SSusan.Scheufele@Sun.COM */ 8749440SSusan.Scheufele@Sun.COM #define IS_DMA64 (sizeof (dma_addr_t) == 8) 8759440SSusan.Scheufele@Sun.COM 8769440SSusan.Scheufele@Sun.COM #define IB_MSG_0_OFF 0x10 /* XScale */ 8779440SSusan.Scheufele@Sun.COM #define OB_MSG_0_OFF 0x18 /* XScale */ 8789440SSusan.Scheufele@Sun.COM #define IB_DOORBELL_OFF 0x20 /* XScale & ROC */ 8799440SSusan.Scheufele@Sun.COM #define OB_INTR_STATUS_OFF 0x30 /* XScale & ROC */ 8809440SSusan.Scheufele@Sun.COM #define OB_INTR_MASK_OFF 0x34 /* XScale & ROC */ 8819440SSusan.Scheufele@Sun.COM #define IB_QPORT_OFF 0x40 /* XScale & ROC */ 8829440SSusan.Scheufele@Sun.COM #define OB_DOORBELL_CLEAR_OFF 0xA0 /* ROC */ 8839440SSusan.Scheufele@Sun.COM #define OB_SCRATCH_PAD_0_OFF 0xB0 /* ROC */ 8849440SSusan.Scheufele@Sun.COM #define OB_INTR_MASK 0xFFFFFFFF 8859440SSusan.Scheufele@Sun.COM #define OB_DOORBELL_CLEAR_MASK 0xFFFFFFFF 88612244SYu.Wu@Sun.COM #define WRITE_SEQ_OFF 0x000000FC 88712244SYu.Wu@Sun.COM #define HOST_DIAG_OFF 0x000000F8 88812244SYu.Wu@Sun.COM #define DIAG_RESET_ADAPTER 0x00000004 88912244SYu.Wu@Sun.COM #define DIAG_WRITE_ENABLE 0x00000080 8909440SSusan.Scheufele@Sun.COM /* 8919440SSusan.Scheufele@Sun.COM * All MFI register set macros accept mrsas_register_set* 8929440SSusan.Scheufele@Sun.COM */ 89312244SYu.Wu@Sun.COM #define WR_IB_WRITE_SEQ(v, instance) ddi_put32((instance)->regmap_handle, \ 89412244SYu.Wu@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + WRITE_SEQ_OFF), (v)) 89512244SYu.Wu@Sun.COM 89612244SYu.Wu@Sun.COM #define RD_OB_DRWE(instance) ddi_get32((instance)->regmap_handle, \ 89712244SYu.Wu@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + HOST_DIAG_OFF)) 89812244SYu.Wu@Sun.COM 89912244SYu.Wu@Sun.COM #define WR_IB_DRWE(v, instance) ddi_put32((instance)->regmap_handle, \ 90012244SYu.Wu@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + HOST_DIAG_OFF), (v)) 90112244SYu.Wu@Sun.COM 9029440SSusan.Scheufele@Sun.COM #define WR_IB_MSG_0(v, instance) ddi_put32((instance)->regmap_handle, \ 9039440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + IB_MSG_0_OFF), (v)) 9049440SSusan.Scheufele@Sun.COM 9059440SSusan.Scheufele@Sun.COM #define RD_OB_MSG_0(instance) ddi_get32((instance)->regmap_handle, \ 9069440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_MSG_0_OFF)) 9079440SSusan.Scheufele@Sun.COM 9089440SSusan.Scheufele@Sun.COM #define WR_IB_DOORBELL(v, instance) ddi_put32((instance)->regmap_handle, \ 9099440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + IB_DOORBELL_OFF), (v)) 9109440SSusan.Scheufele@Sun.COM 9119440SSusan.Scheufele@Sun.COM #define RD_IB_DOORBELL(instance) ddi_get32((instance)->regmap_handle, \ 9129440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + IB_DOORBELL_OFF)) 9139440SSusan.Scheufele@Sun.COM 9149440SSusan.Scheufele@Sun.COM #define WR_OB_INTR_STATUS(v, instance) ddi_put32((instance)->regmap_handle, \ 9159440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_STATUS_OFF), (v)) 9169440SSusan.Scheufele@Sun.COM 9179440SSusan.Scheufele@Sun.COM #define RD_OB_INTR_STATUS(instance) ddi_get32((instance)->regmap_handle, \ 9189440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_STATUS_OFF)) 9199440SSusan.Scheufele@Sun.COM 9209440SSusan.Scheufele@Sun.COM #define WR_OB_INTR_MASK(v, instance) ddi_put32((instance)->regmap_handle, \ 9219440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_MASK_OFF), (v)) 9229440SSusan.Scheufele@Sun.COM 9239440SSusan.Scheufele@Sun.COM #define RD_OB_INTR_MASK(instance) ddi_get32((instance)->regmap_handle, \ 9249440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_MASK_OFF)) 9259440SSusan.Scheufele@Sun.COM 9269440SSusan.Scheufele@Sun.COM #define WR_IB_QPORT(v, instance) ddi_put32((instance)->regmap_handle, \ 9279440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + IB_QPORT_OFF), (v)) 9289440SSusan.Scheufele@Sun.COM 9299440SSusan.Scheufele@Sun.COM #define WR_OB_DOORBELL_CLEAR(v, instance) ddi_put32((instance)->regmap_handle, \ 9309440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_DOORBELL_CLEAR_OFF), \ 9319440SSusan.Scheufele@Sun.COM (v)) 9329440SSusan.Scheufele@Sun.COM 9339440SSusan.Scheufele@Sun.COM #define RD_OB_SCRATCH_PAD_0(instance) ddi_get32((instance)->regmap_handle, \ 9349440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_SCRATCH_PAD_0_OFF)) 9359440SSusan.Scheufele@Sun.COM 9369440SSusan.Scheufele@Sun.COM /* 9379440SSusan.Scheufele@Sun.COM * When FW is in MFI_STATE_READY or MFI_STATE_OPERATIONAL, the state data 9389440SSusan.Scheufele@Sun.COM * of Outbound Msg Reg 0 indicates max concurrent cmds supported, max SGEs 9399440SSusan.Scheufele@Sun.COM * supported per cmd and if 64-bit MFAs (M64) is enabled or disabled. 9409440SSusan.Scheufele@Sun.COM */ 9419440SSusan.Scheufele@Sun.COM #define MFI_OB_INTR_STATUS_MASK 0x00000002 9429440SSusan.Scheufele@Sun.COM 9439440SSusan.Scheufele@Sun.COM /* 9449440SSusan.Scheufele@Sun.COM * This MFI_REPLY_2108_MESSAGE_INTR flag is used also 9459440SSusan.Scheufele@Sun.COM * in enable_intr_ppc also. Hence bit 2, i.e. 0x4 has 9469440SSusan.Scheufele@Sun.COM * been set in this flag along with bit 1. 9479440SSusan.Scheufele@Sun.COM */ 9489440SSusan.Scheufele@Sun.COM #define MFI_REPLY_2108_MESSAGE_INTR 0x00000001 9499440SSusan.Scheufele@Sun.COM #define MFI_REPLY_2108_MESSAGE_INTR_MASK 0x00000005 9509440SSusan.Scheufele@Sun.COM 9519440SSusan.Scheufele@Sun.COM #define MFI_POLL_TIMEOUT_SECS 60 9529440SSusan.Scheufele@Sun.COM 9539440SSusan.Scheufele@Sun.COM #define MFI_ENABLE_INTR(instance) ddi_put32((instance)->regmap_handle, \ 9549440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_MASK_OFF), 1) 9559440SSusan.Scheufele@Sun.COM #define MFI_DISABLE_INTR(instance) \ 9569440SSusan.Scheufele@Sun.COM { \ 9579440SSusan.Scheufele@Sun.COM uint32_t disable = 1; \ 9589440SSusan.Scheufele@Sun.COM uint32_t mask = ddi_get32((instance)->regmap_handle, \ 9599440SSusan.Scheufele@Sun.COM (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_MASK_OFF));\ 9609440SSusan.Scheufele@Sun.COM mask &= ~disable; \ 9619440SSusan.Scheufele@Sun.COM ddi_put32((instance)->regmap_handle, (uint32_t *) \ 9629440SSusan.Scheufele@Sun.COM (uintptr_t)((instance)->regmap + OB_INTR_MASK_OFF), mask); \ 9639440SSusan.Scheufele@Sun.COM } 9649440SSusan.Scheufele@Sun.COM 9659440SSusan.Scheufele@Sun.COM /* By default, the firmware programs for 8 Kbytes of memory */ 9669440SSusan.Scheufele@Sun.COM #define DEFAULT_MFI_MEM_SZ 8192 9679440SSusan.Scheufele@Sun.COM #define MINIMUM_MFI_MEM_SZ 4096 9689440SSusan.Scheufele@Sun.COM 9699440SSusan.Scheufele@Sun.COM /* DCMD Message Frame MAILBOX0-11 */ 9709440SSusan.Scheufele@Sun.COM #define DCMD_MBOX_SZ 12 9719440SSusan.Scheufele@Sun.COM 972*12757SYu.Wu@Sun.COM /* 973*12757SYu.Wu@Sun.COM * on_off_property of mrsas_ctrl_prop 974*12757SYu.Wu@Sun.COM * bit0-9, 11-31 are reserved 975*12757SYu.Wu@Sun.COM */ 976*12757SYu.Wu@Sun.COM #define DISABLE_OCR_PROP_FLAG 0x00000400 /* bit 10 */ 9779440SSusan.Scheufele@Sun.COM 9789440SSusan.Scheufele@Sun.COM struct mrsas_register_set { 9799440SSusan.Scheufele@Sun.COM uint32_t reserved_0[4]; 9809440SSusan.Scheufele@Sun.COM 9819440SSusan.Scheufele@Sun.COM uint32_t inbound_msg_0; 9829440SSusan.Scheufele@Sun.COM uint32_t inbound_msg_1; 9839440SSusan.Scheufele@Sun.COM uint32_t outbound_msg_0; 9849440SSusan.Scheufele@Sun.COM uint32_t outbound_msg_1; 9859440SSusan.Scheufele@Sun.COM 9869440SSusan.Scheufele@Sun.COM uint32_t inbound_doorbell; 9879440SSusan.Scheufele@Sun.COM uint32_t inbound_intr_status; 9889440SSusan.Scheufele@Sun.COM uint32_t inbound_intr_mask; 9899440SSusan.Scheufele@Sun.COM 9909440SSusan.Scheufele@Sun.COM uint32_t outbound_doorbell; 9919440SSusan.Scheufele@Sun.COM uint32_t outbound_intr_status; 9929440SSusan.Scheufele@Sun.COM uint32_t outbound_intr_mask; 9939440SSusan.Scheufele@Sun.COM 9949440SSusan.Scheufele@Sun.COM uint32_t reserved_1[2]; 9959440SSusan.Scheufele@Sun.COM 9969440SSusan.Scheufele@Sun.COM uint32_t inbound_queue_port; 9979440SSusan.Scheufele@Sun.COM uint32_t outbound_queue_port; 9989440SSusan.Scheufele@Sun.COM 9999440SSusan.Scheufele@Sun.COM uint32_t reserved_2[22]; 10009440SSusan.Scheufele@Sun.COM 10019440SSusan.Scheufele@Sun.COM uint32_t outbound_doorbell_clear; 10029440SSusan.Scheufele@Sun.COM 10039440SSusan.Scheufele@Sun.COM uint32_t reserved_3[3]; 10049440SSusan.Scheufele@Sun.COM 10059440SSusan.Scheufele@Sun.COM uint32_t outbound_scratch_pad; 10069440SSusan.Scheufele@Sun.COM 10079440SSusan.Scheufele@Sun.COM uint32_t reserved_4[3]; 10089440SSusan.Scheufele@Sun.COM 10099440SSusan.Scheufele@Sun.COM uint32_t inbound_low_queue_port; 10109440SSusan.Scheufele@Sun.COM 10119440SSusan.Scheufele@Sun.COM uint32_t inbound_high_queue_port; 10129440SSusan.Scheufele@Sun.COM 10139440SSusan.Scheufele@Sun.COM uint32_t reserved_5; 10149440SSusan.Scheufele@Sun.COM uint32_t index_registers[820]; 10159440SSusan.Scheufele@Sun.COM }; 10169440SSusan.Scheufele@Sun.COM 10179440SSusan.Scheufele@Sun.COM struct mrsas_sge32 { 10189440SSusan.Scheufele@Sun.COM uint32_t phys_addr; 10199440SSusan.Scheufele@Sun.COM uint32_t length; 10209440SSusan.Scheufele@Sun.COM }; 10219440SSusan.Scheufele@Sun.COM 10229440SSusan.Scheufele@Sun.COM struct mrsas_sge64 { 10239440SSusan.Scheufele@Sun.COM uint64_t phys_addr; 10249440SSusan.Scheufele@Sun.COM uint32_t length; 10259440SSusan.Scheufele@Sun.COM }; 10269440SSusan.Scheufele@Sun.COM 102711856SYu.Wu@Sun.COM struct mrsas_sge_ieee { 102811856SYu.Wu@Sun.COM uint64_t phys_addr; 102911856SYu.Wu@Sun.COM uint32_t length; 103011856SYu.Wu@Sun.COM uint32_t flag; 103111856SYu.Wu@Sun.COM }; 103211856SYu.Wu@Sun.COM 10339440SSusan.Scheufele@Sun.COM union mrsas_sgl { 10349440SSusan.Scheufele@Sun.COM struct mrsas_sge32 sge32[1]; 10359440SSusan.Scheufele@Sun.COM struct mrsas_sge64 sge64[1]; 103611856SYu.Wu@Sun.COM struct mrsas_sge_ieee sge_ieee[1]; 10379440SSusan.Scheufele@Sun.COM }; 10389440SSusan.Scheufele@Sun.COM 10399440SSusan.Scheufele@Sun.COM struct mrsas_header { 10409440SSusan.Scheufele@Sun.COM uint8_t cmd; 10419440SSusan.Scheufele@Sun.COM uint8_t sense_len; 10429440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 10439440SSusan.Scheufele@Sun.COM uint8_t scsi_status; 10449440SSusan.Scheufele@Sun.COM 10459440SSusan.Scheufele@Sun.COM uint8_t target_id; 10469440SSusan.Scheufele@Sun.COM uint8_t lun; 10479440SSusan.Scheufele@Sun.COM uint8_t cdb_len; 10489440SSusan.Scheufele@Sun.COM uint8_t sge_count; 10499440SSusan.Scheufele@Sun.COM 10509440SSusan.Scheufele@Sun.COM uint32_t context; 10519440SSusan.Scheufele@Sun.COM uint8_t req_id; 10529440SSusan.Scheufele@Sun.COM uint8_t msgvector; 10539440SSusan.Scheufele@Sun.COM uint16_t pad_0; 10549440SSusan.Scheufele@Sun.COM 10559440SSusan.Scheufele@Sun.COM uint16_t flags; 10569440SSusan.Scheufele@Sun.COM uint16_t timeout; 10579440SSusan.Scheufele@Sun.COM uint32_t data_xferlen; 10589440SSusan.Scheufele@Sun.COM }; 10599440SSusan.Scheufele@Sun.COM 10609440SSusan.Scheufele@Sun.COM union mrsas_sgl_frame { 10619440SSusan.Scheufele@Sun.COM struct mrsas_sge32 sge32[8]; 10629440SSusan.Scheufele@Sun.COM struct mrsas_sge64 sge64[5]; 10639440SSusan.Scheufele@Sun.COM }; 10649440SSusan.Scheufele@Sun.COM 10659440SSusan.Scheufele@Sun.COM struct mrsas_init_frame { 10669440SSusan.Scheufele@Sun.COM uint8_t cmd; 10679440SSusan.Scheufele@Sun.COM uint8_t reserved_0; 10689440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 10699440SSusan.Scheufele@Sun.COM 10709440SSusan.Scheufele@Sun.COM uint8_t reserved_1; 10719440SSusan.Scheufele@Sun.COM uint32_t reserved_2; 10729440SSusan.Scheufele@Sun.COM 10739440SSusan.Scheufele@Sun.COM uint32_t context; 10749440SSusan.Scheufele@Sun.COM uint8_t req_id; 10759440SSusan.Scheufele@Sun.COM uint8_t msgvector; 10769440SSusan.Scheufele@Sun.COM uint16_t pad_0; 10779440SSusan.Scheufele@Sun.COM 10789440SSusan.Scheufele@Sun.COM uint16_t flags; 10799440SSusan.Scheufele@Sun.COM uint16_t reserved_3; 10809440SSusan.Scheufele@Sun.COM uint32_t data_xfer_len; 10819440SSusan.Scheufele@Sun.COM 10829440SSusan.Scheufele@Sun.COM uint32_t queue_info_new_phys_addr_lo; 10839440SSusan.Scheufele@Sun.COM uint32_t queue_info_new_phys_addr_hi; 10849440SSusan.Scheufele@Sun.COM uint32_t queue_info_old_phys_addr_lo; 10859440SSusan.Scheufele@Sun.COM uint32_t queue_info_old_phys_addr_hi; 10869440SSusan.Scheufele@Sun.COM 10879440SSusan.Scheufele@Sun.COM uint32_t reserved_4[6]; 10889440SSusan.Scheufele@Sun.COM }; 10899440SSusan.Scheufele@Sun.COM 10909440SSusan.Scheufele@Sun.COM struct mrsas_init_queue_info { 10919440SSusan.Scheufele@Sun.COM uint32_t init_flags; 10929440SSusan.Scheufele@Sun.COM uint32_t reply_queue_entries; 10939440SSusan.Scheufele@Sun.COM 10949440SSusan.Scheufele@Sun.COM uint32_t reply_queue_start_phys_addr_lo; 10959440SSusan.Scheufele@Sun.COM uint32_t reply_queue_start_phys_addr_hi; 10969440SSusan.Scheufele@Sun.COM uint32_t producer_index_phys_addr_lo; 10979440SSusan.Scheufele@Sun.COM uint32_t producer_index_phys_addr_hi; 10989440SSusan.Scheufele@Sun.COM uint32_t consumer_index_phys_addr_lo; 10999440SSusan.Scheufele@Sun.COM uint32_t consumer_index_phys_addr_hi; 11009440SSusan.Scheufele@Sun.COM }; 11019440SSusan.Scheufele@Sun.COM 11029440SSusan.Scheufele@Sun.COM struct mrsas_io_frame { 11039440SSusan.Scheufele@Sun.COM uint8_t cmd; 11049440SSusan.Scheufele@Sun.COM uint8_t sense_len; 11059440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 11069440SSusan.Scheufele@Sun.COM uint8_t scsi_status; 11079440SSusan.Scheufele@Sun.COM 11089440SSusan.Scheufele@Sun.COM uint8_t target_id; 11099440SSusan.Scheufele@Sun.COM uint8_t access_byte; 11109440SSusan.Scheufele@Sun.COM uint8_t reserved_0; 11119440SSusan.Scheufele@Sun.COM uint8_t sge_count; 11129440SSusan.Scheufele@Sun.COM 11139440SSusan.Scheufele@Sun.COM uint32_t context; 11149440SSusan.Scheufele@Sun.COM uint8_t req_id; 11159440SSusan.Scheufele@Sun.COM uint8_t msgvector; 11169440SSusan.Scheufele@Sun.COM uint16_t pad_0; 11179440SSusan.Scheufele@Sun.COM 11189440SSusan.Scheufele@Sun.COM uint16_t flags; 11199440SSusan.Scheufele@Sun.COM uint16_t timeout; 11209440SSusan.Scheufele@Sun.COM uint32_t lba_count; 11219440SSusan.Scheufele@Sun.COM 11229440SSusan.Scheufele@Sun.COM uint32_t sense_buf_phys_addr_lo; 11239440SSusan.Scheufele@Sun.COM uint32_t sense_buf_phys_addr_hi; 11249440SSusan.Scheufele@Sun.COM 11259440SSusan.Scheufele@Sun.COM uint32_t start_lba_lo; 11269440SSusan.Scheufele@Sun.COM uint32_t start_lba_hi; 11279440SSusan.Scheufele@Sun.COM 11289440SSusan.Scheufele@Sun.COM union mrsas_sgl sgl; 11299440SSusan.Scheufele@Sun.COM }; 11309440SSusan.Scheufele@Sun.COM 11319440SSusan.Scheufele@Sun.COM struct mrsas_pthru_frame { 11329440SSusan.Scheufele@Sun.COM uint8_t cmd; 11339440SSusan.Scheufele@Sun.COM uint8_t sense_len; 11349440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 11359440SSusan.Scheufele@Sun.COM uint8_t scsi_status; 11369440SSusan.Scheufele@Sun.COM 11379440SSusan.Scheufele@Sun.COM uint8_t target_id; 11389440SSusan.Scheufele@Sun.COM uint8_t lun; 11399440SSusan.Scheufele@Sun.COM uint8_t cdb_len; 11409440SSusan.Scheufele@Sun.COM uint8_t sge_count; 11419440SSusan.Scheufele@Sun.COM 11429440SSusan.Scheufele@Sun.COM uint32_t context; 11439440SSusan.Scheufele@Sun.COM uint8_t req_id; 11449440SSusan.Scheufele@Sun.COM uint8_t msgvector; 11459440SSusan.Scheufele@Sun.COM uint16_t pad_0; 11469440SSusan.Scheufele@Sun.COM 11479440SSusan.Scheufele@Sun.COM uint16_t flags; 11489440SSusan.Scheufele@Sun.COM uint16_t timeout; 11499440SSusan.Scheufele@Sun.COM uint32_t data_xfer_len; 11509440SSusan.Scheufele@Sun.COM 11519440SSusan.Scheufele@Sun.COM uint32_t sense_buf_phys_addr_lo; 11529440SSusan.Scheufele@Sun.COM uint32_t sense_buf_phys_addr_hi; 11539440SSusan.Scheufele@Sun.COM 11549440SSusan.Scheufele@Sun.COM uint8_t cdb[16]; 11559440SSusan.Scheufele@Sun.COM union mrsas_sgl sgl; 11569440SSusan.Scheufele@Sun.COM }; 11579440SSusan.Scheufele@Sun.COM 11589440SSusan.Scheufele@Sun.COM struct mrsas_dcmd_frame { 11599440SSusan.Scheufele@Sun.COM uint8_t cmd; 11609440SSusan.Scheufele@Sun.COM uint8_t reserved_0; 11619440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 11629440SSusan.Scheufele@Sun.COM uint8_t reserved_1[4]; 11639440SSusan.Scheufele@Sun.COM uint8_t sge_count; 11649440SSusan.Scheufele@Sun.COM 11659440SSusan.Scheufele@Sun.COM uint32_t context; 11669440SSusan.Scheufele@Sun.COM uint8_t req_id; 11679440SSusan.Scheufele@Sun.COM uint8_t msgvector; 11689440SSusan.Scheufele@Sun.COM uint16_t pad_0; 11699440SSusan.Scheufele@Sun.COM 11709440SSusan.Scheufele@Sun.COM uint16_t flags; 11719440SSusan.Scheufele@Sun.COM uint16_t timeout; 11729440SSusan.Scheufele@Sun.COM 11739440SSusan.Scheufele@Sun.COM uint32_t data_xfer_len; 11749440SSusan.Scheufele@Sun.COM uint32_t opcode; 11759440SSusan.Scheufele@Sun.COM 11769440SSusan.Scheufele@Sun.COM union { 11779440SSusan.Scheufele@Sun.COM uint8_t b[DCMD_MBOX_SZ]; 11789440SSusan.Scheufele@Sun.COM uint16_t s[6]; 11799440SSusan.Scheufele@Sun.COM uint32_t w[3]; 11809440SSusan.Scheufele@Sun.COM } mbox; 11819440SSusan.Scheufele@Sun.COM 11829440SSusan.Scheufele@Sun.COM union mrsas_sgl sgl; 11839440SSusan.Scheufele@Sun.COM }; 11849440SSusan.Scheufele@Sun.COM 11859440SSusan.Scheufele@Sun.COM struct mrsas_abort_frame { 11869440SSusan.Scheufele@Sun.COM uint8_t cmd; 11879440SSusan.Scheufele@Sun.COM uint8_t reserved_0; 11889440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 11899440SSusan.Scheufele@Sun.COM 11909440SSusan.Scheufele@Sun.COM uint8_t reserved_1; 11919440SSusan.Scheufele@Sun.COM uint32_t reserved_2; 11929440SSusan.Scheufele@Sun.COM 11939440SSusan.Scheufele@Sun.COM uint32_t context; 11949440SSusan.Scheufele@Sun.COM uint8_t req_id; 11959440SSusan.Scheufele@Sun.COM uint8_t msgvector; 11969440SSusan.Scheufele@Sun.COM uint16_t pad_0; 11979440SSusan.Scheufele@Sun.COM 11989440SSusan.Scheufele@Sun.COM uint16_t flags; 11999440SSusan.Scheufele@Sun.COM uint16_t reserved_3; 12009440SSusan.Scheufele@Sun.COM uint32_t reserved_4; 12019440SSusan.Scheufele@Sun.COM 12029440SSusan.Scheufele@Sun.COM uint32_t abort_context; 12039440SSusan.Scheufele@Sun.COM uint32_t pad_1; 12049440SSusan.Scheufele@Sun.COM 12059440SSusan.Scheufele@Sun.COM uint32_t abort_mfi_phys_addr_lo; 12069440SSusan.Scheufele@Sun.COM uint32_t abort_mfi_phys_addr_hi; 12079440SSusan.Scheufele@Sun.COM 12089440SSusan.Scheufele@Sun.COM uint32_t reserved_5[6]; 12099440SSusan.Scheufele@Sun.COM }; 12109440SSusan.Scheufele@Sun.COM 12119440SSusan.Scheufele@Sun.COM struct mrsas_smp_frame { 12129440SSusan.Scheufele@Sun.COM uint8_t cmd; 12139440SSusan.Scheufele@Sun.COM uint8_t reserved_1; 12149440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 12159440SSusan.Scheufele@Sun.COM uint8_t connection_status; 12169440SSusan.Scheufele@Sun.COM 12179440SSusan.Scheufele@Sun.COM uint8_t reserved_2[3]; 12189440SSusan.Scheufele@Sun.COM uint8_t sge_count; 12199440SSusan.Scheufele@Sun.COM 12209440SSusan.Scheufele@Sun.COM uint32_t context; 12219440SSusan.Scheufele@Sun.COM uint8_t req_id; 12229440SSusan.Scheufele@Sun.COM uint8_t msgvector; 12239440SSusan.Scheufele@Sun.COM uint16_t pad_0; 12249440SSusan.Scheufele@Sun.COM 12259440SSusan.Scheufele@Sun.COM uint16_t flags; 12269440SSusan.Scheufele@Sun.COM uint16_t timeout; 12279440SSusan.Scheufele@Sun.COM 12289440SSusan.Scheufele@Sun.COM uint32_t data_xfer_len; 12299440SSusan.Scheufele@Sun.COM 12309440SSusan.Scheufele@Sun.COM uint64_t sas_addr; 12319440SSusan.Scheufele@Sun.COM 12329440SSusan.Scheufele@Sun.COM union mrsas_sgl sgl[2]; 12339440SSusan.Scheufele@Sun.COM }; 12349440SSusan.Scheufele@Sun.COM 12359440SSusan.Scheufele@Sun.COM struct mrsas_stp_frame { 12369440SSusan.Scheufele@Sun.COM uint8_t cmd; 12379440SSusan.Scheufele@Sun.COM uint8_t reserved_1; 12389440SSusan.Scheufele@Sun.COM uint8_t cmd_status; 12399440SSusan.Scheufele@Sun.COM uint8_t connection_status; 12409440SSusan.Scheufele@Sun.COM 12419440SSusan.Scheufele@Sun.COM uint8_t target_id; 12429440SSusan.Scheufele@Sun.COM uint8_t reserved_2[2]; 12439440SSusan.Scheufele@Sun.COM uint8_t sge_count; 12449440SSusan.Scheufele@Sun.COM 12459440SSusan.Scheufele@Sun.COM uint32_t context; 12469440SSusan.Scheufele@Sun.COM uint8_t req_id; 12479440SSusan.Scheufele@Sun.COM uint8_t msgvector; 12489440SSusan.Scheufele@Sun.COM uint16_t pad_0; 12499440SSusan.Scheufele@Sun.COM 12509440SSusan.Scheufele@Sun.COM uint16_t flags; 12519440SSusan.Scheufele@Sun.COM uint16_t timeout; 12529440SSusan.Scheufele@Sun.COM 12539440SSusan.Scheufele@Sun.COM uint32_t data_xfer_len; 12549440SSusan.Scheufele@Sun.COM 12559440SSusan.Scheufele@Sun.COM uint16_t fis[10]; 12569440SSusan.Scheufele@Sun.COM uint32_t stp_flags; 12579440SSusan.Scheufele@Sun.COM union mrsas_sgl sgl; 12589440SSusan.Scheufele@Sun.COM }; 12599440SSusan.Scheufele@Sun.COM 12609440SSusan.Scheufele@Sun.COM union mrsas_frame { 12619440SSusan.Scheufele@Sun.COM struct mrsas_header hdr; 12629440SSusan.Scheufele@Sun.COM struct mrsas_init_frame init; 12639440SSusan.Scheufele@Sun.COM struct mrsas_io_frame io; 12649440SSusan.Scheufele@Sun.COM struct mrsas_pthru_frame pthru; 12659440SSusan.Scheufele@Sun.COM struct mrsas_dcmd_frame dcmd; 12669440SSusan.Scheufele@Sun.COM struct mrsas_abort_frame abort; 12679440SSusan.Scheufele@Sun.COM struct mrsas_smp_frame smp; 12689440SSusan.Scheufele@Sun.COM struct mrsas_stp_frame stp; 12699440SSusan.Scheufele@Sun.COM 12709440SSusan.Scheufele@Sun.COM uint8_t raw_bytes[64]; 12719440SSusan.Scheufele@Sun.COM }; 12729440SSusan.Scheufele@Sun.COM 12739440SSusan.Scheufele@Sun.COM typedef struct mrsas_pd_address { 12749440SSusan.Scheufele@Sun.COM uint16_t device_id; 12759440SSusan.Scheufele@Sun.COM uint16_t encl_id; 12769440SSusan.Scheufele@Sun.COM 12779440SSusan.Scheufele@Sun.COM union { 12789440SSusan.Scheufele@Sun.COM struct { 12799440SSusan.Scheufele@Sun.COM uint8_t encl_index; 12809440SSusan.Scheufele@Sun.COM uint8_t slot_number; 12819440SSusan.Scheufele@Sun.COM } pd_address; 12829440SSusan.Scheufele@Sun.COM struct { 12839440SSusan.Scheufele@Sun.COM uint8_t encl_position; 12849440SSusan.Scheufele@Sun.COM uint8_t encl_connector_index; 12859440SSusan.Scheufele@Sun.COM } encl_address; 12869440SSusan.Scheufele@Sun.COM }address; 12879440SSusan.Scheufele@Sun.COM 12889440SSusan.Scheufele@Sun.COM uint8_t scsi_dev_type; 12899440SSusan.Scheufele@Sun.COM 12909440SSusan.Scheufele@Sun.COM union { 12919440SSusan.Scheufele@Sun.COM uint8_t port_bitmap; 12929440SSusan.Scheufele@Sun.COM uint8_t port_numbers; 12939440SSusan.Scheufele@Sun.COM } connected; 12949440SSusan.Scheufele@Sun.COM 12959440SSusan.Scheufele@Sun.COM uint64_t sas_addr[2]; 12969440SSusan.Scheufele@Sun.COM } mrsas_pd_address_t; 12979440SSusan.Scheufele@Sun.COM 12989440SSusan.Scheufele@Sun.COM union mrsas_evt_class_locale { 12999440SSusan.Scheufele@Sun.COM struct { 13009440SSusan.Scheufele@Sun.COM uint16_t locale; 13019440SSusan.Scheufele@Sun.COM uint8_t reserved; 13029440SSusan.Scheufele@Sun.COM int8_t class; 13039440SSusan.Scheufele@Sun.COM } members; 13049440SSusan.Scheufele@Sun.COM 13059440SSusan.Scheufele@Sun.COM uint32_t word; 13069440SSusan.Scheufele@Sun.COM }; 13079440SSusan.Scheufele@Sun.COM 13089440SSusan.Scheufele@Sun.COM struct mrsas_evt_log_info { 13099440SSusan.Scheufele@Sun.COM uint32_t newest_seq_num; 13109440SSusan.Scheufele@Sun.COM uint32_t oldest_seq_num; 13119440SSusan.Scheufele@Sun.COM uint32_t clear_seq_num; 13129440SSusan.Scheufele@Sun.COM uint32_t shutdown_seq_num; 13139440SSusan.Scheufele@Sun.COM uint32_t boot_seq_num; 13149440SSusan.Scheufele@Sun.COM }; 13159440SSusan.Scheufele@Sun.COM 13169440SSusan.Scheufele@Sun.COM struct mrsas_progress { 13179440SSusan.Scheufele@Sun.COM uint16_t progress; 13189440SSusan.Scheufele@Sun.COM uint16_t elapsed_seconds; 13199440SSusan.Scheufele@Sun.COM }; 13209440SSusan.Scheufele@Sun.COM 13219440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld { 13229440SSusan.Scheufele@Sun.COM uint16_t target_id; 13239440SSusan.Scheufele@Sun.COM uint8_t ld_index; 13249440SSusan.Scheufele@Sun.COM uint8_t reserved; 13259440SSusan.Scheufele@Sun.COM }; 13269440SSusan.Scheufele@Sun.COM 13279440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd { 13289440SSusan.Scheufele@Sun.COM uint16_t device_id; 13299440SSusan.Scheufele@Sun.COM uint8_t encl_index; 13309440SSusan.Scheufele@Sun.COM uint8_t slot_number; 13319440SSusan.Scheufele@Sun.COM }; 13329440SSusan.Scheufele@Sun.COM 13339440SSusan.Scheufele@Sun.COM struct mrsas_evt_detail { 13349440SSusan.Scheufele@Sun.COM uint32_t seq_num; 13359440SSusan.Scheufele@Sun.COM uint32_t time_stamp; 13369440SSusan.Scheufele@Sun.COM uint32_t code; 13379440SSusan.Scheufele@Sun.COM union mrsas_evt_class_locale cl; 13389440SSusan.Scheufele@Sun.COM uint8_t arg_type; 13399440SSusan.Scheufele@Sun.COM uint8_t reserved1[15]; 13409440SSusan.Scheufele@Sun.COM 13419440SSusan.Scheufele@Sun.COM union { 13429440SSusan.Scheufele@Sun.COM struct { 13439440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd pd; 13449440SSusan.Scheufele@Sun.COM uint8_t cdb_length; 13459440SSusan.Scheufele@Sun.COM uint8_t sense_length; 13469440SSusan.Scheufele@Sun.COM uint8_t reserved[2]; 13479440SSusan.Scheufele@Sun.COM uint8_t cdb[16]; 13489440SSusan.Scheufele@Sun.COM uint8_t sense[64]; 13499440SSusan.Scheufele@Sun.COM } cdbSense; 13509440SSusan.Scheufele@Sun.COM 13519440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 13529440SSusan.Scheufele@Sun.COM 13539440SSusan.Scheufele@Sun.COM struct { 13549440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 13559440SSusan.Scheufele@Sun.COM uint64_t count; 13569440SSusan.Scheufele@Sun.COM } ld_count; 13579440SSusan.Scheufele@Sun.COM 13589440SSusan.Scheufele@Sun.COM struct { 13599440SSusan.Scheufele@Sun.COM uint64_t lba; 13609440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 13619440SSusan.Scheufele@Sun.COM } ld_lba; 13629440SSusan.Scheufele@Sun.COM 13639440SSusan.Scheufele@Sun.COM struct { 13649440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 13659440SSusan.Scheufele@Sun.COM uint32_t prevOwner; 13669440SSusan.Scheufele@Sun.COM uint32_t newOwner; 13679440SSusan.Scheufele@Sun.COM } ld_owner; 13689440SSusan.Scheufele@Sun.COM 13699440SSusan.Scheufele@Sun.COM struct { 13709440SSusan.Scheufele@Sun.COM uint64_t ld_lba; 13719440SSusan.Scheufele@Sun.COM uint64_t pd_lba; 13729440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 13739440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd pd; 13749440SSusan.Scheufele@Sun.COM } ld_lba_pd_lba; 13759440SSusan.Scheufele@Sun.COM 13769440SSusan.Scheufele@Sun.COM struct { 13779440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 13789440SSusan.Scheufele@Sun.COM struct mrsas_progress prog; 13799440SSusan.Scheufele@Sun.COM } ld_prog; 13809440SSusan.Scheufele@Sun.COM 13819440SSusan.Scheufele@Sun.COM struct { 13829440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 13839440SSusan.Scheufele@Sun.COM uint32_t prev_state; 13849440SSusan.Scheufele@Sun.COM uint32_t new_state; 13859440SSusan.Scheufele@Sun.COM } ld_state; 13869440SSusan.Scheufele@Sun.COM 13879440SSusan.Scheufele@Sun.COM struct { 13889440SSusan.Scheufele@Sun.COM uint64_t strip; 13899440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 13909440SSusan.Scheufele@Sun.COM } ld_strip; 13919440SSusan.Scheufele@Sun.COM 13929440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd pd; 13939440SSusan.Scheufele@Sun.COM 13949440SSusan.Scheufele@Sun.COM struct { 13959440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd pd; 13969440SSusan.Scheufele@Sun.COM uint32_t err; 13979440SSusan.Scheufele@Sun.COM } pd_err; 13989440SSusan.Scheufele@Sun.COM 13999440SSusan.Scheufele@Sun.COM struct { 14009440SSusan.Scheufele@Sun.COM uint64_t lba; 14019440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd pd; 14029440SSusan.Scheufele@Sun.COM } pd_lba; 14039440SSusan.Scheufele@Sun.COM 14049440SSusan.Scheufele@Sun.COM struct { 14059440SSusan.Scheufele@Sun.COM uint64_t lba; 14069440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd pd; 14079440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_ld ld; 14089440SSusan.Scheufele@Sun.COM } pd_lba_ld; 14099440SSusan.Scheufele@Sun.COM 14109440SSusan.Scheufele@Sun.COM struct { 14119440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd pd; 14129440SSusan.Scheufele@Sun.COM struct mrsas_progress prog; 14139440SSusan.Scheufele@Sun.COM } pd_prog; 14149440SSusan.Scheufele@Sun.COM 14159440SSusan.Scheufele@Sun.COM struct { 14169440SSusan.Scheufele@Sun.COM struct mrsas_evtarg_pd pd; 14179440SSusan.Scheufele@Sun.COM uint32_t prevState; 14189440SSusan.Scheufele@Sun.COM uint32_t newState; 14199440SSusan.Scheufele@Sun.COM } pd_state; 14209440SSusan.Scheufele@Sun.COM 14219440SSusan.Scheufele@Sun.COM struct { 14229440SSusan.Scheufele@Sun.COM uint16_t vendorId; 14239440SSusan.Scheufele@Sun.COM uint16_t deviceId; 14249440SSusan.Scheufele@Sun.COM uint16_t subVendorId; 14259440SSusan.Scheufele@Sun.COM uint16_t subDeviceId; 14269440SSusan.Scheufele@Sun.COM } pci; 14279440SSusan.Scheufele@Sun.COM 14289440SSusan.Scheufele@Sun.COM uint32_t rate; 14299440SSusan.Scheufele@Sun.COM char str[96]; 14309440SSusan.Scheufele@Sun.COM 14319440SSusan.Scheufele@Sun.COM struct { 14329440SSusan.Scheufele@Sun.COM uint32_t rtc; 14339440SSusan.Scheufele@Sun.COM uint32_t elapsedSeconds; 14349440SSusan.Scheufele@Sun.COM } time; 14359440SSusan.Scheufele@Sun.COM 14369440SSusan.Scheufele@Sun.COM struct { 14379440SSusan.Scheufele@Sun.COM uint32_t ecar; 14389440SSusan.Scheufele@Sun.COM uint32_t elog; 14399440SSusan.Scheufele@Sun.COM char str[64]; 14409440SSusan.Scheufele@Sun.COM } ecc; 14419440SSusan.Scheufele@Sun.COM 14429440SSusan.Scheufele@Sun.COM mrsas_pd_address_t pd_addr; 14439440SSusan.Scheufele@Sun.COM 14449440SSusan.Scheufele@Sun.COM uint8_t b[96]; 14459440SSusan.Scheufele@Sun.COM uint16_t s[48]; 14469440SSusan.Scheufele@Sun.COM uint32_t w[24]; 14479440SSusan.Scheufele@Sun.COM uint64_t d[12]; 14489440SSusan.Scheufele@Sun.COM } args; 14499440SSusan.Scheufele@Sun.COM 14509440SSusan.Scheufele@Sun.COM char description[128]; 14519440SSusan.Scheufele@Sun.COM 14529440SSusan.Scheufele@Sun.COM }; 14539440SSusan.Scheufele@Sun.COM 14549440SSusan.Scheufele@Sun.COM /* only 63 are usable by the application */ 14559440SSusan.Scheufele@Sun.COM #define MAX_LOGICAL_DRIVES 64 14569440SSusan.Scheufele@Sun.COM /* only 255 physical devices may be used */ 14579440SSusan.Scheufele@Sun.COM #define MAX_PHYSICAL_DEVICES 256 14589440SSusan.Scheufele@Sun.COM #define MAX_PD_PER_ENCLOSURE 64 14599440SSusan.Scheufele@Sun.COM /* maximum disks per array */ 14609440SSusan.Scheufele@Sun.COM #define MAX_ROW_SIZE 32 14619440SSusan.Scheufele@Sun.COM /* maximum spans per logical drive */ 14629440SSusan.Scheufele@Sun.COM #define MAX_SPAN_DEPTH 8 14639440SSusan.Scheufele@Sun.COM /* maximum number of arrays a hot spare may be dedicated to */ 14649440SSusan.Scheufele@Sun.COM #define MAX_ARRAYS_DEDICATED 16 14659440SSusan.Scheufele@Sun.COM /* maximum number of arrays which may exist */ 14669440SSusan.Scheufele@Sun.COM #define MAX_ARRAYS 128 14679440SSusan.Scheufele@Sun.COM /* maximum number of foreign configs that may ha managed at once */ 14689440SSusan.Scheufele@Sun.COM #define MAX_FOREIGN_CONFIGS 8 14699440SSusan.Scheufele@Sun.COM /* maximum spares (global and dedicated combined) */ 14709440SSusan.Scheufele@Sun.COM #define MAX_SPARES_FOR_THE_CONTROLLER MAX_PHYSICAL_DEVICES 14719440SSusan.Scheufele@Sun.COM /* maximum possible Target IDs (i.e. 0 to 63) */ 14729440SSusan.Scheufele@Sun.COM #define MAX_TARGET_ID 63 14739440SSusan.Scheufele@Sun.COM /* maximum number of supported enclosures */ 14749440SSusan.Scheufele@Sun.COM #define MAX_ENCLOSURES 32 14759440SSusan.Scheufele@Sun.COM /* maximum number of PHYs per controller */ 14769440SSusan.Scheufele@Sun.COM #define MAX_PHYS_PER_CONTROLLER 16 14779440SSusan.Scheufele@Sun.COM /* maximum number of LDs per array (due to DDF limitations) */ 14789440SSusan.Scheufele@Sun.COM #define MAX_LDS_PER_ARRAY 16 14799440SSusan.Scheufele@Sun.COM 14809440SSusan.Scheufele@Sun.COM /* 14819440SSusan.Scheufele@Sun.COM * ----------------------------------------------------------------------------- 14829440SSusan.Scheufele@Sun.COM * ----------------------------------------------------------------------------- 14839440SSusan.Scheufele@Sun.COM * 14849440SSusan.Scheufele@Sun.COM * Logical Drive commands 14859440SSusan.Scheufele@Sun.COM * 14869440SSusan.Scheufele@Sun.COM * ----------------------------------------------------------------------------- 14879440SSusan.Scheufele@Sun.COM * ----------------------------------------------------------------------------- 14889440SSusan.Scheufele@Sun.COM */ 14899440SSusan.Scheufele@Sun.COM #define MR_DCMD_LD 0x03000000, /* Logical Device (LD) opcodes */ 14909440SSusan.Scheufele@Sun.COM 14919440SSusan.Scheufele@Sun.COM /* 14929440SSusan.Scheufele@Sun.COM * Input: dcmd.opcode - MR_DCMD_LD_GET_LIST 14939440SSusan.Scheufele@Sun.COM * dcmd.mbox - reserved 14949440SSusan.Scheufele@Sun.COM * dcmd.sge IN - ptr to returned MR_LD_LIST structure 14959440SSusan.Scheufele@Sun.COM * Desc: Return the logical drive list structure 14969440SSusan.Scheufele@Sun.COM * Status: No error 14979440SSusan.Scheufele@Sun.COM */ 14989440SSusan.Scheufele@Sun.COM 14999440SSusan.Scheufele@Sun.COM /* 15009440SSusan.Scheufele@Sun.COM * defines the logical drive reference structure 15019440SSusan.Scheufele@Sun.COM */ 15029440SSusan.Scheufele@Sun.COM typedef union _MR_LD_REF { /* LD reference structure */ 15039440SSusan.Scheufele@Sun.COM struct { 15049440SSusan.Scheufele@Sun.COM uint8_t targetId; /* LD target id (0 to MAX_TARGET_ID) */ 15059440SSusan.Scheufele@Sun.COM uint8_t reserved; /* reserved for in line with MR_PD_REF */ 15069440SSusan.Scheufele@Sun.COM uint16_t seqNum; /* Sequence Number */ 15079440SSusan.Scheufele@Sun.COM } ld_ref; 15089440SSusan.Scheufele@Sun.COM uint32_t ref; /* shorthand reference to full 32-bits */ 15099440SSusan.Scheufele@Sun.COM } MR_LD_REF; /* 4 bytes */ 15109440SSusan.Scheufele@Sun.COM 15119440SSusan.Scheufele@Sun.COM /* 15129440SSusan.Scheufele@Sun.COM * defines the logical drive list structure 15139440SSusan.Scheufele@Sun.COM */ 15149440SSusan.Scheufele@Sun.COM typedef struct _MR_LD_LIST { 15159440SSusan.Scheufele@Sun.COM uint32_t ldCount; /* number of LDs */ 15169440SSusan.Scheufele@Sun.COM uint32_t reserved; /* pad to 8-byte boundary */ 15179440SSusan.Scheufele@Sun.COM struct { 15189440SSusan.Scheufele@Sun.COM MR_LD_REF ref; /* LD reference */ 15199440SSusan.Scheufele@Sun.COM uint8_t state; /* current LD state (MR_LD_STATE) */ 15209440SSusan.Scheufele@Sun.COM uint8_t reserved[3]; /* pad to 8-byte boundary */ 15219440SSusan.Scheufele@Sun.COM uint64_t size; /* LD size */ 15229440SSusan.Scheufele@Sun.COM } ldList[MAX_LOGICAL_DRIVES]; 15239440SSusan.Scheufele@Sun.COM } MR_LD_LIST; 15249440SSusan.Scheufele@Sun.COM 15259440SSusan.Scheufele@Sun.COM struct mrsas_drv_ver { 15269440SSusan.Scheufele@Sun.COM uint8_t signature[12]; 15279440SSusan.Scheufele@Sun.COM uint8_t os_name[16]; 15289440SSusan.Scheufele@Sun.COM uint8_t os_ver[12]; 15299440SSusan.Scheufele@Sun.COM uint8_t drv_name[20]; 15309440SSusan.Scheufele@Sun.COM uint8_t drv_ver[32]; 15319440SSusan.Scheufele@Sun.COM uint8_t drv_rel_date[20]; 15329440SSusan.Scheufele@Sun.COM }; 15339440SSusan.Scheufele@Sun.COM 15349440SSusan.Scheufele@Sun.COM #define PCI_TYPE0_ADDRESSES 6 15359440SSusan.Scheufele@Sun.COM #define PCI_TYPE1_ADDRESSES 2 15369440SSusan.Scheufele@Sun.COM #define PCI_TYPE2_ADDRESSES 5 15379440SSusan.Scheufele@Sun.COM 15389440SSusan.Scheufele@Sun.COM struct mrsas_pci_common_header { 15399440SSusan.Scheufele@Sun.COM uint16_t vendorID; /* (ro) */ 15409440SSusan.Scheufele@Sun.COM uint16_t deviceID; /* (ro) */ 15419440SSusan.Scheufele@Sun.COM uint16_t command; /* Device control */ 15429440SSusan.Scheufele@Sun.COM uint16_t status; 15439440SSusan.Scheufele@Sun.COM uint8_t revisionID; /* (ro) */ 15449440SSusan.Scheufele@Sun.COM uint8_t progIf; /* (ro) */ 15459440SSusan.Scheufele@Sun.COM uint8_t subClass; /* (ro) */ 15469440SSusan.Scheufele@Sun.COM uint8_t baseClass; /* (ro) */ 15479440SSusan.Scheufele@Sun.COM uint8_t cacheLineSize; /* (ro+) */ 15489440SSusan.Scheufele@Sun.COM uint8_t latencyTimer; /* (ro+) */ 15499440SSusan.Scheufele@Sun.COM uint8_t headerType; /* (ro) */ 15509440SSusan.Scheufele@Sun.COM uint8_t bist; /* Built in self test */ 15519440SSusan.Scheufele@Sun.COM 15529440SSusan.Scheufele@Sun.COM union { 15539440SSusan.Scheufele@Sun.COM struct { 15549440SSusan.Scheufele@Sun.COM uint32_t baseAddresses[PCI_TYPE0_ADDRESSES]; 15559440SSusan.Scheufele@Sun.COM uint32_t cis; 15569440SSusan.Scheufele@Sun.COM uint16_t subVendorID; 15579440SSusan.Scheufele@Sun.COM uint16_t subSystemID; 15589440SSusan.Scheufele@Sun.COM uint32_t romBaseAddress; 15599440SSusan.Scheufele@Sun.COM uint8_t capabilitiesPtr; 15609440SSusan.Scheufele@Sun.COM uint8_t reserved1[3]; 15619440SSusan.Scheufele@Sun.COM uint32_t reserved2; 15629440SSusan.Scheufele@Sun.COM uint8_t interruptLine; 15639440SSusan.Scheufele@Sun.COM uint8_t interruptPin; /* (ro) */ 15649440SSusan.Scheufele@Sun.COM uint8_t minimumGrant; /* (ro) */ 15659440SSusan.Scheufele@Sun.COM uint8_t maximumLatency; /* (ro) */ 15669440SSusan.Scheufele@Sun.COM } type_0; 15679440SSusan.Scheufele@Sun.COM 15689440SSusan.Scheufele@Sun.COM struct { 15699440SSusan.Scheufele@Sun.COM uint32_t baseAddresses[PCI_TYPE1_ADDRESSES]; 15709440SSusan.Scheufele@Sun.COM uint8_t primaryBus; 15719440SSusan.Scheufele@Sun.COM uint8_t secondaryBus; 15729440SSusan.Scheufele@Sun.COM uint8_t subordinateBus; 15739440SSusan.Scheufele@Sun.COM uint8_t secondaryLatency; 15749440SSusan.Scheufele@Sun.COM uint8_t ioBase; 15759440SSusan.Scheufele@Sun.COM uint8_t ioLimit; 15769440SSusan.Scheufele@Sun.COM uint16_t secondaryStatus; 15779440SSusan.Scheufele@Sun.COM uint16_t memoryBase; 15789440SSusan.Scheufele@Sun.COM uint16_t memoryLimit; 15799440SSusan.Scheufele@Sun.COM uint16_t prefetchBase; 15809440SSusan.Scheufele@Sun.COM uint16_t prefetchLimit; 15819440SSusan.Scheufele@Sun.COM uint32_t prefetchBaseUpper32; 15829440SSusan.Scheufele@Sun.COM uint32_t prefetchLimitUpper32; 15839440SSusan.Scheufele@Sun.COM uint16_t ioBaseUpper16; 15849440SSusan.Scheufele@Sun.COM uint16_t ioLimitUpper16; 15859440SSusan.Scheufele@Sun.COM uint8_t capabilitiesPtr; 15869440SSusan.Scheufele@Sun.COM uint8_t reserved1[3]; 15879440SSusan.Scheufele@Sun.COM uint32_t romBaseAddress; 15889440SSusan.Scheufele@Sun.COM uint8_t interruptLine; 15899440SSusan.Scheufele@Sun.COM uint8_t interruptPin; 15909440SSusan.Scheufele@Sun.COM uint16_t bridgeControl; 15919440SSusan.Scheufele@Sun.COM } type_1; 15929440SSusan.Scheufele@Sun.COM 15939440SSusan.Scheufele@Sun.COM struct { 15949440SSusan.Scheufele@Sun.COM uint32_t socketRegistersBaseAddress; 15959440SSusan.Scheufele@Sun.COM uint8_t capabilitiesPtr; 15969440SSusan.Scheufele@Sun.COM uint8_t reserved; 15979440SSusan.Scheufele@Sun.COM uint16_t secondaryStatus; 15989440SSusan.Scheufele@Sun.COM uint8_t primaryBus; 15999440SSusan.Scheufele@Sun.COM uint8_t secondaryBus; 16009440SSusan.Scheufele@Sun.COM uint8_t subordinateBus; 16019440SSusan.Scheufele@Sun.COM uint8_t secondaryLatency; 16029440SSusan.Scheufele@Sun.COM struct { 16039440SSusan.Scheufele@Sun.COM uint32_t base; 16049440SSusan.Scheufele@Sun.COM uint32_t limit; 16059440SSusan.Scheufele@Sun.COM } range[PCI_TYPE2_ADDRESSES-1]; 16069440SSusan.Scheufele@Sun.COM uint8_t interruptLine; 16079440SSusan.Scheufele@Sun.COM uint8_t interruptPin; 16089440SSusan.Scheufele@Sun.COM uint16_t bridgeControl; 16099440SSusan.Scheufele@Sun.COM } type_2; 16109440SSusan.Scheufele@Sun.COM } header; 16119440SSusan.Scheufele@Sun.COM }; 16129440SSusan.Scheufele@Sun.COM 16139440SSusan.Scheufele@Sun.COM struct mrsas_pci_link_capability { 16149440SSusan.Scheufele@Sun.COM union { 16159440SSusan.Scheufele@Sun.COM struct { 16169440SSusan.Scheufele@Sun.COM uint32_t linkSpeed :4; 16179440SSusan.Scheufele@Sun.COM uint32_t linkWidth :6; 16189440SSusan.Scheufele@Sun.COM uint32_t aspmSupport :2; 16199440SSusan.Scheufele@Sun.COM uint32_t losExitLatency :3; 16209440SSusan.Scheufele@Sun.COM uint32_t l1ExitLatency :3; 16219440SSusan.Scheufele@Sun.COM uint32_t rsvdp :6; 16229440SSusan.Scheufele@Sun.COM uint32_t portNumber :8; 16239440SSusan.Scheufele@Sun.COM } bits; 16249440SSusan.Scheufele@Sun.COM 16259440SSusan.Scheufele@Sun.COM uint32_t asUlong; 16269440SSusan.Scheufele@Sun.COM } cap; 16279440SSusan.Scheufele@Sun.COM 16289440SSusan.Scheufele@Sun.COM }; 16299440SSusan.Scheufele@Sun.COM 16309440SSusan.Scheufele@Sun.COM struct mrsas_pci_link_status_capability { 16319440SSusan.Scheufele@Sun.COM union { 16329440SSusan.Scheufele@Sun.COM struct { 16339440SSusan.Scheufele@Sun.COM uint16_t linkSpeed :4; 16349440SSusan.Scheufele@Sun.COM uint16_t negotiatedLinkWidth :6; 16359440SSusan.Scheufele@Sun.COM uint16_t linkTrainingError :1; 16369440SSusan.Scheufele@Sun.COM uint16_t linkTraning :1; 16379440SSusan.Scheufele@Sun.COM uint16_t slotClockConfig :1; 16389440SSusan.Scheufele@Sun.COM uint16_t rsvdZ :3; 16399440SSusan.Scheufele@Sun.COM } bits; 16409440SSusan.Scheufele@Sun.COM 16419440SSusan.Scheufele@Sun.COM uint16_t asUshort; 16429440SSusan.Scheufele@Sun.COM } stat_cap; 16439440SSusan.Scheufele@Sun.COM 16449440SSusan.Scheufele@Sun.COM uint16_t reserved; 16459440SSusan.Scheufele@Sun.COM 16469440SSusan.Scheufele@Sun.COM }; 16479440SSusan.Scheufele@Sun.COM 16489440SSusan.Scheufele@Sun.COM struct mrsas_pci_capabilities { 16499440SSusan.Scheufele@Sun.COM struct mrsas_pci_link_capability linkCapability; 16509440SSusan.Scheufele@Sun.COM struct mrsas_pci_link_status_capability linkStatusCapability; 16519440SSusan.Scheufele@Sun.COM }; 16529440SSusan.Scheufele@Sun.COM 16539440SSusan.Scheufele@Sun.COM struct mrsas_pci_information 16549440SSusan.Scheufele@Sun.COM { 16559440SSusan.Scheufele@Sun.COM uint32_t busNumber; 16569440SSusan.Scheufele@Sun.COM uint8_t deviceNumber; 16579440SSusan.Scheufele@Sun.COM uint8_t functionNumber; 16589440SSusan.Scheufele@Sun.COM uint8_t interruptVector; 16599440SSusan.Scheufele@Sun.COM uint8_t reserved; 16609440SSusan.Scheufele@Sun.COM struct mrsas_pci_common_header pciHeaderInfo; 16619440SSusan.Scheufele@Sun.COM struct mrsas_pci_capabilities capability; 16629440SSusan.Scheufele@Sun.COM uint8_t reserved2[32]; 16639440SSusan.Scheufele@Sun.COM }; 16649440SSusan.Scheufele@Sun.COM 16659440SSusan.Scheufele@Sun.COM struct mrsas_ioctl { 16669440SSusan.Scheufele@Sun.COM uint16_t version; 16679440SSusan.Scheufele@Sun.COM uint16_t controller_id; 16689440SSusan.Scheufele@Sun.COM uint8_t signature[8]; 16699440SSusan.Scheufele@Sun.COM uint32_t reserved_1; 16709440SSusan.Scheufele@Sun.COM uint32_t control_code; 16719440SSusan.Scheufele@Sun.COM uint32_t reserved_2[2]; 16729440SSusan.Scheufele@Sun.COM uint8_t frame[64]; 16739440SSusan.Scheufele@Sun.COM union mrsas_sgl_frame sgl_frame; 16749440SSusan.Scheufele@Sun.COM uint8_t sense_buff[MRSAS_MAX_SENSE_LENGTH]; 16759440SSusan.Scheufele@Sun.COM uint8_t data[1]; 16769440SSusan.Scheufele@Sun.COM }; 16779440SSusan.Scheufele@Sun.COM 16789440SSusan.Scheufele@Sun.COM struct mrsas_aen { 16799440SSusan.Scheufele@Sun.COM uint16_t host_no; 16809440SSusan.Scheufele@Sun.COM uint16_t cmd_status; 16819440SSusan.Scheufele@Sun.COM uint32_t seq_num; 16829440SSusan.Scheufele@Sun.COM uint32_t class_locale_word; 16839440SSusan.Scheufele@Sun.COM }; 16849440SSusan.Scheufele@Sun.COM #pragma pack() 16859440SSusan.Scheufele@Sun.COM 16869440SSusan.Scheufele@Sun.COM #ifndef DDI_VENDOR_LSI 16879440SSusan.Scheufele@Sun.COM #define DDI_VENDOR_LSI "LSI" 16889440SSusan.Scheufele@Sun.COM #endif /* DDI_VENDOR_LSI */ 16899440SSusan.Scheufele@Sun.COM 16909795SYu.Wu@Sun.COM #ifndef KMDB_MODULE 16919440SSusan.Scheufele@Sun.COM static int mrsas_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); 16929440SSusan.Scheufele@Sun.COM static int mrsas_attach(dev_info_t *, ddi_attach_cmd_t); 169312356SYu.Wu@Sun.COM #ifdef __sparc 16949440SSusan.Scheufele@Sun.COM static int mrsas_reset(dev_info_t *, ddi_reset_cmd_t); 169512356SYu.Wu@Sun.COM #else /* __sparc */ 169612356SYu.Wu@Sun.COM static int mrsas_quiesce(dev_info_t *); 169712356SYu.Wu@Sun.COM #endif /* __sparc */ 16989440SSusan.Scheufele@Sun.COM static int mrsas_detach(dev_info_t *, ddi_detach_cmd_t); 16999440SSusan.Scheufele@Sun.COM static int mrsas_open(dev_t *, int, int, cred_t *); 17009440SSusan.Scheufele@Sun.COM static int mrsas_close(dev_t, int, int, cred_t *); 17019440SSusan.Scheufele@Sun.COM static int mrsas_ioctl(dev_t, int, intptr_t, int, cred_t *, int *); 17029440SSusan.Scheufele@Sun.COM 17039440SSusan.Scheufele@Sun.COM static int mrsas_tran_tgt_init(dev_info_t *, dev_info_t *, 17049440SSusan.Scheufele@Sun.COM scsi_hba_tran_t *, struct scsi_device *); 17059440SSusan.Scheufele@Sun.COM static struct scsi_pkt *mrsas_tran_init_pkt(struct scsi_address *, register 17069440SSusan.Scheufele@Sun.COM struct scsi_pkt *, struct buf *, int, int, int, int, 17079440SSusan.Scheufele@Sun.COM int (*)(), caddr_t); 17089440SSusan.Scheufele@Sun.COM static int mrsas_tran_start(struct scsi_address *, 17099440SSusan.Scheufele@Sun.COM register struct scsi_pkt *); 17109440SSusan.Scheufele@Sun.COM static int mrsas_tran_abort(struct scsi_address *, struct scsi_pkt *); 17119440SSusan.Scheufele@Sun.COM static int mrsas_tran_reset(struct scsi_address *, int); 17129440SSusan.Scheufele@Sun.COM static int mrsas_tran_getcap(struct scsi_address *, char *, int); 17139440SSusan.Scheufele@Sun.COM static int mrsas_tran_setcap(struct scsi_address *, char *, int, int); 17149440SSusan.Scheufele@Sun.COM static void mrsas_tran_destroy_pkt(struct scsi_address *, 17159440SSusan.Scheufele@Sun.COM struct scsi_pkt *); 17169440SSusan.Scheufele@Sun.COM static void mrsas_tran_dmafree(struct scsi_address *, struct scsi_pkt *); 17179440SSusan.Scheufele@Sun.COM static void mrsas_tran_sync_pkt(struct scsi_address *, struct scsi_pkt *); 17189440SSusan.Scheufele@Sun.COM static uint_t mrsas_isr(); 17199440SSusan.Scheufele@Sun.COM static uint_t mrsas_softintr(); 17209440SSusan.Scheufele@Sun.COM 17219440SSusan.Scheufele@Sun.COM static int init_mfi(struct mrsas_instance *); 17229440SSusan.Scheufele@Sun.COM static int mrsas_free_dma_obj(struct mrsas_instance *, dma_obj_t); 17239440SSusan.Scheufele@Sun.COM static int mrsas_alloc_dma_obj(struct mrsas_instance *, dma_obj_t *, 17249440SSusan.Scheufele@Sun.COM uchar_t); 17259440SSusan.Scheufele@Sun.COM static struct mrsas_cmd *get_mfi_pkt(struct mrsas_instance *); 17269440SSusan.Scheufele@Sun.COM static void return_mfi_pkt(struct mrsas_instance *, 17279440SSusan.Scheufele@Sun.COM struct mrsas_cmd *); 17289440SSusan.Scheufele@Sun.COM 17299440SSusan.Scheufele@Sun.COM static void free_space_for_mfi(struct mrsas_instance *); 17309440SSusan.Scheufele@Sun.COM static void free_additional_dma_buffer(struct mrsas_instance *); 17319440SSusan.Scheufele@Sun.COM static int alloc_additional_dma_buffer(struct mrsas_instance *); 17329440SSusan.Scheufele@Sun.COM static int read_fw_status_reg_ppc(struct mrsas_instance *); 17339440SSusan.Scheufele@Sun.COM static void issue_cmd_ppc(struct mrsas_cmd *, struct mrsas_instance *); 17349440SSusan.Scheufele@Sun.COM static int issue_cmd_in_poll_mode_ppc(struct mrsas_instance *, 17359440SSusan.Scheufele@Sun.COM struct mrsas_cmd *); 17369440SSusan.Scheufele@Sun.COM static int issue_cmd_in_sync_mode_ppc(struct mrsas_instance *, 17379440SSusan.Scheufele@Sun.COM struct mrsas_cmd *); 17389440SSusan.Scheufele@Sun.COM static void enable_intr_ppc(struct mrsas_instance *); 17399440SSusan.Scheufele@Sun.COM static void disable_intr_ppc(struct mrsas_instance *); 17409440SSusan.Scheufele@Sun.COM static int intr_ack_ppc(struct mrsas_instance *); 17419440SSusan.Scheufele@Sun.COM static int mfi_state_transition_to_ready(struct mrsas_instance *); 17429440SSusan.Scheufele@Sun.COM static void destroy_mfi_frame_pool(struct mrsas_instance *); 17439440SSusan.Scheufele@Sun.COM static int create_mfi_frame_pool(struct mrsas_instance *); 17449440SSusan.Scheufele@Sun.COM static int mrsas_dma_alloc(struct mrsas_instance *, struct scsi_pkt *, 17459440SSusan.Scheufele@Sun.COM struct buf *, int, int (*)()); 17469440SSusan.Scheufele@Sun.COM static int mrsas_dma_move(struct mrsas_instance *, 17479440SSusan.Scheufele@Sun.COM struct scsi_pkt *, struct buf *); 17489440SSusan.Scheufele@Sun.COM static void flush_cache(struct mrsas_instance *instance); 17499440SSusan.Scheufele@Sun.COM static void display_scsi_inquiry(caddr_t); 17509440SSusan.Scheufele@Sun.COM static int start_mfi_aen(struct mrsas_instance *instance); 17519440SSusan.Scheufele@Sun.COM static int handle_drv_ioctl(struct mrsas_instance *instance, 17529440SSusan.Scheufele@Sun.COM struct mrsas_ioctl *ioctl, int mode); 17539440SSusan.Scheufele@Sun.COM static int handle_mfi_ioctl(struct mrsas_instance *instance, 17549440SSusan.Scheufele@Sun.COM struct mrsas_ioctl *ioctl, int mode); 17559440SSusan.Scheufele@Sun.COM static int handle_mfi_aen(struct mrsas_instance *instance, 17569440SSusan.Scheufele@Sun.COM struct mrsas_aen *aen); 17579440SSusan.Scheufele@Sun.COM static void fill_up_drv_ver(struct mrsas_drv_ver *dv); 17589440SSusan.Scheufele@Sun.COM static struct mrsas_cmd *build_cmd(struct mrsas_instance *instance, 17599440SSusan.Scheufele@Sun.COM struct scsi_address *ap, struct scsi_pkt *pkt, 17609440SSusan.Scheufele@Sun.COM uchar_t *cmd_done); 176112356SYu.Wu@Sun.COM #ifndef __sparc 176212356SYu.Wu@Sun.COM static int wait_for_outstanding(struct mrsas_instance *instance); 176312356SYu.Wu@Sun.COM #endif /* __sparc */ 17649440SSusan.Scheufele@Sun.COM static int register_mfi_aen(struct mrsas_instance *instance, 17659440SSusan.Scheufele@Sun.COM uint32_t seq_num, uint32_t class_locale_word); 17669440SSusan.Scheufele@Sun.COM static int issue_mfi_pthru(struct mrsas_instance *instance, struct 17679440SSusan.Scheufele@Sun.COM mrsas_ioctl *ioctl, struct mrsas_cmd *cmd, int mode); 17689440SSusan.Scheufele@Sun.COM static int issue_mfi_dcmd(struct mrsas_instance *instance, struct 17699440SSusan.Scheufele@Sun.COM mrsas_ioctl *ioctl, struct mrsas_cmd *cmd, int mode); 17709440SSusan.Scheufele@Sun.COM static int issue_mfi_smp(struct mrsas_instance *instance, struct 17719440SSusan.Scheufele@Sun.COM mrsas_ioctl *ioctl, struct mrsas_cmd *cmd, int mode); 17729440SSusan.Scheufele@Sun.COM static int issue_mfi_stp(struct mrsas_instance *instance, struct 17739440SSusan.Scheufele@Sun.COM mrsas_ioctl *ioctl, struct mrsas_cmd *cmd, int mode); 17749440SSusan.Scheufele@Sun.COM static int abort_aen_cmd(struct mrsas_instance *instance, 17759440SSusan.Scheufele@Sun.COM struct mrsas_cmd *cmd_to_abort); 17769440SSusan.Scheufele@Sun.COM 17779440SSusan.Scheufele@Sun.COM static int mrsas_common_check(struct mrsas_instance *instance, 17789440SSusan.Scheufele@Sun.COM struct mrsas_cmd *cmd); 17799440SSusan.Scheufele@Sun.COM static void mrsas_fm_init(struct mrsas_instance *instance); 17809440SSusan.Scheufele@Sun.COM static void mrsas_fm_fini(struct mrsas_instance *instance); 17819440SSusan.Scheufele@Sun.COM static int mrsas_fm_error_cb(dev_info_t *, ddi_fm_error_t *, 17829440SSusan.Scheufele@Sun.COM const void *); 17839440SSusan.Scheufele@Sun.COM static void mrsas_fm_ereport(struct mrsas_instance *instance, 17849440SSusan.Scheufele@Sun.COM char *detail); 17859440SSusan.Scheufele@Sun.COM static int mrsas_check_dma_handle(ddi_dma_handle_t handle); 17869440SSusan.Scheufele@Sun.COM static int mrsas_check_acc_handle(ddi_acc_handle_t handle); 17879440SSusan.Scheufele@Sun.COM 17889440SSusan.Scheufele@Sun.COM static void mrsas_rem_intrs(struct mrsas_instance *instance); 17899440SSusan.Scheufele@Sun.COM static int mrsas_add_intrs(struct mrsas_instance *instance, int intr_type); 17909440SSusan.Scheufele@Sun.COM 17919440SSusan.Scheufele@Sun.COM static void mrsas_tran_tgt_free(dev_info_t *, dev_info_t *, 17929440SSusan.Scheufele@Sun.COM scsi_hba_tran_t *, struct scsi_device *); 17939440SSusan.Scheufele@Sun.COM static int mrsas_tran_bus_config(dev_info_t *, uint_t, 17949440SSusan.Scheufele@Sun.COM ddi_bus_config_op_t, void *, dev_info_t **); 17959440SSusan.Scheufele@Sun.COM static int mrsas_parse_devname(char *, int *, int *); 17969440SSusan.Scheufele@Sun.COM static int mrsas_config_all_devices(struct mrsas_instance *); 17979440SSusan.Scheufele@Sun.COM static int mrsas_config_scsi_device(struct mrsas_instance *, 17989440SSusan.Scheufele@Sun.COM struct scsi_device *, dev_info_t **); 17999440SSusan.Scheufele@Sun.COM static int mrsas_config_ld(struct mrsas_instance *, uint16_t, 18009440SSusan.Scheufele@Sun.COM uint8_t, dev_info_t **); 18019440SSusan.Scheufele@Sun.COM static dev_info_t *mrsas_find_child(struct mrsas_instance *, uint16_t, 18029440SSusan.Scheufele@Sun.COM uint8_t); 18039440SSusan.Scheufele@Sun.COM static int mrsas_name_node(dev_info_t *, char *, int); 18049440SSusan.Scheufele@Sun.COM static void mrsas_issue_evt_taskq(struct mrsas_eventinfo *); 18059440SSusan.Scheufele@Sun.COM static int mrsas_service_evt(struct mrsas_instance *, int, int, int, 18069440SSusan.Scheufele@Sun.COM uint64_t); 18079440SSusan.Scheufele@Sun.COM static int mrsas_mode_sense_build(struct scsi_pkt *); 180812244SYu.Wu@Sun.COM static void push_pending_mfi_pkt(struct mrsas_instance *, 180912244SYu.Wu@Sun.COM struct mrsas_cmd *); 181012244SYu.Wu@Sun.COM static int mrsas_issue_init_mfi(struct mrsas_instance *); 181112244SYu.Wu@Sun.COM static int mrsas_issue_pending_cmds(struct mrsas_instance *); 181212244SYu.Wu@Sun.COM static int mrsas_print_pending_cmds(struct mrsas_instance *); 181312244SYu.Wu@Sun.COM static int mrsas_complete_pending_cmds(struct mrsas_instance *); 181412244SYu.Wu@Sun.COM static int mrsas_reset_ppc(struct mrsas_instance *); 181512244SYu.Wu@Sun.COM static uint32_t mrsas_initiate_ocr_if_fw_is_faulty(struct mrsas_instance *); 181612244SYu.Wu@Sun.COM static int mrsas_kill_adapter(struct mrsas_instance *); 181712244SYu.Wu@Sun.COM static void io_timeout_checker(void *instance); 181812244SYu.Wu@Sun.COM static void complete_cmd_in_sync_mode(struct mrsas_instance *, 181912244SYu.Wu@Sun.COM struct mrsas_cmd *); 182012244SYu.Wu@Sun.COM 18219795SYu.Wu@Sun.COM #endif /* KMDB_MODULE */ 18229440SSusan.Scheufele@Sun.COM 182312244SYu.Wu@Sun.COM 18249440SSusan.Scheufele@Sun.COM #ifdef __cplusplus 18259440SSusan.Scheufele@Sun.COM } 18269440SSusan.Scheufele@Sun.COM #endif 18279440SSusan.Scheufele@Sun.COM 18289440SSusan.Scheufele@Sun.COM #endif /* _MR_SAS_H_ */ 1829