xref: /openbmc/linux/drivers/message/fusion/mptsas.h (revision 817a7c99)
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  *
8cddc0ab7SPrakash, Sathya  *  Copyright (c) 1999-2008 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;
56e7deff33SKashyap, Desai 	unsigned long	 time_count;
5756af97aeSPrakash, Sathya };
5856af97aeSPrakash, Sathya 
5956af97aeSPrakash, Sathya enum mptsas_hotplug_action {
6056af97aeSPrakash, Sathya 	MPTSAS_ADD_DEVICE,
6156af97aeSPrakash, Sathya 	MPTSAS_DEL_DEVICE,
6256af97aeSPrakash, Sathya 	MPTSAS_ADD_RAID,
6356af97aeSPrakash, Sathya 	MPTSAS_DEL_RAID,
643eb0822cSKashyap, Desai 	MPTSAS_ADD_PHYSDISK,
653eb0822cSKashyap, Desai 	MPTSAS_ADD_PHYSDISK_REPROBE,
663eb0822cSKashyap, Desai 	MPTSAS_DEL_PHYSDISK,
673eb0822cSKashyap, Desai 	MPTSAS_DEL_PHYSDISK_REPROBE,
6856af97aeSPrakash, Sathya 	MPTSAS_ADD_INACTIVE_VOLUME,
6956af97aeSPrakash, Sathya 	MPTSAS_IGNORE_EVENT,
7056af97aeSPrakash, Sathya };
7156af97aeSPrakash, Sathya 
723eb0822cSKashyap, Desai struct mptsas_mapping{
733eb0822cSKashyap, Desai 	u8			id;
743eb0822cSKashyap, Desai 	u8			channel;
753eb0822cSKashyap, Desai };
763eb0822cSKashyap, Desai 
773eb0822cSKashyap, Desai struct mptsas_device_info {
783eb0822cSKashyap, Desai 	struct list_head 	list;
793eb0822cSKashyap, Desai 	struct mptsas_mapping	os;	/* operating system mapping*/
803eb0822cSKashyap, Desai 	struct mptsas_mapping	fw;	/* firmware mapping */
813eb0822cSKashyap, Desai 	u64			sas_address;
823eb0822cSKashyap, Desai 	u32			device_info; /* specific bits for devices */
833eb0822cSKashyap, Desai 	u16			slot;		/* enclosure slot id */
843eb0822cSKashyap, Desai 	u64			enclosure_logical_id; /*enclosure address */
85a7938b0bSKashyap, Desai 	u8			is_logical_volume; /* is this logical volume */
8657e98513SKashyap, Desai 	/* this belongs to volume */
8757e98513SKashyap, Desai 	u8			is_hidden_raid_component;
8857e98513SKashyap, Desai 	/* this valid when is_hidden_raid_component set */
8957e98513SKashyap, Desai 	u8			volume_id;
9057e98513SKashyap, Desai 	/* cached data for a removed device */
9157e98513SKashyap, Desai 	u8			is_cached;
923eb0822cSKashyap, Desai };
933eb0822cSKashyap, Desai 
9456af97aeSPrakash, Sathya struct mptsas_hotplug_event {
9556af97aeSPrakash, Sathya 	MPT_ADAPTER		*ioc;
9656af97aeSPrakash, Sathya 	enum mptsas_hotplug_action event_type;
9756af97aeSPrakash, Sathya 	u64			sas_address;
9856af97aeSPrakash, Sathya 	u8			channel;
9956af97aeSPrakash, Sathya 	u8			id;
10056af97aeSPrakash, Sathya 	u32			device_info;
10156af97aeSPrakash, Sathya 	u16			handle;
10256af97aeSPrakash, Sathya 	u8			phy_id;
10356af97aeSPrakash, Sathya 	u8			phys_disk_num;		/* hrc - unique index*/
1043eb0822cSKashyap, Desai 	struct scsi_device	*sdev;
1053eb0822cSKashyap, Desai };
1063eb0822cSKashyap, Desai 
1073eb0822cSKashyap, Desai struct fw_event_work {
1083eb0822cSKashyap, Desai 	struct list_head 	list;
1093eb0822cSKashyap, Desai 	struct delayed_work	 work;
110*817a7c99SSebastian Andrzej Siewior 	int			users;
1113eb0822cSKashyap, Desai 	MPT_ADAPTER	*ioc;
1123eb0822cSKashyap, Desai 	u32			event;
1133eb0822cSKashyap, Desai 	u8			retries;
114fd6282afSGustavo A. R. Silva 	char			event_data[] __aligned(4);
11556af97aeSPrakash, Sathya };
11656af97aeSPrakash, Sathya 
11756af97aeSPrakash, Sathya struct mptsas_discovery_event {
11856af97aeSPrakash, Sathya 	struct work_struct	work;
11956af97aeSPrakash, Sathya 	MPT_ADAPTER		*ioc;
12056af97aeSPrakash, Sathya };
12156af97aeSPrakash, Sathya 
12256af97aeSPrakash, Sathya /*
12356af97aeSPrakash, Sathya  * SAS topology structures
12456af97aeSPrakash, Sathya  *
12556af97aeSPrakash, Sathya  * The MPT Fusion firmware interface spreads information about the
12656af97aeSPrakash, Sathya  * SAS topology over many manufacture pages, thus we need some data
12756af97aeSPrakash, Sathya  * structure to collect it and process it for the SAS transport class.
12856af97aeSPrakash, Sathya  */
12956af97aeSPrakash, Sathya 
13056af97aeSPrakash, Sathya struct mptsas_devinfo {
13156af97aeSPrakash, Sathya 	u16	handle;		/* unique id to address this device */
13256af97aeSPrakash, Sathya 	u16	handle_parent;	/* unique id to address parent device */
13356af97aeSPrakash, Sathya 	u16	handle_enclosure; /* enclosure identifier of the enclosure */
13456af97aeSPrakash, Sathya 	u16	slot;		/* physical slot in enclosure */
13556af97aeSPrakash, Sathya 	u8	phy_id;		/* phy number of parent device */
13656af97aeSPrakash, Sathya 	u8	port_id;	/* sas physical port this device
13756af97aeSPrakash, Sathya 				   is assoc'd with */
13856af97aeSPrakash, Sathya 	u8	id;		/* logical target id of this device */
13956af97aeSPrakash, Sathya 	u32	phys_disk_num;	/* phys disk id, for csmi-ioctls */
14056af97aeSPrakash, Sathya 	u8	channel;	/* logical bus number of this device */
14156af97aeSPrakash, Sathya 	u64	sas_address;    /* WWN of this device,
14256af97aeSPrakash, Sathya 				   SATA is assigned by HBA,expander */
14356af97aeSPrakash, Sathya 	u32	device_info;	/* bitfield detailed info about this device */
14451106ab5SKashyap, Desai 	u16	flags;		/* sas device pg0 flags */
14556af97aeSPrakash, Sathya };
14656af97aeSPrakash, Sathya 
14756af97aeSPrakash, Sathya /*
14856af97aeSPrakash, Sathya  * Specific details on ports, wide/narrow
14956af97aeSPrakash, Sathya  */
15056af97aeSPrakash, Sathya struct mptsas_portinfo_details{
15156af97aeSPrakash, Sathya 	u16	num_phys;	/* number of phys belong to this port */
15256af97aeSPrakash, Sathya 	u64	phy_bitmask; 	/* TODO, extend support for 255 phys */
15356af97aeSPrakash, Sathya 	struct sas_rphy *rphy;	/* transport layer rphy object */
15456af97aeSPrakash, Sathya 	struct sas_port *port;	/* transport layer port object */
15556af97aeSPrakash, Sathya 	struct scsi_target *starget;
15656af97aeSPrakash, Sathya 	struct mptsas_portinfo *port_info;
15756af97aeSPrakash, Sathya };
15856af97aeSPrakash, Sathya 
15956af97aeSPrakash, Sathya struct mptsas_phyinfo {
16056af97aeSPrakash, Sathya 	u16	handle;			/* unique id to address this */
16156af97aeSPrakash, Sathya 	u8	phy_id; 		/* phy index */
16256af97aeSPrakash, Sathya 	u8	port_id; 		/* firmware port identifier */
16356af97aeSPrakash, Sathya 	u8	negotiated_link_rate;	/* nego'd link rate for this phy */
16456af97aeSPrakash, Sathya 	u8	hw_link_rate; 		/* hardware max/min phys link rate */
16556af97aeSPrakash, Sathya 	u8	programmed_link_rate;	/* programmed max/min phy link rate */
16656af97aeSPrakash, Sathya 	u8	sas_port_add_phy;	/* flag to request sas_port_add_phy*/
16756af97aeSPrakash, Sathya 	struct mptsas_devinfo identify;	/* point to phy device info */
16856af97aeSPrakash, Sathya 	struct mptsas_devinfo attached;	/* point to attached device info */
16956af97aeSPrakash, Sathya 	struct sas_phy *phy;		/* transport layer phy object */
17056af97aeSPrakash, Sathya 	struct mptsas_portinfo *portinfo;
17156af97aeSPrakash, Sathya 	struct mptsas_portinfo_details * port_details;
17256af97aeSPrakash, Sathya };
17356af97aeSPrakash, Sathya 
17456af97aeSPrakash, Sathya struct mptsas_portinfo {
17556af97aeSPrakash, Sathya 	struct list_head list;
17656af97aeSPrakash, Sathya 	u16		num_phys;	/* number of phys */
17756af97aeSPrakash, Sathya 	struct mptsas_phyinfo *phy_info;
17856af97aeSPrakash, Sathya };
17956af97aeSPrakash, Sathya 
18056af97aeSPrakash, Sathya struct mptsas_enclosure {
18156af97aeSPrakash, Sathya 	u64	enclosure_logical_id;	/* The WWN for the enclosure */
18256af97aeSPrakash, Sathya 	u16	enclosure_handle;	/* unique id to address this */
18356af97aeSPrakash, Sathya 	u16	flags;			/* details enclosure management */
18456af97aeSPrakash, Sathya 	u16	num_slot;		/* num slots */
18556af97aeSPrakash, Sathya 	u16	start_slot;		/* first slot */
18656af97aeSPrakash, Sathya 	u8	start_id;		/* starting logical target id */
18756af97aeSPrakash, Sathya 	u8	start_channel;		/* starting logical channel id */
18856af97aeSPrakash, Sathya 	u8	sep_id;			/* SEP device logical target id */
18956af97aeSPrakash, Sathya 	u8	sep_channel;		/* SEP channel logical channel id */
19056af97aeSPrakash, Sathya };
19156af97aeSPrakash, Sathya 
19256af97aeSPrakash, Sathya /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
19356af97aeSPrakash, Sathya #endif
194