diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/s390/scsi/zfcp_ccw.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/s390/scsi/zfcp_ccw.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_ccw.c | 83 |
1 files changed, 12 insertions, 71 deletions
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index f2dd3a0a39e..e8b7cee6204 100644 --- a/drivers/s390/scsi/zfcp_ccw.c +++ b/drivers/s390/scsi/zfcp_ccw.c | |||
@@ -3,13 +3,12 @@ | |||
3 | * | 3 | * |
4 | * Registration and callback for the s390 common I/O layer. | 4 | * Registration and callback for the s390 common I/O layer. |
5 | * | 5 | * |
6 | * Copyright IBM Corp. 2002, 2010 | 6 | * Copyright IBM Corporation 2002, 2010 |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #define KMSG_COMPONENT "zfcp" | 9 | #define KMSG_COMPONENT "zfcp" |
10 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | 10 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
11 | 11 | ||
12 | #include <linux/module.h> | ||
13 | #include "zfcp_ext.h" | 12 | #include "zfcp_ext.h" |
14 | #include "zfcp_reqlist.h" | 13 | #include "zfcp_reqlist.h" |
15 | 14 | ||
@@ -39,25 +38,19 @@ void zfcp_ccw_adapter_put(struct zfcp_adapter *adapter) | |||
39 | spin_unlock_irqrestore(&zfcp_ccw_adapter_ref_lock, flags); | 38 | spin_unlock_irqrestore(&zfcp_ccw_adapter_ref_lock, flags); |
40 | } | 39 | } |
41 | 40 | ||
42 | /** | 41 | static int zfcp_ccw_activate(struct ccw_device *cdev) |
43 | * zfcp_ccw_activate - activate adapter and wait for it to finish | 42 | |
44 | * @cdev: pointer to belonging ccw device | ||
45 | * @clear: Status flags to clear. | ||
46 | * @tag: s390dbf trace record tag | ||
47 | */ | ||
48 | static int zfcp_ccw_activate(struct ccw_device *cdev, int clear, char *tag) | ||
49 | { | 43 | { |
50 | struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev); | 44 | struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev); |
51 | 45 | ||
52 | if (!adapter) | 46 | if (!adapter) |
53 | return 0; | 47 | return 0; |
54 | 48 | ||
55 | zfcp_erp_clear_adapter_status(adapter, clear); | ||
56 | zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING); | 49 | zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING); |
57 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, | 50 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, |
58 | tag); | 51 | "ccresu2"); |
59 | zfcp_erp_wait(adapter); | 52 | zfcp_erp_wait(adapter); |
60 | flush_work(&adapter->scan_work); /* ok to call even if nothing queued */ | 53 | flush_work(&adapter->scan_work); |
61 | 54 | ||
62 | zfcp_ccw_adapter_put(adapter); | 55 | zfcp_ccw_adapter_put(adapter); |
63 | 56 | ||
@@ -170,34 +163,26 @@ static int zfcp_ccw_set_online(struct ccw_device *cdev) | |||
170 | BUG_ON(!zfcp_reqlist_isempty(adapter->req_list)); | 163 | BUG_ON(!zfcp_reqlist_isempty(adapter->req_list)); |
171 | adapter->req_no = 0; | 164 | adapter->req_no = 0; |
172 | 165 | ||
173 | zfcp_ccw_activate(cdev, 0, "ccsonl1"); | 166 | zfcp_ccw_activate(cdev); |
174 | /* scan for remote ports | ||
175 | either at the end of any successful adapter recovery | ||
176 | or only after the adapter recovery for setting a device online */ | ||
177 | zfcp_fc_inverse_conditional_port_scan(adapter); | ||
178 | flush_work(&adapter->scan_work); /* ok to call even if nothing queued */ | ||
179 | zfcp_ccw_adapter_put(adapter); | 167 | zfcp_ccw_adapter_put(adapter); |
180 | return 0; | 168 | return 0; |
181 | } | 169 | } |
182 | 170 | ||
183 | /** | 171 | /** |
184 | * zfcp_ccw_offline_sync - shut down adapter and wait for it to finish | 172 | * zfcp_ccw_set_offline - set_offline function of zfcp driver |
185 | * @cdev: pointer to belonging ccw device | 173 | * @cdev: pointer to belonging ccw device |
186 | * @set: Status flags to set. | ||
187 | * @tag: s390dbf trace record tag | ||
188 | * | 174 | * |
189 | * This function gets called by the common i/o layer and sets an adapter | 175 | * This function gets called by the common i/o layer and sets an adapter |
190 | * into state offline. | 176 | * into state offline. |
191 | */ | 177 | */ |
192 | static int zfcp_ccw_offline_sync(struct ccw_device *cdev, int set, char *tag) | 178 | static int zfcp_ccw_set_offline(struct ccw_device *cdev) |
193 | { | 179 | { |
194 | struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev); | 180 | struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev); |
195 | 181 | ||
196 | if (!adapter) | 182 | if (!adapter) |
197 | return 0; | 183 | return 0; |
198 | 184 | ||
199 | zfcp_erp_set_adapter_status(adapter, set); | 185 | zfcp_erp_adapter_shutdown(adapter, 0, "ccsoff1"); |
200 | zfcp_erp_adapter_shutdown(adapter, 0, tag); | ||
201 | zfcp_erp_wait(adapter); | 186 | zfcp_erp_wait(adapter); |
202 | 187 | ||
203 | zfcp_ccw_adapter_put(adapter); | 188 | zfcp_ccw_adapter_put(adapter); |
@@ -205,18 +190,6 @@ static int zfcp_ccw_offline_sync(struct ccw_device *cdev, int set, char *tag) | |||
205 | } | 190 | } |
206 | 191 | ||
207 | /** | 192 | /** |
208 | * zfcp_ccw_set_offline - set_offline function of zfcp driver | ||
209 | * @cdev: pointer to belonging ccw device | ||
210 | * | ||
211 | * This function gets called by the common i/o layer and sets an adapter | ||
212 | * into state offline. | ||
213 | */ | ||
214 | static int zfcp_ccw_set_offline(struct ccw_device *cdev) | ||
215 | { | ||
216 | return zfcp_ccw_offline_sync(cdev, 0, "ccsoff1"); | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * zfcp_ccw_notify - ccw notify function | 193 | * zfcp_ccw_notify - ccw notify function |
221 | * @cdev: pointer to belonging ccw device | 194 | * @cdev: pointer to belonging ccw device |
222 | * @event: indicates if adapter was detached or attached | 195 | * @event: indicates if adapter was detached or attached |
@@ -233,11 +206,6 @@ static int zfcp_ccw_notify(struct ccw_device *cdev, int event) | |||
233 | 206 | ||
234 | switch (event) { | 207 | switch (event) { |
235 | case CIO_GONE: | 208 | case CIO_GONE: |
236 | if (atomic_read(&adapter->status) & | ||
237 | ZFCP_STATUS_ADAPTER_SUSPENDED) { /* notification ignore */ | ||
238 | zfcp_dbf_hba_basic("ccnigo1", adapter); | ||
239 | break; | ||
240 | } | ||
241 | dev_warn(&cdev->dev, "The FCP device has been detached\n"); | 209 | dev_warn(&cdev->dev, "The FCP device has been detached\n"); |
242 | zfcp_erp_adapter_shutdown(adapter, 0, "ccnoti1"); | 210 | zfcp_erp_adapter_shutdown(adapter, 0, "ccnoti1"); |
243 | break; | 211 | break; |
@@ -247,11 +215,6 @@ static int zfcp_ccw_notify(struct ccw_device *cdev, int event) | |||
247 | zfcp_erp_adapter_shutdown(adapter, 0, "ccnoti2"); | 215 | zfcp_erp_adapter_shutdown(adapter, 0, "ccnoti2"); |
248 | break; | 216 | break; |
249 | case CIO_OPER: | 217 | case CIO_OPER: |
250 | if (atomic_read(&adapter->status) & | ||
251 | ZFCP_STATUS_ADAPTER_SUSPENDED) { /* notification ignore */ | ||
252 | zfcp_dbf_hba_basic("ccniop1", adapter); | ||
253 | break; | ||
254 | } | ||
255 | dev_info(&cdev->dev, "The FCP device is operational again\n"); | 218 | dev_info(&cdev->dev, "The FCP device is operational again\n"); |
256 | zfcp_erp_set_adapter_status(adapter, | 219 | zfcp_erp_set_adapter_status(adapter, |
257 | ZFCP_STATUS_COMMON_RUNNING); | 220 | ZFCP_STATUS_COMMON_RUNNING); |
@@ -287,28 +250,6 @@ static void zfcp_ccw_shutdown(struct ccw_device *cdev) | |||
287 | zfcp_ccw_adapter_put(adapter); | 250 | zfcp_ccw_adapter_put(adapter); |
288 | } | 251 | } |
289 | 252 | ||
290 | static int zfcp_ccw_suspend(struct ccw_device *cdev) | ||
291 | { | ||
292 | zfcp_ccw_offline_sync(cdev, ZFCP_STATUS_ADAPTER_SUSPENDED, "ccsusp1"); | ||
293 | return 0; | ||
294 | } | ||
295 | |||
296 | static int zfcp_ccw_thaw(struct ccw_device *cdev) | ||
297 | { | ||
298 | /* trace records for thaw and final shutdown during suspend | ||
299 | can only be found in system dump until the end of suspend | ||
300 | but not after resume because it's based on the memory image | ||
301 | right after the very first suspend (freeze) callback */ | ||
302 | zfcp_ccw_activate(cdev, 0, "ccthaw1"); | ||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | static int zfcp_ccw_resume(struct ccw_device *cdev) | ||
307 | { | ||
308 | zfcp_ccw_activate(cdev, ZFCP_STATUS_ADAPTER_SUSPENDED, "ccresu1"); | ||
309 | return 0; | ||
310 | } | ||
311 | |||
312 | struct ccw_driver zfcp_ccw_driver = { | 253 | struct ccw_driver zfcp_ccw_driver = { |
313 | .driver = { | 254 | .driver = { |
314 | .owner = THIS_MODULE, | 255 | .owner = THIS_MODULE, |
@@ -321,7 +262,7 @@ struct ccw_driver zfcp_ccw_driver = { | |||
321 | .set_offline = zfcp_ccw_set_offline, | 262 | .set_offline = zfcp_ccw_set_offline, |
322 | .notify = zfcp_ccw_notify, | 263 | .notify = zfcp_ccw_notify, |
323 | .shutdown = zfcp_ccw_shutdown, | 264 | .shutdown = zfcp_ccw_shutdown, |
324 | .freeze = zfcp_ccw_suspend, | 265 | .freeze = zfcp_ccw_set_offline, |
325 | .thaw = zfcp_ccw_thaw, | 266 | .thaw = zfcp_ccw_activate, |
326 | .restore = zfcp_ccw_resume, | 267 | .restore = zfcp_ccw_activate, |
327 | }; | 268 | }; |