162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * linux/drivers/message/fusion/mptsas.h 362306a36Sopenharmony_ci * High performance SCSI + LAN / Fibre Channel device drivers. 462306a36Sopenharmony_ci * For use with PCI chip/adapter(s): 562306a36Sopenharmony_ci * LSIFC9xx/LSI409xx Fibre Channel 662306a36Sopenharmony_ci * running LSI MPT (Message Passing Technology) firmware. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright (c) 1999-2008 LSI Corporation 962306a36Sopenharmony_ci * (mailto:DL-MPTFusionLinux@lsi.com) 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1362306a36Sopenharmony_ci/* 1462306a36Sopenharmony_ci This program is free software; you can redistribute it and/or modify 1562306a36Sopenharmony_ci it under the terms of the GNU General Public License as published by 1662306a36Sopenharmony_ci the Free Software Foundation; version 2 of the License. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci This program is distributed in the hope that it will be useful, 1962306a36Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 2062306a36Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2162306a36Sopenharmony_ci GNU General Public License for more details. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci NO WARRANTY 2462306a36Sopenharmony_ci THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 2562306a36Sopenharmony_ci CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 2662306a36Sopenharmony_ci LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 2762306a36Sopenharmony_ci MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 2862306a36Sopenharmony_ci solely responsible for determining the appropriateness of using and 2962306a36Sopenharmony_ci distributing the Program and assumes all risks associated with its 3062306a36Sopenharmony_ci exercise of rights under this Agreement, including but not limited to 3162306a36Sopenharmony_ci the risks and costs of program errors, damage to or loss of data, 3262306a36Sopenharmony_ci programs or equipment, and unavailability or interruption of operations. 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci DISCLAIMER OF LIABILITY 3562306a36Sopenharmony_ci NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 3662306a36Sopenharmony_ci DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3762306a36Sopenharmony_ci DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 3862306a36Sopenharmony_ci ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 3962306a36Sopenharmony_ci TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 4062306a36Sopenharmony_ci USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 4162306a36Sopenharmony_ci HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci You should have received a copy of the GNU General Public License 4462306a36Sopenharmony_ci along with this program; if not, write to the Free Software 4562306a36Sopenharmony_ci Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 4662306a36Sopenharmony_ci*/ 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#ifndef MPTSAS_H_INCLUDED 4962306a36Sopenharmony_ci#define MPTSAS_H_INCLUDED 5062306a36Sopenharmony_ci/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_cistruct mptsas_target_reset_event { 5362306a36Sopenharmony_ci struct list_head list; 5462306a36Sopenharmony_ci EVENT_DATA_SAS_DEVICE_STATUS_CHANGE sas_event_data; 5562306a36Sopenharmony_ci u8 target_reset_issued; 5662306a36Sopenharmony_ci unsigned long time_count; 5762306a36Sopenharmony_ci}; 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_cienum mptsas_hotplug_action { 6062306a36Sopenharmony_ci MPTSAS_ADD_DEVICE, 6162306a36Sopenharmony_ci MPTSAS_DEL_DEVICE, 6262306a36Sopenharmony_ci MPTSAS_ADD_RAID, 6362306a36Sopenharmony_ci MPTSAS_DEL_RAID, 6462306a36Sopenharmony_ci MPTSAS_ADD_PHYSDISK, 6562306a36Sopenharmony_ci MPTSAS_ADD_PHYSDISK_REPROBE, 6662306a36Sopenharmony_ci MPTSAS_DEL_PHYSDISK, 6762306a36Sopenharmony_ci MPTSAS_DEL_PHYSDISK_REPROBE, 6862306a36Sopenharmony_ci MPTSAS_ADD_INACTIVE_VOLUME, 6962306a36Sopenharmony_ci MPTSAS_IGNORE_EVENT, 7062306a36Sopenharmony_ci}; 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_cistruct mptsas_mapping{ 7362306a36Sopenharmony_ci u8 id; 7462306a36Sopenharmony_ci u8 channel; 7562306a36Sopenharmony_ci}; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_cistruct mptsas_device_info { 7862306a36Sopenharmony_ci struct list_head list; 7962306a36Sopenharmony_ci struct mptsas_mapping os; /* operating system mapping*/ 8062306a36Sopenharmony_ci struct mptsas_mapping fw; /* firmware mapping */ 8162306a36Sopenharmony_ci u64 sas_address; 8262306a36Sopenharmony_ci u32 device_info; /* specific bits for devices */ 8362306a36Sopenharmony_ci u16 slot; /* enclosure slot id */ 8462306a36Sopenharmony_ci u64 enclosure_logical_id; /*enclosure address */ 8562306a36Sopenharmony_ci u8 is_logical_volume; /* is this logical volume */ 8662306a36Sopenharmony_ci /* this belongs to volume */ 8762306a36Sopenharmony_ci u8 is_hidden_raid_component; 8862306a36Sopenharmony_ci /* this valid when is_hidden_raid_component set */ 8962306a36Sopenharmony_ci u8 volume_id; 9062306a36Sopenharmony_ci /* cached data for a removed device */ 9162306a36Sopenharmony_ci u8 is_cached; 9262306a36Sopenharmony_ci}; 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_cistruct mptsas_hotplug_event { 9562306a36Sopenharmony_ci MPT_ADAPTER *ioc; 9662306a36Sopenharmony_ci enum mptsas_hotplug_action event_type; 9762306a36Sopenharmony_ci u64 sas_address; 9862306a36Sopenharmony_ci u8 channel; 9962306a36Sopenharmony_ci u8 id; 10062306a36Sopenharmony_ci u32 device_info; 10162306a36Sopenharmony_ci u16 handle; 10262306a36Sopenharmony_ci u8 phy_id; 10362306a36Sopenharmony_ci u8 phys_disk_num; /* hrc - unique index*/ 10462306a36Sopenharmony_ci struct scsi_device *sdev; 10562306a36Sopenharmony_ci}; 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_cistruct fw_event_work { 10862306a36Sopenharmony_ci struct list_head list; 10962306a36Sopenharmony_ci struct delayed_work work; 11062306a36Sopenharmony_ci int users; 11162306a36Sopenharmony_ci MPT_ADAPTER *ioc; 11262306a36Sopenharmony_ci u32 event; 11362306a36Sopenharmony_ci u8 retries; 11462306a36Sopenharmony_ci char event_data[] __aligned(4); 11562306a36Sopenharmony_ci}; 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_cistruct mptsas_discovery_event { 11862306a36Sopenharmony_ci struct work_struct work; 11962306a36Sopenharmony_ci MPT_ADAPTER *ioc; 12062306a36Sopenharmony_ci}; 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci/* 12362306a36Sopenharmony_ci * SAS topology structures 12462306a36Sopenharmony_ci * 12562306a36Sopenharmony_ci * The MPT Fusion firmware interface spreads information about the 12662306a36Sopenharmony_ci * SAS topology over many manufacture pages, thus we need some data 12762306a36Sopenharmony_ci * structure to collect it and process it for the SAS transport class. 12862306a36Sopenharmony_ci */ 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_cistruct mptsas_devinfo { 13162306a36Sopenharmony_ci u16 handle; /* unique id to address this device */ 13262306a36Sopenharmony_ci u16 handle_parent; /* unique id to address parent device */ 13362306a36Sopenharmony_ci u16 handle_enclosure; /* enclosure identifier of the enclosure */ 13462306a36Sopenharmony_ci u16 slot; /* physical slot in enclosure */ 13562306a36Sopenharmony_ci u8 phy_id; /* phy number of parent device */ 13662306a36Sopenharmony_ci u8 port_id; /* sas physical port this device 13762306a36Sopenharmony_ci is assoc'd with */ 13862306a36Sopenharmony_ci u8 id; /* logical target id of this device */ 13962306a36Sopenharmony_ci u32 phys_disk_num; /* phys disk id, for csmi-ioctls */ 14062306a36Sopenharmony_ci u8 channel; /* logical bus number of this device */ 14162306a36Sopenharmony_ci u64 sas_address; /* WWN of this device, 14262306a36Sopenharmony_ci SATA is assigned by HBA,expander */ 14362306a36Sopenharmony_ci u32 device_info; /* bitfield detailed info about this device */ 14462306a36Sopenharmony_ci u16 flags; /* sas device pg0 flags */ 14562306a36Sopenharmony_ci}; 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci/* 14862306a36Sopenharmony_ci * Specific details on ports, wide/narrow 14962306a36Sopenharmony_ci */ 15062306a36Sopenharmony_cistruct mptsas_portinfo_details{ 15162306a36Sopenharmony_ci u16 num_phys; /* number of phys belong to this port */ 15262306a36Sopenharmony_ci u64 phy_bitmask; /* TODO, extend support for 255 phys */ 15362306a36Sopenharmony_ci struct sas_rphy *rphy; /* transport layer rphy object */ 15462306a36Sopenharmony_ci struct sas_port *port; /* transport layer port object */ 15562306a36Sopenharmony_ci struct scsi_target *starget; 15662306a36Sopenharmony_ci struct mptsas_portinfo *port_info; 15762306a36Sopenharmony_ci}; 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_cistruct mptsas_phyinfo { 16062306a36Sopenharmony_ci u16 handle; /* unique id to address this */ 16162306a36Sopenharmony_ci u8 phy_id; /* phy index */ 16262306a36Sopenharmony_ci u8 port_id; /* firmware port identifier */ 16362306a36Sopenharmony_ci u8 negotiated_link_rate; /* nego'd link rate for this phy */ 16462306a36Sopenharmony_ci u8 hw_link_rate; /* hardware max/min phys link rate */ 16562306a36Sopenharmony_ci u8 programmed_link_rate; /* programmed max/min phy link rate */ 16662306a36Sopenharmony_ci u8 sas_port_add_phy; /* flag to request sas_port_add_phy*/ 16762306a36Sopenharmony_ci struct mptsas_devinfo identify; /* point to phy device info */ 16862306a36Sopenharmony_ci struct mptsas_devinfo attached; /* point to attached device info */ 16962306a36Sopenharmony_ci struct sas_phy *phy; /* transport layer phy object */ 17062306a36Sopenharmony_ci struct mptsas_portinfo *portinfo; 17162306a36Sopenharmony_ci struct mptsas_portinfo_details * port_details; 17262306a36Sopenharmony_ci}; 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_cistruct mptsas_portinfo { 17562306a36Sopenharmony_ci struct list_head list; 17662306a36Sopenharmony_ci u16 num_phys; /* number of phys */ 17762306a36Sopenharmony_ci struct mptsas_phyinfo *phy_info; 17862306a36Sopenharmony_ci}; 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_cistruct mptsas_enclosure { 18162306a36Sopenharmony_ci u64 enclosure_logical_id; /* The WWN for the enclosure */ 18262306a36Sopenharmony_ci u16 enclosure_handle; /* unique id to address this */ 18362306a36Sopenharmony_ci u16 flags; /* details enclosure management */ 18462306a36Sopenharmony_ci u16 num_slot; /* num slots */ 18562306a36Sopenharmony_ci u16 start_slot; /* first slot */ 18662306a36Sopenharmony_ci u8 start_id; /* starting logical target id */ 18762306a36Sopenharmony_ci u8 start_channel; /* starting logical channel id */ 18862306a36Sopenharmony_ci u8 sep_id; /* SEP device logical target id */ 18962306a36Sopenharmony_ci u8 sep_channel; /* SEP channel logical channel id */ 19062306a36Sopenharmony_ci}; 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ci/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 19362306a36Sopenharmony_ci#endif 194