~ubuntu-branches/ubuntu/hoary/s390-tools/hoary

« back to all changes in this revision

Viewing changes to zfcpdump/kernel/patches/linux-2.4.19-s390-3-may2002.diff

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2004-06-27 18:45:15 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040627184515-q7lnvli1j94gr6dv
Tags: upstream-1.3.1
ImportĀ upstreamĀ versionĀ 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -ruN linux-2.4.19/drivers/s390/block/dasd.c linux-2.3/drivers/s390/block/dasd.c
 
2
--- linux-2.4.19/drivers/s390/block/dasd.c      Wed Jan 29 20:13:56 2003
 
3
+++ linux-2.3/drivers/s390/block/dasd.c Wed Jan 22 13:23:31 2003
 
4
@@ -6,7 +6,7 @@
 
5
  * Bugreports.to..: <Linux390@de.ibm.com>
 
6
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
 
7
  *
 
8
- * $Revision: 1.234.2.32 $
 
9
+ * $Revision: 1.234.2.35 $
 
10
  *
 
11
  * History of changes (starts July 2000)
 
12
  * 11/09/00 complete redesign after code review
 
13
@@ -107,6 +107,7 @@
 
14
 EXPORT_SYMBOL (dasd_start_IO);
 
15
 EXPORT_SYMBOL (dasd_term_IO);
 
16
 EXPORT_SYMBOL (dasd_schedule_bh);
 
17
+EXPORT_SYMBOL (dasd_schedule_bh_timed);
 
18
 EXPORT_SYMBOL (dasd_int_handler);
 
19
 EXPORT_SYMBOL (dasd_oper_handler);
 
20
 EXPORT_SYMBOL (dasd_alloc_request);
 
21
@@ -132,8 +132,6 @@
 
22
 #undef DASD_PROFILE             /* without procfs                      */
 
23
 #endif /* not CONFIG_PROC_FS */
 
24
 
 
25
-#define DASD_MIN_SIZE_FOR_QUEUE 32
 
26
-#undef CONFIG_DYNAMIC_QUEUE_MIN_SIZE
 
27
 #define DASD_CHANQ_MAX_SIZE 6
 
28
 
 
29
 /********************************************************************************
 
30
@@ -1230,7 +1228,15 @@
 
31
             cplength * sizeof (ccw1_t) + datasize) > PAGE_SIZE) {
 
32
                BUG ();
 
33
                }
 
34
-        if (device->lowmem_cqr==NULL) {
 
35
+
 
36
+        /* use emergency request only for ERP or if it is the only request on queue */
 
37
+        if ((device->lowmem_cqr==NULL) &&
 
38
+            (device->queue.head == NULL ||
 
39
+             device->queue.head->status == CQR_STATUS_ERROR)) {
 
40
+
 
41
+                DEV_MESSAGE (KERN_DEBUG, device,
 
42
+                             "Low memory! Using emergency request %p.",
 
43
+                             device->lowmem_ccws);
 
44
 
 
45
                 DBF_EVENT (DBF_CRIT,
 
46
                            "(%04x) Low memory! Using emergency request %p.",
 
47
@@ -1248,6 +1254,11 @@
 
48
                rv->cpaddr = (ccw1_t *) ((long) rv + sizeof (ccw_req_t));
 
49
         } else {
 
50
 
 
51
+                DEV_MESSAGE (KERN_DEBUG, device,
 
52
+                             "Refusing emergency mem for request "
 
53
+                             "(already in use at %p)?",
 
54
+                             device->lowmem_ccws);
 
55
+
 
56
                 DBF_EVENT (DBF_CRIT,
 
57
                            "(%04x) Refusing emergency mem for request "
 
58
                            "NULL, already in use at %p.",
 
59
@@ -1323,6 +1334,18 @@
 
60
 
 
61
                 return -ENOMEM;
 
62
         }
 
63
+
 
64
+       if ((device->queue.head != NULL) && 
 
65
+            (device->queue.head->status != CQR_STATUS_ERROR) && 
 
66
+            (device->lowmem_cqr!=request)) {
 
67
+               DBF_DEV_EVENT (DBF_WARNING, device,
 
68
+                               "Refusing emergency idals for request %p "
 
69
+                               "because other requests are running & no ERP "
 
70
+                               "in progress",
 
71
+                               request);
 
72
+               return -ENOMEM;
 
73
+       }
 
74
+
 
75
         device->lowmem_cqr=request;
 
76
         if (device->lowmem_idal_ptr == device->lowmem_idals) {
 
77
 
 
78
@@ -1899,7 +1922,6 @@
 
79
        dasd_chanq_t *qp = &device->queue;
 
80
        int irq = device->devinfo.irq;
 
81
        ccw_req_t *final_requests = NULL;
 
82
-       static int chanq_min_size = DASD_MIN_SIZE_FOR_QUEUE;
 
83
        int chanq_max_size = DASD_CHANQ_MAX_SIZE;
 
84
        ccw_req_t *cqr = NULL, *temp;
 
85
        dasd_erp_postaction_fn_t erp_postaction;
 
86
@@ -1928,7 +1950,8 @@
 
87
 
 
88
                                 qp->head->stopclk = get_clock ();
 
89
 
 
90
-                        } else if ((device->discipline->erp_action == NULL                          ) ||
 
91
+                        } else if (((qp->head->dstat->flag & DEVSTAT_FLAG_SENSE_AVAIL) == 0         ) ||
 
92
+                                   (device->discipline->erp_action == NULL                          ) ||
 
93
                                    ((erp_action = device->discipline->erp_action (qp->head)) == NULL)   ) {
 
94
                                 
 
95
                                erp_cqr = dasd_default_erp_action (qp->head);
 
96
@@ -1947,7 +1970,7 @@
 
97
                                                "ERP successful");
 
98
                        } else {
 
99
 
 
100
-                                DEV_MESSAGE (KERN_ERR, device, "%s",
 
101
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
 
102
                                              "ERP unsuccessful");
 
103
                        }
 
104
 
 
105
@@ -1992,52 +2015,42 @@
 
106
                (queue) &&
 
107
                (!queue->plugged) &&
 
108
               (!list_empty (&queue->queue_head)) &&
 
109
-              (req = dasd_next_request (queue)) != NULL) {
 
110
+              (req = dasd_next_request (queue)) &&
 
111
+               (qp->head == NULL || chanq_max_size > 0)) {
 
112
                /* queue empty or certain critera fulfilled -> transfer */
 
113
-               if (qp->head == NULL ||
 
114
-                   chanq_max_size > 0 || (req->nr_sectors >= chanq_min_size)) {
 
115
-                       ccw_req_t *cqr = NULL;
 
116
-                        if (is_read_only(device->kdev) && req->cmd == WRITE) {
 
117
-
 
118
-                                DBF_EVENT (DBF_ERR,
 
119
-                                           "(%04x) Rejecting write request %p",
 
120
-                                           device->devinfo.devno,
 
121
-                                           req);
 
122
+                ccw_req_t *cqr = NULL;
 
123
+                if (is_read_only(device->kdev) && req->cmd == WRITE) {
 
124
 
 
125
-                                dasd_end_request (req, 0);
 
126
-                                dasd_dequeue_request (queue,req);
 
127
-                        } else {
 
128
-                            /* relocate request according to partition table */
 
129
-                            req->sector +=
 
130
-                                device->major_info->gendisk.
 
131
-                                part[MINOR (req->rq_dev)].start_sect;
 
132
-                            cqr = device->discipline->build_cp_from_req (device, req);
 
133
-                            if (cqr == NULL) {
 
134
-
 
135
-                                    DBF_EVENT (DBF_ERR,
 
136
-                                               "(%04x) CCW creation failed "
 
137
-                                               "on request %p",
 
138
-                                               device->devinfo.devno,
 
139
-                                               req);
 
140
-
 
141
-                                    /* revert relocation of request */
 
142
-                                    req->sector -=
 
143
-                                        device->major_info->gendisk.
 
144
-                                        part[MINOR (req->rq_dev)].start_sect;
 
145
-                                    break;     /* terminate request queue loop */
 
146
-                                    
 
147
-                            }
 
148
-#ifdef CONFIG_DYNAMIC_QUEUE_MIN_SIZE
 
149
-                            chanq_min_size =
 
150
-                                (chanq_min_size + req->nr_sectors) >> 1;
 
151
-#endif                         /* CONFIG_DYNAMIC_QUEUE_MIN_SIZE */
 
152
-                            dasd_dequeue_request (queue, req);
 
153
-                            dasd_chanq_enq (qp, cqr);
 
154
+
 
155
+                        DBF_EVENT (DBF_ERR,
 
156
+                                   "(%04x) Rejecting write request %p",
 
157
+                                   device->devinfo.devno,
 
158
+                                   req);
 
159
+                        dasd_dequeue_request (queue,req);
 
160
+                        dasd_end_request (req, 0);
 
161
+                        continue;
 
162
+                } 
 
163
+                cqr = device->discipline->build_cp_from_req (device, req);
 
164
+                        
 
165
+                if (cqr == NULL || IS_ERR(cqr)) {
 
166
+                        if (cqr == ERR_PTR(-ENOMEM)) {
 
167
+                                break;
 
168
                         }
 
169
-               } else {        /* queue not empty OR criteria not met */
 
170
-                       break;  /* terminate request queue loop */
 
171
-               }
 
172
+
 
173
+                        MESSAGE (KERN_EMERG,
 
174
+                                 "(%04x) CCW creation failed "
 
175
+                                 "on request %p",
 
176
+                                 device->devinfo.devno, req);
 
177
+                        dasd_dequeue_request (queue,req);
 
178
+                        dasd_end_request (req, 0);
 
179
+                        continue;
 
180
+                }
 
181
+
 
182
+                dasd_dequeue_request (queue, req);
 
183
+                dasd_chanq_enq (qp, cqr);
 
184
+                chanq_max_size--;
 
185
        }
 
186
+
 
187
        /* we process the requests with non-final status */
 
188
        if (qp->head) {
 
189
                switch (qp->head->status) {
 
190
@@ -2164,9 +2177,9 @@
 
191
 
 
192
        if (cqr == NULL) {
 
193
                MESSAGE (KERN_DEBUG,
 
194
-                               "got state change pending interrupt on"
 
195
-                               "an idle device: devno%04x",
 
196
-                               stat->devno);
 
197
+                         "got state change pending interrupt on"
 
198
+                         " idle device: devno%04x",
 
199
+                         stat->devno);
 
200
                return;
 
201
        }
 
202
         
 
203
@@ -2180,11 +2193,16 @@
 
204
                 
 
205
                 check_then_set (&cqr->status,
 
206
                                 CQR_STATUS_PENDING, CQR_STATUS_QUEUED);
 
207
-                
 
208
-                dasd_schedule_bh (*device_addr);
 
209
-                
 
210
+       }
 
211
+       if (cqr->status == CQR_STATUS_IN_IO) {
 
212
+               cqr->status = CQR_STATUS_QUEUED;
 
213
+               DEV_MESSAGE (KERN_WARNING, (*device_addr), "%s",
 
214
+                             "redriving state change pending condition w"
 
215
+                             "hile in IO");
 
216
         }
 
217
 
 
218
+        dasd_schedule_bh (*device_addr);
 
219
+
 
220
 } /* end dasd_handle_state_change_pending */
 
221
 
 
222
 /*
 
223
@@ -2274,20 +2292,43 @@
 
224
                        ((stat->cstat<<8)|stat->dstat));
 
225
 
 
226
        /* first of all lets try to find out the appropriate era_action */
 
227
-       if (stat->flag & DEVSTAT_FLAG_SENSE_AVAIL ||
 
228
-           stat->dstat & ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) {
 
229
-               /* anything abnormal ? */
 
230
-               if (device->discipline->examine_error == NULL ||
 
231
-                   stat->flag & DEVSTAT_HALT_FUNCTION) {
 
232
-                       era = dasd_era_fatal;
 
233
+        if (stat->flag & DEVSTAT_HALT_FUNCTION) {
 
234
+                era = dasd_era_fatal;
 
235
+        } else if ( stat->flag & DEVSTAT_FLAG_SENSE_AVAIL ) {
 
236
+               if (cqr->dstat == NULL)
 
237
+                       cqr->dstat = kmalloc (sizeof (devstat_t), GFP_ATOMIC);
 
238
+               if (cqr->dstat) {
 
239
+                       memcpy (cqr->dstat, stat, sizeof (devstat_t));
 
240
                } else {
 
241
-                       era = device->discipline->examine_error (cqr, stat);
 
242
+                       MESSAGE (KERN_DEBUG, "%s",
 
243
+                                 "no memory for dstat...ignoring");
 
244
                }
 
245
 
 
246
-                DBF_EVENT (DBF_NOTICE,
 
247
-                           "era_code %d",
 
248
-                           era);
 
249
-       }
 
250
+#ifdef ERP_DEBUG
 
251
+               if (device->discipline            &&
 
252
+                    device->discipline->dump_sense  ) {
 
253
+                        
 
254
+                        device->discipline->dump_sense (device, 
 
255
+                                                        cqr);
 
256
+               }
 
257
+#endif
 
258
+                if (device->discipline->examine_error == NULL) {
 
259
+                        era = dasd_era_recover;
 
260
+                } else {
 
261
+                        era = device->discipline->examine_error (cqr, stat);
 
262
+                }
 
263
+        } else if (stat->dstat & ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END) ||
 
264
+                   stat->cstat & ~(SCHN_STAT_PCI | SCHN_STAT_INCORR_LEN) ) {
 
265
+                /* received IFCC or DATA_CHECK or ..... */
 
266
+                DEV_MESSAGE (KERN_DEBUG, device,
 
267
+                             "Status without sense (IFCC,...) CS/DS %04x flag %08x",
 
268
+                            ((stat->cstat<<8)|stat->dstat),
 
269
+                            stat->flag);
 
270
+                era = dasd_era_recover;
 
271
+        } else {
 
272
+                era = dasd_era_none;
 
273
+        }
 
274
+        
 
275
         if ( era == dasd_era_none ) {
 
276
                 check_then_set(&cqr->status, 
 
277
                                CQR_STATUS_IN_IO, 
 
278
@@ -2304,25 +2345,6 @@
 
279
                         } 
 
280
                 }
 
