blob: 27991b69205625cb9c8d11e12321647b8ee272b4 [file] [log] [blame]
Horst Hummel138c0142006-06-29 14:58:12 +02001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * File...........: linux/drivers/s390/block/dasd_3990_erp.c
Horst Hummel138c0142006-06-29 14:58:12 +02003 * Author(s)......: Horst Hummel <Horst.Hummel@de.ibm.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * Holger Smolinski <Holger.Smolinski@de.ibm.com>
5 * Bugreports.to..: <Linux390@de.ibm.com>
6 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001
7 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
9
Stefan Haberlandfc19f382009-03-26 15:23:49 +010010#define KMSG_COMPONENT "dasd"
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/timer.h>
13#include <linux/slab.h>
14#include <asm/idals.h>
15#include <asm/todclk.h>
16
17#define PRINTK_HEADER "dasd_erp(3990): "
18
19#include "dasd_int.h"
20#include "dasd_eckd.h"
21
22
23struct DCTL_data {
24 unsigned char subcommand; /* e.g Inhibit Write, Enable Write,... */
25 unsigned char modifier; /* Subcommand modifier */
26 unsigned short res; /* reserved */
27} __attribute__ ((packed));
28
29/*
Horst Hummel138c0142006-06-29 14:58:12 +020030 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 * SECTION ERP HANDLING
Horst Hummel138c0142006-06-29 14:58:12 +020032 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 */
34/*
Horst Hummel138c0142006-06-29 14:58:12 +020035 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 * 24 and 32 byte sense ERP functions
Horst Hummel138c0142006-06-29 14:58:12 +020037 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 */
39
40/*
Horst Hummel138c0142006-06-29 14:58:12 +020041 * DASD_3990_ERP_CLEANUP
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 *
43 * DESCRIPTION
44 * Removes the already build but not necessary ERP request and sets
45 * the status of the original cqr / erp to the given (final) status
46 *
47 * PARAMETER
48 * erp request to be blocked
Horst Hummel138c0142006-06-29 14:58:12 +020049 * final_status either DASD_CQR_DONE or DASD_CQR_FAILED
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 *
51 * RETURN VALUES
Horst Hummel138c0142006-06-29 14:58:12 +020052 * cqr original cqr
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 */
54static struct dasd_ccw_req *
55dasd_3990_erp_cleanup(struct dasd_ccw_req * erp, char final_status)
56{
57 struct dasd_ccw_req *cqr = erp->refers;
58
Stefan Weinhuber8e09f212008-01-26 14:11:23 +010059 dasd_free_erp_request(erp, erp->memdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 cqr->status = final_status;
61 return cqr;
62
63} /* end dasd_3990_erp_cleanup */
64
65/*
Horst Hummel138c0142006-06-29 14:58:12 +020066 * DASD_3990_ERP_BLOCK_QUEUE
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 *
68 * DESCRIPTION
69 * Block the given device request queue to prevent from further
70 * processing until the started timer has expired or an related
71 * interrupt was received.
72 */
73static void
74dasd_3990_erp_block_queue(struct dasd_ccw_req * erp, int expires)
75{
76
Stefan Weinhuber8e09f212008-01-26 14:11:23 +010077 struct dasd_device *device = erp->startdev;
78 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Stefan Haberlandfc19f382009-03-26 15:23:49 +010080 DBF_DEV_EVENT(DBF_INFO, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 "blocking request queue for %is", expires/HZ);
82
Stefan Weinhuber8e09f212008-01-26 14:11:23 +010083 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 device->stopped |= DASD_STOPPED_PENDING;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +010085 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
86 erp->status = DASD_CQR_FILLED;
87 dasd_block_set_timer(device->block, expires);
Linus Torvalds1da177e2005-04-16 15:20:36 -070088}
89
90/*
Horst Hummel138c0142006-06-29 14:58:12 +020091 * DASD_3990_ERP_INT_REQ
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 *
93 * DESCRIPTION
94 * Handles 'Intervention Required' error.
95 * This means either device offline or not installed.
96 *
97 * PARAMETER
98 * erp current erp
99 * RETURN VALUES
100 * erp modified erp
101 */
102static struct dasd_ccw_req *
103dasd_3990_erp_int_req(struct dasd_ccw_req * erp)
104{
105
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100106 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107
108 /* first time set initial retry counter and erp_function */
109 /* and retry once without blocking queue */
110 /* (this enables easier enqueing of the cqr) */
111 if (erp->function != dasd_3990_erp_int_req) {
112
113 erp->retries = 256;
114 erp->function = dasd_3990_erp_int_req;
115
116 } else {
117
118 /* issue a message and wait for 'device ready' interrupt */
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100119 dev_err(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 "is offline or not installed - "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100121 "INTERVENTION REQUIRED!!\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
123 dasd_3990_erp_block_queue(erp, 60*HZ);
124 }
125
126 return erp;
127
128} /* end dasd_3990_erp_int_req */
129
130/*
Horst Hummel138c0142006-06-29 14:58:12 +0200131 * DASD_3990_ERP_ALTERNATE_PATH
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 *
133 * DESCRIPTION
134 * Repeat the operation on a different channel path.
135 * If all alternate paths have been tried, the request is posted with a
136 * permanent error.
137 *
138 * PARAMETER
139 * erp pointer to the current ERP
140 *
141 * RETURN VALUES
142 * erp modified pointer to the ERP
143 */
144static void
145dasd_3990_erp_alternate_path(struct dasd_ccw_req * erp)
146{
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100147 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 __u8 opm;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100149 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150
151 /* try alternate valid path */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100152 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153 opm = ccw_device_get_path_mask(device->cdev);
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100154 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 //FIXME: start with get_opm ?
156 if (erp->lpm == 0)
157 erp->lpm = LPM_ANYPATH & ~(erp->irb.esw.esw0.sublog.lpum);
158 else
159 erp->lpm &= ~(erp->irb.esw.esw0.sublog.lpum);
160
161 if ((erp->lpm & opm) != 0x00) {
162
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100163 DBF_DEV_EVENT(DBF_WARNING, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 "try alternate lpm=%x (lpum=%x / opm=%x)",
165 erp->lpm, erp->irb.esw.esw0.sublog.lpum, opm);
166
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100167 /* reset status to submit the request again... */
168 erp->status = DASD_CQR_FILLED;
Stefan Haberland6c5f57c2008-02-05 16:50:46 +0100169 erp->retries = 10;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 } else {
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100171 dev_err(&device->cdev->dev,
172 "The DASD cannot be reached on any path (lpum=%x"
173 "/opm=%x)\n", erp->irb.esw.esw0.sublog.lpum, opm);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174
175 /* post request with permanent error */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100176 erp->status = DASD_CQR_FAILED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 }
178} /* end dasd_3990_erp_alternate_path */
179
180/*
181 * DASD_3990_ERP_DCTL
182 *
183 * DESCRIPTION
Horst Hummel138c0142006-06-29 14:58:12 +0200184 * Setup cqr to do the Diagnostic Control (DCTL) command with an
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 * Inhibit Write subcommand (0x20) and the given modifier.
186 *
187 * PARAMETER
188 * erp pointer to the current (failed) ERP
189 * modifier subcommand modifier
Horst Hummel138c0142006-06-29 14:58:12 +0200190 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 * RETURN VALUES
Horst Hummel138c0142006-06-29 14:58:12 +0200192 * dctl_cqr pointer to NEW dctl_cqr
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 *
194 */
195static struct dasd_ccw_req *
196dasd_3990_erp_DCTL(struct dasd_ccw_req * erp, char modifier)
197{
198
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100199 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 struct DCTL_data *DCTL_data;
201 struct ccw1 *ccw;
202 struct dasd_ccw_req *dctl_cqr;
203
204 dctl_cqr = dasd_alloc_erp_request((char *) &erp->magic, 1,
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100205 sizeof(struct DCTL_data),
206 device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 if (IS_ERR(dctl_cqr)) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100208 dev_err(&device->cdev->dev,
209 "Unable to allocate DCTL-CQR\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 erp->status = DASD_CQR_FAILED;
211 return erp;
212 }
213
214 DCTL_data = dctl_cqr->data;
215
216 DCTL_data->subcommand = 0x02; /* Inhibit Write */
217 DCTL_data->modifier = modifier;
218
219 ccw = dctl_cqr->cpaddr;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100220 memset(ccw, 0, sizeof(struct ccw1));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 ccw->cmd_code = CCW_CMD_DCTL;
222 ccw->count = 4;
223 ccw->cda = (__u32)(addr_t) DCTL_data;
224 dctl_cqr->function = dasd_3990_erp_DCTL;
225 dctl_cqr->refers = erp;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100226 dctl_cqr->startdev = device;
227 dctl_cqr->memdev = device;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 dctl_cqr->magic = erp->magic;
229 dctl_cqr->expires = 5 * 60 * HZ;
230 dctl_cqr->retries = 2;
231
232 dctl_cqr->buildclk = get_clock();
233
234 dctl_cqr->status = DASD_CQR_FILLED;
235
236 return dctl_cqr;
237
238} /* end dasd_3990_erp_DCTL */
239
240/*
Horst Hummel138c0142006-06-29 14:58:12 +0200241 * DASD_3990_ERP_ACTION_1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 *
243 * DESCRIPTION
244 * Setup ERP to do the ERP action 1 (see Reference manual).
245 * Repeat the operation on a different channel path.
246 * If all alternate paths have been tried, the request is posted with a
247 * permanent error.
248 * Note: duplex handling is not implemented (yet).
249 *
250 * PARAMETER
251 * erp pointer to the current ERP
252 *
253 * RETURN VALUES
254 * erp pointer to the ERP
255 *
256 */
257static struct dasd_ccw_req *
258dasd_3990_erp_action_1(struct dasd_ccw_req * erp)
259{
260
261 erp->function = dasd_3990_erp_action_1;
262
263 dasd_3990_erp_alternate_path(erp);
264
265 return erp;
266
267} /* end dasd_3990_erp_action_1 */
268
269/*
Horst Hummel138c0142006-06-29 14:58:12 +0200270 * DASD_3990_ERP_ACTION_4
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 *
272 * DESCRIPTION
273 * Setup ERP to do the ERP action 4 (see Reference manual).
274 * Set the current request to PENDING to block the CQR queue for that device
275 * until the state change interrupt appears.
276 * Use a timer (20 seconds) to retry the cqr if the interrupt is still
277 * missing.
278 *
279 * PARAMETER
280 * sense sense data of the actual error
281 * erp pointer to the current ERP
282 *
283 * RETURN VALUES
284 * erp pointer to the ERP
285 *
286 */
287static struct dasd_ccw_req *
288dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense)
289{
290
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100291 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292
293 /* first time set initial retry counter and erp_function */
294 /* and retry once without waiting for state change pending */
295 /* interrupt (this enables easier enqueing of the cqr) */
296 if (erp->function != dasd_3990_erp_action_4) {
297
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100298 DBF_DEV_EVENT(DBF_INFO, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 "dasd_3990_erp_action_4: first time retry");
300
301 erp->retries = 256;
302 erp->function = dasd_3990_erp_action_4;
303
304 } else {
Stefan Haberland6c5f57c2008-02-05 16:50:46 +0100305 if (sense && (sense[25] == 0x1D)) { /* state change pending */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100307 DBF_DEV_EVENT(DBF_INFO, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308 "waiting for state change pending "
309 "interrupt, %d retries left",
310 erp->retries);
Horst Hummel138c0142006-06-29 14:58:12 +0200311
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 dasd_3990_erp_block_queue(erp, 30*HZ);
313
Stefan Haberland6c5f57c2008-02-05 16:50:46 +0100314 } else if (sense && (sense[25] == 0x1E)) { /* busy */
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100315 DBF_DEV_EVENT(DBF_INFO, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316 "busy - redriving request later, "
317 "%d retries left",
318 erp->retries);
319 dasd_3990_erp_block_queue(erp, HZ);
320 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321 /* no state change pending - retry */
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100322 DBF_DEV_EVENT(DBF_INFO, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323 "redriving request immediately, "
Horst Hummel138c0142006-06-29 14:58:12 +0200324 "%d retries left",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325 erp->retries);
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100326 erp->status = DASD_CQR_FILLED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 }
328 }
329
330 return erp;
331
332} /* end dasd_3990_erp_action_4 */
333
334/*
Horst Hummel138c0142006-06-29 14:58:12 +0200335 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 * 24 byte sense ERP functions (only)
Horst Hummel138c0142006-06-29 14:58:12 +0200337 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338 */
339
340/*
Horst Hummel138c0142006-06-29 14:58:12 +0200341 * DASD_3990_ERP_ACTION_5
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 *
343 * DESCRIPTION
344 * Setup ERP to do the ERP action 5 (see Reference manual).
345 * NOTE: Further handling is done in xxx_further_erp after the retries.
346 *
347 * PARAMETER
348 * erp pointer to the current ERP
349 *
350 * RETURN VALUES
351 * erp pointer to the ERP
352 *
353 */
354static struct dasd_ccw_req *
355dasd_3990_erp_action_5(struct dasd_ccw_req * erp)
356{
357
358 /* first of all retry */
359 erp->retries = 10;
360 erp->function = dasd_3990_erp_action_5;
361
362 return erp;
363
364} /* end dasd_3990_erp_action_5 */
365
366/*
367 * DASD_3990_HANDLE_ENV_DATA
368 *
369 * DESCRIPTION
370 * Handles 24 byte 'Environmental data present'.
371 * Does a analysis of the sense data (message Format)
372 * and prints the error messages.
373 *
374 * PARAMETER
375 * sense current sense data
Horst Hummel138c0142006-06-29 14:58:12 +0200376 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 * RETURN VALUES
378 * void
379 */
380static void
381dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
382{
383
Stefan Weinhuber8e09f212008-01-26 14:11:23 +0100384 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385 char msg_format = (sense[7] & 0xF0);
386 char msg_no = (sense[7] & 0x0F);
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100387 char errorstring[ERRORLENGTH];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388
389 switch (msg_format) {
390 case 0x00: /* Format 0 - Program or System Checks */
391
392 if (sense[1] & 0x10) { /* check message to operator bit */
393
394 switch (msg_no) {
395 case 0x00: /* No Message */
396 break;
397 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100398 dev_warn(&device->cdev->dev,
399 "FORMAT 0 - Invalid Command\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 break;
401 case 0x02:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100402 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 "FORMAT 0 - Invalid Command "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100404 "Sequence\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 break;
406 case 0x03:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100407 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 "FORMAT 0 - CCW Count less than "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100409 "required\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410 break;
411 case 0x04:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100412 dev_warn(&device->cdev->dev,
413 "FORMAT 0 - Invalid Parameter\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 break;
415 case 0x05:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100416 dev_warn(&device->cdev->dev,
417 "FORMAT 0 - Diagnostic of Special"
418 " Command Violates File Mask\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 break;
420 case 0x07:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100421 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422 "FORMAT 0 - Channel Returned with "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100423 "Incorrect retry CCW\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 break;
425 case 0x08:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100426 dev_warn(&device->cdev->dev,
427 "FORMAT 0 - Reset Notification\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 break;
429 case 0x09:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100430 dev_warn(&device->cdev->dev,
431 "FORMAT 0 - Storage Path Restart\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 break;
433 case 0x0A:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100434 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435 "FORMAT 0 - Channel requested "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100436 "... %02x\n", sense[8]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 break;
438 case 0x0B:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100439 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 "FORMAT 0 - Invalid Defective/"
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100441 "Alternate Track Pointer\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 break;
443 case 0x0C:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100444 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 "FORMAT 0 - DPS Installation "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100446 "Check\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 break;
448 case 0x0E:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100449 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450 "FORMAT 0 - Command Invalid on "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100451 "Secondary Address\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452 break;
453 case 0x0F:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100454 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 "FORMAT 0 - Status Not As "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100456 "Required: reason %02x\n",
457 sense[8]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 break;
459 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100460 dev_warn(&device->cdev->dev,
461 "FORMAT 0 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 }
463 } else {
464 switch (msg_no) {
465 case 0x00: /* No Message */
466 break;
467 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100468 dev_warn(&device->cdev->dev,
469 "FORMAT 0 - Device Error "
470 "Source\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 break;
472 case 0x02:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100473 dev_warn(&device->cdev->dev,
474 "FORMAT 0 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 break;
476 case 0x03:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100477 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 "FORMAT 0 - Device Fenced - "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100479 "device = %02x\n", sense[4]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480 break;
481 case 0x04:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100482 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 "FORMAT 0 - Data Pinned for "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100484 "Device\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485 break;
486 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100487 dev_warn(&device->cdev->dev,
488 "FORMAT 0 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489 }
490 }
491 break;
492
493 case 0x10: /* Format 1 - Device Equipment Checks */
494 switch (msg_no) {
495 case 0x00: /* No Message */
496 break;
497 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100498 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 "FORMAT 1 - Device Status 1 not as "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100500 "expected\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 break;
502 case 0x03:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100503 dev_warn(&device->cdev->dev,
504 "FORMAT 1 - Index missing\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505 break;
506 case 0x04:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100507 dev_warn(&device->cdev->dev,
508 "FORMAT 1 - Interruption cannot be "
509 "reset\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 break;
511 case 0x05:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100512 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 "FORMAT 1 - Device did not respond to "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100514 "selection\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 break;
516 case 0x06:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100517 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 "FORMAT 1 - Device check-2 error or Set "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100519 "Sector is not complete\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 break;
521 case 0x07:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100522 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523 "FORMAT 1 - Head address does not "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100524 "compare\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525 break;
526 case 0x08:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100527 dev_warn(&device->cdev->dev,
528 "FORMAT 1 - Device status 1 not valid\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529 break;
530 case 0x09:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100531 dev_warn(&device->cdev->dev,
532 "FORMAT 1 - Device not ready\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533 break;
534 case 0x0A:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100535 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 "FORMAT 1 - Track physical address did "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100537 "not compare\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 break;
539 case 0x0B:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100540 dev_warn(&device->cdev->dev,
541 "FORMAT 1 - Missing device address bit\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 break;
543 case 0x0C:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100544 dev_warn(&device->cdev->dev,
545 "FORMAT 1 - Drive motor switch is off\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546 break;
547 case 0x0D:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100548 dev_warn(&device->cdev->dev,
549 "FORMAT 1 - Seek incomplete\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 break;
551 case 0x0E:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100552 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553 "FORMAT 1 - Cylinder address did not "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100554 "compare\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555 break;
556 case 0x0F:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100557 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 "FORMAT 1 - Offset active cannot be "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100559 "reset\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560 break;
561 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100562 dev_warn(&device->cdev->dev,
563 "FORMAT 1 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 }
565 break;
566
567 case 0x20: /* Format 2 - 3990 Equipment Checks */
568 switch (msg_no) {
569 case 0x08:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100570 dev_warn(&device->cdev->dev,
571 "FORMAT 2 - 3990 check-2 error\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 break;
573 case 0x0E:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100574 dev_warn(&device->cdev->dev,
575 "FORMAT 2 - Support facility errors\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576 break;
577 case 0x0F:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100578 dev_warn(&device->cdev->dev,
579 "FORMAT 2 - Microcode detected error "
580 "%02x\n",
581 sense[8]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 break;
583 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100584 dev_warn(&device->cdev->dev,
585 "FORMAT 2 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 }
587 break;
588
589 case 0x30: /* Format 3 - 3990 Control Checks */
590 switch (msg_no) {
591 case 0x0F:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100592 dev_warn(&device->cdev->dev,
593 "FORMAT 3 - Allegiance terminated\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 break;
595 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100596 dev_warn(&device->cdev->dev,
597 "FORMAT 3 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598 }
599 break;
600
601 case 0x40: /* Format 4 - Data Checks */
602 switch (msg_no) {
603 case 0x00:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100604 dev_warn(&device->cdev->dev,
605 "FORMAT 4 - Home address area error\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 break;
607 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100608 dev_warn(&device->cdev->dev,
609 "FORMAT 4 - Count area error\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 break;
611 case 0x02:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100612 dev_warn(&device->cdev->dev,
613 "FORMAT 4 - Key area error\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700614 break;
615 case 0x03:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100616 dev_warn(&device->cdev->dev,
617 "FORMAT 4 - Data area error\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618 break;
619 case 0x04:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100620 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 "FORMAT 4 - No sync byte in home address "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100622 "area\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 break;
624 case 0x05:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100625 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626 "FORMAT 4 - No sync byte in count address "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100627 "area\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 break;
629 case 0x06:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100630 dev_warn(&device->cdev->dev,
631 "FORMAT 4 - No sync byte in key area\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632 break;
633 case 0x07:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100634 dev_warn(&device->cdev->dev,
635 "FORMAT 4 - No sync byte in data area\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636 break;
637 case 0x08:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100638 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 "FORMAT 4 - Home address area error; "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100640 "offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700641 break;
642 case 0x09:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100643 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644 "FORMAT 4 - Count area error; offset "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100645 "active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 break;
647 case 0x0A:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100648 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649 "FORMAT 4 - Key area error; offset "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100650 "active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 break;
652 case 0x0B:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100653 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654 "FORMAT 4 - Data area error; "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100655 "offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656 break;
657 case 0x0C:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100658 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700659 "FORMAT 4 - No sync byte in home "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100660 "address area; offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 break;
662 case 0x0D:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100663 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 "FORMAT 4 - No syn byte in count "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100665 "address area; offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 break;
667 case 0x0E:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100668 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 "FORMAT 4 - No sync byte in key area; "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100670 "offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 break;
672 case 0x0F:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100673 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 "FORMAT 4 - No syn byte in data area; "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100675 "offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700676 break;
677 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100678 dev_warn(&device->cdev->dev,
679 "FORMAT 4 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 }
681 break;
682
683 case 0x50: /* Format 5 - Data Check with displacement information */
684 switch (msg_no) {
685 case 0x00:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100686 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 "FORMAT 5 - Data Check in the "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100688 "home address area\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 break;
690 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100691 dev_warn(&device->cdev->dev,
692 "FORMAT 5 - Data Check in the count "
693 "area\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 break;
695 case 0x02:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100696 dev_warn(&device->cdev->dev,
697 "FORMAT 5 - Data Check in the key area\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 break;
699 case 0x03:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100700 dev_warn(&device->cdev->dev,
701 "FORMAT 5 - Data Check in the data "
702 "area\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703 break;
704 case 0x08:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100705 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 "FORMAT 5 - Data Check in the "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100707 "home address area; offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708 break;
709 case 0x09:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100710 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 "FORMAT 5 - Data Check in the count area; "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100712 "offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700713 break;
714 case 0x0A:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100715 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716 "FORMAT 5 - Data Check in the key area; "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100717 "offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700718 break;
719 case 0x0B:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100720 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 "FORMAT 5 - Data Check in the data area; "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100722 "offset active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723 break;
724 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100725 dev_warn(&device->cdev->dev,
726 "FORMAT 5 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 }
728 break;
729
730 case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */
731 switch (msg_no) {
732 case 0x00:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100733 dev_warn(&device->cdev->dev,
734 "FORMAT 6 - Overrun on channel A\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735 break;
736 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100737 dev_warn(&device->cdev->dev,
738 "FORMAT 6 - Overrun on channel B\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739 break;
740 case 0x02:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100741 dev_warn(&device->cdev->dev,
742 "FORMAT 6 - Overrun on channel C\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700743 break;
744 case 0x03:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100745 dev_warn(&device->cdev->dev,
746 "FORMAT 6 - Overrun on channel D\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 break;
748 case 0x04:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100749 dev_warn(&device->cdev->dev,
750 "FORMAT 6 - Overrun on channel E\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700751 break;
752 case 0x05:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100753 dev_warn(&device->cdev->dev,
754 "FORMAT 6 - Overrun on channel F\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700755 break;
756 case 0x06:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100757 dev_warn(&device->cdev->dev,
758 "FORMAT 6 - Overrun on channel G\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759 break;
760 case 0x07:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100761 dev_warn(&device->cdev->dev,
762 "FORMAT 6 - Overrun on channel H\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 break;
764 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100765 dev_warn(&device->cdev->dev,
766 "FORMAT 6 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767 }
768 break;
769
770 case 0x70: /* Format 7 - Device Connection Control Checks */
771 switch (msg_no) {
772 case 0x00:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100773 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774 "FORMAT 7 - RCC initiated by a connection "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100775 "check alert\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776 break;
777 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100778 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 "FORMAT 7 - RCC 1 sequence not "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100780 "successful\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781 break;
782 case 0x02:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100783 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784 "FORMAT 7 - RCC 1 and RCC 2 sequences not "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100785 "successful\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786 break;
787 case 0x03:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100788 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789 "FORMAT 7 - Invalid tag-in during "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100790 "selection sequence\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791 break;
792 case 0x04:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100793 dev_warn(&device->cdev->dev,
794 "FORMAT 7 - extra RCC required\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795 break;
796 case 0x05:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100797 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798 "FORMAT 7 - Invalid DCC selection "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100799 "response or timeout\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 break;
801 case 0x06:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100802 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700803 "FORMAT 7 - Missing end operation; device "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100804 "transfer complete\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805 break;
806 case 0x07:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100807 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808 "FORMAT 7 - Missing end operation; device "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100809 "transfer incomplete\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 break;
811 case 0x08:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100812 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813 "FORMAT 7 - Invalid tag-in for an "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100814 "immediate command sequence\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815 break;
816 case 0x09:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100817 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700818 "FORMAT 7 - Invalid tag-in for an "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100819 "extended command sequence\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820 break;
821 case 0x0A:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100822 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823 "FORMAT 7 - 3990 microcode time out when "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100824 "stopping selection\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825 break;
826 case 0x0B:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100827 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700828 "FORMAT 7 - No response to selection "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100829 "after a poll interruption\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830 break;
831 case 0x0C:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100832 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833 "FORMAT 7 - Permanent path error (DASD "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100834 "controller not available)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 break;
836 case 0x0D:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100837 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838 "FORMAT 7 - DASD controller not available"
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100839 " on disconnected command chain\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840 break;
841 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100842 dev_warn(&device->cdev->dev,
843 "FORMAT 7 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844 }
845 break;
846
847 case 0x80: /* Format 8 - Additional Device Equipment Checks */
848 switch (msg_no) {
849 case 0x00: /* No Message */
850 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100851 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852 "FORMAT 8 - Error correction code "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100853 "hardware fault\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700854 break;
855 case 0x03:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100856 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857 "FORMAT 8 - Unexpected end operation "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100858 "response code\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859 break;
860 case 0x04:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100861 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862 "FORMAT 8 - End operation with transfer "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100863 "count not zero\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700864 break;
865 case 0x05:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100866 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867 "FORMAT 8 - End operation with transfer "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100868 "count zero\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869 break;
870 case 0x06:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100871 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700872 "FORMAT 8 - DPS checks after a system "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100873 "reset or selective reset\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700874 break;
875 case 0x07:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100876 dev_warn(&device->cdev->dev,
877 "FORMAT 8 - DPS cannot be filled\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878 break;
879 case 0x08:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100880 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881 "FORMAT 8 - Short busy time-out during "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100882 "device selection\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883 break;
884 case 0x09:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100885 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700886 "FORMAT 8 - DASD controller failed to "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100887 "set or reset the long busy latch\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700888 break;
889 case 0x0A:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100890 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700891 "FORMAT 8 - No interruption from device "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100892 "during a command chain\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700893 break;
894 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100895 dev_warn(&device->cdev->dev,
896 "FORMAT 8 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700897 }
898 break;
899
900 case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */
901 switch (msg_no) {
902 case 0x00:
903 break; /* No Message */
904 case 0x06:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100905 dev_warn(&device->cdev->dev,
906 "FORMAT 9 - Device check-2 error\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907 break;
908 case 0x07:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100909 dev_warn(&device->cdev->dev,
910 "FORMAT 9 - Head address did not "
911 "compare\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700912 break;
913 case 0x0A:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100914 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700915 "FORMAT 9 - Track physical address did "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100916 "not compare while oriented\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700917 break;
918 case 0x0E:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100919 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700920 "FORMAT 9 - Cylinder address did not "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100921 "compare\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700922 break;
923 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100924 dev_warn(&device->cdev->dev,
925 "FORMAT 9 - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700926 }
927 break;
928
929 case 0xF0: /* Format F - Cache Storage Checks */
930 switch (msg_no) {
931 case 0x00:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100932 dev_warn(&device->cdev->dev,
933 "FORMAT F - Operation Terminated\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700934 break;
935 case 0x01:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100936 dev_warn(&device->cdev->dev,
937 "FORMAT F - Subsystem Processing Error\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700938 break;
939 case 0x02:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100940 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941 "FORMAT F - Cache or nonvolatile storage "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100942 "equipment failure\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700943 break;
944 case 0x04:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100945 dev_warn(&device->cdev->dev,
946 "FORMAT F - Caching terminated\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700947 break;
948 case 0x06:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100949 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700950 "FORMAT F - Cache fast write access not "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100951 "authorized\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700952 break;
953 case 0x07:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100954 dev_warn(&device->cdev->dev,
955 "FORMAT F - Track format incorrect\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700956 break;
957 case 0x09:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100958 dev_warn(&device->cdev->dev,
959 "FORMAT F - Caching reinitiated\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700960 break;
961 case 0x0A:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100962 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700963 "FORMAT F - Nonvolatile storage "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100964 "terminated\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700965 break;
966 case 0x0B:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100967 dev_warn(&device->cdev->dev,
968 "FORMAT F - Volume is suspended duplex\n");
Stefan Weinhuber20c64462006-03-24 03:15:25 -0800969 /* call extended error reporting (EER) */
970 dasd_eer_write(device, erp->refers,
971 DASD_EER_PPRCSUSPEND);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700972 break;
973 case 0x0C:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100974 dev_warn(&device->cdev->dev,
975 "FORMAT F - Subsystem status cannot be "
976 "determined\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700977 break;
978 case 0x0D:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100979 dev_warn(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700980 "FORMAT F - Caching status reset to "
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100981 "default\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700982 break;
983 case 0x0E:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100984 dev_warn(&device->cdev->dev,
985 "FORMAT F - DASD Fast Write inhibited\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700986 break;
987 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100988 dev_warn(&device->cdev->dev,
989 "FORMAT D - Reserved\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700990 }
991 break;
992
Stefan Haberlandfc19f382009-03-26 15:23:49 +0100993 default: /* unknown message format - should not happen
994 internal error 03 - unknown message format */
995 snprintf(errorstring, ERRORLENGTH, "03 %x02", msg_format);
996 dev_err(&device->cdev->dev,
997 "An error occurred in the DASD device driver, "
998 "reason=%s\n", errorstring);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700999 break;
1000 } /* end switch message format */
1001
1002} /* end dasd_3990_handle_env_data */
1003
1004/*
1005 * DASD_3990_ERP_COM_REJ
1006 *
1007 * DESCRIPTION
1008 * Handles 24 byte 'Command Reject' error.
1009 *
1010 * PARAMETER
1011 * erp current erp_head
1012 * sense current sense data
Horst Hummel138c0142006-06-29 14:58:12 +02001013 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07001014 * RETURN VALUES
Horst Hummel138c0142006-06-29 14:58:12 +02001015 * erp 'new' erp_head - pointer to new ERP
Linus Torvalds1da177e2005-04-16 15:20:36 -07001016 */
1017static struct dasd_ccw_req *
1018dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense)
1019{
1020
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001021 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001022
1023 erp->function = dasd_3990_erp_com_rej;
1024
1025 /* env data present (ACTION 10 - retry should work) */
1026 if (sense[2] & SNS2_ENV_DATA_PRESENT) {
1027
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001028 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001029 "Command Reject - environmental data present");
1030
1031 dasd_3990_handle_env_data(erp, sense);
1032
1033 erp->retries = 5;
1034
1035 } else {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001036 /* fatal error - set status to FAILED
1037 internal error 09 - Command Reject */
1038 dev_err(&device->cdev->dev, "An error occurred in the DASD "
1039 "device driver, reason=%s\n", "09");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040
1041 erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
1042 }
1043
1044 return erp;
1045
1046} /* end dasd_3990_erp_com_rej */
1047
1048/*
Horst Hummel138c0142006-06-29 14:58:12 +02001049 * DASD_3990_ERP_BUS_OUT
Linus Torvalds1da177e2005-04-16 15:20:36 -07001050 *
1051 * DESCRIPTION
1052 * Handles 24 byte 'Bus Out Parity Check' error.
1053 *
1054 * PARAMETER
1055 * erp current erp_head
1056 * RETURN VALUES
1057 * erp new erp_head - pointer to new ERP
1058 */
1059static struct dasd_ccw_req *
1060dasd_3990_erp_bus_out(struct dasd_ccw_req * erp)
1061{
1062
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001063 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001064
1065 /* first time set initial retry counter and erp_function */
1066 /* and retry once without blocking queue */
1067 /* (this enables easier enqueing of the cqr) */
1068 if (erp->function != dasd_3990_erp_bus_out) {
1069 erp->retries = 256;
1070 erp->function = dasd_3990_erp_bus_out;
1071
1072 } else {
1073
1074 /* issue a message and wait for 'device ready' interrupt */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001075 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001076 "bus out parity error or BOPC requested by "
1077 "channel");
1078
1079 dasd_3990_erp_block_queue(erp, 60*HZ);
1080
1081 }
1082
1083 return erp;
1084
1085} /* end dasd_3990_erp_bus_out */
1086
1087/*
1088 * DASD_3990_ERP_EQUIP_CHECK
1089 *
1090 * DESCRIPTION
1091 * Handles 24 byte 'Equipment Check' error.
1092 *
1093 * PARAMETER
1094 * erp current erp_head
1095 * RETURN VALUES
1096 * erp new erp_head - pointer to new ERP
1097 */
1098static struct dasd_ccw_req *
1099dasd_3990_erp_equip_check(struct dasd_ccw_req * erp, char *sense)
1100{
1101
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001102 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001103
1104 erp->function = dasd_3990_erp_equip_check;
1105
1106 if (sense[1] & SNS1_WRITE_INHIBITED) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001107 dev_info(&device->cdev->dev,
1108 "Write inhibited path encountered\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001110 /* vary path offline
1111 internal error 04 - Path should be varied off-line.*/
1112 dev_err(&device->cdev->dev, "An error occurred in the DASD "
1113 "device driver, reason=%s\n", "04");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001114
1115 erp = dasd_3990_erp_action_1(erp);
1116
1117 } else if (sense[2] & SNS2_ENV_DATA_PRESENT) {
1118
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001119 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001120 "Equipment Check - " "environmental data present");
1121
1122 dasd_3990_handle_env_data(erp, sense);
1123
1124 erp = dasd_3990_erp_action_4(erp, sense);
1125
1126 } else if (sense[1] & SNS1_PERM_ERR) {
1127
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001128 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001129 "Equipment Check - retry exhausted or "
1130 "undesirable");
1131
1132 erp = dasd_3990_erp_action_1(erp);
1133
1134 } else {
1135 /* all other equipment checks - Action 5 */
1136 /* rest is done when retries == 0 */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001137 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138 "Equipment check or processing error");
1139
1140 erp = dasd_3990_erp_action_5(erp);
1141 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001142 return erp;
1143
1144} /* end dasd_3990_erp_equip_check */
1145
1146/*
1147 * DASD_3990_ERP_DATA_CHECK
1148 *
1149 * DESCRIPTION
1150 * Handles 24 byte 'Data Check' error.
1151 *
1152 * PARAMETER
1153 * erp current erp_head
1154 * RETURN VALUES
1155 * erp new erp_head - pointer to new ERP
1156 */
1157static struct dasd_ccw_req *
1158dasd_3990_erp_data_check(struct dasd_ccw_req * erp, char *sense)
1159{
1160
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001161 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001162
1163 erp->function = dasd_3990_erp_data_check;
1164
1165 if (sense[2] & SNS2_CORRECTABLE) { /* correctable data check */
1166
1167 /* issue message that the data has been corrected */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001168 dev_emerg(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001169 "Data recovered during retry with PCI "
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001170 "fetch mode active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001171
1172 /* not possible to handle this situation in Linux */
1173 panic("No way to inform application about the possibly "
1174 "incorrect data");
1175
1176 } else if (sense[2] & SNS2_ENV_DATA_PRESENT) {
1177
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001178 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001179 "Uncorrectable data check recovered secondary "
1180 "addr of duplex pair");
1181
1182 erp = dasd_3990_erp_action_4(erp, sense);
1183
1184 } else if (sense[1] & SNS1_PERM_ERR) {
1185
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001186 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001187 "Uncorrectable data check with internal "
1188 "retry exhausted");
1189
1190 erp = dasd_3990_erp_action_1(erp);
1191
1192 } else {
1193 /* all other data checks */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001194 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001195 "Uncorrectable data check with retry count "
1196 "exhausted...");
1197
1198 erp = dasd_3990_erp_action_5(erp);
1199 }
1200
1201 return erp;
1202
1203} /* end dasd_3990_erp_data_check */
1204
1205/*
1206 * DASD_3990_ERP_OVERRUN
1207 *
1208 * DESCRIPTION
1209 * Handles 24 byte 'Overrun' error.
1210 *
1211 * PARAMETER
1212 * erp current erp_head
1213 * RETURN VALUES
1214 * erp new erp_head - pointer to new ERP
1215 */
1216static struct dasd_ccw_req *
1217dasd_3990_erp_overrun(struct dasd_ccw_req * erp, char *sense)
1218{
1219
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001220 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001221
1222 erp->function = dasd_3990_erp_overrun;
1223
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001224 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001225 "Overrun - service overrun or overrun"
1226 " error requested by channel");
1227
1228 erp = dasd_3990_erp_action_5(erp);
1229
1230 return erp;
1231
1232} /* end dasd_3990_erp_overrun */
1233
1234/*
1235 * DASD_3990_ERP_INV_FORMAT
1236 *
1237 * DESCRIPTION
1238 * Handles 24 byte 'Invalid Track Format' error.
1239 *
1240 * PARAMETER
1241 * erp current erp_head
1242 * RETURN VALUES
1243 * erp new erp_head - pointer to new ERP
1244 */
1245static struct dasd_ccw_req *
1246dasd_3990_erp_inv_format(struct dasd_ccw_req * erp, char *sense)
1247{
1248
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001249 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001250
1251 erp->function = dasd_3990_erp_inv_format;
1252
1253 if (sense[2] & SNS2_ENV_DATA_PRESENT) {
1254
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001255 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001256 "Track format error when destaging or "
1257 "staging data");
1258
1259 dasd_3990_handle_env_data(erp, sense);
1260
1261 erp = dasd_3990_erp_action_4(erp, sense);
1262
1263 } else {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001264 /* internal error 06 - The track format is not valid*/
1265 dev_err(&device->cdev->dev,
1266 "An error occurred in the DASD device driver, "
1267 "reason=%s\n", "06");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001268
1269 erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
1270 }
1271
1272 return erp;
1273
1274} /* end dasd_3990_erp_inv_format */
1275
1276/*
1277 * DASD_3990_ERP_EOC
1278 *
1279 * DESCRIPTION
1280 * Handles 24 byte 'End-of-Cylinder' error.
1281 *
1282 * PARAMETER
1283 * erp already added default erp
1284 * RETURN VALUES
1285 * erp pointer to original (failed) cqr.
1286 */
1287static struct dasd_ccw_req *
1288dasd_3990_erp_EOC(struct dasd_ccw_req * default_erp, char *sense)
1289{
1290
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001291 struct dasd_device *device = default_erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001292
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001293 dev_err(&device->cdev->dev,
1294 "The cylinder data for accessing the DASD is inconsistent\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001295
1296 /* implement action 7 - BUG */
1297 return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED);
1298
1299} /* end dasd_3990_erp_EOC */
1300
1301/*
1302 * DASD_3990_ERP_ENV_DATA
1303 *
1304 * DESCRIPTION
1305 * Handles 24 byte 'Environmental-Data Present' error.
1306 *
1307 * PARAMETER
1308 * erp current erp_head
1309 * RETURN VALUES
1310 * erp new erp_head - pointer to new ERP
1311 */
1312static struct dasd_ccw_req *
1313dasd_3990_erp_env_data(struct dasd_ccw_req * erp, char *sense)
1314{
1315
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001316 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001317
1318 erp->function = dasd_3990_erp_env_data;
1319
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001320 DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Environmental data present");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001321
1322 dasd_3990_handle_env_data(erp, sense);
1323
1324 /* don't retry on disabled interface */
1325 if (sense[7] != 0x0F) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001326 erp = dasd_3990_erp_action_4(erp, sense);
1327 } else {
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001328 erp->status = DASD_CQR_FILLED;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001329 }
1330
1331 return erp;
1332
1333} /* end dasd_3990_erp_env_data */
1334
1335/*
1336 * DASD_3990_ERP_NO_REC
1337 *
1338 * DESCRIPTION
1339 * Handles 24 byte 'No Record Found' error.
1340 *
1341 * PARAMETER
1342 * erp already added default ERP
Horst Hummel138c0142006-06-29 14:58:12 +02001343 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07001344 * RETURN VALUES
1345 * erp new erp_head - pointer to new ERP
1346 */
1347static struct dasd_ccw_req *
1348dasd_3990_erp_no_rec(struct dasd_ccw_req * default_erp, char *sense)
1349{
1350
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001351 struct dasd_device *device = default_erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001352
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001353 dev_err(&device->cdev->dev,
1354 "The specified record was not found\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001355
1356 return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED);
1357
1358} /* end dasd_3990_erp_no_rec */
1359
1360/*
1361 * DASD_3990_ERP_FILE_PROT
1362 *
1363 * DESCRIPTION
1364 * Handles 24 byte 'File Protected' error.
1365 * Note: Seek related recovery is not implemented because
1366 * wee don't use the seek command yet.
1367 *
1368 * PARAMETER
1369 * erp current erp_head
1370 * RETURN VALUES
1371 * erp new erp_head - pointer to new ERP
1372 */
1373static struct dasd_ccw_req *
1374dasd_3990_erp_file_prot(struct dasd_ccw_req * erp)
1375{
1376
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001377 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001378
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001379 dev_err(&device->cdev->dev, "Accessing the DASD failed because of "
1380 "a hardware error\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001381
1382 return dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
1383
1384} /* end dasd_3990_erp_file_prot */
1385
1386/*
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001387 * DASD_3990_ERP_INSPECT_ALIAS
1388 *
1389 * DESCRIPTION
1390 * Checks if the original request was started on an alias device.
1391 * If yes, it modifies the original and the erp request so that
1392 * the erp request can be started on a base device.
1393 *
1394 * PARAMETER
1395 * erp pointer to the currently created default ERP
1396 *
1397 * RETURN VALUES
1398 * erp pointer to the modified ERP, or NULL
1399 */
1400
1401static struct dasd_ccw_req *dasd_3990_erp_inspect_alias(
1402 struct dasd_ccw_req *erp)
1403{
1404 struct dasd_ccw_req *cqr = erp->refers;
1405
1406 if (cqr->block &&
1407 (cqr->block->base != cqr->startdev)) {
1408 if (cqr->startdev->features & DASD_FEATURE_ERPLOG) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001409 DBF_DEV_EVENT(DBF_ERR, cqr->startdev,
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001410 "ERP on alias device for request %p,"
1411 " recover on base device %s", cqr,
Kay Sievers2a0217d2008-10-10 21:33:09 +02001412 dev_name(&cqr->block->base->cdev->dev));
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001413 }
1414 dasd_eckd_reset_ccw_to_base_io(cqr);
1415 erp->startdev = cqr->block->base;
1416 erp->function = dasd_3990_erp_inspect_alias;
1417 return erp;
1418 } else
1419 return NULL;
1420}
1421
1422
1423/*
Horst Hummel138c0142006-06-29 14:58:12 +02001424 * DASD_3990_ERP_INSPECT_24
Linus Torvalds1da177e2005-04-16 15:20:36 -07001425 *
1426 * DESCRIPTION
1427 * Does a detailed inspection of the 24 byte sense data
Horst Hummel138c0142006-06-29 14:58:12 +02001428 * and sets up a related error recovery action.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001429 *
1430 * PARAMETER
1431 * sense sense data of the actual error
1432 * erp pointer to the currently created default ERP
1433 *
1434 * RETURN VALUES
1435 * erp pointer to the (addtitional) ERP
1436 */
1437static struct dasd_ccw_req *
1438dasd_3990_erp_inspect_24(struct dasd_ccw_req * erp, char *sense)
1439{
1440
1441 struct dasd_ccw_req *erp_filled = NULL;
1442
1443 /* Check sense for .... */
1444 /* 'Command Reject' */
1445 if ((erp_filled == NULL) && (sense[0] & SNS0_CMD_REJECT)) {
1446 erp_filled = dasd_3990_erp_com_rej(erp, sense);
1447 }
1448 /* 'Intervention Required' */
1449 if ((erp_filled == NULL) && (sense[0] & SNS0_INTERVENTION_REQ)) {
1450 erp_filled = dasd_3990_erp_int_req(erp);
1451 }
1452 /* 'Bus Out Parity Check' */
1453 if ((erp_filled == NULL) && (sense[0] & SNS0_BUS_OUT_CHECK)) {
1454 erp_filled = dasd_3990_erp_bus_out(erp);
1455 }
1456 /* 'Equipment Check' */
1457 if ((erp_filled == NULL) && (sense[0] & SNS0_EQUIPMENT_CHECK)) {
1458 erp_filled = dasd_3990_erp_equip_check(erp, sense);
1459 }
1460 /* 'Data Check' */
1461 if ((erp_filled == NULL) && (sense[0] & SNS0_DATA_CHECK)) {
1462 erp_filled = dasd_3990_erp_data_check(erp, sense);
1463 }
1464 /* 'Overrun' */
1465 if ((erp_filled == NULL) && (sense[0] & SNS0_OVERRUN)) {
1466 erp_filled = dasd_3990_erp_overrun(erp, sense);
1467 }
1468 /* 'Invalid Track Format' */
1469 if ((erp_filled == NULL) && (sense[1] & SNS1_INV_TRACK_FORMAT)) {
1470 erp_filled = dasd_3990_erp_inv_format(erp, sense);
1471 }
1472 /* 'End-of-Cylinder' */
1473 if ((erp_filled == NULL) && (sense[1] & SNS1_EOC)) {
1474 erp_filled = dasd_3990_erp_EOC(erp, sense);
1475 }
1476 /* 'Environmental Data' */
1477 if ((erp_filled == NULL) && (sense[2] & SNS2_ENV_DATA_PRESENT)) {
1478 erp_filled = dasd_3990_erp_env_data(erp, sense);
1479 }
1480 /* 'No Record Found' */
1481 if ((erp_filled == NULL) && (sense[1] & SNS1_NO_REC_FOUND)) {
1482 erp_filled = dasd_3990_erp_no_rec(erp, sense);
1483 }
1484 /* 'File Protected' */
1485 if ((erp_filled == NULL) && (sense[1] & SNS1_FILE_PROTECTED)) {
1486 erp_filled = dasd_3990_erp_file_prot(erp);
1487 }
1488 /* other (unknown) error - do default ERP */
1489 if (erp_filled == NULL) {
1490
1491 erp_filled = erp;
1492 }
1493
1494 return erp_filled;
1495
1496} /* END dasd_3990_erp_inspect_24 */
1497
1498/*
Horst Hummel138c0142006-06-29 14:58:12 +02001499 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -07001500 * 32 byte sense ERP functions (only)
Horst Hummel138c0142006-06-29 14:58:12 +02001501 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -07001502 */
1503
1504/*
Horst Hummel138c0142006-06-29 14:58:12 +02001505 * DASD_3990_ERPACTION_10_32
Linus Torvalds1da177e2005-04-16 15:20:36 -07001506 *
1507 * DESCRIPTION
1508 * Handles 32 byte 'Action 10' of Single Program Action Codes.
1509 * Just retry and if retry doesn't work, return with error.
1510 *
1511 * PARAMETER
1512 * erp current erp_head
Horst Hummel138c0142006-06-29 14:58:12 +02001513 * sense current sense data
Linus Torvalds1da177e2005-04-16 15:20:36 -07001514 * RETURN VALUES
1515 * erp modified erp_head
1516 */
1517static struct dasd_ccw_req *
1518dasd_3990_erp_action_10_32(struct dasd_ccw_req * erp, char *sense)
1519{
1520
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001521 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001522
1523 erp->retries = 256;
1524 erp->function = dasd_3990_erp_action_10_32;
1525
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001526 DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Perform logging requested");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001527
1528 return erp;
1529
1530} /* end dasd_3990_erp_action_10_32 */
1531
1532/*
1533 * DASD_3990_ERP_ACTION_1B_32
1534 *
1535 * DESCRIPTION
1536 * Handles 32 byte 'Action 1B' of Single Program Action Codes.
Horst Hummel138c0142006-06-29 14:58:12 +02001537 * A write operation could not be finished because of an unexpected
Linus Torvalds1da177e2005-04-16 15:20:36 -07001538 * condition.
Horst Hummel138c0142006-06-29 14:58:12 +02001539 * The already created 'default erp' is used to get the link to
1540 * the erp chain, but it can not be used for this recovery
Linus Torvalds1da177e2005-04-16 15:20:36 -07001541 * action because it contains no DE/LO data space.
1542 *
1543 * PARAMETER
1544 * default_erp already added default erp.
Horst Hummel138c0142006-06-29 14:58:12 +02001545 * sense current sense data
Linus Torvalds1da177e2005-04-16 15:20:36 -07001546 *
1547 * RETURN VALUES
Horst Hummel138c0142006-06-29 14:58:12 +02001548 * erp new erp or
Linus Torvalds1da177e2005-04-16 15:20:36 -07001549 * default_erp in case of imprecise ending or error
1550 */
1551static struct dasd_ccw_req *
1552dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense)
1553{
1554
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001555 struct dasd_device *device = default_erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001556 __u32 cpa = 0;
1557 struct dasd_ccw_req *cqr;
1558 struct dasd_ccw_req *erp;
1559 struct DE_eckd_data *DE_data;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001560 struct PFX_eckd_data *PFX_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001561 char *LO_data; /* LO_eckd_data_t */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001562 struct ccw1 *ccw, *oldccw;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001563
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001564 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001565 "Write not finished because of unexpected condition");
1566
1567 default_erp->function = dasd_3990_erp_action_1B_32;
1568
1569 /* determine the original cqr */
1570 cqr = default_erp;
1571
1572 while (cqr->refers != NULL) {
1573 cqr = cqr->refers;
1574 }
1575
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01001576 if (scsw_is_tm(&cqr->irb.scsw)) {
1577 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
1578 "32 bit sense, action 1B is not defined"
1579 " in transport mode - just retry");
1580 return default_erp;
1581 }
1582
Linus Torvalds1da177e2005-04-16 15:20:36 -07001583 /* for imprecise ending just do default erp */
1584 if (sense[1] & 0x01) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001585 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001586 "Imprecise ending is set - just retry");
1587
1588 return default_erp;
1589 }
1590
1591 /* determine the address of the CCW to be restarted */
1592 /* Imprecise ending is not set -> addr from IRB-SCSW */
Peter Oberparleiter23d805b2008-07-14 09:58:50 +02001593 cpa = default_erp->refers->irb.scsw.cmd.cpa;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001594
1595 if (cpa == 0) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001596 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001597 "Unable to determine address of the CCW "
1598 "to be restarted");
1599
1600 return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED);
1601 }
1602
1603 /* Build new ERP request including DE/LO */
1604 erp = dasd_alloc_erp_request((char *) &cqr->magic,
1605 2 + 1,/* DE/LO + TIC */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001606 sizeof(struct DE_eckd_data) +
1607 sizeof(struct LO_eckd_data), device);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001608
1609 if (IS_ERR(erp)) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001610 /* internal error 01 - Unable to allocate ERP */
1611 dev_err(&device->cdev->dev, "An error occurred in the DASD "
1612 "device driver, reason=%s\n", "01");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001613 return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED);
1614 }
1615
1616 /* use original DE */
1617 DE_data = erp->data;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001618 oldccw = cqr->cpaddr;
1619 if (oldccw->cmd_code == DASD_ECKD_CCW_PFX) {
1620 PFX_data = cqr->data;
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01001621 memcpy(DE_data, &PFX_data->define_extent,
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001622 sizeof(struct DE_eckd_data));
1623 } else
1624 memcpy(DE_data, cqr->data, sizeof(struct DE_eckd_data));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001625
1626 /* create LO */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001627 LO_data = erp->data + sizeof(struct DE_eckd_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001628
1629 if ((sense[3] == 0x01) && (LO_data[1] & 0x01)) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001630 /* should not */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001631 return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED);
1632 }
1633
1634 if ((sense[7] & 0x3F) == 0x01) {
1635 /* operation code is WRITE DATA -> data area orientation */
1636 LO_data[0] = 0x81;
1637
1638 } else if ((sense[7] & 0x3F) == 0x03) {
1639 /* operation code is FORMAT WRITE -> index orientation */
1640 LO_data[0] = 0xC3;
1641
1642 } else {
1643 LO_data[0] = sense[7]; /* operation */
1644 }
1645
1646 LO_data[1] = sense[8]; /* auxiliary */
1647 LO_data[2] = sense[9];
1648 LO_data[3] = sense[3]; /* count */
1649 LO_data[4] = sense[29]; /* seek_addr.cyl */
1650 LO_data[5] = sense[30]; /* seek_addr.cyl 2nd byte */
1651 LO_data[7] = sense[31]; /* seek_addr.head 2nd byte */
1652
1653 memcpy(&(LO_data[8]), &(sense[11]), 8);
1654
1655 /* create DE ccw */
1656 ccw = erp->cpaddr;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001657 memset(ccw, 0, sizeof(struct ccw1));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001658 ccw->cmd_code = DASD_ECKD_CCW_DEFINE_EXTENT;
1659 ccw->flags = CCW_FLAG_CC;
1660 ccw->count = 16;
1661 ccw->cda = (__u32)(addr_t) DE_data;
1662
1663 /* create LO ccw */
1664 ccw++;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001665 memset(ccw, 0, sizeof(struct ccw1));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001666 ccw->cmd_code = DASD_ECKD_CCW_LOCATE_RECORD;
1667 ccw->flags = CCW_FLAG_CC;
1668 ccw->count = 16;
1669 ccw->cda = (__u32)(addr_t) LO_data;
1670
1671 /* TIC to the failed ccw */
1672 ccw++;
1673 ccw->cmd_code = CCW_CMD_TIC;
1674 ccw->cda = cpa;
1675
1676 /* fill erp related fields */
1677 erp->function = dasd_3990_erp_action_1B_32;
1678 erp->refers = default_erp->refers;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001679 erp->startdev = device;
1680 erp->memdev = device;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001681 erp->magic = default_erp->magic;
1682 erp->expires = 0;
1683 erp->retries = 256;
1684 erp->buildclk = get_clock();
1685 erp->status = DASD_CQR_FILLED;
1686
1687 /* remove the default erp */
1688 dasd_free_erp_request(default_erp, device);
1689
1690 return erp;
1691
1692} /* end dasd_3990_erp_action_1B_32 */
1693
1694/*
1695 * DASD_3990_UPDATE_1B
1696 *
1697 * DESCRIPTION
Horst Hummel138c0142006-06-29 14:58:12 +02001698 * Handles the update to the 32 byte 'Action 1B' of Single Program
Linus Torvalds1da177e2005-04-16 15:20:36 -07001699 * Action Codes in case the first action was not successful.
1700 * The already created 'previous_erp' is the currently not successful
Horst Hummel138c0142006-06-29 14:58:12 +02001701 * ERP.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001702 *
1703 * PARAMETER
1704 * previous_erp already created previous erp.
Horst Hummel138c0142006-06-29 14:58:12 +02001705 * sense current sense data
Linus Torvalds1da177e2005-04-16 15:20:36 -07001706 * RETURN VALUES
Horst Hummel138c0142006-06-29 14:58:12 +02001707 * erp modified erp
Linus Torvalds1da177e2005-04-16 15:20:36 -07001708 */
1709static struct dasd_ccw_req *
1710dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense)
1711{
1712
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001713 struct dasd_device *device = previous_erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001714 __u32 cpa = 0;
1715 struct dasd_ccw_req *cqr;
1716 struct dasd_ccw_req *erp;
1717 char *LO_data; /* struct LO_eckd_data */
1718 struct ccw1 *ccw;
1719
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001720 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001721 "Write not finished because of unexpected condition"
1722 " - follow on");
1723
1724 /* determine the original cqr */
1725 cqr = previous_erp;
1726
1727 while (cqr->refers != NULL) {
1728 cqr = cqr->refers;
1729 }
1730
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01001731 if (scsw_is_tm(&cqr->irb.scsw)) {
1732 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
1733 "32 bit sense, action 1B, update,"
1734 " in transport mode - just retry");
1735 return previous_erp;
1736 }
1737
Linus Torvalds1da177e2005-04-16 15:20:36 -07001738 /* for imprecise ending just do default erp */
1739 if (sense[1] & 0x01) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001740 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07001741 "Imprecise ending is set - just retry");
1742
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001743 previous_erp->status = DASD_CQR_FILLED;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001744
1745 return previous_erp;
1746 }
1747
1748 /* determine the address of the CCW to be restarted */
1749 /* Imprecise ending is not set -> addr from IRB-SCSW */
Peter Oberparleiter23d805b2008-07-14 09:58:50 +02001750 cpa = previous_erp->irb.scsw.cmd.cpa;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001751
1752 if (cpa == 0) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001753 /* internal error 02 -
1754 Unable to determine address of the CCW to be restarted */
1755 dev_err(&device->cdev->dev, "An error occurred in the DASD "
1756 "device driver, reason=%s\n", "02");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001757
1758 previous_erp->status = DASD_CQR_FAILED;
1759
1760 return previous_erp;
1761 }
1762
1763 erp = previous_erp;
1764
1765 /* update the LO with the new returned sense data */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001766 LO_data = erp->data + sizeof(struct DE_eckd_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001767
1768 if ((sense[3] == 0x01) && (LO_data[1] & 0x01)) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001769 /* should not happen */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001770 previous_erp->status = DASD_CQR_FAILED;
1771
1772 return previous_erp;
1773 }
1774
1775 if ((sense[7] & 0x3F) == 0x01) {
1776 /* operation code is WRITE DATA -> data area orientation */
1777 LO_data[0] = 0x81;
1778
1779 } else if ((sense[7] & 0x3F) == 0x03) {
1780 /* operation code is FORMAT WRITE -> index orientation */
1781 LO_data[0] = 0xC3;
1782
1783 } else {
1784 LO_data[0] = sense[7]; /* operation */
1785 }
1786
1787 LO_data[1] = sense[8]; /* auxiliary */
1788 LO_data[2] = sense[9];
1789 LO_data[3] = sense[3]; /* count */
1790 LO_data[4] = sense[29]; /* seek_addr.cyl */
1791 LO_data[5] = sense[30]; /* seek_addr.cyl 2nd byte */
1792 LO_data[7] = sense[31]; /* seek_addr.head 2nd byte */
1793
1794 memcpy(&(LO_data[8]), &(sense[11]), 8);
1795
1796 /* TIC to the failed ccw */
1797 ccw = erp->cpaddr; /* addr of DE ccw */
1798 ccw++; /* addr of LE ccw */
1799 ccw++; /* addr of TIC ccw */
1800 ccw->cda = cpa;
1801
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001802 erp->status = DASD_CQR_FILLED;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001803
1804 return erp;
1805
1806} /* end dasd_3990_update_1B */
1807
1808/*
Horst Hummel138c0142006-06-29 14:58:12 +02001809 * DASD_3990_ERP_COMPOUND_RETRY
Linus Torvalds1da177e2005-04-16 15:20:36 -07001810 *
1811 * DESCRIPTION
1812 * Handles the compound ERP action retry code.
1813 * NOTE: At least one retry is done even if zero is specified
1814 * by the sense data. This makes enqueueing of the request
1815 * easier.
1816 *
1817 * PARAMETER
1818 * sense sense data of the actual error
1819 * erp pointer to the currently created ERP
1820 *
1821 * RETURN VALUES
1822 * erp modified ERP pointer
1823 *
1824 */
1825static void
1826dasd_3990_erp_compound_retry(struct dasd_ccw_req * erp, char *sense)
1827{
1828
1829 switch (sense[25] & 0x03) {
1830 case 0x00: /* no not retry */
1831 erp->retries = 1;
1832 break;
1833
1834 case 0x01: /* retry 2 times */
1835 erp->retries = 2;
1836 break;
1837
1838 case 0x02: /* retry 10 times */
1839 erp->retries = 10;
1840 break;
1841
1842 case 0x03: /* retry 256 times */
1843 erp->retries = 256;
1844 break;
1845
1846 default:
1847 BUG();
1848 }
1849
1850 erp->function = dasd_3990_erp_compound_retry;
1851
1852} /* end dasd_3990_erp_compound_retry */
1853
1854/*
Horst Hummel138c0142006-06-29 14:58:12 +02001855 * DASD_3990_ERP_COMPOUND_PATH
Linus Torvalds1da177e2005-04-16 15:20:36 -07001856 *
1857 * DESCRIPTION
1858 * Handles the compound ERP action for retry on alternate
1859 * channel path.
1860 *
1861 * PARAMETER
1862 * sense sense data of the actual error
1863 * erp pointer to the currently created ERP
1864 *
1865 * RETURN VALUES
1866 * erp modified ERP pointer
1867 *
1868 */
1869static void
1870dasd_3990_erp_compound_path(struct dasd_ccw_req * erp, char *sense)
1871{
1872
1873 if (sense[25] & DASD_SENSE_BIT_3) {
1874 dasd_3990_erp_alternate_path(erp);
1875
1876 if (erp->status == DASD_CQR_FAILED) {
Horst Hummel138c0142006-06-29 14:58:12 +02001877 /* reset the lpm and the status to be able to
Linus Torvalds1da177e2005-04-16 15:20:36 -07001878 * try further actions. */
1879
1880 erp->lpm = 0;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001881 erp->status = DASD_CQR_NEED_ERP;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001882 }
1883 }
1884
1885 erp->function = dasd_3990_erp_compound_path;
1886
1887} /* end dasd_3990_erp_compound_path */
1888
1889/*
Horst Hummel138c0142006-06-29 14:58:12 +02001890 * DASD_3990_ERP_COMPOUND_CODE
Linus Torvalds1da177e2005-04-16 15:20:36 -07001891 *
1892 * DESCRIPTION
1893 * Handles the compound ERP action for retry code.
1894 *
1895 * PARAMETER
1896 * sense sense data of the actual error
1897 * erp pointer to the currently created ERP
1898 *
1899 * RETURN VALUES
1900 * erp NEW ERP pointer
1901 *
1902 */
1903static struct dasd_ccw_req *
1904dasd_3990_erp_compound_code(struct dasd_ccw_req * erp, char *sense)
1905{
1906
1907 if (sense[25] & DASD_SENSE_BIT_2) {
1908
1909 switch (sense[28]) {
1910 case 0x17:
Horst Hummel138c0142006-06-29 14:58:12 +02001911 /* issue a Diagnostic Control command with an
Robert P. J. Day3a4fa0a2007-10-19 23:10:43 +02001912 * Inhibit Write subcommand and controller modifier */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001913 erp = dasd_3990_erp_DCTL(erp, 0x20);
1914 break;
Horst Hummel138c0142006-06-29 14:58:12 +02001915
Linus Torvalds1da177e2005-04-16 15:20:36 -07001916 case 0x25:
1917 /* wait for 5 seconds and retry again */
1918 erp->retries = 1;
Horst Hummel138c0142006-06-29 14:58:12 +02001919
Linus Torvalds1da177e2005-04-16 15:20:36 -07001920 dasd_3990_erp_block_queue (erp, 5*HZ);
1921 break;
Horst Hummel138c0142006-06-29 14:58:12 +02001922
Linus Torvalds1da177e2005-04-16 15:20:36 -07001923 default:
1924 /* should not happen - continue */
1925 break;
1926 }
1927 }
1928
1929 erp->function = dasd_3990_erp_compound_code;
1930
1931 return erp;
1932
1933} /* end dasd_3990_erp_compound_code */
1934
1935/*
Horst Hummel138c0142006-06-29 14:58:12 +02001936 * DASD_3990_ERP_COMPOUND_CONFIG
Linus Torvalds1da177e2005-04-16 15:20:36 -07001937 *
1938 * DESCRIPTION
1939 * Handles the compound ERP action for configruation
1940 * dependent error.
1941 * Note: duplex handling is not implemented (yet).
1942 *
1943 * PARAMETER
1944 * sense sense data of the actual error
1945 * erp pointer to the currently created ERP
1946 *
1947 * RETURN VALUES
1948 * erp modified ERP pointer
1949 *
1950 */
1951static void
1952dasd_3990_erp_compound_config(struct dasd_ccw_req * erp, char *sense)
1953{
1954
1955 if ((sense[25] & DASD_SENSE_BIT_1) && (sense[26] & DASD_SENSE_BIT_2)) {
1956
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001957 /* set to suspended duplex state then restart
1958 internal error 05 - Set device to suspended duplex state
1959 should be done */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001960 struct dasd_device *device = erp->startdev;
Stefan Haberlandfc19f382009-03-26 15:23:49 +01001961 dev_err(&device->cdev->dev,
1962 "An error occurred in the DASD device driver, "
1963 "reason=%s\n", "05");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001964
1965 }
1966
1967 erp->function = dasd_3990_erp_compound_config;
1968
1969} /* end dasd_3990_erp_compound_config */
1970
1971/*
Horst Hummel138c0142006-06-29 14:58:12 +02001972 * DASD_3990_ERP_COMPOUND
Linus Torvalds1da177e2005-04-16 15:20:36 -07001973 *
1974 * DESCRIPTION
Horst Hummel138c0142006-06-29 14:58:12 +02001975 * Does the further compound program action if
Linus Torvalds1da177e2005-04-16 15:20:36 -07001976 * compound retry was not successful.
1977 *
1978 * PARAMETER
1979 * sense sense data of the actual error
1980 * erp pointer to the current (failed) ERP
1981 *
1982 * RETURN VALUES
1983 * erp (additional) ERP pointer
1984 *
1985 */
1986static struct dasd_ccw_req *
1987dasd_3990_erp_compound(struct dasd_ccw_req * erp, char *sense)
1988{
1989
1990 if ((erp->function == dasd_3990_erp_compound_retry) &&
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001991 (erp->status == DASD_CQR_NEED_ERP)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001992
1993 dasd_3990_erp_compound_path(erp, sense);
1994 }
1995
1996 if ((erp->function == dasd_3990_erp_compound_path) &&
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01001997 (erp->status == DASD_CQR_NEED_ERP)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001998
1999 erp = dasd_3990_erp_compound_code(erp, sense);
2000 }
2001
2002 if ((erp->function == dasd_3990_erp_compound_code) &&
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002003 (erp->status == DASD_CQR_NEED_ERP)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002004
2005 dasd_3990_erp_compound_config(erp, sense);
2006 }
2007
2008 /* if no compound action ERP specified, the request failed */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002009 if (erp->status == DASD_CQR_NEED_ERP)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002010 erp->status = DASD_CQR_FAILED;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002011
2012 return erp;
2013
2014} /* end dasd_3990_erp_compound */
2015
2016/*
Stefan Haberlandf60c7682008-04-17 07:46:08 +02002017 *DASD_3990_ERP_HANDLE_SIM
2018 *
2019 *DESCRIPTION
2020 * inspects the SIM SENSE data and starts an appropriate action
2021 *
2022 * PARAMETER
2023 * sense sense data of the actual error
2024 *
2025 * RETURN VALUES
2026 * none
2027 */
2028void
2029dasd_3990_erp_handle_sim(struct dasd_device *device, char *sense)
2030{
2031 /* print message according to log or message to operator mode */
2032 if ((sense[24] & DASD_SIM_MSG_TO_OP) || (sense[1] & 0x10)) {
Stefan Haberlandf60c7682008-04-17 07:46:08 +02002033 /* print SIM SRC from RefCode */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002034 dev_err(&device->cdev->dev, "SIM - SRC: "
2035 "%02x%02x%02x%02x\n", sense[22],
Stefan Haberlandf60c7682008-04-17 07:46:08 +02002036 sense[23], sense[11], sense[12]);
2037 } else if (sense[24] & DASD_SIM_LOG) {
2038 /* print SIM SRC Refcode */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002039 dev_warn(&device->cdev->dev, "log SIM - SRC: "
2040 "%02x%02x%02x%02x\n", sense[22],
Stefan Haberlandf60c7682008-04-17 07:46:08 +02002041 sense[23], sense[11], sense[12]);
2042 }
2043}
2044
2045/*
Horst Hummel138c0142006-06-29 14:58:12 +02002046 * DASD_3990_ERP_INSPECT_32
Linus Torvalds1da177e2005-04-16 15:20:36 -07002047 *
2048 * DESCRIPTION
2049 * Does a detailed inspection of the 32 byte sense data
Horst Hummel138c0142006-06-29 14:58:12 +02002050 * and sets up a related error recovery action.
Linus Torvalds1da177e2005-04-16 15:20:36 -07002051 *
2052 * PARAMETER
2053 * sense sense data of the actual error
2054 * erp pointer to the currently created default ERP
2055 *
2056 * RETURN VALUES
2057 * erp_filled pointer to the ERP
2058 *
2059 */
2060static struct dasd_ccw_req *
2061dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense)
2062{
2063
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002064 struct dasd_device *device = erp->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002065
2066 erp->function = dasd_3990_erp_inspect_32;
2067
Stefan Haberlandf60c7682008-04-17 07:46:08 +02002068 /* check for SIM sense data */
2069 if ((sense[6] & DASD_SIM_SENSE) == DASD_SIM_SENSE)
2070 dasd_3990_erp_handle_sim(device, sense);
2071
Linus Torvalds1da177e2005-04-16 15:20:36 -07002072 if (sense[25] & DASD_SENSE_BIT_0) {
2073
2074 /* compound program action codes (byte25 bit 0 == '1') */
2075 dasd_3990_erp_compound_retry(erp, sense);
2076
2077 } else {
2078
2079 /* single program action codes (byte25 bit 0 == '0') */
2080 switch (sense[25]) {
2081
2082 case 0x00: /* success - use default ERP for retries */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002083 DBF_DEV_EVENT(DBF_DEBUG, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07002084 "ERP called for successful request"
2085 " - just retry");
2086 break;
2087
2088 case 0x01: /* fatal error */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002089 dev_err(&device->cdev->dev,
2090 "ERP failed for the DASD\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07002091
2092 erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
2093 break;
2094
2095 case 0x02: /* intervention required */
2096 case 0x03: /* intervention required during dual copy */
2097 erp = dasd_3990_erp_int_req(erp);
2098 break;
2099
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002100 case 0x0F: /* length mismatch during update write command
2101 internal error 08 - update write command error*/
2102 dev_err(&device->cdev->dev, "An error occurred in the "
2103 "DASD device driver, reason=%s\n", "08");
Linus Torvalds1da177e2005-04-16 15:20:36 -07002104
2105 erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
2106 break;
2107
2108 case 0x10: /* logging required for other channel program */
2109 erp = dasd_3990_erp_action_10_32(erp, sense);
2110 break;
2111
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002112 case 0x15: /* next track outside defined extend
2113 internal error 07 - The next track is not
2114 within the defined storage extent */
2115 dev_err(&device->cdev->dev,
2116 "An error occurred in the DASD device driver, "
2117 "reason=%s\n", "07");
Linus Torvalds1da177e2005-04-16 15:20:36 -07002118
2119 erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
2120 break;
2121
2122 case 0x1B: /* unexpected condition during write */
2123
2124 erp = dasd_3990_erp_action_1B_32(erp, sense);
2125 break;
2126
2127 case 0x1C: /* invalid data */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002128 dev_emerg(&device->cdev->dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002129 "Data recovered during retry with PCI "
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002130 "fetch mode active\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07002131
2132 /* not possible to handle this situation in Linux */
2133 panic
2134 ("Invalid data - No way to inform application "
2135 "about the possibly incorrect data");
2136 break;
2137
2138 case 0x1D: /* state-change pending */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002139 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07002140 "A State change pending condition exists "
2141 "for the subsystem or device");
2142
2143 erp = dasd_3990_erp_action_4(erp, sense);
2144 break;
2145
2146 case 0x1E: /* busy */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002147 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07002148 "Busy condition exists "
2149 "for the subsystem or device");
2150 erp = dasd_3990_erp_action_4(erp, sense);
2151 break;
2152
2153 default: /* all others errors - default erp */
2154 break;
2155 }
2156 }
2157
2158 return erp;
2159
2160} /* end dasd_3990_erp_inspect_32 */
2161
2162/*
Horst Hummel138c0142006-06-29 14:58:12 +02002163 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -07002164 * main ERP control fuctions (24 and 32 byte sense)
Horst Hummel138c0142006-06-29 14:58:12 +02002165 *****************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -07002166 */
2167
2168/*
Stefan Haberland6c5f57c2008-02-05 16:50:46 +01002169 * DASD_3990_ERP_CONTROL_CHECK
2170 *
2171 * DESCRIPTION
2172 * Does a generic inspection if a control check occured and sets up
2173 * the related error recovery procedure
2174 *
2175 * PARAMETER
2176 * erp pointer to the currently created default ERP
2177 *
2178 * RETURN VALUES
2179 * erp_filled pointer to the erp
2180 */
2181
2182static struct dasd_ccw_req *
2183dasd_3990_erp_control_check(struct dasd_ccw_req *erp)
2184{
2185 struct dasd_device *device = erp->startdev;
2186
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002187 if (scsw_cstat(&erp->refers->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK
Stefan Haberland6c5f57c2008-02-05 16:50:46 +01002188 | SCHN_STAT_CHN_CTRL_CHK)) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002189 DBF_DEV_EVENT(DBF_WARNING, device, "%s",
Stefan Haberland6c5f57c2008-02-05 16:50:46 +01002190 "channel or interface control check");
2191 erp = dasd_3990_erp_action_4(erp, NULL);
2192 }
2193 return erp;
2194}
2195
2196/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002197 * DASD_3990_ERP_INSPECT
2198 *
2199 * DESCRIPTION
2200 * Does a detailed inspection for sense data by calling either
2201 * the 24-byte or the 32-byte inspection routine.
2202 *
2203 * PARAMETER
2204 * erp pointer to the currently created default ERP
2205 * RETURN VALUES
Horst Hummel138c0142006-06-29 14:58:12 +02002206 * erp_new contens was possibly modified
Linus Torvalds1da177e2005-04-16 15:20:36 -07002207 */
2208static struct dasd_ccw_req *
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002209dasd_3990_erp_inspect(struct dasd_ccw_req *erp)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002210{
2211
2212 struct dasd_ccw_req *erp_new = NULL;
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002213 char *sense;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002214
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002215 /* if this problem occured on an alias retry on base */
2216 erp_new = dasd_3990_erp_inspect_alias(erp);
2217 if (erp_new)
2218 return erp_new;
2219
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002220 /* sense data are located in the refers record of the
2221 * already set up new ERP !
2222 * check if concurrent sens is available
2223 */
2224 sense = dasd_get_sense(&erp->refers->irb);
2225 if (!sense)
Stefan Haberland6c5f57c2008-02-05 16:50:46 +01002226 erp_new = dasd_3990_erp_control_check(erp);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002227 /* distinguish between 24 and 32 byte sense data */
Stefan Haberland6c5f57c2008-02-05 16:50:46 +01002228 else if (sense[27] & DASD_SENSE_BIT_0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002229
2230 /* inspect the 24 byte sense data */
2231 erp_new = dasd_3990_erp_inspect_24(erp, sense);
2232
2233 } else {
2234
2235 /* inspect the 32 byte sense data */
2236 erp_new = dasd_3990_erp_inspect_32(erp, sense);
2237
2238 } /* end distinguish between 24 and 32 byte sense data */
2239
2240 return erp_new;
2241}
2242
2243/*
2244 * DASD_3990_ERP_ADD_ERP
Horst Hummel138c0142006-06-29 14:58:12 +02002245 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07002246 * DESCRIPTION
2247 * This funtion adds an additional request block (ERP) to the head of
2248 * the given cqr (or erp).
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002249 * For a command mode cqr the erp is initialized as an default erp
2250 * (retry TIC).
2251 * For transport mode we make a copy of the original TCW (points to
2252 * the original TCCB, TIDALs, etc.) but give it a fresh
2253 * TSB so the original sense data will not be changed.
Linus Torvalds1da177e2005-04-16 15:20:36 -07002254 *
2255 * PARAMETER
Horst Hummel138c0142006-06-29 14:58:12 +02002256 * cqr head of the current ERP-chain (or single cqr if
Linus Torvalds1da177e2005-04-16 15:20:36 -07002257 * first error)
2258 * RETURN VALUES
2259 * erp pointer to new ERP-chain head
2260 */
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002261static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002262{
2263
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002264 struct dasd_device *device = cqr->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002265 struct ccw1 *ccw;
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002266 struct dasd_ccw_req *erp;
2267 int cplength, datasize;
2268 struct tcw *tcw;
2269 struct tsb *tsb;
2270
2271 if (cqr->cpmode == 1) {
2272 cplength = 0;
2273 datasize = sizeof(struct tcw) + sizeof(struct tsb);
2274 } else {
2275 cplength = 2;
2276 datasize = 0;
2277 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002278
2279 /* allocate additional request block */
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002280 erp = dasd_alloc_erp_request((char *) &cqr->magic,
2281 cplength, datasize, device);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002282 if (IS_ERR(erp)) {
2283 if (cqr->retries <= 0) {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002284 DBF_DEV_EVENT(DBF_ERR, device, "%s",
Linus Torvalds1da177e2005-04-16 15:20:36 -07002285 "Unable to allocate ERP request");
2286 cqr->status = DASD_CQR_FAILED;
2287 cqr->stopclk = get_clock ();
2288 } else {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002289 DBF_DEV_EVENT(DBF_ERR, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002290 "Unable to allocate ERP request "
2291 "(%i retries left)",
2292 cqr->retries);
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002293 dasd_block_set_timer(device->block, (HZ << 3));
Linus Torvalds1da177e2005-04-16 15:20:36 -07002294 }
2295 return cqr;
2296 }
2297
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002298 if (cqr->cpmode == 1) {
2299 /* make a shallow copy of the original tcw but set new tsb */
2300 erp->cpmode = 1;
2301 erp->cpaddr = erp->data;
2302 tcw = erp->data;
2303 tsb = (struct tsb *) &tcw[1];
2304 *tcw = *((struct tcw *)cqr->cpaddr);
2305 tcw->tsb = (long)tsb;
2306 } else {
2307 /* initialize request with default TIC to current ERP/CQR */
2308 ccw = erp->cpaddr;
2309 ccw->cmd_code = CCW_CMD_NOOP;
2310 ccw->flags = CCW_FLAG_CC;
2311 ccw++;
2312 ccw->cmd_code = CCW_CMD_TIC;
2313 ccw->cda = (long)(cqr->cpaddr);
2314 }
2315
Linus Torvalds1da177e2005-04-16 15:20:36 -07002316 erp->function = dasd_3990_erp_add_erp;
2317 erp->refers = cqr;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002318 erp->startdev = device;
2319 erp->memdev = device;
2320 erp->block = cqr->block;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002321 erp->magic = cqr->magic;
2322 erp->expires = 0;
2323 erp->retries = 256;
2324 erp->buildclk = get_clock();
Linus Torvalds1da177e2005-04-16 15:20:36 -07002325 erp->status = DASD_CQR_FILLED;
2326
2327 return erp;
2328}
2329
2330/*
Horst Hummel138c0142006-06-29 14:58:12 +02002331 * DASD_3990_ERP_ADDITIONAL_ERP
2332 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07002333 * DESCRIPTION
2334 * An additional ERP is needed to handle the current error.
2335 * Add ERP to the head of the ERP-chain containing the ERP processing
2336 * determined based on the sense data.
2337 *
2338 * PARAMETER
Horst Hummel138c0142006-06-29 14:58:12 +02002339 * cqr head of the current ERP-chain (or single cqr if
Linus Torvalds1da177e2005-04-16 15:20:36 -07002340 * first error)
2341 *
2342 * RETURN VALUES
2343 * erp pointer to new ERP-chain head
2344 */
2345static struct dasd_ccw_req *
2346dasd_3990_erp_additional_erp(struct dasd_ccw_req * cqr)
2347{
2348
2349 struct dasd_ccw_req *erp = NULL;
2350
2351 /* add erp and initialize with default TIC */
2352 erp = dasd_3990_erp_add_erp(cqr);
2353
2354 /* inspect sense, determine specific ERP if possible */
2355 if (erp != cqr) {
2356
2357 erp = dasd_3990_erp_inspect(erp);
2358 }
2359
2360 return erp;
2361
2362} /* end dasd_3990_erp_additional_erp */
2363
2364/*
2365 * DASD_3990_ERP_ERROR_MATCH
2366 *
2367 * DESCRIPTION
2368 * Check if the device status of the given cqr is the same.
2369 * This means that the failed CCW and the relevant sense data
2370 * must match.
2371 * I don't distinguish between 24 and 32 byte sense because in case of
2372 * 24 byte sense byte 25 and 27 is set as well.
2373 *
2374 * PARAMETER
Horst Hummel138c0142006-06-29 14:58:12 +02002375 * cqr1 first cqr, which will be compared with the
Linus Torvalds1da177e2005-04-16 15:20:36 -07002376 * cqr2 second cqr.
2377 *
2378 * RETURN VALUES
2379 * match 'boolean' for match found
2380 * returns 1 if match found, otherwise 0.
2381 */
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002382static int dasd_3990_erp_error_match(struct dasd_ccw_req *cqr1,
2383 struct dasd_ccw_req *cqr2)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002384{
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002385 char *sense1, *sense2;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002386
Stefan Weinhuber5c12f242008-03-05 12:37:10 +01002387 if (cqr1->startdev != cqr2->startdev)
2388 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002389
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002390 sense1 = dasd_get_sense(&cqr1->irb);
2391 sense2 = dasd_get_sense(&cqr2->irb);
Stefan Haberland6c5f57c2008-02-05 16:50:46 +01002392
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002393 /* one request has sense data, the other not -> no match, return 0 */
2394 if (!sense1 != !sense2)
2395 return 0;
2396 /* no sense data in both cases -> check cstat for IFCC */
2397 if (!sense1 && !sense2) {
2398 if ((scsw_cstat(&cqr1->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK |
2399 SCHN_STAT_CHN_CTRL_CHK)) ==
2400 (scsw_cstat(&cqr2->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK |
2401 SCHN_STAT_CHN_CTRL_CHK)))
Stefan Haberland6c5f57c2008-02-05 16:50:46 +01002402 return 1; /* match with ifcc*/
2403 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002404 /* check sense data; byte 0-2,25,27 */
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002405 if (!(sense1 && sense2 &&
2406 (memcmp(sense1, sense2, 3) == 0) &&
2407 (sense1[27] == sense2[27]) &&
2408 (sense1[25] == sense2[25]))) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002409
2410 return 0; /* sense doesn't match */
2411 }
2412
2413 return 1; /* match */
2414
2415} /* end dasd_3990_erp_error_match */
2416
2417/*
2418 * DASD_3990_ERP_IN_ERP
2419 *
2420 * DESCRIPTION
2421 * check if the current error already happened before.
2422 * quick exit if current cqr is not an ERP (cqr->refers=NULL)
2423 *
2424 * PARAMETER
2425 * cqr failed cqr (either original cqr or already an erp)
2426 *
2427 * RETURN VALUES
Horst Hummel138c0142006-06-29 14:58:12 +02002428 * erp erp-pointer to the already defined error
Linus Torvalds1da177e2005-04-16 15:20:36 -07002429 * recovery procedure OR
2430 * NULL if a 'new' error occurred.
2431 */
2432static struct dasd_ccw_req *
2433dasd_3990_erp_in_erp(struct dasd_ccw_req *cqr)
2434{
2435
2436 struct dasd_ccw_req *erp_head = cqr, /* save erp chain head */
2437 *erp_match = NULL; /* save erp chain head */
2438 int match = 0; /* 'boolean' for matching error found */
2439
2440 if (cqr->refers == NULL) { /* return if not in erp */
2441 return NULL;
2442 }
2443
2444 /* check the erp/cqr chain for current error */
2445 do {
2446 match = dasd_3990_erp_error_match(erp_head, cqr->refers);
2447 erp_match = cqr; /* save possible matching erp */
2448 cqr = cqr->refers; /* check next erp/cqr in queue */
2449
2450 } while ((cqr->refers != NULL) && (!match));
2451
2452 if (!match) {
2453 return NULL; /* no match was found */
2454 }
2455
2456 return erp_match; /* return address of matching erp */
2457
2458} /* END dasd_3990_erp_in_erp */
2459
2460/*
2461 * DASD_3990_ERP_FURTHER_ERP (24 & 32 byte sense)
2462 *
2463 * DESCRIPTION
Horst Hummel138c0142006-06-29 14:58:12 +02002464 * No retry is left for the current ERP. Check what has to be done
Linus Torvalds1da177e2005-04-16 15:20:36 -07002465 * with the ERP.
2466 * - do further defined ERP action or
Horst Hummel138c0142006-06-29 14:58:12 +02002467 * - wait for interrupt or
Linus Torvalds1da177e2005-04-16 15:20:36 -07002468 * - exit with permanent error
2469 *
2470 * PARAMETER
2471 * erp ERP which is in progress with no retry left
2472 *
2473 * RETURN VALUES
2474 * erp modified/additional ERP
2475 */
2476static struct dasd_ccw_req *
2477dasd_3990_erp_further_erp(struct dasd_ccw_req *erp)
2478{
2479
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002480 struct dasd_device *device = erp->startdev;
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002481 char *sense = dasd_get_sense(&erp->irb);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002482
2483 /* check for 24 byte sense ERP */
2484 if ((erp->function == dasd_3990_erp_bus_out) ||
2485 (erp->function == dasd_3990_erp_action_1) ||
2486 (erp->function == dasd_3990_erp_action_4)) {
2487
2488 erp = dasd_3990_erp_action_1(erp);
2489
2490 } else if (erp->function == dasd_3990_erp_action_5) {
2491
2492 /* retries have not been successful */
2493 /* prepare erp for retry on different channel path */
2494 erp = dasd_3990_erp_action_1(erp);
2495
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002496 if (sense && !(sense[2] & DASD_SENSE_BIT_0)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002497
Horst Hummel138c0142006-06-29 14:58:12 +02002498 /* issue a Diagnostic Control command with an
Linus Torvalds1da177e2005-04-16 15:20:36 -07002499 * Inhibit Write subcommand */
2500
2501 switch (sense[25]) {
2502 case 0x17:
2503 case 0x57:{ /* controller */
2504 erp = dasd_3990_erp_DCTL(erp, 0x20);
2505 break;
2506 }
2507 case 0x18:
2508 case 0x58:{ /* channel path */
2509 erp = dasd_3990_erp_DCTL(erp, 0x40);
2510 break;
2511 }
2512 case 0x19:
2513 case 0x59:{ /* storage director */
2514 erp = dasd_3990_erp_DCTL(erp, 0x80);
2515 break;
2516 }
2517 default:
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002518 DBF_DEV_EVENT(DBF_WARNING, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002519 "invalid subcommand modifier 0x%x "
2520 "for Diagnostic Control Command",
2521 sense[25]);
2522 }
2523 }
2524
2525 /* check for 32 byte sense ERP */
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002526 } else if (sense &&
2527 ((erp->function == dasd_3990_erp_compound_retry) ||
2528 (erp->function == dasd_3990_erp_compound_path) ||
2529 (erp->function == dasd_3990_erp_compound_code) ||
2530 (erp->function == dasd_3990_erp_compound_config))) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002531
2532 erp = dasd_3990_erp_compound(erp, sense);
2533
2534 } else {
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002535 /*
2536 * No retry left and no additional special handling
2537 * necessary
2538 */
2539 dev_err(&device->cdev->dev,
2540 "ERP %p has run out of retries and failed\n", erp);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002541
2542 erp->status = DASD_CQR_FAILED;
2543 }
2544
2545 return erp;
2546
2547} /* end dasd_3990_erp_further_erp */
2548
2549/*
Horst Hummel138c0142006-06-29 14:58:12 +02002550 * DASD_3990_ERP_HANDLE_MATCH_ERP
Linus Torvalds1da177e2005-04-16 15:20:36 -07002551 *
2552 * DESCRIPTION
2553 * An error occurred again and an ERP has been detected which is already
Horst Hummel138c0142006-06-29 14:58:12 +02002554 * used to handle this error (e.g. retries).
Linus Torvalds1da177e2005-04-16 15:20:36 -07002555 * All prior ERP's are asumed to be successful and therefore removed
2556 * from queue.
Horst Hummel138c0142006-06-29 14:58:12 +02002557 * If retry counter of matching erp is already 0, it is checked if further
Linus Torvalds1da177e2005-04-16 15:20:36 -07002558 * action is needed (besides retry) or if the ERP has failed.
2559 *
2560 * PARAMETER
2561 * erp_head first ERP in ERP-chain
2562 * erp ERP that handles the actual error.
2563 * (matching erp)
2564 *
2565 * RETURN VALUES
2566 * erp modified/additional ERP
2567 */
2568static struct dasd_ccw_req *
2569dasd_3990_erp_handle_match_erp(struct dasd_ccw_req *erp_head,
2570 struct dasd_ccw_req *erp)
2571{
2572
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002573 struct dasd_device *device = erp_head->startdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002574 struct dasd_ccw_req *erp_done = erp_head; /* finished req */
2575 struct dasd_ccw_req *erp_free = NULL; /* req to be freed */
2576
2577 /* loop over successful ERPs and remove them from chanq */
2578 while (erp_done != erp) {
2579
2580 if (erp_done == NULL) /* end of chain reached */
2581 panic(PRINTK_HEADER "Programming error in ERP! The "
2582 "original request was lost\n");
2583
2584 /* remove the request from the device queue */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002585 list_del(&erp_done->blocklist);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002586
2587 erp_free = erp_done;
2588 erp_done = erp_done->refers;
2589
2590 /* free the finished erp request */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002591 dasd_free_erp_request(erp_free, erp_free->memdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002592
2593 } /* end while */
2594
2595 if (erp->retries > 0) {
2596
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002597 char *sense = dasd_get_sense(&erp->refers->irb);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002598
2599 /* check for special retries */
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002600 if (sense && erp->function == dasd_3990_erp_action_4) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002601
2602 erp = dasd_3990_erp_action_4(erp, sense);
2603
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002604 } else if (sense &&
2605 erp->function == dasd_3990_erp_action_1B_32) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002606
2607 erp = dasd_3990_update_1B(erp, sense);
2608
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002609 } else if (sense && erp->function == dasd_3990_erp_int_req) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002610
2611 erp = dasd_3990_erp_int_req(erp);
2612
2613 } else {
2614 /* simple retry */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002615 DBF_DEV_EVENT(DBF_DEBUG, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002616 "%i retries left for erp %p",
2617 erp->retries, erp);
2618
2619 /* handle the request again... */
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002620 erp->status = DASD_CQR_FILLED;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002621 }
2622
2623 } else {
2624 /* no retry left - check for further necessary action */
2625 /* if no further actions, handle rest as permanent error */
2626 erp = dasd_3990_erp_further_erp(erp);
2627 }
2628
2629 return erp;
2630
2631} /* end dasd_3990_erp_handle_match_erp */
2632
2633/*
2634 * DASD_3990_ERP_ACTION
2635 *
2636 * DESCRIPTION
Joe Perches5d67d162008-01-26 14:11:20 +01002637 * control routine for 3990 erp actions.
Linus Torvalds1da177e2005-04-16 15:20:36 -07002638 * Has to be called with the queue lock (namely the s390_irq_lock) acquired.
2639 *
2640 * PARAMETER
2641 * cqr failed cqr (either original cqr or already an erp)
2642 *
2643 * RETURN VALUES
2644 * erp erp-pointer to the head of the ERP action chain.
2645 * This means:
2646 * - either a ptr to an additional ERP cqr or
Horst Hummel138c0142006-06-29 14:58:12 +02002647 * - the original given cqr (which's status might
Linus Torvalds1da177e2005-04-16 15:20:36 -07002648 * be modified)
2649 */
2650struct dasd_ccw_req *
2651dasd_3990_erp_action(struct dasd_ccw_req * cqr)
2652{
Linus Torvalds1da177e2005-04-16 15:20:36 -07002653 struct dasd_ccw_req *erp = NULL;
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002654 struct dasd_device *device = cqr->startdev;
Horst Hummel9575bf22006-12-08 15:54:15 +01002655 struct dasd_ccw_req *temp_erp = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002656
Horst Hummel9575bf22006-12-08 15:54:15 +01002657 if (device->features & DASD_FEATURE_ERPLOG) {
2658 /* print current erp_chain */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002659 dev_err(&device->cdev->dev,
2660 "ERP chain at BEGINNING of ERP-ACTION\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07002661 for (temp_erp = cqr;
2662 temp_erp != NULL; temp_erp = temp_erp->refers) {
2663
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002664 dev_err(&device->cdev->dev,
2665 "ERP %p (%02x) refers to %p\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -07002666 temp_erp, temp_erp->status,
2667 temp_erp->refers);
2668 }
2669 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002670
Coly Li73ac36e2009-01-07 18:09:16 -08002671 /* double-check if current erp/cqr was successful */
Stefan Weinhuberf3eb5382009-03-26 15:23:48 +01002672 if ((scsw_cstat(&cqr->irb.scsw) == 0x00) &&
2673 (scsw_dstat(&cqr->irb.scsw) ==
Peter Oberparleiter23d805b2008-07-14 09:58:50 +02002674 (DEV_STAT_CHN_END | DEV_STAT_DEV_END))) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002675
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002676 DBF_DEV_EVENT(DBF_DEBUG, device,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002677 "ERP called for successful request %p"
2678 " - NO ERP necessary", cqr);
2679
2680 cqr->status = DASD_CQR_DONE;
2681
2682 return cqr;
2683 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002684
2685 /* check if error happened before */
2686 erp = dasd_3990_erp_in_erp(cqr);
2687
2688 if (erp == NULL) {
2689 /* no matching erp found - set up erp */
2690 erp = dasd_3990_erp_additional_erp(cqr);
2691 } else {
2692 /* matching erp found - set all leading erp's to DONE */
2693 erp = dasd_3990_erp_handle_match_erp(cqr, erp);
2694 }
2695
Horst Hummel9575bf22006-12-08 15:54:15 +01002696 if (device->features & DASD_FEATURE_ERPLOG) {
2697 /* print current erp_chain */
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002698 dev_err(&device->cdev->dev,
2699 "ERP chain at END of ERP-ACTION\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07002700 for (temp_erp = erp;
2701 temp_erp != NULL; temp_erp = temp_erp->refers) {
2702
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002703 dev_err(&device->cdev->dev,
2704 "ERP %p (%02x) refers to %p\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -07002705 temp_erp, temp_erp->status,
2706 temp_erp->refers);
2707 }
2708 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002709
Stefan Weinhuber8e09f212008-01-26 14:11:23 +01002710 /* enqueue ERP request if it's a new one */
2711 if (list_empty(&erp->blocklist)) {
2712 cqr->status = DASD_CQR_IN_ERP;
2713 /* add erp request before the cqr */
2714 list_add_tail(&erp->blocklist, &cqr->blocklist);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002715 }
2716
Stefan Haberlandfc19f382009-03-26 15:23:49 +01002717
2718
Linus Torvalds1da177e2005-04-16 15:20:36 -07002719 return erp;
2720
2721} /* end dasd_3990_erp_action */