xref: /openbmc/linux/drivers/message/fusion/mptsas.h (revision 56af97ae)
156af97aeSPrakash, Sathya /*
256af97aeSPrakash, Sathya  *  linux/drivers/message/fusion/mptsas.h
356af97aeSPrakash, Sathya  *      High performance SCSI + LAN / Fibre Channel device drivers.
456af97aeSPrakash, Sathya  *      For use with PCI chip/adapter(s):
556af97aeSPrakash, Sathya  *          LSIFC9xx/LSI409xx Fibre Channel
656af97aeSPrakash, Sathya  *      running LSI MPT (Message Passing Technology) firmware.
756af97aeSPrakash, Sathya  *
856af97aeSPrakash, Sathya  *  Copyright (c) 1999-2007 LSI Corporation
956af97aeSPrakash, Sathya  *  (mailto:DL-MPTFusionLinux@lsi.com)
1056af97aeSPrakash, Sathya  *
1156af97aeSPrakash, Sathya  */
1256af97aeSPrakash, Sathya /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1356af97aeSPrakash, Sathya /*
1456af97aeSPrakash, Sathya     This program is free software; you can redistribute it and/or modify
1556af97aeSPrakash, Sathya     it under the terms of the GNU General Public License as published by
1656af97aeSPrakash, Sathya     the Free Software Foundation; version 2 of the License.
1756af97aeSPrakash, Sathya 
1856af97aeSPrakash, Sathya     This program is distributed in the hope that it will be useful,
1956af97aeSPrakash, Sathya     but WITHOUT ANY WARRANTY; without even the implied warranty of
2056af97aeSPrakash, Sathya     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2156af97aeSPrakash, Sathya     GNU General Public License for more details.
2256af97aeSPrakash, Sathya 
2356af97aeSPrakash, Sathya     NO WARRANTY
2456af97aeSPrakash, Sathya     THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
2556af97aeSPrakash, Sathya     CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
2656af97aeSPrakash, Sathya     LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
2756af97aeSPrakash, Sathya     MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
2856af97aeSPrakash, Sathya     solely responsible for determining the appropriateness of using and
2956af97aeSPrakash, Sathya     distributing the Program and assumes all risks associated with its
3056af97aeSPrakash, Sathya     exercise of rights under this Agreement, including but not limited to
3156af97aeSPrakash, Sathya     the risks and costs of program errors, damage to or loss of data,
3256af97aeSPrakash, Sathya     programs or equipment, and unavailability or interruption of operations.
3356af97aeSPrakash, Sathya 
3456af97aeSPrakash, Sathya     DISCLAIMER OF LIABILITY
3556af97aeSPrakash, Sathya     NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
3656af97aeSPrakash, Sathya     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3756af97aeSPrakash, Sathya     DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
3856af97aeSPrakash, Sathya     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
3956af97aeSPrakash, Sathya     TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
4056af97aeSPrakash, Sathya     USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
4156af97aeSPrakash, Sathya     HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
4256af97aeSPrakash, Sathya 
4356af97aeSPrakash, Sathya     You should have received a copy of the GNU General Public License
4456af97aeSPrakash, Sathya     along with this program; if not, write to the Free Software
4556af97aeSPrakash, Sathya     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4656af97aeSPrakash, Sathya */
4756af97aeSPrakash, Sathya 
4856af97aeSPrakash, Sathya #ifndef MPTSAS_H_INCLUDED
4956af97aeSPrakash, Sathya #define MPTSAS_H_INCLUDED
5056af97aeSPrakash, Sathya /*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5156af97aeSPrakash, Sathya 
5256af97aeSPrakash, Sathya struct mptsas_target_reset_event {
5356af97aeSPrakash, Sathya 	struct list_head 	list;
5456af97aeSPrakash, Sathya 	EVENT_DATA_SAS_DEVICE_STATUS_CHANGE sas_event_data;
5556af97aeSPrakash, Sathya 	u8	target_reset_issued;
5656af97aeSPrakash, Sathya };
5756af97aeSPrakash, Sathya 
5856af97aeSPrakash, Sathya enum mptsas_hotplug_action {
5956af97aeSPrakash, Sathya 	MPTSAS_ADD_DEVICE,
6056af97aeSPrakash, Sathya 	MPTSAS_DEL_DEVICE,
6156af97aeSPrakash, Sathya 	MPTSAS_ADD_RAID,
6256af97aeSPrakash, Sathya 	MPTSAS_DEL_RAID,
6356af97aeSPrakash, Sathya 	MPTSAS_ADD_INACTIVE_VOLUME,
6456af97aeSPrakash, Sathya 	MPTSAS_IGNORE_EVENT,
6556af97aeSPrakash, Sathya };
6656af97aeSPrakash, Sathya 
6756af97aeSPrakash, Sathya struct mptsas_hotplug_event {
6856af97aeSPrakash, Sathya 	struct work_struct	work;
6956af97aeSPrakash, Sathya 	MPT_ADAPTER		*ioc;
7056af97aeSPrakash, Sathya 	enum mptsas_hotplug_action event_type;
7156af97aeSPrakash, Sathya 	u64			sas_address;
7256af97aeSPrakash, Sathya 	u8			channel;
7356af97aeSPrakash, Sathya 	u8			id;
7456af97aeSPrakash, Sathya 	u32			device_info;
7556af97aeSPrakash, Sathya 	u16			handle;
7656af97aeSPrakash, Sathya 	u16			parent_handle;
7756af97aeSPrakash, Sathya 	u8			phy_id;
7856af97aeSPrakash, Sathya 	u8			phys_disk_num_valid;	/* hrc (hidden raid component) */
7956af97aeSPrakash, Sathya 	u8			phys_disk_num;		/* hrc - unique index*/
8056af97aeSPrakash, Sathya 	u8			hidden_raid_component;	/* hrc - don't expose*/
8156af97aeSPrakash, Sathya };
8256af97aeSPrakash, Sathya 
8356af97aeSPrakash, Sathya struct mptsas_discovery_event {
8456af97aeSPrakash, Sathya 	struct work_struct	work;
8556af97aeSPrakash, Sathya 	MPT_ADAPTER		*ioc;
8656af97aeSPrakash, Sathya };
8756af97aeSPrakash, Sathya 
8856af97aeSPrakash, Sathya /*
8956af97aeSPrakash, Sathya  * SAS topology structures
9056af97aeSPrakash, Sathya  *
9156af97aeSPrakash, Sathya  * The MPT Fusion firmware interface spreads information about the
9256af97aeSPrakash, Sathya  * SAS topology over many manufacture pages, thus we need some data
9356af97aeSPrakash, Sathya  * structure to collect it and process it for the SAS transport class.
9456af97aeSPrakash, Sathya  */
9556af97aeSPrakash, Sathya 
9656af97aeSPrakash, Sathya struct mptsas_devinfo {
9756af97aeSPrakash, Sathya 	u16	handle;		/* unique id to address this device */
9856af97aeSPrakash, Sathya 	u16	handle_parent;	/* unique id to address parent device */
9956af97aeSPrakash, Sathya 	u16	handle_enclosure; /* enclosure identifier of the enclosure */
10056af97aeSPrakash, Sathya 	u16	slot;		/* physical slot in enclosure */
10156af97aeSPrakash, Sathya 	u8	phy_id;		/* phy number of parent device */
10256af97aeSPrakash, Sathya 	u8	port_id;	/* sas physical port this device
10356af97aeSPrakash, Sathya 				   is assoc'd with */
10456af97aeSPrakash, Sathya 	u8	id;		/* logical target id of this device */
10556af97aeSPrakash, Sathya 	u32	phys_disk_num;	/* phys disk id, for csmi-ioctls */
10656af97aeSPrakash, Sathya 	u8	channel;	/* logical bus number of this device */
10756af97aeSPrakash, Sathya 	u64	sas_address;    /* WWN of this device,
10856af97aeSPrakash, Sathya 				   SATA is assigned by HBA,expander */
10956af97aeSPrakash, Sathya 	u32	device_info;	/* bitfield detailed info about this device */
11056af97aeSPrakash, Sathya };
11156af97aeSPrakash, Sathya 
11256af97aeSPrakash, Sathya /*
11356af97aeSPrakash, Sathya  * Specific details on ports, wide/narrow
11456af97aeSPrakash, Sathya  */
11556af97aeSPrakash, Sathya struct mptsas_portinfo_details{
11656af97aeSPrakash, Sathya 	u16	num_phys;	/* number of phys belong to this port */
11756af97aeSPrakash, Sathya 	u64	phy_bitmask; 	/* TODO, extend support for 255 phys */
11856af97aeSPrakash, Sathya 	struct sas_rphy *rphy;	/* transport layer rphy object */
11956af97aeSPrakash, Sathya 	struct sas_port *port;	/* transport layer port object */
12056af97aeSPrakash, Sathya 	struct scsi_target *starget;
12156af97aeSPrakash, Sathya 	struct mptsas_portinfo *port_info;
12256af97aeSPrakash, Sathya };
12356af97aeSPrakash, Sathya 
12456af97aeSPrakash, Sathya struct mptsas_phyinfo {
12556af97aeSPrakash, Sathya 	u16	handle;			/* unique id to address this */
12656af97aeSPrakash, Sathya 	u8	phy_id; 		/* phy index */
12756af97aeSPrakash, Sathya 	u8	port_id; 		/* firmware port identifier */
12856af97aeSPrakash, Sathya 	u8	negotiated_link_rate;	/* nego'd link rate for this phy */
12956af97aeSPrakash, Sathya 	u8	hw_link_rate; 		/* hardware max/min phys link rate */
13056af97aeSPrakash, Sathya 	u8	programmed_link_rate;	/* programmed max/min phy link rate */
13156af97aeSPrakash, Sathya 	u8	sas_port_add_phy;	/* flag to request sas_port_add_phy*/
13256af97aeSPrakash, Sathya 	struct mptsas_devinfo identify;	/* point to phy device info */
13356af97aeSPrakash, Sathya 	struct mptsas_devinfo attached;	/* point to attached device info */
13456af97aeSPrakash, Sathya 	struct sas_phy *phy;		/* transport layer phy object */
13556af97aeSPrakash, Sathya 	struct mptsas_portinfo *portinfo;
13656af97aeSPrakash, Sathya 	struct mptsas_portinfo_details * port_details;
13756af97aeSPrakash, Sathya };
13856af97aeSPrakash, Sathya 
13956af97aeSPrakash, Sathya struct mptsas_portinfo {
14056af97aeSPrakash, Sathya 	struct list_head list;
14156af97aeSPrakash, Sathya 	u16		num_phys;	/* number of phys */
14256af97aeSPrakash, Sathya 	struct mptsas_phyinfo *phy_info;
14356af97aeSPrakash, Sathya };
14456af97aeSPrakash, Sathya 
14556af97aeSPrakash, Sathya struct mptsas_enclosure {
14656af97aeSPrakash, Sathya 	u64	enclosure_logical_id;	/* The WWN for the enclosure */
14756af97aeSPrakash, Sathya 	u16	enclosure_handle;	/* unique id to address this */
14856af97aeSPrakash, Sathya 	u16	flags;			/* details enclosure management */
14956af97aeSPrakash, Sathya 	u16	num_slot;		/* num slots */
15056af97aeSPrakash, Sathya 	u16	start_slot;		/* first slot */
15156af97aeSPrakash, Sathya 	u8	start_id;		/* starting logical target id */
15256af97aeSPrakash, Sathya 	u8	start_channel;		/* starting logical channel id */
15356af97aeSPrakash, Sathya 	u8	sep_id;			/* SEP device logical target id */
15456af97aeSPrakash, Sathya 	u8	sep_channel;		/* SEP channel logical channel id */
15556af97aeSPrakash, Sathya };
15656af97aeSPrakash, Sathya 
15756af97aeSPrakash, Sathya /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
15856af97aeSPrakash, Sathya #endif
159