diff options
-rw-r--r-- | drivers/message/fusion/mptsas.c | 106 | ||||
-rw-r--r-- | drivers/message/fusion/mptsas.h | 158 |
2 files changed, 159 insertions, 105 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index ffbf0e59200e..5951fe02ed4c 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -61,6 +61,7 @@ | |||
61 | 61 | ||
62 | #include "mptbase.h" | 62 | #include "mptbase.h" |
63 | #include "mptscsih.h" | 63 | #include "mptscsih.h" |
64 | #include "mptsas.h" | ||
64 | 65 | ||
65 | 66 | ||
66 | #define my_NAME "Fusion MPT SAS Host driver" | 67 | #define my_NAME "Fusion MPT SAS Host driver" |
@@ -96,111 +97,6 @@ static u8 mptsasMgmtCtx = MPT_MAX_PROTOCOL_DRIVERS; | |||
96 | 97 | ||
97 | static void mptsas_hotplug_work(struct work_struct *work); | 98 | static void mptsas_hotplug_work(struct work_struct *work); |
98 | 99 | ||
99 | struct mptsas_target_reset_event { | ||
100 | struct list_head list; | ||
101 | EVENT_DATA_SAS_DEVICE_STATUS_CHANGE sas_event_data; | ||
102 | u8 target_reset_issued; | ||
103 | }; | ||
104 | |||
105 | enum mptsas_hotplug_action { | ||
106 | MPTSAS_ADD_DEVICE, | ||
107 | MPTSAS_DEL_DEVICE, | ||
108 | MPTSAS_ADD_RAID, | ||
109 | MPTSAS_DEL_RAID, | ||
110 | MPTSAS_ADD_INACTIVE_VOLUME, | ||
111 | MPTSAS_IGNORE_EVENT, | ||
112 | }; | ||
113 | |||
114 | struct mptsas_hotplug_event { | ||
115 | struct work_struct work; | ||
116 | MPT_ADAPTER *ioc; | ||
117 | enum mptsas_hotplug_action event_type; | ||
118 | u64 sas_address; | ||
119 | u8 channel; | ||
120 | u8 id; | ||
121 | u32 device_info; | ||
122 | u16 handle; | ||
123 | u16 parent_handle; | ||
124 | u8 phy_id; | ||
125 | u8 phys_disk_num_valid; /* hrc (hidden raid component) */ | ||
126 | u8 phys_disk_num; /* hrc - unique index*/ | ||
127 | u8 hidden_raid_component; /* hrc - don't expose*/ | ||
128 | }; | ||
129 | |||
130 | struct mptsas_discovery_event { | ||
131 | struct work_struct work; | ||
132 | MPT_ADAPTER *ioc; | ||
133 | }; | ||
134 | |||
135 | /* | ||
136 | * SAS topology structures | ||
137 | * | ||
138 | * The MPT Fusion firmware interface spreads information about the | ||
139 | * SAS topology over many manufacture pages, thus we need some data | ||
140 | * structure to collect it and process it for the SAS transport class. | ||
141 | */ | ||
142 | |||
143 | struct mptsas_devinfo { | ||
144 | u16 handle; /* unique id to address this device */ | ||
145 | u16 handle_parent; /* unique id to address parent device */ | ||
146 | u16 handle_enclosure; /* enclosure identifier of the enclosure */ | ||
147 | u16 slot; /* physical slot in enclosure */ | ||
148 | u8 phy_id; /* phy number of parent device */ | ||
149 | u8 port_id; /* sas physical port this device | ||
150 | is assoc'd with */ | ||
151 | u8 id; /* logical target id of this device */ | ||
152 | u32 phys_disk_num; /* phys disk id, for csmi-ioctls */ | ||
153 | u8 channel; /* logical bus number of this device */ | ||
154 | u64 sas_address; /* WWN of this device, | ||
155 | SATA is assigned by HBA,expander */ | ||
156 | u32 device_info; /* bitfield detailed info about this device */ | ||
157 | }; | ||
158 | |||
159 | /* | ||
160 | * Specific details on ports, wide/narrow | ||
161 | */ | ||
162 | struct mptsas_portinfo_details{ | ||
163 | u16 num_phys; /* number of phys belong to this port */ | ||
164 | u64 phy_bitmask; /* TODO, extend support for 255 phys */ | ||
165 | struct sas_rphy *rphy; /* transport layer rphy object */ | ||
166 | struct sas_port *port; /* transport layer port object */ | ||
167 | struct scsi_target *starget; | ||
168 | struct mptsas_portinfo *port_info; | ||
169 | }; | ||
170 | |||
171 | struct mptsas_phyinfo { | ||
172 | u16 handle; /* unique id to address this */ | ||
173 | u8 phy_id; /* phy index */ | ||
174 | u8 port_id; /* firmware port identifier */ | ||
175 | u8 negotiated_link_rate; /* nego'd link rate for this phy */ | ||
176 | u8 hw_link_rate; /* hardware max/min phys link rate */ | ||
177 | u8 programmed_link_rate; /* programmed max/min phy link rate */ | ||
178 | u8 sas_port_add_phy; /* flag to request sas_port_add_phy*/ | ||
179 | struct mptsas_devinfo identify; /* point to phy device info */ | ||
180 | struct mptsas_devinfo attached; /* point to attached device info */ | ||
181 | struct sas_phy *phy; /* transport layer phy object */ | ||
182 | struct mptsas_portinfo *portinfo; | ||
183 | struct mptsas_portinfo_details * port_details; | ||
184 | }; | ||
185 | |||
186 | struct mptsas_portinfo { | ||
187 | struct list_head list; | ||
188 | u16 num_phys; /* number of phys */ | ||
189 | struct mptsas_phyinfo *phy_info; | ||
190 | }; | ||
191 | |||
192 | struct mptsas_enclosure { | ||
193 | u64 enclosure_logical_id; /* The WWN for the enclosure */ | ||
194 | u16 enclosure_handle; /* unique id to address this */ | ||
195 | u16 flags; /* details enclosure management */ | ||
196 | u16 num_slot; /* num slots */ | ||
197 | u16 start_slot; /* first slot */ | ||
198 | u8 start_id; /* starting logical target id */ | ||
199 | u8 start_channel; /* starting logical channel id */ | ||
200 | u8 sep_id; /* SEP device logical target id */ | ||
201 | u8 sep_channel; /* SEP channel logical channel id */ | ||
202 | }; | ||
203 | |||
204 | static void mptsas_print_phy_data(MPT_ADAPTER *ioc, | 100 | static void mptsas_print_phy_data(MPT_ADAPTER *ioc, |
205 | MPI_SAS_IO_UNIT0_PHY_DATA *phy_data) | 101 | MPI_SAS_IO_UNIT0_PHY_DATA *phy_data) |
206 | { | 102 | { |
diff --git a/drivers/message/fusion/mptsas.h b/drivers/message/fusion/mptsas.h new file mode 100644 index 000000000000..7c150f50629a --- /dev/null +++ b/drivers/message/fusion/mptsas.h | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
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 | * | ||
8 | * Copyright (c) 1999-2007 LSI Corporation | ||
9 | * (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 | |||
52 | struct mptsas_target_reset_event { | ||
53 | struct list_head list; | ||
54 | EVENT_DATA_SAS_DEVICE_STATUS_CHANGE sas_event_data; | ||
55 | u8 target_reset_issued; | ||
56 | }; | ||
57 | |||
58 | enum mptsas_hotplug_action { | ||
59 | MPTSAS_ADD_DEVICE, | ||
60 | MPTSAS_DEL_DEVICE, | ||
61 | MPTSAS_ADD_RAID, | ||
62 | MPTSAS_DEL_RAID, | ||
63 | MPTSAS_ADD_INACTIVE_VOLUME, | ||
64 | MPTSAS_IGNORE_EVENT, | ||
65 | }; | ||
66 | |||
67 | struct mptsas_hotplug_event { | ||
68 | struct work_struct work; | ||
69 | MPT_ADAPTER *ioc; | ||
70 | enum mptsas_hotplug_action event_type; | ||
71 | u64 sas_address; | ||
72 | u8 channel; | ||
73 | u8 id; | ||
74 | u32 device_info; | ||
75 | u16 handle; | ||
76 | u16 parent_handle; | ||
77 | u8 phy_id; | ||
78 | u8 phys_disk_num_valid; /* hrc (hidden raid component) */ | ||
79 | u8 phys_disk_num; /* hrc - unique index*/ | ||
80 | u8 hidden_raid_component; /* hrc - don't expose*/ | ||
81 | }; | ||
82 | |||
83 | struct mptsas_discovery_event { | ||
84 | struct work_struct work; | ||
85 | MPT_ADAPTER *ioc; | ||
86 | }; | ||
87 | |||
88 | /* | ||
89 | * SAS topology structures | ||
90 | * | ||
91 | * The MPT Fusion firmware interface spreads information about the | ||
92 | * SAS topology over many manufacture pages, thus we need some data | ||
93 | * structure to collect it and process it for the SAS transport class. | ||
94 | */ | ||
95 | |||
96 | struct mptsas_devinfo { | ||
97 | u16 handle; /* unique id to address this device */ | ||
98 | u16 handle_parent; /* unique id to address parent device */ | ||
99 | u16 handle_enclosure; /* enclosure identifier of the enclosure */ | ||
100 | u16 slot; /* physical slot in enclosure */ | ||
101 | u8 phy_id; /* phy number of parent device */ | ||
102 | u8 port_id; /* sas physical port this device | ||
103 | is assoc'd with */ | ||
104 | u8 id; /* logical target id of this device */ | ||
105 | u32 phys_disk_num; /* phys disk id, for csmi-ioctls */ | ||
106 | u8 channel; /* logical bus number of this device */ | ||
107 | u64 sas_address; /* WWN of this device, | ||
108 | SATA is assigned by HBA,expander */ | ||
109 | u32 device_info; /* bitfield detailed info about this device */ | ||
110 | }; | ||
111 | |||
112 | /* | ||
113 | * Specific details on ports, wide/narrow | ||
114 | */ | ||
115 | struct mptsas_portinfo_details{ | ||
116 | u16 num_phys; /* number of phys belong to this port */ | ||
117 | u64 phy_bitmask; /* TODO, extend support for 255 phys */ | ||
118 | struct sas_rphy *rphy; /* transport layer rphy object */ | ||
119 | struct sas_port *port; /* transport layer port object */ | ||
120 | struct scsi_target *starget; | ||
121 | struct mptsas_portinfo *port_info; | ||
122 | }; | ||
123 | |||
124 | struct mptsas_phyinfo { | ||
125 | u16 handle; /* unique id to address this */ | ||
126 | u8 phy_id; /* phy index */ | ||
127 | u8 port_id; /* firmware port identifier */ | ||
128 | u8 negotiated_link_rate; /* nego'd link rate for this phy */ | ||
129 | u8 hw_link_rate; /* hardware max/min phys link rate */ | ||
130 | u8 programmed_link_rate; /* programmed max/min phy link rate */ | ||
131 | u8 sas_port_add_phy; /* flag to request sas_port_add_phy*/ | ||
132 | struct mptsas_devinfo identify; /* point to phy device info */ | ||
133 | struct mptsas_devinfo attached; /* point to attached device info */ | ||
134 | struct sas_phy *phy; /* transport layer phy object */ | ||
135 | struct mptsas_portinfo *portinfo; | ||
136 | struct mptsas_portinfo_details * port_details; | ||
137 | }; | ||
138 | |||
139 | struct mptsas_portinfo { | ||
140 | struct list_head list; | ||
141 | u16 num_phys; /* number of phys */ | ||
142 | struct mptsas_phyinfo *phy_info; | ||
143 | }; | ||
144 | |||
145 | struct mptsas_enclosure { | ||
146 | u64 enclosure_logical_id; /* The WWN for the enclosure */ | ||
147 | u16 enclosure_handle; /* unique id to address this */ | ||
148 | u16 flags; /* details enclosure management */ | ||
149 | u16 num_slot; /* num slots */ | ||
150 | u16 start_slot; /* first slot */ | ||
151 | u8 start_id; /* starting logical target id */ | ||
152 | u8 start_channel; /* starting logical channel id */ | ||
153 | u8 sep_id; /* SEP device logical target id */ | ||
154 | u8 sep_channel; /* SEP channel logical channel id */ | ||
155 | }; | ||
156 | |||
157 | /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
158 | #endif | ||