281
         } else { /* error */
 
282
-               if (cqr->dstat == NULL)
 
283
-                       cqr->dstat = kmalloc (sizeof (devstat_t), GFP_ATOMIC);
 
284
-               if (cqr->dstat) {
 
285
-                       memcpy (cqr->dstat, stat, sizeof (devstat_t));
 
286
-               } else {
 
287
-
 
288
-                       MESSAGE (KERN_ERR, "%s",
 
289
-                                 "no memory for dstat...ignoring");
 
290
-               }
 
291
-
 
292
-#ifdef ERP_DEBUG
 
293
-               /* dump sense data */
 
294
-               if (device->discipline            && 
 
295
-                    device->discipline->dump_sense  ) {
 
296
-
 
297
-                        device->discipline->dump_sense (device, 
 
298
-                                                        cqr);
 
299
-               }
 
300
-#endif
 
301
 
 
302
                switch (era) {
 
303
                case dasd_era_fatal:
 
304
@@ -2360,53 +2382,40 @@
 
305
  * DEFAULT_ERP_ACTION
 
306
  *
 
307
  * DESCRIPTION
 
308
- *   sets up the default-ERP ccw_req_t, namely one, which performs a TIC
 
309
- *   to the original channel program with a retry counter of 16
 
310
+ *   just retries the current cqr
 
311
  *
 
312
  * PARAMETER
 
313
  *   cqr                failed CQR
 
314
  *
 
315
  * RETURN VALUES
 
316
- *   erp                CQR performing the ERP
 
317
+ *   cqr                modified CQR
 
318
  */
 
319
 ccw_req_t *
 
320
 dasd_default_erp_action (ccw_req_t * cqr)
 
321
 {
 
322
 
 
323
         dasd_device_t *device = cqr->device;
 
324
-       ccw_req_t     *erp    = dasd_alloc_request ((char *) &cqr->magic, 1, 0, cqr->device);
 
325
-
 
326
-       MESSAGE (KERN_DEBUG, "%s",
 
327
-                 "Default ERP called... ");
 
328
-
 
329
-       if (!erp) {
 
330
 
 
331
-                DEV_MESSAGE (KERN_ERR, device, "%s",
 
332
-                             "Unable to allocate request for default ERP");
 
333
-                
 
334
+        // just retry - there is nothing to save ... I got no sense data....
 
335
+        if (cqr->retries > 0) {
 
336
+                DEV_MESSAGE (KERN_DEBUG, device, 
 
337
+                             "default ERP called (%i retries left)",
 
338
+                             cqr->retries);
 
339
 
340
                 check_then_set (&cqr->status,
 
341
                                 CQR_STATUS_ERROR,
 
342
-                                CQR_STATUS_FAILED);
 
343
-
 
344
-                cqr->stopclk = get_clock ();
 
345
-
 
346
-                return cqr;
 
347
-       }
 
348
-
 
349
-       erp->cpaddr->cmd_code = CCW_CMD_TIC;
 
350
-       erp->cpaddr->cda = (__u32) (addr_t) cqr->cpaddr;
 
351
-       erp->function = dasd_default_erp_action;
 
352
-       erp->refers = cqr;
 
353
-       erp->device = cqr->device;
 
354
-       erp->magic = cqr->magic;
 
355
-       erp->retries = 16;
 
356
-
 
357
-       erp->status = CQR_STATUS_FILLED;
 
358
-
 
359
-        dasd_chanq_enq_head (&device->queue,
 
360
-                             erp);
 
361
-
 
362
-       return erp;
 
363
+                                CQR_STATUS_QUEUED);
 
364
+        } else {
 
365
+                DEV_MESSAGE (KERN_WARNING, device, "%s",
 
366
+                            "default ERP called (NO retry left)");
 
367
+               
 
368
+               check_then_set (&cqr->status,
 
369
+                               CQR_STATUS_ERROR,
 
370
+                               CQR_STATUS_FAILED);
 
371
+               
 
372
+               cqr->stopclk = get_clock ();
 
373
+        }
 
374
+        return cqr;
 
375
 
 
376
 } /* end dasd_default_erp_action */
 
377
 
 
378
@@ -2520,7 +2529,8 @@
 
379
                }
 
380
                if ((rc = dasd_sleep_on_req (req)) != 0) {
 
381
 
 
382
-                       DEV_MESSAGE (KERN_ERR, device,
 
383
+
 
384
+                       DEV_MESSAGE (KERN_WARNING, device,
 
385
                                      " Formatting of unit %d failed "
 
386
                                      "with rc = %d",
 
387
                                      fdata->start_unit, rc);
 
388
@@ -3031,6 +3041,7 @@
 
389
                         set_device_ro(MKDEV(major,minor), intval);
 
390
                 return 0;
 
391
         }
 
392
+       case BLKBSZGET:
 
393
        case BLKSSZGET:
 
394
        case BLKROGET:
 
395
        case BLKRASET:
 
396
@@ -3879,7 +3890,7 @@
 
397
                                                &device->dev_status);
 
