/*1* linux/drivers/message/fusion/mptsas.h2* High performance SCSI + LAN / Fibre Channel device drivers.3* For use with PCI chip/adapter(s):4* LSIFC9xx/LSI409xx Fibre Channel5* running LSI MPT (Message Passing Technology) firmware.6*7* Copyright (c) 1999-2008 LSI Corporation8* (mailto:[email protected])9*10*/11/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/12/*13This program is free software; you can redistribute it and/or modify14it under the terms of the GNU General Public License as published by15the Free Software Foundation; version 2 of the License.1617This program is distributed in the hope that it will be useful,18but WITHOUT ANY WARRANTY; without even the implied warranty of19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20GNU General Public License for more details.2122NO WARRANTY23THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR24CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT25LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,26MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is27solely responsible for determining the appropriateness of using and28distributing the Program and assumes all risks associated with its29exercise of rights under this Agreement, including but not limited to30the risks and costs of program errors, damage to or loss of data,31programs or equipment, and unavailability or interruption of operations.3233DISCLAIMER OF LIABILITY34NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY35DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL36DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND37ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR38TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE39USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED40HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES4142You should have received a copy of the GNU General Public License43along with this program; if not, write to the Free Software44Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA45*/4647#ifndef MPTSAS_H_INCLUDED48#define MPTSAS_H_INCLUDED49/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/5051struct mptsas_target_reset_event {52struct list_head list;53EVENT_DATA_SAS_DEVICE_STATUS_CHANGE sas_event_data;54u8 target_reset_issued;55unsigned long time_count;56};5758enum mptsas_hotplug_action {59MPTSAS_ADD_DEVICE,60MPTSAS_DEL_DEVICE,61MPTSAS_ADD_RAID,62MPTSAS_DEL_RAID,63MPTSAS_ADD_PHYSDISK,64MPTSAS_ADD_PHYSDISK_REPROBE,65MPTSAS_DEL_PHYSDISK,66MPTSAS_DEL_PHYSDISK_REPROBE,67MPTSAS_ADD_INACTIVE_VOLUME,68MPTSAS_IGNORE_EVENT,69};7071struct mptsas_mapping{72u8 id;73u8 channel;74};7576struct mptsas_device_info {77struct list_head list;78struct mptsas_mapping os; /* operating system mapping*/79struct mptsas_mapping fw; /* firmware mapping */80u64 sas_address;81u32 device_info; /* specific bits for devices */82u16 slot; /* enclosure slot id */83u64 enclosure_logical_id; /*enclosure address */84u8 is_logical_volume; /* is this logical volume */85/* this belongs to volume */86u8 is_hidden_raid_component;87/* this valid when is_hidden_raid_component set */88u8 volume_id;89/* cached data for a removed device */90u8 is_cached;91};9293struct mptsas_hotplug_event {94MPT_ADAPTER *ioc;95enum mptsas_hotplug_action event_type;96u64 sas_address;97u8 channel;98u8 id;99u32 device_info;100u16 handle;101u8 phy_id;102u8 phys_disk_num; /* hrc - unique index*/103struct scsi_device *sdev;104};105106struct fw_event_work {107struct list_head list;108struct delayed_work work;109MPT_ADAPTER *ioc;110u32 event;111u8 retries;112u8 __attribute__((aligned(4))) event_data[1];113};114115struct mptsas_discovery_event {116struct work_struct work;117MPT_ADAPTER *ioc;118};119120/*121* SAS topology structures122*123* The MPT Fusion firmware interface spreads information about the124* SAS topology over many manufacture pages, thus we need some data125* structure to collect it and process it for the SAS transport class.126*/127128struct mptsas_devinfo {129u16 handle; /* unique id to address this device */130u16 handle_parent; /* unique id to address parent device */131u16 handle_enclosure; /* enclosure identifier of the enclosure */132u16 slot; /* physical slot in enclosure */133u8 phy_id; /* phy number of parent device */134u8 port_id; /* sas physical port this device135is assoc'd with */136u8 id; /* logical target id of this device */137u32 phys_disk_num; /* phys disk id, for csmi-ioctls */138u8 channel; /* logical bus number of this device */139u64 sas_address; /* WWN of this device,140SATA is assigned by HBA,expander */141u32 device_info; /* bitfield detailed info about this device */142u16 flags; /* sas device pg0 flags */143};144145/*146* Specific details on ports, wide/narrow147*/148struct mptsas_portinfo_details{149u16 num_phys; /* number of phys belong to this port */150u64 phy_bitmask; /* TODO, extend support for 255 phys */151struct sas_rphy *rphy; /* transport layer rphy object */152struct sas_port *port; /* transport layer port object */153struct scsi_target *starget;154struct mptsas_portinfo *port_info;155};156157struct mptsas_phyinfo {158u16 handle; /* unique id to address this */159u8 phy_id; /* phy index */160u8 port_id; /* firmware port identifier */161u8 negotiated_link_rate; /* nego'd link rate for this phy */162u8 hw_link_rate; /* hardware max/min phys link rate */163u8 programmed_link_rate; /* programmed max/min phy link rate */164u8 sas_port_add_phy; /* flag to request sas_port_add_phy*/165struct mptsas_devinfo identify; /* point to phy device info */166struct mptsas_devinfo attached; /* point to attached device info */167struct sas_phy *phy; /* transport layer phy object */168struct mptsas_portinfo *portinfo;169struct mptsas_portinfo_details * port_details;170};171172struct mptsas_portinfo {173struct list_head list;174u16 num_phys; /* number of phys */175struct mptsas_phyinfo *phy_info;176};177178struct mptsas_enclosure {179u64 enclosure_logical_id; /* The WWN for the enclosure */180u16 enclosure_handle; /* unique id to address this */181u16 flags; /* details enclosure management */182u16 num_slot; /* num slots */183u16 start_slot; /* first slot */184u8 start_id; /* starting logical target id */185u8 start_channel; /* starting logical channel id */186u8 sep_id; /* SEP device logical target id */187u8 sep_channel; /* SEP channel logical channel id */188};189190/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/191#endif192193194