1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * linux/drivers/message/fusion/mptsas.h 3*4882a593Smuzhiyun * High performance SCSI + LAN / Fibre Channel device drivers. 4*4882a593Smuzhiyun * For use with PCI chip/adapter(s): 5*4882a593Smuzhiyun * LSIFC9xx/LSI409xx Fibre Channel 6*4882a593Smuzhiyun * running LSI MPT (Message Passing Technology) firmware. 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * Copyright (c) 1999-2008 LSI Corporation 9*4882a593Smuzhiyun * (mailto:DL-MPTFusionLinux@lsi.com) 10*4882a593Smuzhiyun * 11*4882a593Smuzhiyun */ 12*4882a593Smuzhiyun /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 13*4882a593Smuzhiyun /* 14*4882a593Smuzhiyun This program is free software; you can redistribute it and/or modify 15*4882a593Smuzhiyun it under the terms of the GNU General Public License as published by 16*4882a593Smuzhiyun the Free Software Foundation; version 2 of the License. 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun This program is distributed in the hope that it will be useful, 19*4882a593Smuzhiyun but WITHOUT ANY WARRANTY; without even the implied warranty of 20*4882a593Smuzhiyun MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21*4882a593Smuzhiyun GNU General Public License for more details. 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun NO WARRANTY 24*4882a593Smuzhiyun THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 25*4882a593Smuzhiyun CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 26*4882a593Smuzhiyun LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 27*4882a593Smuzhiyun MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 28*4882a593Smuzhiyun solely responsible for determining the appropriateness of using and 29*4882a593Smuzhiyun distributing the Program and assumes all risks associated with its 30*4882a593Smuzhiyun exercise of rights under this Agreement, including but not limited to 31*4882a593Smuzhiyun the risks and costs of program errors, damage to or loss of data, 32*4882a593Smuzhiyun programs or equipment, and unavailability or interruption of operations. 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun DISCLAIMER OF LIABILITY 35*4882a593Smuzhiyun NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 36*4882a593Smuzhiyun DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37*4882a593Smuzhiyun DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 38*4882a593Smuzhiyun ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 39*4882a593Smuzhiyun TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 40*4882a593Smuzhiyun USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 41*4882a593Smuzhiyun HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun You should have received a copy of the GNU General Public License 44*4882a593Smuzhiyun along with this program; if not, write to the Free Software 45*4882a593Smuzhiyun Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 46*4882a593Smuzhiyun */ 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun #ifndef MPTSAS_H_INCLUDED 49*4882a593Smuzhiyun #define MPTSAS_H_INCLUDED 50*4882a593Smuzhiyun /*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun struct mptsas_target_reset_event { 53*4882a593Smuzhiyun struct list_head list; 54*4882a593Smuzhiyun EVENT_DATA_SAS_DEVICE_STATUS_CHANGE sas_event_data; 55*4882a593Smuzhiyun u8 target_reset_issued; 56*4882a593Smuzhiyun unsigned long time_count; 57*4882a593Smuzhiyun }; 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun enum mptsas_hotplug_action { 60*4882a593Smuzhiyun MPTSAS_ADD_DEVICE, 61*4882a593Smuzhiyun MPTSAS_DEL_DEVICE, 62*4882a593Smuzhiyun MPTSAS_ADD_RAID, 63*4882a593Smuzhiyun MPTSAS_DEL_RAID, 64*4882a593Smuzhiyun MPTSAS_ADD_PHYSDISK, 65*4882a593Smuzhiyun MPTSAS_ADD_PHYSDISK_REPROBE, 66*4882a593Smuzhiyun MPTSAS_DEL_PHYSDISK, 67*4882a593Smuzhiyun MPTSAS_DEL_PHYSDISK_REPROBE, 68*4882a593Smuzhiyun MPTSAS_ADD_INACTIVE_VOLUME, 69*4882a593Smuzhiyun MPTSAS_IGNORE_EVENT, 70*4882a593Smuzhiyun }; 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun struct mptsas_mapping{ 73*4882a593Smuzhiyun u8 id; 74*4882a593Smuzhiyun u8 channel; 75*4882a593Smuzhiyun }; 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun struct mptsas_device_info { 78*4882a593Smuzhiyun struct list_head list; 79*4882a593Smuzhiyun struct mptsas_mapping os; /* operating system mapping*/ 80*4882a593Smuzhiyun struct mptsas_mapping fw; /* firmware mapping */ 81*4882a593Smuzhiyun u64 sas_address; 82*4882a593Smuzhiyun u32 device_info; /* specific bits for devices */ 83*4882a593Smuzhiyun u16 slot; /* enclosure slot id */ 84*4882a593Smuzhiyun u64 enclosure_logical_id; /*enclosure address */ 85*4882a593Smuzhiyun u8 is_logical_volume; /* is this logical volume */ 86*4882a593Smuzhiyun /* this belongs to volume */ 87*4882a593Smuzhiyun u8 is_hidden_raid_component; 88*4882a593Smuzhiyun /* this valid when is_hidden_raid_component set */ 89*4882a593Smuzhiyun u8 volume_id; 90*4882a593Smuzhiyun /* cached data for a removed device */ 91*4882a593Smuzhiyun u8 is_cached; 92*4882a593Smuzhiyun }; 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun struct mptsas_hotplug_event { 95*4882a593Smuzhiyun MPT_ADAPTER *ioc; 96*4882a593Smuzhiyun enum mptsas_hotplug_action event_type; 97*4882a593Smuzhiyun u64 sas_address; 98*4882a593Smuzhiyun u8 channel; 99*4882a593Smuzhiyun u8 id; 100*4882a593Smuzhiyun u32 device_info; 101*4882a593Smuzhiyun u16 handle; 102*4882a593Smuzhiyun u8 phy_id; 103*4882a593Smuzhiyun u8 phys_disk_num; /* hrc - unique index*/ 104*4882a593Smuzhiyun struct scsi_device *sdev; 105*4882a593Smuzhiyun }; 106*4882a593Smuzhiyun 107*4882a593Smuzhiyun struct fw_event_work { 108*4882a593Smuzhiyun struct list_head list; 109*4882a593Smuzhiyun struct delayed_work work; 110*4882a593Smuzhiyun MPT_ADAPTER *ioc; 111*4882a593Smuzhiyun u32 event; 112*4882a593Smuzhiyun u8 retries; 113*4882a593Smuzhiyun char event_data[] __aligned(4); 114*4882a593Smuzhiyun }; 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun struct mptsas_discovery_event { 117*4882a593Smuzhiyun struct work_struct work; 118*4882a593Smuzhiyun MPT_ADAPTER *ioc; 119*4882a593Smuzhiyun }; 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun /* 122*4882a593Smuzhiyun * SAS topology structures 123*4882a593Smuzhiyun * 124*4882a593Smuzhiyun * The MPT Fusion firmware interface spreads information about the 125*4882a593Smuzhiyun * SAS topology over many manufacture pages, thus we need some data 126*4882a593Smuzhiyun * structure to collect it and process it for the SAS transport class. 127*4882a593Smuzhiyun */ 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun struct mptsas_devinfo { 130*4882a593Smuzhiyun u16 handle; /* unique id to address this device */ 131*4882a593Smuzhiyun u16 handle_parent; /* unique id to address parent device */ 132*4882a593Smuzhiyun u16 handle_enclosure; /* enclosure identifier of the enclosure */ 133*4882a593Smuzhiyun u16 slot; /* physical slot in enclosure */ 134*4882a593Smuzhiyun u8 phy_id; /* phy number of parent device */ 135*4882a593Smuzhiyun u8 port_id; /* sas physical port this device 136*4882a593Smuzhiyun is assoc'd with */ 137*4882a593Smuzhiyun u8 id; /* logical target id of this device */ 138*4882a593Smuzhiyun u32 phys_disk_num; /* phys disk id, for csmi-ioctls */ 139*4882a593Smuzhiyun u8 channel; /* logical bus number of this device */ 140*4882a593Smuzhiyun u64 sas_address; /* WWN of this device, 141*4882a593Smuzhiyun SATA is assigned by HBA,expander */ 142*4882a593Smuzhiyun u32 device_info; /* bitfield detailed info about this device */ 143*4882a593Smuzhiyun u16 flags; /* sas device pg0 flags */ 144*4882a593Smuzhiyun }; 145*4882a593Smuzhiyun 146*4882a593Smuzhiyun /* 147*4882a593Smuzhiyun * Specific details on ports, wide/narrow 148*4882a593Smuzhiyun */ 149*4882a593Smuzhiyun struct mptsas_portinfo_details{ 150*4882a593Smuzhiyun u16 num_phys; /* number of phys belong to this port */ 151*4882a593Smuzhiyun u64 phy_bitmask; /* TODO, extend support for 255 phys */ 152*4882a593Smuzhiyun struct sas_rphy *rphy; /* transport layer rphy object */ 153*4882a593Smuzhiyun struct sas_port *port; /* transport layer port object */ 154*4882a593Smuzhiyun struct scsi_target *starget; 155*4882a593Smuzhiyun struct mptsas_portinfo *port_info; 156*4882a593Smuzhiyun }; 157*4882a593Smuzhiyun 158*4882a593Smuzhiyun struct mptsas_phyinfo { 159*4882a593Smuzhiyun u16 handle; /* unique id to address this */ 160*4882a593Smuzhiyun u8 phy_id; /* phy index */ 161*4882a593Smuzhiyun u8 port_id; /* firmware port identifier */ 162*4882a593Smuzhiyun u8 negotiated_link_rate; /* nego'd link rate for this phy */ 163*4882a593Smuzhiyun u8 hw_link_rate; /* hardware max/min phys link rate */ 164*4882a593Smuzhiyun u8 programmed_link_rate; /* programmed max/min phy link rate */ 165*4882a593Smuzhiyun u8 sas_port_add_phy; /* flag to request sas_port_add_phy*/ 166*4882a593Smuzhiyun struct mptsas_devinfo identify; /* point to phy device info */ 167*4882a593Smuzhiyun struct mptsas_devinfo attached; /* point to attached device info */ 168*4882a593Smuzhiyun struct sas_phy *phy; /* transport layer phy object */ 169*4882a593Smuzhiyun struct mptsas_portinfo *portinfo; 170*4882a593Smuzhiyun struct mptsas_portinfo_details * port_details; 171*4882a593Smuzhiyun }; 172*4882a593Smuzhiyun 173*4882a593Smuzhiyun struct mptsas_portinfo { 174*4882a593Smuzhiyun struct list_head list; 175*4882a593Smuzhiyun u16 num_phys; /* number of phys */ 176*4882a593Smuzhiyun struct mptsas_phyinfo *phy_info; 177*4882a593Smuzhiyun }; 178*4882a593Smuzhiyun 179*4882a593Smuzhiyun struct mptsas_enclosure { 180*4882a593Smuzhiyun u64 enclosure_logical_id; /* The WWN for the enclosure */ 181*4882a593Smuzhiyun u16 enclosure_handle; /* unique id to address this */ 182*4882a593Smuzhiyun u16 flags; /* details enclosure management */ 183*4882a593Smuzhiyun u16 num_slot; /* num slots */ 184*4882a593Smuzhiyun u16 start_slot; /* first slot */ 185*4882a593Smuzhiyun u8 start_id; /* starting logical target id */ 186*4882a593Smuzhiyun u8 start_channel; /* starting logical channel id */ 187*4882a593Smuzhiyun u8 sep_id; /* SEP device logical target id */ 188*4882a593Smuzhiyun u8 sep_channel; /* SEP channel logical channel id */ 189*4882a593Smuzhiyun }; 190*4882a593Smuzhiyun 191*4882a593Smuzhiyun /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 192*4882a593Smuzhiyun #endif 193