398
                 if ( rc ) {
 
399
 
 
400
-                        MESSAGE (KERN_ERR, "%s",
 
401
+                        MESSAGE (KERN_DEBUG, "%s",
 
402
                                  "No request IRQ");
 
403
 
 
404
                         goto out;
 
405
@@ -4532,7 +4543,8 @@
 
406
                                 &range);
 
407
         
 
408
         /* Negative numbers in str/from/to indicate errors */
 
409
-        if (IS_ERR (str)) 
 
410
+        if (IS_ERR (str) || (range.from < 0) || (range.to < 0)
 
411
+            || (range.from > 65535) || (range.to > 65535)) 
 
412
                 return;
 
413
 
 
414
         if (strncmp (str, "on", 2) == 0) {
 
415
@@ -4567,7 +4579,8 @@
 
416
                                 &range);
 
417
         
 
418
         /* Negative numbers in str/from/to indicate errors */
 
419
-        if (IS_ERR (str))
 
420
+        if (IS_ERR (str) || (range.from < 0) || (range.to < 0)
 
421
+            || (range.from > 65535) || (range.to > 65535))
 
422
                 return;
 
423
 
 
424
         dasd_add_range (range.from, range.to, range.features);
 
425
@@ -4591,7 +4604,7 @@
 
426
                 
 
427
         /* check devixe status */
 
428
         if (device->level != DASD_STATE_BOXED) {
 
429
-                MESSAGE (KERN_ERR,
 
430
+                MESSAGE (KERN_WARNING,
 
431
                          "/proc/dasd/devices: the given device (%04X) "
 
432
                          "is not 'boxed')",
 
433
                          device->devinfo.devno);
 
434
@@ -4617,7 +4630,7 @@
 
435
         device->discipline = discipline;
 
436
 
 
437
         if (device->discipline == NULL) {
 
438
-                MESSAGE (KERN_ERR, "%s",
 
439
+                MESSAGE (KERN_WARNING, "%s",
 
440
                          "/proc/dasd/devices: discipline not found "
 
441
                          "in discipline list");
 
442
                 rc = -EINVAL;
 
443
@@ -4666,7 +4679,7 @@
 
444
                 return;
 
445
 
 
446
         if (range.from != range.to) {
 
447
-                MESSAGE (KERN_ERR, "%s",
 
448
+                MESSAGE (KERN_WARNING, "%s",
 
449
                          "/proc/dasd/devices: 'brk <devno> <discipline> "
 
450
                          "is only allowed for a single device (no ranges)");
 
451
                 return;
 
452
@@ -4674,7 +4687,7 @@
 
453
 
 
454
         /* check for discipline = 'eckd' */
 
455
         if (strncmp(str, "eckd", 4) != 0) {
 
456
-                MESSAGE (KERN_ERR,
 
457
+                MESSAGE (KERN_WARNING,
 
458
                          "/proc/dasd/devices: 'brk <devno> <discipline> "
 
459
                          "is only allowed for 'eckd' (%s)",
 
460
                          str);
 
461
@@ -4685,7 +4698,7 @@
 
462
 
 
463
        device = *(dasd_device_from_devno (range.from));
 
464
         if (device == NULL) {
 
465
-                MESSAGE (KERN_ERR,
 
466
+                MESSAGE (KERN_WARNING,
 
467
                          "/proc/dasd/devices: no device found for devno (%04X)",
 
468
                          range.from);
 
469
                 return;
 
470
diff -ruN linux-2.4.19/drivers/s390/block/dasd_3990_erp.c linux-2.3/drivers/s390/block/dasd_3990_erp.c
 
471
--- linux-2.4.19/drivers/s390/block/dasd_3990_erp.c     Wed Jan 29 20:13:56 2003
 
472
+++ linux-2.3/drivers/s390/block/dasd_3990_erp.c        Wed Jan 22 13:23:31 2003
 
473
@@ -83,6 +83,32 @@
 
474
                         nl +=16;
 
475
                 }        
 
476
                 
 
477
+               DEV_MESSAGE (KERN_ERR, device,
 
478
+                               "DATA area is at: %p",
 
479
+                               loop_cqr->data);
 
480
+
 
481
+               nl      = (char *) loop_cqr->data;
 
482
+               end_cqr = nl + loop_cqr->datasize;
 
483
+
 
484
+                while (nl < end_cqr) {
 
485
+                                        
 
486
+                        sprintf (buffer,
 
487
+                                 "%p: %02x%02x%02x%02x"
 
488
+                                 " %02x%02x%02x%02x"
 
489
+                                 " %02x%02x%02x%02x"
 
490
+                                 " %02x%02x%02x%02x",
 
491
+                                 nl,
 
492
+                                 nl[0], nl[1], nl[2], nl[3],
 
493
+                                 nl[4], nl[5], nl[6], nl[7],
 
494
+                                 nl[8], nl[9], nl[10], nl[11],
 
495
+                                 nl[12], nl[13], nl[14], nl[15]);
 
496
+
 
497
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
 
498
+                                     buffer);
 
499
+
 
500
+                        nl +=16;
 
501
+              }
 
502
+               
 
503
                 nl  = (char *) loop_cqr->cpaddr;
 
504
                 
 
505
                 if (loop_cqr->cplength > 40) { /* log only parts of the CP */
 
506
@@ -741,7 +767,7 @@
 
507
 
 
508
         } else {
 
509
 
 
510
-                if (sense[25] & 0x1D) {        /* state change pending */
 
511
+                if (sense[25] == 0x1D) {       /* state change pending */
 
512
                         
 
513
                         DEV_MESSAGE (KERN_INFO, device, "%s",
 
514
                                      "waiting for state change pending "
 
515
@@ -753,14 +779,19 @@
 
516
                 } else {
 
517
 
 
518
                         /* no state change pending - retry */
 
519
+                       DEV_MESSAGE (KERN_INFO, device, 
 
520
+                                     "redriving request immediately, "
 
521
+                                     "%d retries left", 
 
522
+                                     erp->retries);
 
523
+
 
524
                         check_then_set (&erp->status,
 
525
                                         CQR_STATUS_ERROR,
 
526
                                         CQR_STATUS_QUEUED);
 
527
                 }
 
528
         }
 
529
-
 
530
+        
 
531
        return erp;
 
532
-
 
533
+        
 
534
 } /* end dasd_3990_erp_action_4 */
 
535
 
 
536
 /*
 
537
@@ -2681,25 +2712,49 @@
 
538
 {
 
539
 
 
540
        dasd_device_t *device = cqr->device;
 
541
+       ccw1_t *ccw;
 
542
 
 
543
        /* allocate additional request block */
 
544
-       ccw_req_t *erp = dasd_alloc_request ((char *) &cqr->magic, 1, 0, cqr->device);
 
545
+       ccw_req_t *erp = dasd_alloc_request ((char *) &cqr->magic, 2, 0, cqr->device);
 
546
 
 
547
        if (!erp) {
 
548
-
 
549
-                DEV_MESSAGE (KERN_ERR, device, "%s",
 
550
-                             "Unable to allocate ERP request");
 
551
+                if (cqr->retries <= 0) {
 
552
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
 
553
+                                     "Unable to allocate ERP request "
 
554
+                                     "(NO retries left)");
 
555
                 
 
556
-                check_then_set (&cqr->status,
 
557
-                                CQR_STATUS_ERROR,
 
558
-                                CQR_STATUS_FAILED);
 
559
+                        check_then_set (&cqr->status,
 
560
+                                        CQR_STATUS_ERROR,
 
561
+                                        CQR_STATUS_FAILED);
 
562
+
 
563
+                        cqr->stopclk = get_clock ();
 
564
 
 
565
+                } else {
 
566
+                        DEV_MESSAGE (KERN_ERR, device,
 
567
+                                     "Unable to allocate ERP request "
 
568
+                                     "(%i retries left)",
 
569
+                                     cqr->retries);
 
570
+                
 
571
+                        if (!timer_pending(&device->timer)) {
 
572
+                                init_timer (&device->timer);
 
573
+                                device->timer.function = dasd_schedule_bh_timed;
 
574
+                                device->timer.data     = (unsigned long) device;
 
575
+                                device->timer.expires  = jiffies + (HZ << 3);
 
576
+                                add_timer (&device->timer);
 
577
+                        } else {
 
578
+                                mod_timer(&device->timer, jiffies + (HZ << 3));
 
579
+                        }
 
580
+                }
 
581
                 return cqr;
 
582
        }
 
583
 
 
584
        /* initialize request with default TIC to current ERP/CQR */
 
585
-       erp->cpaddr->cmd_code = CCW_CMD_TIC;
 
586
-       erp->cpaddr->cda      = (long)(cqr->cpaddr);
 
587
+       ccw = erp->cpaddr;
 
588
+       ccw->cmd_code = CCW_CMD_NOOP;
 
589
+       ccw->flags = CCW_FLAG_CC;
 
590
+       ccw++;
 
591
+       ccw->cmd_code = CCW_CMD_TIC;
 
592
+       ccw->cda      = (long)(cqr->cpaddr);
 
593
        erp->function = dasd_3990_erp_add_erp;
 
594
        erp->refers   = cqr;
 
595
        erp->device   = cqr->device;
 
596
@@ -2777,9 +2832,9 @@
 
597
        }
 
598
 
 
599
        /* check sense data; byte 0-2,25,27 */
 
600
-       if (!((strncmp (cqr1->dstat->ii.sense.data,
 
601
-                       cqr2->dstat->ii.sense.data,
 
602
-                       3) == 0) &&
 
603
+       if (!((memcmp (cqr1->dstat->ii.sense.data,
 
604
+                       cqr2->dstat->ii.sense.data,
 
605
+                       3) == 0) &&
 
606
              (cqr1->dstat->ii.sense.data[27] ==
 
607
               cqr2->dstat->ii.sense.data[27]   ) &&
 
608
              (cqr1->dstat->ii.sense.data[25] ==
 
609
@@ -2979,7 +3034,7 @@
 
610
 
 
611
         if (erp->retries > 0) {
 
612
                 
 
613
-                char *sense = erp->dstat->ii.sense.data;
 
614
+                char *sense = erp->refers->dstat->ii.sense.data;
 
615
                 
 
616
                 /* check for special retries */
 
617
                 if (erp->function == dasd_3990_erp_action_4) {
 
618
@@ -3131,18 +3186,15 @@
 
619
         }
 
620
 
 
621
         /* enqueue added ERP request */
 
622
-        if ((erp != cqr                      ) &&
 
623
+        if ((erp != device->queue.head       ) &&
 
624
             (erp->status == CQR_STATUS_FILLED)   ){
 
625
 
 
626
                 dasd_chanq_enq_head (&device->queue,
 
627
                                      erp);
 
628
         } else {
 
629
-                if ((erp->status == CQR_STATUS_FILLED )||
 
630
-                    (erp != cqr                       )  ){
 
631
-                        /* something strange happened - log the error and throw a BUG() */
 
632
-                        DEV_MESSAGE (KERN_ERR, device, "%s",
 
633
-                                     "Problems with ERP chain!!! BUG");
 
634
-
 
635
+                if ((erp->status == CQR_STATUS_FILLED) || 
 
636
+                    (erp != device->queue.head       )   ) {
 
637
+                        /* something strange happened - log the error and panic */
 
638
                         /* print current erp_chain */
 
639
                         DEV_MESSAGE (KERN_DEBUG, device, "%s",
 
640
                                      "ERP chain at END of ERP-ACTION");
 
641
@@ -3160,7 +3212,8 @@
 
642
                                                      temp_erp->refers);
 
643
                                 }
 
644
                         }
 
645
-                        BUG();
 
646
+                        panic ("Problems with ERP chain!!! "
 
647
+                               "Please report to linux390@de.ibm.com");
 
648
                 }
 
649
 
 
650
         }
 
651
diff -ruN linux-2.4.19/drivers/s390/block/dasd_diag.c linux-2.3/drivers/s390/block/dasd_diag.c
 
652
--- linux-2.4.19/drivers/s390/block/dasd_diag.c Wed Jan 29 20:13:56 2003
 
653
+++ linux-2.3/drivers/s390/block/dasd_diag.c    Wed Jan 22 13:23:31 2003
 
654
@@ -6,7 +6,7 @@
 
655
  * Bugreports.to..: <Linux390@de.ibm.com>
 
656
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
 
657
  *
 
658
- * $Revision: 1.37.2.6 $
 
659
+ * $Revision: 1.37.2.8 $
 
660
  *
 
661
  * History of changes
 
662
  * 07/13/00 Added fixup sections for diagnoses ans saved some registers
 
663
@@ -472,13 +472,15 @@
 
664
        diag_bio_t *bio;
 
665
        int bhct;
 
666
        long size;
 
667
+        unsigned long reloc_sector = req->sector + 
 
668
+                device->major_info->gendisk.part[MINOR (req->rq_dev)].start_sect;
 
669
 
 
670
        if (!noblk) {
 
671
 
 
672
                MESSAGE (KERN_ERR, "%s",
 
673
                          "No blocks to read/write...returning");
 
674
 
 
675
-               return NULL;
 
676
+               return ERR_PTR(-EINVAL);
 
677
        }
 
678
        if (req->cmd == READ) {
 
679
                rw_cmd = MDSK_READ_REQ;
 
680
@@ -494,11 +496,11 @@
 
681
        /* Build the request */
 
682
        rw_cp = dasd_alloc_request (dasd_diag_discipline.name, bhct << 1, 0, device);
 
683
        if (!rw_cp) {
 
684
-               return NULL;
 
685
+               return  ERR_PTR(-ENOMEM);
 
686
        }
 
687
        bio = (diag_bio_t *) (rw_cp->cpaddr);
 
688
 
 
689
-       block = req->sector >> device->sizes.s2b_shift;
 
690
+       block = reloc_sector >> device->sizes.s2b_shift;
 
691
        for (bh = req->bh; bh; bh = bh->b_reqnext) {
 
692
                 memset (bio, 0, sizeof (diag_bio_t));
 
693
                 for (size = 0; size < bh->b_size; size += byt_per_blk) {
 
694
diff -ruN linux-2.4.19/drivers/s390/block/dasd_eckd.c linux-2.3/drivers/s390/block/dasd_eckd.c
 
695
--- linux-2.4.19/drivers/s390/block/dasd_eckd.c Wed Jan 29 20:13:56 2003
 
696
+++ linux-2.3/drivers/s390/block/dasd_eckd.c    Wed Jan 22 13:23:31 2003
 
697
@@ -6,7 +6,7 @@
 
698
  * Bugreports.to..: <Linux390@de.ibm.com>
 
699
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
 
700
  *
 
701
- * $Revision: 1.82.6.6 $
 
702
+ * $Revision: 1.82.6.8 $
 
703
  *
 
704
  * History of changes (starts July 2000)
 
705
  * 07/11/00 Enabled rotational position sensing
 
706
@@ -750,6 +750,7 @@
 
707
         }
 
708
        cqr->device = device;
 
709
        cqr->retries = 0;
 
710
+        cqr->buildclk = get_clock ();
 
711
        cqr->status = CQR_STATUS_FILLED;
 
712
         dasd_chanq_enq (&device->queue, cqr);
 
713
         goto out;
 
714
@@ -1143,6 +1144,7 @@
 
715
                }
 
716
                (last_ccw - 1)->flags &= ~(CCW_FLAG_CC | CCW_FLAG_DC);
 
717
                fcp->device = device;
 
718
+                fcp->buildclk = get_clock ();
 
719
                fcp->status = CQR_STATUS_FILLED;
 
720
        }
 
721
         goto out;
 
722
@@ -1247,11 +1249,14 @@
 
723
        int byt_per_blk = device->sizes.bp_block;
 
724
        int shift = device->sizes.s2b_shift;
 
725
        int blk_per_trk = recs_per_track (&(private->rdc_data), 0, byt_per_blk);
 
726
-       int btrk = (req->sector >> shift) / blk_per_trk;
 
727
-       int etrk = ((req->sector + req->nr_sectors - 1) >> shift) / blk_per_trk;
 
728
-       int recid = req->sector >> shift;
 
729
+        unsigned long reloc_sector = req->sector + 
 
730
+                device->major_info->gendisk.part[MINOR(req->rq_dev)].start_sect;
 
731
+        int btrk = (reloc_sector >> shift) / blk_per_trk; 
 
732
+       int etrk = ((reloc_sector + req->nr_sectors - 1) >> shift) / blk_per_trk;
 
733
+       int recid = reloc_sector >> shift;
 
734
        int locate4k_set = 0;
 
735
        int nlocs = 0;
 
736
+       int errcode;
 
737
 
 
738
        if (req->cmd == READ) {
 
739
                rw_cmd = DASD_ECKD_CCW_READ_MT;
 
740
@@ -1263,14 +1268,17 @@
 
741
                          "Unknown command %d", 
 
742
                          req->cmd);
 
743
 
 
744
-               return NULL;
 
745
+               return ERR_PTR(-EINVAL);
 
746
        }
 
747
        /* Build the request */
 
748
        /* count bhs to prevent errors, when bh smaller than block */
 
749
        bhct = 0;
 
750
        for (bh = req->bh; bh; bh = bh->b_reqnext) {
 
751
-               if (bh->b_size < byt_per_blk)
 
752
-                        BUG();
 
753
+               if (bh->b_size < byt_per_blk) {
 
754
+                       MESSAGE(KERN_ERR, "ignoring bogus sized request: %d<%d",
 
755
+                                         bh->b_size, byt_per_blk);
 
756
+                        return ERR_PTR(-EINVAL);
 
757
+               }
 
758
                 bhct+= bh->b_size >> (device->sizes.s2b_shift+9);
 
759
        }
 
760
        if (btrk < 2 && private->uses_cdl) {
 
761
@@ -1286,12 +1294,12 @@
 
762
                                     sizeof (LO_eckd_data_t),
 
763
                                     device);
 
764
        if (!rw_cp) {
 
765
-               return NULL;
 
766
+               return ERR_PTR(-ENOMEM);
 
767
        }
 
768
        DE_data = rw_cp->data;
 
769
        LO_data = rw_cp->data + sizeof (DE_eckd_data_t);
 
770
        ccw = rw_cp->cpaddr;
 
771
-       if (define_extent (ccw, DE_data, btrk, etrk, rw_cmd, device, rw_cp)) {
 
772
+       if (errcode=define_extent (ccw, DE_data, btrk, etrk, rw_cmd, device, rw_cp)) {
 
773
                 goto clear_rw_cp;
 
774
         }
 
775
        ccw->flags |= CCW_FLAG_CC;
 
776
@@ -1304,7 +1312,7 @@
 
777
                                     && private->uses_cdl) {
 
778
                                         /* Do a locate record for our special blocks */
 
779
                                         int cmd = dasd_eckd_cdl_cmd (device,recid, req->cmd);
 
780
-                                        if (locate_record (ccw, 
 
781
+                                        if (errcode=locate_record (ccw, 
 
782
                                                        LO_data++,
 
783
                                                        recid / blk_per_trk, 
 
784
                                                        recid % blk_per_trk + 1, 
 
785
@@ -1314,11 +1322,11 @@
 
786
                                         }
 
787
                                 } else {
 
788
                                         // Do a locate record for standard blocks */
 
789
-                                        if (locate_record (ccw, 
 
790
+                                        if (errcode=locate_record (ccw, 
 
791
                                                        LO_data++,
 
792
                                                        recid /blk_per_trk,
 
793
                                                        recid %blk_per_trk + 1,
 
794
-                                                       (((req->sector +
 
795
+                                                       (((reloc_sector +
 
796
                                                           req->nr_sectors) >>
 
797
                                                          shift) - recid), 
 
798
                                                        rw_cmd, device,
 
799
@@ -1341,7 +1349,7 @@
 
800
                                             0xE5, byt_per_blk - ccw->count);
 
801
                                 }
 
802
                         }
 
803
-                        if (dasd_set_normalized_cda (ccw, __pa (bh->b_data+size), rw_cp, device)) {
 
804
+                        if (errcode=dasd_set_normalized_cda (ccw, __pa (bh->b_data+size), rw_cp, device)) {
 
805
                                 goto clear_rw_cp;
 
806
                         }
 
807
                         recid++;
 
808
@@ -1353,7 +1361,7 @@
 
809
        rw_cp->expires = 5 * TOD_MIN;   /* 5 minutes */
 
810
        rw_cp->req     = req;
 
811
        rw_cp->lpm     = LPM_ANYPATH;
 
812
-       rw_cp->retries = 2;
 
813
+       rw_cp->retries = 256;
 
814
 
 
815
        rw_cp->buildclk = get_clock ();
 
816
 
 
817
@@ -1365,7 +1373,7 @@
 
818
  clear_rw_cp:
 
819
         dasd_free_request (rw_cp, 
 
820
                            device);
 
821
-        rw_cp=NULL;
 
822
+        rw_cp=ERR_PTR(errcode);
 
823
  out:
 
824
        return rw_cp;
 
825
 }
 
826
@@ -1432,6 +1440,7 @@
 
827
        cqr->device  = device;
 
828
        cqr->retries = 0;
 
829
        cqr->expires = 10 * TOD_SEC;
 
830
+       cqr->buildclk = get_clock ();
 
831
        cqr->status  = CQR_STATUS_FILLED;
 
832
        return cqr; 
 
833
 }
 
834
@@ -1460,6 +1469,7 @@
 
835
        cqr->device  = device;
 
836
        cqr->retries = 0;
 
837
        cqr->expires = 10 * TOD_SEC;
 
838
+       cqr->buildclk = get_clock ();
 
839
        cqr->status  = CQR_STATUS_FILLED;
 
840
        return cqr;
 
841
 
 
842
@@ -1489,6 +1499,7 @@
 
843
        cqr->device  = device;
 
844
        cqr->retries = 0;
 
845
        cqr->expires = 10 * TOD_SEC;
 
846
+       cqr->buildclk = get_clock ();
 
847
        cqr->status  = CQR_STATUS_FILLED;
 
848
        return cqr;
 
849
 }
 
850
@@ -1617,6 +1628,7 @@
 
851
                 return NULL;
 
852
         }
 
853
        
 
854
+       cqr->buildclk = get_clock ();
 
855
        cqr->status   = CQR_STATUS_FILLED;
 
856
 
 
857
        return cqr; 
 
858
diff -ruN linux-2.4.19/drivers/s390/block/dasd_fba.c linux-2.3/drivers/s390/block/dasd_fba.c
 
859
--- linux-2.4.19/drivers/s390/block/dasd_fba.c  Wed Jan 29 20:13:56 2003
 
860
+++ linux-2.3/drivers/s390/block/dasd_fba.c     Wed Jan 22 13:23:31 2003
 
861
@@ -4,7 +4,7 @@
 
862
  * Bugreports.to..: <Linux390@de.ibm.com>
 
863
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
 
864
  *
 
865
- * $Revision: 1.44.10.4 $
 
866
+ * $Revision: 1.44.10.6 $
 
867
  *
 
868
  * History of changes
 
869
  *          fixed partition handling and HDIO_GETGEO
 
870
@@ -290,6 +290,8 @@
 
871
        struct buffer_head *bh;
 
872
        dasd_fba_private_t *private = (dasd_fba_private_t *) device->private;
 
873
        int byt_per_blk = device->sizes.bp_block;
 
874
+        unsigned long reloc_sector = req->sector + 
 
875
+                device->major_info->gendisk.part[MINOR (req->rq_dev)].start_sect;
 
876
         
 
877
        if (req->cmd == READ) {
 
878
                rw_cmd = DASD_FBA_CCW_READ;
 
879
@@ -301,7 +303,7 @@
 
880
                          "Unknown command %d\n", 
 
881
                          req->cmd);
 
882
 
 
883
-               return NULL;
 
884
+               return ERR_PTR(-EINVAL);
 
885
        }
 
886
        /* Build the request */
 
887
        /* count hs to prevent errors, when bh smaller than block */
 
888
@@ -329,14 +331,14 @@
 
889
                                             device);
 
890
         }
 
891
        if (!rw_cp) {
 
892
-               return NULL;
 
893
+               return ERR_PTR(-ENOMEM);
 
894
        }
 
895
        DE_data = rw_cp->data;
 
896
        LO_data = rw_cp->data + sizeof (DE_fba_data_t);
 
897
        ccw = rw_cp->cpaddr;
 
898
 
 
899
        if (define_extent (ccw, DE_data, req->cmd, byt_per_blk,
 
900
-                           req->sector, req->nr_sectors, rw_cp, device)) {
 
901
+                           reloc_sector, req->nr_sectors, rw_cp, device)) {
 
902
                 goto clear_rw_cp;
 
903
         }
 
904
        ccw->flags |= CCW_FLAG_CC;
 
905
diff -ruN linux-2.4.19/drivers/s390/char/hwc_rw.c linux-2.3/drivers/s390/char/hwc_rw.c
 
906
--- linux-2.4.19/drivers/s390/char/hwc_rw.c     Wed Jan 29 20:13:56 2003
 
907
+++ linux-2.3/drivers/s390/char/hwc_rw.c        Wed Jan 29 20:15:03 2003
 
908
@@ -1662,7 +1662,7 @@
 
909
        psw_t quiesce_psw;
 
910
 
 
911
        quiesce_psw.mask = _DW_PSW_MASK;
 
912
-       queisce_psw.addr = 0xfff;
 
913
+       quiesce_psw.addr = 0xfff;
 
914
        __load_psw (quiesce_psw);
 
915
 }
 
916
 
 
917
diff -ruN linux-2.4.19/drivers/s390/char/tapechar.c linux-2.3/drivers/s390/char/tapechar.c
 
918
--- linux-2.4.19/drivers/s390/char/tapechar.c   Wed Jan 29 20:13:56 2003
 
919
+++ linux-2.3/drivers/s390/char/tapechar.c      Wed Dec 11 14:06:18 2002
 
920
@@ -497,7 +497,7 @@
 
921
                if(op.mt_op == MTBSR  || 
 
922
                   op.mt_op == MTFSR  ||
 
923
                   op.mt_op == MTFSF  ||
 
924
-                  op.mt_op == MTBSR  ||
 
925
+                  op.mt_op == MTBSF  ||
 
926
                   op.mt_op == MTFSFM ||
 
927
                   op.mt_op == MTBSFM) 
 
928
                {
 
929
diff -ruN linux-2.4.19/drivers/s390/misc/z90main.c linux-2.3/drivers/s390/misc/z90main.c
 
930
--- linux-2.4.19/drivers/s390/misc/z90main.c    Wed Jan 29 20:13:56 2003
 
931
+++ linux-2.3/drivers/s390/misc/z90main.c       Thu Jan 23 22:55:06 2003
 
932
@@ -1851,12 +1851,22 @@
 
933
     // Request for device reset
 
934
     //
 
935
     case ICAZ90HARDRESET:
 
936
-      PRINTK("RESETING device under directions from PID %d.\n", pid);
 
937
-      if(current->euid != 0)
 
938
-        ret = -EACCES;
 
939
-      else
 
940
-        atomic_set(&__this_module.uc.usecount, 1);
 
941
-      break;
 
942
+#ifdef Z90CRYPT_DEBUG
 
943
+    #ifdef MODULE
 
944
+        PRINTK("RESETING device under directions from PID %d.\n", pid);
 
945
+        if(current->euid != 0)
 
946
+            ret = -EACCES;
 
947
+        else
 
948
+            atomic_set(&__this_module.uc.usecount, 1);
 
949
+        break;
 
950
+    #else
 
951
+        ret = -EPERM;  
 
952
+        break;
 
953
+    #endif // MODULE
 
954
+#else
 
955
+    ret = -ENOTTY;
 
956
+    break;
 
957
+#endif // Z90CRYPT_DEBUG
 
958
 
 
959
     //
 
960
     // Request for RSA Clear-Key Decrypt
 
961
diff -ruN linux-2.4.19/drivers/s390/s390io.c linux-2.3/drivers/s390/s390io.c
 
962
--- linux-2.4.19/drivers/s390/s390io.c  Wed Jan 29 20:13:56 2003
 
963
+++ linux-2.3/drivers/s390/s390io.c     Tue Dec 10 18:16:13 2002
 
964
@@ -1,7 +1,7 @@
 
965
 /*
 
966
  *  drivers/s390/s390io.c
 
967
  *   S/390 common I/O routines
 
968
- *   $Revision: 1.171.2.28 $
 
969
+ *   $Revision: 1.171.2.34 $
 
970
  *
 
971
  *  S390 version
 
972
  *    Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH,
 
973
@@ -816,24 +816,6 @@
 
974
 }
 
975
 
 
976
 /*
 
977
- * Switch chpids off after the paths in mask failed
 
978
- */
 
979
-inline void
 
980
-switch_off_chpids(int irq, __u8 mask)
 
981
-{
 
982
-       int i;
 
983
-       pmcw_t *pmcw = &ioinfo[irq]->schib.pmcw;
 
984
-
 
985
-       for (i=0;i<8;i++)
 
986
-               if ((0x80>>i) & mask
 
987
-                   & pmcw->pim
 
988
-                   & pmcw->pam
 
989
-                   & pmcw->pom)
 
990
-                       clear_bit(pmcw->chpid[i], &chpids);
 
991
-}
 
992
-
 
993
-
 
994
-/*
 
995
  * Function: s390_send_nop
 
996
  * 
 
997
  * sends a nop CCW to the specified subchannel down the given path(s)
 
998
@@ -1692,6 +1674,16 @@
 
999
 
 
1000
        case 1:         /* status pending */
 
1001
 
 
1002
+               /* 
 
1003
+                * Don't do an inline processing of pending interrupt conditions
 
1004
+                * while doing async. I/O. The interrupt will pop up when we are
 
1005
+                * enabled again and the I/O can be retried.
 
1006
+                */
 
1007
+               if (!ioinfo[irq]->ui.flags.syncio) {
 
1008
+                       ret = -EBUSY;
 
1009
+                       break;
 
1010
+               }
 
1011
+               
 
1012
                ioinfo[irq]->devstat.flag = DEVSTAT_START_FUNCTION
 
1013
                    | DEVSTAT_STATUS_PENDING;
 
1014
 
 
1015
@@ -1732,14 +1724,6 @@
 
1016
                 *  than the one used (i.e. path available mask is non-zero).
 
1017
                 */
 
1018
                if (ioinfo[irq]->devstat.ii.irb.scsw.cc == 3) {
 
1019
-                       if (flag & DOIO_VALID_LPM) {
 
1020
-                               ioinfo[irq]->opm &=
 
1021
-                                   ~(ioinfo[irq]->devstat.ii.irb.esw.esw1.
 
1022
-                                     lpum);
 
1023
-                       } else {
 
1024
-                               ioinfo[irq]->opm = 0;
 
1025
-
 
1026
-                       }
 
1027
 
 
1028
                        if (ioinfo[irq]->opm == 0) {
 
1029
                                ret = -ENODEV;
 
1030
@@ -1848,7 +1832,6 @@
 
1031
 
 
1032
                if (flag & DOIO_VALID_LPM) {
 
1033
                        ioinfo[irq]->opm &= ~lpm;
 
1034
-                       switch_off_chpids(irq, lpm);
 
1035
                } else {
 
1036
                        ioinfo[irq]->opm = 0;
 
1037
 
 
1038
@@ -2000,7 +1983,6 @@
 
1039
                        break;
 
1040
 
 
1041
                case 1:
 
1042
-                       s390_process_IRQ (irq);
 
1043
                        ret = -EBUSY;
 
1044
                        break;
 
1045
 
 
1046
@@ -2176,6 +2158,16 @@
 
1047
 
 
1048
        case 1:         /* status pending */
 
1049
 
 
1050
+               /* 
 
1051
+                * Don't do an inline processing of pending interrupt conditions
 
1052
+                * while doing async. I/O. The interrupt will pop up when we are
 
1053
+                * enabled again and the I/O can be retried.
 
1054
+                */
 
1055
+               if (!ioinfo[irq]->ui.flags.syncio) {
 
1056
+                       ret = -EBUSY;
 
1057
+                       break;
 
1058
+               }
 
1059
+
 
1060
                ioinfo[irq]->devstat.flag |= DEVSTAT_STATUS_PENDING;
 
1061
 
 
1062
                /*
 
1063
@@ -2453,8 +2445,6 @@
 
1064
 
 
1065
        case 1:         /* status pending */
 
1066
 
 
1067
-               /* process the pending irq... */
 
1068
-               s390_process_IRQ (irq);
 
1069
                ret = -EBUSY;
 
1070
                break;
 
1071
 
 
1072
@@ -2924,8 +2914,8 @@
 
1073
                                 */
 
1074
                                if (ioinfo[irq]->ui.flags.w4sense &&
 
1075
                                        (dp->ii.irb.scsw.dstat & DEV_STAT_UNIT_CHECK)) {
 
1076
-                                       CIO_MSG_EVENT(4,"double unit check irq %04x, dstat %02x, 
 
1077
-                                                       flags %8x\n", irq, dp->ii.irb.scsw.dstat,
 
1078
+                                       CIO_MSG_EVENT(4,"double unit check irq %04x, dstat %02x, "
 
1079
+                                                       "flags %8x\n", irq, dp->ii.irb.scsw.dstat,
 
1080
                                                         ioinfo[irq]->ui.info, ending_status);
 
1081
                                } else {
 
1082
                                /*
 
1083
@@ -2982,6 +2972,32 @@
 
1084
                                ret_io = s390_start_IO (irq, s_ccw, 0xE2C5D5E2, /* = SENSe */
 
1085
                                                        0,      /* n/a */
 
1086
                                                        s_flag);
 
1087
+                               switch (ret_io) {
 
1088
+                               case 0: /* OK */
 
1089
+                                       break;
 
1090
+                               case -ENODEV:
 
1091
+                                       /*
 
1092
+                                        * The device is no longer operational.
 
1093
+                                        * We won't get any sense data.
 
1094
+                                        */
 
1095
+                                       ioinfo[irq]->ui.flags.w4sense = 0;
 
1096
+                                       ioinfo[irq]->ui.flags.oper = 0;
 
1097
+                                       allow4handler = 1; /* to notify the driver */
 
1098
+                                       break;
 
1099
+                               case -EBUSY:
 
1100
+                                       /*
 
1101
+                                        * The channel subsystem is either busy, or we have
 
1102
+                                        * a status pending. Retry later.
 
1103
+                                        */
 
1104
+                                       ioinfo[irq]->ui.flags.w4sense = 0;
 
1105
+                                       ioinfo[irq]->ui.flags.delsense = 1;
 
1106
+                                       break;
 
1107
+                               default:
 
1108
+                                       printk(KERN_ERR"irq %04X: Unexpected rc %d "
 
1109
+                                              "for BASIC SENSE!\n", irq, ret_io);
 
1110
+                                       ioinfo[irq]->ui.flags.w4sense = 0;
 
1111
+                                       allow4handler = 1;
 
1112
+                               }
 
1113
                        } else {
 
1114
                                /*
 
1115
                                 * we received an Unit Check but we have no final
 
1116
@@ -3054,10 +3070,12 @@
 
1117
                                udp->flag |= DEVSTAT_FLAG_SENSE_AVAIL;
 
1118
                                udp->scnt = sense_count;
 
1119
 
 
1120
-                               if (sense_count >= 0) {
 
1121
+                               if (sense_count > 0) {
 
1122
                                        memcpy (udp->ii.sense.data,
 
1123
                                                ioinfo[irq]->sense_data,
 
1124
                                                sense_count);
 
1125
+                               } else if (sense_count == 0) {
 
1126
+                                       udp->flag &= ~DEVSTAT_FLAG_SENSE_AVAIL;
 
1127
                                } else {
 
1128
                                        panic
 
1129
                                            ("s390_process_IRQ(%04x) encountered "
 
1130
@@ -3204,16 +3222,16 @@
 
1131
                dp->cstat = 0;
 
1132
                dp->dstat = 0;
 
1133
 
 
1134
-               if (ioinfo[irq]->ulpm != ioinfo[irq]->opm) {
 
1135
-                       /*
 
1136
-                        * either it was the only path or it was restricted ...
 
1137
-                        */
 
1138
-                       ioinfo[irq]->opm &=
 
1139
-                           ~(ioinfo[irq]->devstat.ii.irb.esw.esw1.lpum);
 
1140
-               } else {
 
1141
-                       ioinfo[irq]->opm = 0;
 
1142
+               if ((dp->ii.irb.scsw.fctl != 0) &&
 
1143
+                   ((dp->ii.irb.scsw.stctl & SCSW_STCTL_STATUS_PEND) != 0) &&
 
1144
+                   (((dp->ii.irb.scsw.stctl & SCSW_STCTL_INTER_STATUS) == 0) ||
 
1145
+                    ((dp->ii.irb.scsw.actl & SCSW_ACTL_SUSPENDED) != 0)))
 
1146
+                       if (dp->ii.irb.scsw.pno) {
 
1147
 
 
1148
-               }
 
1149
+                               stsch(irq, &ioinfo[irq]->schib);
 
1150
+                               ioinfo[irq]->opm &=
 
1151
+                                       ~ioinfo[irq]->schib.pmcw.pnom;
 
1152
+                       }
 
1153
 
 
1154
                if (ioinfo[irq]->opm == 0) {
 
1155
                        ioinfo[irq]->ui.flags.oper = 0;
 
1156
@@ -3468,7 +3486,6 @@
 
1157
                 * we only run the STSCH/MSCH path for the first enablement
 
1158
                 */
 
1159
                else if (sync_isc_cnt == 1) {
 
1160
-                       ioinfo[irq]->ui.flags.syncio = 1;
 
1161
 
 
1162
                        ccode = stsch (irq, &(ioinfo[irq]->schib));
 
1163
 
 
1164
@@ -3493,6 +3510,7 @@
 
1165
                                                 * if neccessary */
 
1166
                                                if (cons_dev != -1)
 
1167
                                                        cr6 &= 0xFEFFFFFF;
 
1168
+                                               ioinfo[irq]->ui.flags.syncio = 1;
 
1169
                                                __ctl_load (cr6, 6, 6);
 
1170
                                                rc = 0;
 
1171
                                                retry = 0;
 
1172
@@ -3535,6 +3553,15 @@
 
1173
                if (rc) {       /* can only happen if stsch/msch fails */
 
1174
                        sync_isc_cnt = 0;
 
1175
                        atomic_set (&sync_isc, -1);
 
1176
+               } else if (sync_isc_cnt == 1) {
 
1177
+                       int ccode;
 
1178
+                       
 
1179
+                       ccode = stsch(irq, &ioinfo[irq]->schib);
 
1180
+                       if (!ccode && ioinfo[irq]->schib.pmcw.isc != 5) {
 
1181
+                               ioinfo[irq]->ui.flags.syncio = 0;
 
1182
+                               sync_isc_cnt = 0;
 
1183
+                               atomic_set (&sync_isc, -1);
 
1184
+                       }
 
1185
                }
 
1186
        } else {
 
1187
 #ifdef CONFIG_SYNC_ISC_PARANOIA
 
1188
@@ -6263,7 +6290,6 @@
 
1189
 
 
1190
                                retry = 0;
 
1191
                                ioinfo[irq]->opm &= ~lpm;
 
1192
-                               switch_off_chpids(irq, lpm);
 
1193
                                irq_ret = -EAGAIN;
 
1194
 
 
1195
                        }
 
1196
@@ -6493,7 +6519,6 @@
 
1197
 
 
1198
                                retry = 0;
 
1199
                                ioinfo[irq]->opm &= ~lpm;
 
1200
-                               switch_off_chpids(irq, lpm);
 
1201
                                irq_ret = -EAGAIN;
 
1202
 
 
1203
                        } else {
 
1204
diff -ruN linux-2.4.19/drivers/s390/scsi/zfcp.c linux-2.3/drivers/s390/scsi/zfcp.c
 
1205
--- linux-2.4.19/drivers/s390/scsi/zfcp.c       Wed Jan 29 20:13:56 2003
 
1206
+++ linux-2.3/drivers/s390/scsi/zfcp.c  Wed Jan 29 20:03:47 2003
 
1207
@@ -12,7 +12,7 @@
 
1208
  */
 
1209
 
 
1210
 /* this drivers version (do not edit !!! generated and updated by cvs) */
 
1211
-#define ZFCP_REVISION          "$Revision: 3.60.4.15 $"
 
1212
+#define ZFCP_REVISION          "$Revision: 3.60.4.29 $"
 
1213
 
 
1214
 #define ZFCP_QTCB_VERSION      FSF_QTCB_CURRENT_VERSION
 
1215
 
 
1216
@@ -32,6 +32,8 @@
 
1217
 
 
1218
 #define ZFCP_DEBUG_ABORTS      /* scsi_cmnd abort tracing */
 
1219
 
 
1220
+#define ZFCP_DEBUG_INCOMING_ELS        /* incoming ELS tracing */
 
1221
+
 
1222
 #undef ZFCP_RESID
 
1223
 
 
1224
 #if 0
 
1225
@@ -195,22 +197,36 @@
 
1226
 /* maximum number of commands in LUN queue */
 
1227
 #define ZFCP_CMND_PER_LUN               32
 
1228
 
 
1229
-/* DBF ENTRIES */
 
1230
-#define ZFCP_ADAPTER_DBF_INDEX 6 
 
1231
-#define ZFCP_ADAPTER_DBF_AREAS 2
 
1232
-#define ZFCP_ADAPTER_DBF_LENGTH 16
 
1233
-#define ZFCP_ADAPTER_DBF_LEVEL 6
 
1234
+/* debug feature entries per adapter */
 
1235
+#define ZFCP_ERP_DBF_INDEX     1 
 
1236
+#define ZFCP_ERP_DBF_AREAS     2
 
1237
+#define ZFCP_ERP_DBF_LENGTH    16
 
1238
+#define ZFCP_ERP_DBF_LEVEL     3
 
1239
+#define ZFCP_ERP_DBF_NAME      "zfcp_erp"
 
1240
+
 
1241
+#define ZFCP_REQ_DBF_INDEX     1
 
1242
+#define ZFCP_REQ_DBF_AREAS     1
 
1243
+#define ZFCP_REQ_DBF_LENGTH    8
 
1244
+#define ZFCP_REQ_DBF_LEVEL     1
 
1245
+#define ZFCP_REQ_DBF_NAME      "zfcp_req"
 
1246
 
 
1247
 #define ZFCP_CMD_DBF_INDEX     2
 
1248
 #define ZFCP_CMD_DBF_AREAS     1
 
1249
 #define ZFCP_CMD_DBF_LENGTH    8
 
1250
 #define ZFCP_CMD_DBF_LEVEL     3
 
1251
+#define ZFCP_CMD_DBF_NAME      "zfcp_cmd"
 
1252
 
 
1253
 #define ZFCP_ABORT_DBF_INDEX   2
 
1254
 #define ZFCP_ABORT_DBF_AREAS   1
 
1255
 #define ZFCP_ABORT_DBF_LENGTH  8
 
1256
 #define ZFCP_ABORT_DBF_LEVEL   6
 
1257
-#define ZFCP_ABORT_DBF_RECSIZE ZFCP_ABORT_DBF_LENGTH * 5
 
1258
+#define ZFCP_ABORT_DBF_NAME    "zfcp_abt"
 
1259
+
 
1260
+#define ZFCP_IN_ELS_DBF_INDEX  2
 
1261
+#define ZFCP_IN_ELS_DBF_AREAS  1
 
1262
+#define ZFCP_IN_ELS_DBF_LENGTH 8
 
1263
+#define ZFCP_IN_ELS_DBF_LEVEL  6
 
1264
+#define ZFCP_IN_ELS_DBF_NAME   "zfcp_els"
 
1265
 
 
1266
 /*
 
1267
  * paranoia: some extra checks ensuring driver consistency and probably
 
1268
@@ -1203,6 +1219,8 @@
 
1269
        /* and here for the extra proc_dir */
 
1270
        struct proc_dir_entry           *proc_dir;
 
1271
        struct proc_dir_entry           *proc_file;
 
1272
+       /* nameserver avaliable via this adapter */
 
1273
+       struct _zfcp_port               *nameserver_port;
 
1274
        /* error recovery for this adapter and associated devices */
 
1275
        struct list_head                erp_ready_head;
 
1276
        struct list_head                erp_running_head;
 
1277
@@ -1214,15 +1232,11 @@
 
1278
        struct _zfcp_erp_action         erp_action;
 
1279
         atomic_t                        erp_counter;
 
1280
         debug_info_t                    *erp_dbf;
 
1281
-       /* nameserver avaliable via this adapter */
 
1282
-       struct _zfcp_port               *nameserver_port;
 
1283
-       debug_info_t                    *cmd_dbf;
 
1284
-       char                            cmd_dbf_name[20];
 
1285
-       rwlock_t                        cmd_dbf_lock;
 
1286
        debug_info_t                    *abort_dbf;
 
1287
-       char                            abort_dbf_name[20];
 
1288
        debug_info_t                    *req_dbf;
 
1289
-        char                            req_dbf_name[20];
 
1290
+       debug_info_t                    *in_els_dbf;
 
1291
+       debug_info_t                    *cmd_dbf;
 
1292
+       rwlock_t                        cmd_dbf_lock;
 
1293
         zfcp_adapter_mem_pool_t                pool;
 
1294
         /* SCSI error recovery watch */
 
1295
         struct timer_list               scsi_er_timer;
 
1296
@@ -1549,7 +1563,7 @@
 
1297
 static int     zfcp_fsf_abort_fcp_command_handler (zfcp_fsf_req_t*);
 
1298
 static int     zfcp_fsf_send_generic_handler (zfcp_fsf_req_t*);
 
1299
 static int      zfcp_fsf_status_read_handler (zfcp_fsf_req_t*);
 
1300
-inline void     zfcp_fsf_els_processing (zfcp_fsf_req_t *); 
 
1301
+void           zfcp_fsf_incoming_els (zfcp_fsf_req_t *); 
 
1302
 static inline int
 
1303
                zfcp_fsf_req_create_sbal_check
 
1304
                        (unsigned long*, zfcp_qdio_queue_t*, int);
 
1305
@@ -2356,7 +2370,7 @@
 
1306
                        debug_event(
 
1307
                                adapter->cmd_dbf,
 
1308
                                level,
 
1309
-                               add_data,
 
1310
+                               (char*)add_data + i,
 
1311
                                min(ZFCP_CMD_DBF_LENGTH, add_length - i));
 
1312
        }
 
1313
        ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->cmd_dbf_lock, flags);
 
1314
@@ -2392,6 +2406,28 @@
 
1315
 }
 
1316
 
 
1317
 
 
1318
+static inline void zfcp_in_els_dbf_event(
 
1319
+               zfcp_adapter_t *adapter,
 
1320
+               const char *text,
 
1321
+               fsf_status_read_buffer_t *status_buffer,
 
1322
+               int length)
 
1323
+{
 
1324
+#ifdef ZFCP_DEBUG_INCOMING_ELS
 
1325
+       int level = 1;
 
1326
+       int i;
 
1327
+
 
1328
+       debug_text_event(adapter->in_els_dbf, level, text);
 
1329
+       debug_event(adapter->in_els_dbf, level, &status_buffer->d_id, 8);
 
1330
+       for (i = 0; i < length; i += ZFCP_IN_ELS_DBF_LENGTH)
 
1331
+               debug_event(
 
1332
+                       adapter->in_els_dbf,
 
1333
+                       level,
 
1334
+                       (char*)status_buffer->payload + i,
 
1335
+                       min(ZFCP_IN_ELS_DBF_LENGTH, length - i));
 
1336
+#endif
 
1337
+}
 
1338
+
 
1339
+
 
1340
 /****************************************************************/
 
1341
 
 
1342
 
 
1343
@@ -3309,7 +3345,7 @@
 
1344
        int retval = 0;
 
1345
         zfcp_adapter_t *adapter;
 
1346
        unsigned long flags;
 
1347
-        char dbf_name[16];
 
1348
+        char dbf_name[20];
 
1349
         
 
1350
         ZFCP_LOG_TRACE(
 
1351
                "enter (devno=0x%x ,adapter_p=0x%lx)\n", 
 
1352
@@ -3389,51 +3425,104 @@
 
1353
         adapter->fc_service_class = ZFCP_FC_SERVICE_CLASS_DEFAULT; 
 
1354
 
 
1355
 #ifdef ZFCP_DEBUG_REQUESTS
 
1356
-        /* debug feature area which records fsf request sequence numbers */
 
1357
-        sprintf(adapter->req_dbf_name, "zfcp_req0x%4.4x",adapter->devno);
 
1358
-        adapter->req_dbf = debug_register(adapter->req_dbf_name, 1, 1, 8);
 
1359
-        if (!adapter->req_dbf) {
 
1360
-                retval = -ENOMEM;
 
1361
-                goto failed_req_dbf;
 
1362
-        }
 
1363
-        debug_register_view(adapter->req_dbf, &debug_hex_ascii_view);
 
1364
-        debug_set_level(adapter->req_dbf, 6);
 
1365
-        debug_text_event(adapter->req_dbf, 1, "zzz");
 
1366
+       /* debug feature area which records fsf request sequence numbers */
 
1367
+       sprintf(dbf_name, ZFCP_REQ_DBF_NAME"0x%4.4x",adapter->devno);
 
1368
+       adapter->req_dbf = debug_register(
 
1369
+                               dbf_name,
 
1370
+                               ZFCP_REQ_DBF_INDEX,
 
1371
+                               ZFCP_REQ_DBF_AREAS,
 
1372
+                               ZFCP_REQ_DBF_LENGTH);
 
1373
+       if (!adapter->req_dbf) {
 
1374
+               ZFCP_LOG_INFO(
 
1375
+                       "error: Out of resources. Request debug feature for "
 
1376
+                       "adapter with devno 0x%4.4x could not be generated.\n",
 
1377
+                       adapter->devno);
 
1378
+               retval = -ENOMEM;
 
1379
+               goto failed_req_dbf;
 
1380
+       }
 
1381
+       debug_register_view(adapter->req_dbf, &debug_hex_ascii_view);
 
1382
+       debug_set_level(adapter->req_dbf, ZFCP_REQ_DBF_LEVEL);
 
1383
+       debug_text_event(adapter->req_dbf, 1, "zzz");
 
1384
 #endif /* ZFCP_DEBUG_REQUESTS */
 
1385
 
 
1386
 #ifdef ZFCP_DEBUG_COMMANDS
 
1387
-        /* debug feature area which records SCSI command failures (hostbyte) */
 
1388
+       /* debug feature area which records SCSI command failures (hostbyte) */
 
1389
        rwlock_init(&adapter->cmd_dbf_lock);
 
1390
-        sprintf(adapter->cmd_dbf_name, "zfcp_cmd0x%4.4x", adapter->devno);
 
1391
-        adapter->cmd_dbf = debug_register(
 
1392
-                               adapter->cmd_dbf_name, 
 
1393
-                               1,
 
1394
+       sprintf(dbf_name, ZFCP_CMD_DBF_NAME"0x%4.4x", adapter->devno);
 
1395
+       adapter->cmd_dbf = debug_register(
 
1396
+                               dbf_name, 
 
1397
+                               ZFCP_CMD_DBF_INDEX,
 
1398
                                ZFCP_CMD_DBF_AREAS,
 
1399
                                ZFCP_CMD_DBF_LENGTH);
 
1400
-        if (!adapter->cmd_dbf) {
 
1401
-                retval = -ENOMEM;
 
1402
-                goto failed_cmd_dbf;
 
1403
-        }
 
1404
-        debug_register_view(adapter->cmd_dbf, &debug_hex_ascii_view);
 
1405
-        debug_set_level(adapter->cmd_dbf, ZFCP_CMD_DBF_LEVEL);
 
1406
+       if (!adapter->cmd_dbf) {
 
1407
+               ZFCP_LOG_INFO(
 
1408
+                       "error: Out of resources. Command debug feature for "
 
1409
+                       "adapter with devno 0x%4.4x could not be generated.\n",
 
1410
+                       adapter->devno);
 
1411
+               retval = -ENOMEM;
 
1412
+               goto failed_cmd_dbf;
 
1413
+       }
 
1414
+       debug_register_view(adapter->cmd_dbf, &debug_hex_ascii_view);
 
1415
+       debug_set_level(adapter->cmd_dbf, ZFCP_CMD_DBF_LEVEL);
 
1416
 #endif /* ZFCP_DEBUG_COMMANDS */
 
1417
 
 
1418
 #ifdef ZFCP_DEBUG_ABORTS
 
1419
-        /* debug feature area which records SCSI command aborts */
 
1420
-        sprintf(adapter->abort_dbf_name, "zfcp_abt0x%4.4x", adapter->devno);
 
1421
-        adapter->abort_dbf = debug_register(
 
1422
-                               adapter->abort_dbf_name, 
 
1423
+       /* debug feature area which records SCSI command aborts */
 
1424
+       sprintf(dbf_name, ZFCP_ABORT_DBF_NAME"0x%4.4x", adapter->devno);
 
1425
+       adapter->abort_dbf = debug_register(
 
1426
+                               dbf_name, 
 
1427
                                ZFCP_ABORT_DBF_INDEX,
 
1428
                                ZFCP_ABORT_DBF_AREAS,
 
1429
                                ZFCP_ABORT_DBF_LENGTH);
 
1430
-        if (!adapter->abort_dbf) {
 
1431
-                retval = -ENOMEM;
 
1432
-                goto failed_abort_dbf;
 
1433
-        }
 
1434
-        debug_register_view(adapter->abort_dbf, &debug_hex_ascii_view);
 
1435
-        debug_set_level(adapter->abort_dbf, ZFCP_ABORT_DBF_LEVEL);
 
1436
+       if (!adapter->abort_dbf) {
 
1437
+               ZFCP_LOG_INFO(
 
1438
+                       "error: Out of resources. Abort debug feature for "
 
1439
+                       "adapter with devno 0x%4.4x could not be generated.\n",
 
1440
+                       adapter->devno);
 
1441
+               retval = -ENOMEM;
 
1442
+               goto failed_abort_dbf;
 
1443
+       }
 
1444
+       debug_register_view(adapter->abort_dbf, &debug_hex_ascii_view);
 
1445
+       debug_set_level(adapter->abort_dbf, ZFCP_ABORT_DBF_LEVEL);
 
1446
 #endif /* ZFCP_DEBUG_ABORTS */
 
1447
 
 
1448
+#ifdef ZFCP_DEBUG_INCOMING_ELS
 
1449
+       /* debug feature area which records SCSI command aborts */
 
1450
+       sprintf(dbf_name, ZFCP_IN_ELS_DBF_NAME"0x%4.4x", adapter->devno);
 
1451
+       adapter->in_els_dbf = debug_register(
 
1452
+                               dbf_name,
 
1453
+                               ZFCP_IN_ELS_DBF_INDEX,
 
1454
+                               ZFCP_IN_ELS_DBF_AREAS,
 
1455
+                               ZFCP_IN_ELS_DBF_LENGTH);
 
1456
+       if (!adapter->in_els_dbf) {
 
1457
+               ZFCP_LOG_INFO(
 
1458
+                       "error: Out of resources. ELS debug feature for "
 
1459
+                       "adapter with devno 0x%4.4x could not be generated.\n",
 
1460
+                       adapter->devno);
 
1461
+               retval = -ENOMEM;
 
1462
+               goto failed_in_els_dbf;
 
1463
+       }
 
1464
+       debug_register_view(adapter->in_els_dbf, &debug_hex_ascii_view);
 
1465
+       debug_set_level(adapter->in_els_dbf, ZFCP_IN_ELS_DBF_LEVEL);
 
1466
+#endif /* ZFCP_DEBUG_INCOMING_ELS */
 
1467
+
 
1468
+       sprintf(dbf_name, ZFCP_ERP_DBF_NAME"0x%4.4x", adapter->devno);
 
1469
+       adapter->erp_dbf = debug_register(
 
1470
+                               dbf_name, 
 
1471
+                               ZFCP_ERP_DBF_INDEX, 
 
1472
+                               ZFCP_ERP_DBF_AREAS,
 
1473
+                               ZFCP_ERP_DBF_LENGTH);
 
1474
+       if (!adapter->erp_dbf) { 
 
1475
+               ZFCP_LOG_INFO(
 
1476
+                       "error: Out of resources. ERP debug feature for "
 
1477
+                       "adapter with devno 0x%4.4x could not be generated.\n",
 
1478
+                       adapter->devno);
 
1479
+               retval = -ENOMEM;
 
1480
+               goto failed_erp_dbf;
 
1481
+       }
 
1482
+       debug_register_view(adapter->erp_dbf, &debug_hex_ascii_view);
 
1483
+       debug_set_level(adapter->erp_dbf, ZFCP_ERP_DBF_LEVEL);
 
1484
+
 
1485
         /* Init proc structures */
 
1486
 #ifdef CONFIG_PROC_FS
 
1487
         ZFCP_LOG_TRACE("Generating proc entry....\n");
 
1488
@@ -3449,24 +3538,6 @@
 
1489
         ZFCP_LOG_TRACE("Proc entry created.\n");
 
1490
 #endif
 
1491
 
 
1492
-        sprintf(dbf_name, "zfcp_erp0x%4.4x", adapter->devno);
 
1493
-        adapter->erp_dbf = debug_register(
 
1494
-                               dbf_name, 
 
1495
-                               1, 
 
1496
-                               ZFCP_ADAPTER_DBF_AREAS,
 
1497
-                               ZFCP_ADAPTER_DBF_LENGTH);
 
1498
-        if (!adapter->erp_dbf) { 
 
1499
-                ZFCP_LOG_INFO(
 
1500
-                       "error: Out of resources. "
 
1501
-                       "Debug feature entries for adapter with "
 
1502
-                       "devno 0x%4.4x could not be generated\n",
 
1503
-                       adapter->devno);
 
1504
-                retval = -ENOMEM;
 
1505
-                goto dbf_failed;
 
1506
-        }
 
1507
-       debug_register_view(adapter->erp_dbf, &debug_hex_ascii_view);
 
1508
-       debug_set_level(adapter->erp_dbf, ZFCP_ADAPTER_DBF_LEVEL);
 
1509
-
 
1510
        retval = zfcp_erp_thread_setup(adapter);
 
1511
         if (retval) {
 
1512
                 ZFCP_LOG_INFO(
 
1513
@@ -3501,12 +3572,17 @@
 
1514
         goto out;
 
1515
 
 
1516
 thread_failed:
 
1517
-        debug_unregister(adapter->erp_dbf);
 
1518
-
 
1519
-dbf_failed:
 
1520
-        zfcp_delete_adapter_proc(adapter);
 
1521
+       zfcp_delete_adapter_proc(adapter);
 
1522
 
 
1523
 proc_failed:
 
1524
+       debug_unregister(adapter->erp_dbf);
 
1525
+
 
1526
+failed_erp_dbf:
 
1527
+#ifdef ZFCP_DEBUG_INCOMING_ELS
 
1528
+       debug_unregister(adapter->in_els_dbf);
 
1529
+failed_in_els_dbf:
 
1530
+#endif
 
1531
+
 
1532
 #ifdef ZFCP_DEBUG_ABORTS
 
1533
        debug_unregister(adapter->abort_dbf);
 
1534
 failed_abort_dbf:
 
1535
@@ -3520,7 +3596,7 @@
 
1536
 #ifdef ZFCP_DEBUG_REQUESTS
 
1537
         debug_unregister(adapter->req_dbf);
 
1538
 failed_req_dbf:
 
1539
-#endif /* ZFCP_DEBUG_REQUESTS */
 
1540
+#endif
 
1541
 
 
1542
 failed_low_mem_buffers:
 
1543
         zfcp_free_low_mem_buffers(adapter);
 
1544
@@ -3653,17 +3729,14 @@
 
1545
 
 
1546
         retval = zfcp_erp_thread_kill(adapter);
 
1547
                 
 
1548
-        ZFCP_LOG_TRACE("Deleting dbf entry......\n");
 
1549
-        debug_unregister(adapter->erp_dbf);
 
1550
-        ZFCP_LOG_TRACE("dbf entry removed.\n");
 
1551
-
 
1552
-        ZFCP_LOG_TRACE("Deleting proc entry......\n");
 
1553
         zfcp_delete_adapter_proc(adapter);
 
1554
         ZFCP_LOG_TRACE("Proc entry removed.\n");
 
1555
 
 
1556
+        debug_unregister(adapter->erp_dbf);
 
1557
+
 
1558
 #ifdef ZFCP_DEBUG_REQUESTS
 
1559
         debug_unregister(adapter->req_dbf);
 
1560
-#endif /* ZFCP_DEBUG_REQUESTS */
 
1561
+#endif
 
1562
 
 
1563
 #ifdef ZFCP_DEBUG_COMMANDS
 
1564
        debug_unregister(adapter->cmd_dbf);
 
1565
@@ -3673,6 +3746,10 @@
 
1566
        debug_unregister(adapter->abort_dbf);
 
1567
 #endif
 
1568
 
 
1569
+#ifdef ZFCP_DEBUG_INCOMING_ELS
 
1570
+       debug_unregister(adapter->in_els_dbf);
 
1571
+#endif
 
1572
+
 
1573
         zfcp_free_low_mem_buffers(adapter);
 
1574
        /* free memory of adapter data structure and queues */
 
1575
         zfcp_free_qdio_queues(adapter);
 
1576
@@ -8372,14 +8449,16 @@
 
1577
        u32 status = 0;
 
1578
 #ifdef ZFCP_DEBUG_ABORTS
 
1579
        /* the components of a abort_dbf record (fixed size record) */
 
1580
-       unsigned long   dbf_scsi_cmnd   = (unsigned long)scpnt;
 
1581
+       u64             dbf_scsi_cmnd   = (unsigned long)scpnt;
 
1582
        char            dbf_opcode[ZFCP_ABORT_DBF_LENGTH];
 
1583
        wwn_t           dbf_wwn         = port->wwpn;
 
1584
        fcp_lun_t       dbf_fcp_lun     = unit->fcp_lun;
 
1585
-       unsigned long   dbf_retries     = scpnt->retries;
 
1586
-       unsigned long   dbf_allowed     = scpnt->allowed;
 
1587
-       unsigned long   dbf_timeout     = 0;
 
1588
-       unsigned long   dbf_fsf_req     = 0;
 
1589
+       u64             dbf_retries     = scpnt->retries;
 
1590
+       u64             dbf_allowed     = scpnt->allowed;
 
1591
+       u64             dbf_timeout     = 0;
 
1592
+       u64             dbf_fsf_req     = 0;
 
1593
+       u64             dbf_fsf_status  = 0;
 
1594
+       u64             dbf_fsf_qual[2] = { 0, 0 };
 
1595
        char            dbf_result[ZFCP_ABORT_DBF_LENGTH]
 
1596
                                        = { "##undef" };
 
1597
 
 
1598
@@ -8536,10 +8615,27 @@
 
1599
 
 
1600
        /* wait for completion of abort */
 
1601
        ZFCP_LOG_DEBUG("Waiting for cleanup....\n");
 
1602
+#ifdef ZFCP_DEBUG_ABORTS
 
1603
+       /* FIXME: copying zfcp_fsf_req_wait_and_cleanup code is not really nice */
 
1604
+       __wait_event(
 
1605
+               new_fsf_req->completion_wq,
 
1606
+               new_fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
 
1607
+       status = new_fsf_req->status;
 
1608
+       dbf_fsf_status = new_fsf_req->qtcb->header.fsf_status;
 
1609
+       /*
 
1610
+        * Ralphs special debug load provides timestamps in the FSF
 
1611
+        * status qualifier. This might be specified later if being
 
1612
+        * useful for debugging aborts.
 
1613
+        */
 
1614
+       dbf_fsf_qual[0] = *(u64*)&new_fsf_req->qtcb->header.fsf_status_qual.word[0];
 
1615
+       dbf_fsf_qual[1] = *(u64*)&new_fsf_req->qtcb->header.fsf_status_qual.word[2];
 
1616
+       retval = zfcp_fsf_req_cleanup(new_fsf_req);
 
1617
+#else
 
1618
        retval = zfcp_fsf_req_wait_and_cleanup(
 
1619
                        new_fsf_req,
 
1620
                        ZFCP_UNINTERRUPTIBLE,
 
1621
                        &status);
 
1622
+#endif
 
1623
        ZFCP_LOG_DEBUG(
 
1624
                "Waiting for cleanup complete, status=0x%x\n",
 
1625
                status);
 
1626
@@ -8557,14 +8653,17 @@
 
1627
 
 
1628
 out:
 
1629
 #ifdef ZFCP_DEBUG_ABORTS
 
1630
-       debug_event(adapter->abort_dbf, 1, &dbf_scsi_cmnd, sizeof(unsigned long));
 
1631
+       debug_event(adapter->abort_dbf, 1, &dbf_scsi_cmnd, sizeof(u64));
 
1632
        debug_event(adapter->abort_dbf, 1, &dbf_opcode, ZFCP_ABORT_DBF_LENGTH);
 
1633
        debug_event(adapter->abort_dbf, 1, &dbf_wwn, sizeof(wwn_t));
 
1634
        debug_event(adapter->abort_dbf, 1, &dbf_fcp_lun, sizeof(fcp_lun_t));
 
1635
-       debug_event(adapter->abort_dbf, 1, &dbf_retries, sizeof(unsigned long));
 
1636
-       debug_event(adapter->abort_dbf, 1, &dbf_allowed, sizeof(unsigned long));
 
1637
-       debug_event(adapter->abort_dbf, 1, &dbf_timeout, sizeof(unsigned long));
 
1638
-       debug_event(adapter->abort_dbf, 1, &dbf_fsf_req, sizeof(unsigned long));
 
1639
+       debug_event(adapter->abort_dbf, 1, &dbf_retries, sizeof(u64));
 
1640
+       debug_event(adapter->abort_dbf, 1, &dbf_allowed, sizeof(u64));
 
1641
+       debug_event(adapter->abort_dbf, 1, &dbf_timeout, sizeof(u64));
 
1642
+       debug_event(adapter->abort_dbf, 1, &dbf_fsf_req, sizeof(u64));
 
1643
+       debug_event(adapter->abort_dbf, 1, &dbf_fsf_status, sizeof(u64));
 
1644
+       debug_event(adapter->abort_dbf, 1, &dbf_fsf_qual[0], sizeof(u64));
 
1645
+       debug_event(adapter->abort_dbf, 1, &dbf_fsf_qual[1], sizeof(u64));
 
1646
        debug_text_event(adapter->abort_dbf, 1, dbf_result);
 
1647
 #endif
 
1648
 
 
1649
@@ -9784,50 +9883,47 @@
 
1650
  */
 
1651
 inline static void zfcp_activate_adapter(int irq)
 
1652
 {
 
1653
-#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_SCSI
 
1654
-#define ZFCP_LOG_AREA_PREFIX           ZFCP_LOG_AREA_PREFIX_SCSI
 
1655
+#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_DIO
 
1656
+#define ZFCP_LOG_AREA_PREFIX           ZFCP_LOG_AREA_PREFIX_DIO
 
1657
 
 
1658
-        int devno;
 
1659
-        zfcp_adapter_t *adapter;
 
1660
+       int devno;
 
1661
+       zfcp_adapter_t *adapter;
 
1662
 
 
1663
-       ZFCP_LOG_TRACE("enter (irq=%i\n", irq);
 
1664
-        
 
1665
-        devno=get_devno_by_irq(irq);
 
1666
-        ZFCP_LOG_TRACE("devno is 0x%4.4x",devno);
 
1667
-        /* Find the new adapter and open it */
 
1668
-        ZFCP_FOR_EACH_ADAPTER(adapter) {
 
1669
-                if (adapter->devno == devno)
 
1670
-                       break;
 
1671
-        }
 
1672
-        if (adapter->devno != devno) {
 
1673
-                ZFCP_LOG_DEBUG(
 
1674
-                       "An unconfigured adapter has become"
 
1675
+       ZFCP_LOG_TRACE("enter (irq=%i)\n", irq);
 
1676
+
 
1677
+       devno = get_devno_by_irq(irq);
 
1678
+       ZFCP_LOG_TRACE("devno is 0x%4.4x\n",devno);
 
1679
+
 
1680
+       /* Find the new adapter and open it */
 
1681
+       ZFCP_FOR_EACH_ADAPTER(adapter) {
 
1682
+               if (adapter->devno == devno) {
 
1683
+                       ZFCP_LOG_INFO(
 
1684
+                               "The adapter with devno 0x%4.4x "
 
1685
+                               "will now be activated.\n",
 
1686
+                               devno);
 
1687
+                       debug_text_event(adapter->erp_dbf,1,"activate");
 
1688
+                       zfcp_erp_modify_adapter_status(
 
1689
+                               adapter,
 
1690
+                               ZFCP_STATUS_COMMON_RUNNING,
 
1691
+                               ZFCP_SET);
 
1692
+                       zfcp_erp_adapter_reopen(
 
1693
+                               adapter,
 
1694
+                               ZFCP_STATUS_COMMON_ERP_FAILED);
 
1695
+               }
 
1696
+       }
 
1697
+       if (!adapter)
 
1698
+               ZFCP_LOG_DEBUG(
 
1699
+                       "An unconfigured adapter has become "
 
1700
                        "active, it's devno 0x%4.4x.\n",
 
1701
                        devno);
 
1702
-                goto out;
 
1703
-        }
 
1704
-        ZFCP_LOG_INFO(
 
1705
-               "The adapter with devno 0x%4.4x will now "
 
1706
-               "be activated.\n",
 
1707
-               adapter->devno);
 
1708
-        zfcp_erp_modify_adapter_status(
 
1709
-                   adapter,
 
1710
-                   ZFCP_STATUS_COMMON_RUNNING,
 
1711
-                   ZFCP_SET);
 
1712
-        debug_text_event(adapter->erp_dbf,1,"activate");
 
1713
-        zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
 
1714
-out:
 
1715
 
 
1716
        ZFCP_LOG_TRACE("exit\n");
 
1717
 
 
1718
-       return;
 
1719
-
 
1720
 #undef ZFCP_LOG_AREA
 
1721
 #undef ZFCP_LOG_AREA_PREFIX
 
1722
 }
 
1723
 
 
1724
 
 
1725
-
 
1726
 /*
 
1727
  * function:   zfcp_dio_oper_handler
 
1728
  *
 
1729
@@ -9837,8 +9933,8 @@
 
1730
  */
 
1731
 static int zfcp_dio_oper_handler(int irq, devreg_t *dreg)
 
1732
 {
 
1733
-#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_SCSI
 
1734
-#define ZFCP_LOG_AREA_PREFIX           ZFCP_LOG_AREA_PREFIX_SCSI
 
1735
+#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_DIO
 
1736
+#define ZFCP_LOG_AREA_PREFIX           ZFCP_LOG_AREA_PREFIX_DIO
 
1737
 
 
1738
        int retval = 0;
 
1739
 
 
1740
@@ -9866,8 +9962,8 @@
 
1741
  */
 
1742
 static void zfcp_dio_not_oper_handler(int irq,  int status)
 
1743
 {
 
1744
-#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_SCSI
 
1745
-#define ZFCP_LOG_AREA_PREFIX           ZFCP_LOG_AREA_PREFIX_SCSI
 
1746
+#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_DIO
 
1747
+#define ZFCP_LOG_AREA_PREFIX           ZFCP_LOG_AREA_PREFIX_DIO
 
1748
         
 
1749
         zfcp_adapter_t *adapter;
 
1750
         int known=0;
 
1751
@@ -9953,8 +10049,8 @@
 
1752
  */
 
1753
 static void zfcp_cio_handler(int irq, void *devstat, struct pt_regs *rgs)
 
1754
 {
 
1755
-#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_SCSI
 
1756
-#define ZFCP_LOG_AREA_PREFIX           ZFCP_LOG_AREA_PREFIX_SCSI
 
1757
+#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_DIO
 
1758
+#define ZFCP_LOG_AREA_PREFIX           ZFCP_LOG_AREA_PREFIX_DIO
 
1759
 
 
1760
        ZFCP_LOG_TRACE(
 
1761
                "enter (irq=%i, devstat=0%lx, pt_regs=0%lx)\n",
 
1762
@@ -10812,6 +10908,69 @@
 
1763
 }
 
1764
 
 
1765
 
 
1766
+static int zfcp_fsf_status_read_port_closed(zfcp_fsf_req_t *fsf_req)
 
1767
+{
 
1768
+#define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_FSF
 
1769
+#define ZFCP_LOG_AREA_PREFIX            ZFCP_LOG_AREA_PREFIX_FSF
 
1770
+
 
1771
+       fsf_status_read_buffer_t *status_buffer = fsf_req->data.status_read.buffer;
 
1772
+       zfcp_adapter_t *adapter = fsf_req->adapter;
 
1773
+       unsigned long flags;
 
1774
+       zfcp_port_t *port;
 
1775
+
 
1776
+       ZFCP_WRITE_LOCK_IRQSAVE(&adapter->port_list_lock, flags);
 
1777
+       ZFCP_FOR_EACH_PORT (adapter, port)
 
1778
+               if (port->d_id == (status_buffer->d_id & ZFCP_DID_MASK))
 
1779
+                       break;
 
1780
+       ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->port_list_lock, flags);
 
1781
+
 
1782
+       if (!port) {
 
1783
+               ZFCP_LOG_NORMAL(
 
1784
+                       "bug: Re-open port indication received for the "
 
1785
+                       "non-existing port with DID 0x%3.3x, on the adapter "
 
1786
+                       "with devno 0x%4.4x. Ignored.\n",
 
1787
+                       status_buffer->d_id & ZFCP_DID_MASK,
 
1788
+                       adapter->devno);
 
1789
+               goto out;
 
1790
+       }
 
1791
+
 
1792
+       switch (status_buffer->status_subtype) {
 
1793
+
 
1794
+               case FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT:
 
1795
+                       ZFCP_LOG_FLAGS(2, "FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT\n");
 
1796
+                       debug_text_event(adapter->erp_dbf, 3, "unsol_pc_phys:");
 
1797
+                       zfcp_erp_port_reopen(port, 0);
 
1798
+                       break;
 
1799
+
 
1800
+               case FSF_STATUS_READ_SUB_ERROR_PORT:
 
1801
+                       ZFCP_LOG_FLAGS(1,"FSF_STATUS_READ_SUB_ERROR_PORT\n");
 
1802
+                       debug_text_event(adapter->erp_dbf, 1, "unsol_pc_err:");
 
1803
+                       zfcp_erp_port_shutdown(port, 0);
 
1804
+                       break;
 
1805
+
 
1806
+               default:
 
1807
+                       debug_text_event(adapter->erp_dbf, 0, "unsol_unk_sub:");
 
1808
+                       debug_exception(
 
1809
+                               adapter->erp_dbf, 0,
 
1810
+                               &status_buffer->status_subtype, sizeof(u32));
 
1811
+                       ZFCP_LOG_NORMAL(
 
1812
+                               "bug: Undefined status subtype received "
 
1813
+                               "for a re-open indication on the port with "
 
1814
+                               "DID 0x%3.3x, on the adapter with devno "
 
1815
+                               "0x%4.4x. Ignored. (debug info 0x%x)\n",
 
1816
+                               status_buffer->d_id,
 
1817
+                               adapter->devno,
 
1818
+                               status_buffer->status_subtype);
 
1819
+       }
 
1820
+
 
1821
+out:
 
1822
+       return 0;
 
1823
+
 
1824
+#undef ZFCP_LOG_AREA
 
1825
+#undef ZFCP_LOG_AREA_PREFIX
 
1826
+}
 
1827
+
 
1828
+
 
1829
 /*
 
1830
  * function:    zfcp_fsf_status_read_handler
 
1831
  *
 
1832
@@ -10826,8 +10985,6 @@
 
1833
  
 
1834
        int retval = 0;
 
1835
         zfcp_adapter_t *adapter = fsf_req->adapter;
 
1836
-        zfcp_port_t *port;
 
1837
-        unsigned long flags;
 
1838
         fsf_status_read_buffer_t *status_buffer = fsf_req->data.status_read.buffer; 
 
1839
 
 
1840
        ZFCP_LOG_TRACE(
 
1841
@@ -10853,56 +11010,13 @@
 
1842
                 debug_event(adapter->erp_dbf,3,
 
1843
                             &status_buffer->d_id,
 
1844
                             sizeof(u32));
 
1845
-               ZFCP_WRITE_LOCK_IRQSAVE(&adapter->port_list_lock, flags);
 
1846
-               ZFCP_FOR_EACH_PORT (adapter, port) {
 
1847
-                        if(port->d_id==((status_buffer->d_id)
 
1848
-                           & ZFCP_DID_MASK)) {
 
1849
-                                break;
 
1850
-                        }
 
1851
-                }
 
1852
-               ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->port_list_lock, flags);
 
1853
-                if(port->d_id!=((status_buffer->d_id)
 
1854
-                   & ZFCP_DID_MASK)) {
 
1855
-                        ZFCP_LOG_NORMAL("bug: Re-open port indication received "
 
1856
-                                        "for the non-existing port with DID "
 
1857
-                                        "0x%3.3x, on the adapter with devno "
 
1858
-                                        "0x%4.4x. Ignored.\n",
 
1859
-                                        status_buffer->d_id,
 
1860
-                                        adapter->devno);
 
1861
-                } else {
 
1862
-                        switch(status_buffer->status_subtype) {
 
1863
-                                
 
1864
-                        case FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT:
 
1865
-                                ZFCP_LOG_FLAGS(2,"FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT\n");
 
1866
-                                debug_text_event(adapter->erp_dbf,3,"unsol_pc_phys:");
 
1867
-                                zfcp_erp_port_reopen(port,0);
 
1868
-                                break;
 
1869
-                        case FSF_STATUS_READ_SUB_ERROR_PORT:
 
1870
-                                ZFCP_LOG_FLAGS(1,"FSF_STATUS_READ_SUB_ERROR_PORT\n");
 
1871
-                                debug_text_event(adapter->erp_dbf,1,"unsol_pc_err:");
 
1872
-                                zfcp_erp_port_shutdown(port, 0);
 
1873
-                                break;
 
1874
-                        default:
 
1875
-                                debug_text_event(adapter->erp_dbf,0,"unsol_unk_sub:");
 
1876
-                                debug_exception(adapter->erp_dbf,0,
 
1877
-                                            &status_buffer->status_subtype,
 
1878
-                                            sizeof(u32));
 
1879
-                                ZFCP_LOG_NORMAL("bug: Undefined status subtype received "
 
1880
-                                                "for a re-open indication on the port with DID "
 
1881
-                                                "0x%3.3x, on the adapter with devno "
 
1882
-                                                "0x%4.4x. Ignored. (debug info 0x%x)\n",
 
1883
-                                                status_buffer->d_id,
 
1884
-                                                adapter->devno,
 
1885
-                                                status_buffer->status_subtype);
 
1886
-                        break;
 
1887
-                        } // switch
 
1888
-                }
 
1889
+               zfcp_fsf_status_read_port_closed(fsf_req);
 
1890
                break;
 
1891
 
 
1892
        case FSF_STATUS_READ_INCOMING_ELS:
 
1893
                 ZFCP_LOG_FLAGS(1,"FSF_STATUS_READ_INCOMING_ELS\n");
 
1894
                 debug_text_event(adapter->erp_dbf,3,"unsol_els:");
 
1895
-                zfcp_fsf_els_processing(fsf_req);
 
1896
+                zfcp_fsf_incoming_els(fsf_req);
 
1897
                break;
 
1898
 
 
1899
         case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
 
1900
@@ -10917,7 +11031,7 @@
 
1901
                 
 
1902
         case FSF_STATUS_READ_LINK_DOWN:
 
1903
                 ZFCP_LOG_FLAGS(1,"FSF_STATUS_READ_LINK_DOWN\n");
 
1904
-                /* Unneccessary, igonoring.... */
 
1905
+                /* Unneccessary, ignoring.... */
 
1906
                 break;
 
1907
                 
 
1908
         case FSF_STATUS_READ_LINK_UP:
 
1909
@@ -10947,13 +11061,14 @@
 
1910
                                "type was received by the zfcp-driver "
 
1911
                                "(debug info 0x%x)\n",
 
1912
                                 status_buffer->status_type);
 
1913
-                ZFCP_LOG_NORMAL("Dump of status_read_buffer 0x%lx:\n", 
 
1914
+                ZFCP_LOG_DEBUG("Dump of status_read_buffer 0x%lx:\n", 
 
1915
                               (unsigned long)status_buffer);
 
1916
-                ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, 
 
1917
+                ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, 
 
1918
                               (char*)status_buffer,
 
1919
                               sizeof(fsf_status_read_buffer_t));
 
1920
                 break;
 
1921
        }
 
1922
+
 
1923
        zfcp_mem_pool_return(status_buffer, &adapter->pool.status_read_buf);
 
1924
         if (zfcp_fsf_req_cleanup(fsf_req)) {
 
1925
                 ZFCP_LOG_NORMAL("bug: Could not remove one FSF "
 
1926
@@ -10999,14 +11114,8 @@
 
1927
 }
 
1928
 
 
1929
 
 
1930
-/*
 
1931
- * function:    zfcp_fsf_rscn_processing
 
1932
- *
 
1933
- * purpose:    tells FSF to abort a running SCSI command
 
1934
- *
 
1935
- */
 
1936
-inline void zfcp_fsf_rscn_processing(
 
1937
-               zfcp_fsf_req_t *fsf_req,
 
1938
+void zfcp_fsf_incoming_els_rscn(
 
1939
+               zfcp_adapter_t *adapter,
 
1940
                fsf_status_read_buffer_t *status_buffer) 
 
1941
 {
 
1942
 #define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_FSF
 
1943
@@ -11026,6 +11135,8 @@
 
1944
         /* see FC-FS */
 
1945
         int no_entries=(fcp_rscn_head->payload_len / 4);
 
1946
 
 
1947
+       zfcp_in_els_dbf_event(adapter, "##rscn", status_buffer, fcp_rscn_head->payload_len);
 
1948
+
 
1949
         for (i=1; i < no_entries; i++) {
 
1950
                 /* skip head and start with 1st element */
 
1951
                 fcp_rscn_element++;
 
1952
@@ -11056,8 +11167,8 @@
 
1953
                         break;
 
1954
                 }
 
1955
                 known=0;
 
1956
-                ZFCP_WRITE_LOCK_IRQSAVE(&fsf_req->adapter->port_list_lock, flags);
 
1957
-                ZFCP_FOR_EACH_PORT (fsf_req->adapter, port) {
 
1958
+                ZFCP_WRITE_LOCK_IRQSAVE(&adapter->port_list_lock, flags);
 
1959
+                ZFCP_FOR_EACH_PORT (adapter, port) {
 
1960
                         if (!atomic_test_mask(ZFCP_STATUS_PORT_DID_DID, &port->status)) {
 
1961
                                 continue;
 
1962
                         }
 
1963
@@ -11069,10 +11180,11 @@
 
1964
                                        known,
 
1965
                                        fcp_rscn_element->nport_did);
 
1966
 #endif
 
1967
+                               debug_text_event(adapter->erp_dbf,1,"unsol_els_rscnk:");
 
1968
                                 zfcp_erp_port_reopen(port, 0);
 
1969
                         }
 
1970
                 }
 
1971
-                ZFCP_WRITE_UNLOCK_IRQRESTORE(&fsf_req->adapter->port_list_lock, flags);
 
1972
+                ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->port_list_lock, flags);
 
1973
 #if 0
 
1974
                 printk("known %d, no_notifications %d\n",
 
1975
                        known, no_notifications);
 
1976
@@ -11087,21 +11199,21 @@
 
1977
         if(reopen_unknown) {
 
1978
                 ZFCP_LOG_DEBUG("At least one unknown did "
 
1979
                               "underwent a state change.\n");
 
1980
-                ZFCP_WRITE_LOCK_IRQSAVE(&fsf_req->adapter->port_list_lock, flags);
 
1981
-                ZFCP_FOR_EACH_PORT (fsf_req->adapter, port) {
 
1982
+                ZFCP_WRITE_LOCK_IRQSAVE(&adapter->port_list_lock, flags);
 
1983
+                ZFCP_FOR_EACH_PORT (adapter, port) {
 
1984
                         if (!atomic_test_mask((ZFCP_STATUS_PORT_DID_DID 
 
1985
                                               | ZFCP_STATUS_PORT_NAMESERVER), 
 
1986
                                               &port->status)) {
 
1987
-                                /*INFO*/
 
1988
-                                ZFCP_LOG_NORMAL("Received state change notification."
 
1989
+                                ZFCP_LOG_INFO("Received state change notification."
 
1990
                                                 "Trying to open the port with wwpn "
 
1991
                                                 "0x%Lx. Hope it's there now.\n",
 
1992
                                                 (llui_t)port->wwpn);
 
1993
+                               debug_text_event(adapter->erp_dbf,1,"unsol_els_rscnu:");
 
1994
                                 zfcp_erp_port_reopen(port, 
 
1995
                                                      ZFCP_STATUS_COMMON_ERP_FAILED);
 
1996
                         }
 
1997
                 }
 
1998
-                ZFCP_WRITE_UNLOCK_IRQRESTORE(&fsf_req->adapter->port_list_lock, flags);
 
1999
+                ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->port_list_lock, flags);
 
2000
         }
 
2001
 
 
2002
 #undef ZFCP_LOG_AREA
 
2003
@@ -11109,96 +11221,126 @@
 
2004
 }
 
2005
 
 
2006
 
 
2007
-/*
 
2008
- * function:    zfcp_fsf_els_processing
 
2009
- *
 
2010
- * purpose:    tells FSF to abort a running SCSI command
 
2011
- *
 
2012
- */
 
2013
-inline void zfcp_fsf_els_processing(zfcp_fsf_req_t *fsf_req) 
 
2014
+void zfcp_fsf_incoming_els_plogi(
 
2015
+               zfcp_adapter_t *adapter,
 
2016
+               fsf_status_read_buffer_t *status_buffer)
 
2017
 {
 
2018
 #define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_FSF
 
2019
 #define ZFCP_LOG_AREA_PREFIX            ZFCP_LOG_AREA_PREFIX_FSF
 
2020
-        fsf_status_read_buffer_t *status_buffer = fsf_req->data.status_read.buffer; 
 
2021
-        u32 els_type=*(u32 *)(status_buffer->payload);
 
2022
-        zfcp_adapter_t *adapter=fsf_req->adapter;
 
2023
-        zfcp_port_t *port;
 
2024
-        unsigned long flags;
 
2025
 
 
2026
-        /* see fcp.h, it's ugly, but it's there */
 
2027
-        logi *els_logi=NULL;
 
2028
-        /* there seems to be no linux define for this */
 
2029
-        fcp_logo_t *els_logo=NULL;
 
2030
-        
 
2031
-        if(els_type==LS_PLOGI) {
 
2032
-                ZFCP_LOG_FLAGS(2,"LS_PLOGI\n");
 
2033
-                els_logi=(logi *)status_buffer->payload;
 
2034
-                debug_text_event(adapter->erp_dbf,1,"unsol_els_plogi:");
 
2035
-                debug_event(adapter->erp_dbf,1,
 
2036
-                            &els_logi->nport_wwn,
 
2037
-                            sizeof(u32));
 
2038
-               ZFCP_WRITE_LOCK_IRQSAVE(&adapter->port_list_lock, flags);
 
2039
-               ZFCP_FOR_EACH_PORT (adapter, port) {
 
2040
-                        if(port->wwpn == (*(wwn_t *)&els_logi->nport_wwn))
 
2041
-                                break;
 
2042
-                }
 
2043
-               ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->port_list_lock, flags);
 
2044
-                if(port->wwpn != (*(wwn_t*)&els_logi->nport_wwn)) {
 
2045
-                        ZFCP_LOG_DEBUG("Re-open port indication received "
 
2046
-                                       "for the non-existing port with DID "
 
2047
-                                       "0x%3.3x, on the adapter with devno "
 
2048
-                                       "0x%4.4x. Ignored.\n",
 
2049
-                                       status_buffer->d_id,
 
2050
-                                       adapter->devno);
 
2051
-                } else {
 
2052
-                        zfcp_erp_port_forced_reopen(port,0);
 
2053
-                }               
 
2054
-                goto out;
 
2055
-        }
 
2056
-        if(els_type==LS_LOGO) {
 
2057
-                ZFCP_LOG_FLAGS(2,"LS_LOGO\n");
 
2058
-                els_logo=(fcp_logo_t *)status_buffer->payload;
 
2059
-                debug_text_event(adapter->erp_dbf,1,"unsol_els_logo");
 
2060
-                debug_event(adapter->erp_dbf,1,
 
2061
-                            &els_logo->nport_wwpn,
 
2062
-                            sizeof(u32));
 
2063
-               ZFCP_WRITE_LOCK_IRQSAVE(&adapter->port_list_lock, flags);
 
2064
-               ZFCP_FOR_EACH_PORT (adapter, port) {
 
2065
-                        if(port->wwpn==els_logo->nport_wwpn)
 
2066
-                                break;
 
2067
-                }
 
2068
-               ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->port_list_lock, flags);
 
2069
-                if(port->wwpn!=els_logo->nport_wwpn) {
 
2070
-                        ZFCP_LOG_DEBUG("Re-open port indication received "
 
2071
-                                       "for the non-existing port with DID "
 
2072
-                                       "0x%3.3x, on the adapter with devno "
 
2073
-                                       "0x%4.4x. Ignored.\n",
 
2074
-                                       status_buffer->d_id,
 
2075
-                                       adapter->devno);
 
2076
-                } else {
 
2077
-                        zfcp_erp_port_forced_reopen(port,0);
 
2078
-                }               
 
2079
-                goto out;
 
2080
-        }
 
2081
-        /* we are only concerned with the command, not the length */
 
2082
-        if((els_type & 0xffff0000) == LS_RSCN) {
 
2083
-                ZFCP_LOG_FLAGS(2,"LS_RSCN\n");
 
2084
-                debug_text_event(adapter->erp_dbf,1,"unsol_els_rscn:");
 
2085
-                zfcp_fsf_rscn_processing(fsf_req, status_buffer);
 
2086
-                goto out;
 
2087
-        }
 
2088
+       logi *els_logi = (logi*) status_buffer->payload;
 
2089
+       zfcp_port_t *port;
 
2090
+       unsigned long flags;
 
2091
 
 
2092
-        ZFCP_LOG_INFO("Unknown Incoming ELS received:\n");
 
2093
-        ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO, 
 
2094
-                      (char *)status_buffer->payload,
 
2095
-                      FSF_STATUS_READ_PAYLOAD_SIZE);
 
2096
- out: 
 
2097
-       return;
 
2098
+       zfcp_in_els_dbf_event(adapter, "##plogi", status_buffer, 28);
 
2099
+
 
2100
+       ZFCP_WRITE_LOCK_IRQSAVE(&adapter->port_list_lock, flags);
 
2101
+       ZFCP_FOR_EACH_PORT(adapter, port) {
 
2102
+               if (port->wwpn == (*(wwn_t *)&els_logi->nport_wwn))
 
2103
+                       break;
 
2104
+       }
 
2105
+       ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->port_list_lock, flags);
 
2106
+
 
2107
+       if (!port) {
 
2108
+               ZFCP_LOG_DEBUG(
 
2109
+                       "Re-open port indication received "
 
2110
+                       "for the non-existing port with D_ID "
 
2111
+                       "0x%3.3x, on the adapter with devno "
 
2112
+                       "0x%4.4x. Ignored.\n",
 
2113
+                       status_buffer->d_id,
 
2114
+                       adapter->devno);
 
2115
+       } else  {
 
2116
+               debug_text_event(adapter->erp_dbf, 1, "unsol_els_plogi:");
 
2117
+               debug_event(adapter->erp_dbf, 1, &els_logi->nport_wwn, 8);
 
2118
+               zfcp_erp_port_forced_reopen(port, 0);
 
2119
+       }
 
2120
 
 
2121
 #undef ZFCP_LOG_AREA
 
2122
 #undef ZFCP_LOG_AREA_PREFIX
 
2123
 }
 
2124
 
 
2125
+
 
2126
+void zfcp_fsf_incoming_els_logo(
 
2127
+               zfcp_adapter_t *adapter,
 
2128
+               fsf_status_read_buffer_t *status_buffer)
 
2129
+{
 
2130
+#define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_FSF
 
2131
+#define ZFCP_LOG_AREA_PREFIX            ZFCP_LOG_AREA_PREFIX_FSF
 
2132
+
 
2133
+       fcp_logo_t *els_logo = (fcp_logo_t*) status_buffer->payload;
 
2134
+       zfcp_port_t *port;
 
2135
+       unsigned long flags;
 
2136
+
 
2137
+       zfcp_in_els_dbf_event(adapter, "##logo", status_buffer, 16);
 
2138
+
 
2139
+       ZFCP_WRITE_LOCK_IRQSAVE(&adapter->port_list_lock, flags);
 
2140
+       ZFCP_FOR_EACH_PORT(adapter, port) {
 
2141
+               if (port->wwpn == els_logo->nport_wwpn)
 
2142
+                       break;
 
2143
+       }
 
2144
+       ZFCP_WRITE_UNLOCK_IRQRESTORE(&adapter->port_list_lock, flags);
 
2145
+
 
2146
+       if (!port) {
 
2147
+               ZFCP_LOG_DEBUG(
 
2148
+                       "Re-open port indication received "
 
2149
+                       "for the non-existing port with D_ID "
 
2150
+                       "0x%3.3x, on the adapter with devno "
 
2151
+                       "0x%4.4x. Ignored.\n",
 
2152
+                       status_buffer->d_id,
 
2153
+                       adapter->devno);
 
2154
+       } else  {
 
2155
+               debug_text_event(adapter->erp_dbf, 1, "unsol_els_logo:");
 
2156
+               debug_event(adapter->erp_dbf, 1, &els_logo->nport_wwpn, 8);
 
2157
+               zfcp_erp_port_forced_reopen(port, 0);
 
2158
+       }
 
2159
+
 
2160
+#undef ZFCP_LOG_AREA
 
2161
+#undef ZFCP_LOG_AREA_PREFIX
 
2162
+}
 
2163
+
 
2164
+
 
2165
+void zfcp_fsf_incoming_els_unknown(
 
2166
+               zfcp_adapter_t *adapter,
 
2167
+               fsf_status_read_buffer_t *status_buffer)
 
2168
+{
 
2169
+#define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_FSF
 
2170
+#define ZFCP_LOG_AREA_PREFIX            ZFCP_LOG_AREA_PREFIX_FSF
 
2171
+
 
2172
+       zfcp_in_els_dbf_event(adapter, "##undef", status_buffer, 24);
 
2173
+       ZFCP_LOG_NORMAL(
 
2174
+               "warning: Unknown incoming ELS (0x%x) received "
 
2175
+               "for the adapter with devno 0x%4.4x\n",
 
2176
+               *(u32*)(status_buffer->payload),
 
2177
+               adapter->devno);
 
2178
+
 
2179
+#undef ZFCP_LOG_AREA
 
2180
+#undef ZFCP_LOG_AREA_PREFIX
 
2181
+}
 
2182
+
 
2183
+
 
2184
+void zfcp_fsf_incoming_els(zfcp_fsf_req_t *fsf_req) 
 
2185
+{
 
2186
+#define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_FSF
 
2187
+#define ZFCP_LOG_AREA_PREFIX            ZFCP_LOG_AREA_PREFIX_FSF
 
2188
+
 
2189
+       fsf_status_read_buffer_t *status_buffer = fsf_req->data.status_read.buffer; 
 
2190
+       u32 els_type = *(u32*)(status_buffer->payload);
 
2191
+       zfcp_adapter_t *adapter = fsf_req->adapter;
 
2192
+
 
2193
+       if (els_type == LS_PLOGI)
 
2194
+               zfcp_fsf_incoming_els_plogi(adapter, status_buffer);
 
2195
+       else if (els_type == LS_LOGO)
 
2196
+               zfcp_fsf_incoming_els_logo(adapter, status_buffer);
 
2197
+       else if ((els_type & 0xffff0000) == LS_RSCN)
 
2198
+               /* we are only concerned with the command, not the length */
 
2199
+               zfcp_fsf_incoming_els_rscn(adapter, status_buffer);
 
2200
+       else    zfcp_fsf_incoming_els_unknown(adapter, status_buffer);
 
2201
+
 
2202
+#undef ZFCP_LOG_AREA
 
2203
+#undef ZFCP_LOG_AREA_PREFIX
 
2204
+}
 
2205
+
 
2206
+
 
2207
 /*
 
2208
  * function:    zfcp_fsf_start_scsi_er_timer
 
2209
  *
 
2210
@@ -11253,7 +11395,7 @@
 
2211
        int retval = 0;
 
2212
        unsigned long lock_flags;
 
2213
  
 
2214
-       ZFCP_LOG_DEBUG(
 
2215
+       ZFCP_LOG_TRACE(
 
2216
                "enter (old_req_id=0x%lx, adapter=0x%lx, "
 
2217
                "unit=0x%lx, req_flags=0x%x)\n",
 
2218
                old_req_id,
 
2219
@@ -11356,8 +11498,8 @@
 
2220
        int retval = -EINVAL;
 
2221
        zfcp_unit_t *unit = new_fsf_req->data.abort_fcp_command.unit;
 
2222
         unsigned char status_qual = new_fsf_req->qtcb->header.fsf_status_qual.word[0];
 
2223
-        /*TRACE */
 
2224
-       ZFCP_LOG_NORMAL(
 
2225
+
 
2226
+       ZFCP_LOG_TRACE(
 
2227
                "enter (new_fsf_req=0x%lx)\n",
 
2228
                (unsigned long)new_fsf_req);
 
2229