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