patch-2.4.22 linux-2.4.22/drivers/s390/block/dasd_3990_erp.c

Next file: linux-2.4.22/drivers/s390/block/dasd_diag.c
Previous file: linux-2.4.22/drivers/s390/block/dasd.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/drivers/s390/block/dasd_3990_erp.c linux-2.4.22/drivers/s390/block/dasd_3990_erp.c
@@ -5,6 +5,8 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001
  *
+ * $Revision: 1.50 $
+ *
  * History of changes:
  * 05/14/01 fixed PL030160GTO (BUG() in erp_action_5)
  */
@@ -41,7 +43,9 @@
         char    *nl, 
                 *end_cqr,
                 *begin, 
-                *end;
+                *end,
+                buffer[80];
+        
         
         /* dump sense data */
         if (device->discipline            && 
@@ -54,83 +58,130 @@
         /* log the channel program */
         while (loop_cqr != NULL) {
                 
-                DASD_MESSAGE (KERN_ERR, device, 
-                              "(%s) ERP chain report for req: %p",
-                              caller == 0 ? "EXAMINE" : "ACTION",
-                              loop_cqr);
+                DEV_MESSAGE (KERN_ERR, device, 
+                             "(%s) ERP chain report for req: %p",
+                             caller == 0 ? "EXAMINE" : "ACTION",
+                             loop_cqr);
                 
                 nl      = (char *) loop_cqr;
                 end_cqr = nl + sizeof (ccw_req_t); 
                 
                 while (nl < end_cqr) {
+
+                        sprintf (buffer,
+                                 "%p: %02x%02x%02x%02x"
+                                 " %02x%02x%02x%02x"
+                                 " %02x%02x%02x%02x"
+                                 " %02x%02x%02x%02x",
+                                 nl,
+                                 nl[0], nl[1], nl[2], nl[3],
+                                 nl[4], nl[5], nl[6], nl[7],
+                                 nl[8], nl[9], nl[10], nl[11],
+                                 nl[12], nl[13], nl[14], nl[15]);
+        
+                        DEV_MESSAGE (KERN_ERR, device, "%s", 
+                                     buffer);
                         
-                        DASD_MESSAGE (KERN_ERR, device, 
-                                      "%p: %02x%02x%02x%02x %02x%02x%02x%02x "
-                                      "%02x%02x%02x%02x %02x%02x%02x%02x",
-                                      nl,
-                                      nl[0], nl[1], nl[2], nl[3],
-                                      nl[4], nl[5], nl[6], nl[7],
-                                      nl[8], nl[9], nl[10], nl[11],
-                                      nl[12], nl[13], nl[14], nl[15]);
                         nl +=16;
                 }        
-                
+               	
+		DEV_MESSAGE (KERN_ERR, device,
+				"DATA area is at: %p",
+				loop_cqr->data);
+
+		nl      = (char *) loop_cqr->data;
+		end_cqr = nl + loop_cqr->datasize;
+
+                while (nl < end_cqr) {
+					 
+                        sprintf (buffer,
+                                 "%p: %02x%02x%02x%02x"
+                                 " %02x%02x%02x%02x"
+                                 " %02x%02x%02x%02x"
+                                 " %02x%02x%02x%02x",
+                                  nl,
+                                  nl[0], nl[1], nl[2], nl[3],
+                                  nl[4], nl[5], nl[6], nl[7],
+                                  nl[8], nl[9], nl[10], nl[11],
+                                 nl[12], nl[13], nl[14], nl[15]);
+
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
+                                     buffer);
+
+                        nl +=16;
+              }
+	       	
                 nl  = (char *) loop_cqr->cpaddr;
                 
                 if (loop_cqr->cplength > 40) { /* log only parts of the CP */
 
-                        DASD_MESSAGE (KERN_ERR, device, "%s",
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
                                       "Start of channel program:");
                         
                         for (i = 0; i < 20; i += 2) { 
                                 
-                                DASD_MESSAGE (KERN_ERR, device, 
-                                              "%p: %02x%02x%02x%02x %02x%02x%02x%02x "
-                                              "%02x%02x%02x%02x %02x%02x%02x%02x",
-                                              nl,
-                                              nl[0], nl[1], nl[2], nl[3],
-                                              nl[4], nl[5], nl[6], nl[7],
-                                              nl[8], nl[9], nl[10], nl[11],
-                                              nl[12], nl[13], nl[14], nl[15]);
+                                sprintf (buffer,
+                                         "%p: %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x",
+                                         nl,
+                                         nl[0], nl[1], nl[2], nl[3],
+                                         nl[4], nl[5], nl[6], nl[7],
+                                         nl[8], nl[9], nl[10], nl[11],
+                                         nl[12], nl[13], nl[14], nl[15]);
                                 
+                                DEV_MESSAGE (KERN_ERR, device, "%s",
+                                             buffer);
+
                                 nl += 16;
                         }
                         
-                        DASD_MESSAGE (KERN_ERR, device, "%s",
-                                      "End of channel program:");
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
+                                     "End of channel program:");
                         
                         nl  = (char *) loop_cqr->cpaddr;
                         nl  += ((loop_cqr->cplength - 10) * 8);
                         
                         for (i = 0; i < 20; i += 2) { 
                                 
-                                DASD_MESSAGE (KERN_ERR, device, 
-                                              "%p: %02x%02x%02x%02x %02x%02x%02x%02x "
-                                              "%02x%02x%02x%02x %02x%02x%02x%02x",
-                                              nl,
-                                              nl[0], nl[1], nl[2], nl[3],
-                                              nl[4], nl[5], nl[6], nl[7],
-                                              nl[8], nl[9], nl[10], nl[11],
-                                              nl[12], nl[13], nl[14], nl[15]);
+                                sprintf (buffer,
+                                         "%p: %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x",
+                                         nl,
+                                         nl[0], nl[1], nl[2], nl[3],
+                                         nl[4], nl[5], nl[6], nl[7],
+                                         nl[8], nl[9], nl[10], nl[11],
+                                         nl[12], nl[13], nl[14], nl[15]);
+                                
+                                DEV_MESSAGE (KERN_ERR, device, "%s",
+                                             buffer);
                                 
                                 nl += 16;
                         }
                         
                 } else { /* log the whole CP */
                         
-                        DASD_MESSAGE (KERN_ERR, device, "%s",
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
                                       "Channel program (complete):");
                         
                         for (i = 0; i < (loop_cqr->cplength + 4); i += 2) { 
                                 
-                                DASD_MESSAGE (KERN_ERR, device, 
-                                              "%p: %02x%02x%02x%02x %02x%02x%02x%02x "
-                                              "%02x%02x%02x%02x %02x%02x%02x%02x",
-                                              nl,
-                                              nl[0], nl[1], nl[2], nl[3],
-                                              nl[4], nl[5], nl[6], nl[7],
-                                              nl[8], nl[9], nl[10], nl[11],
-                                              nl[12], nl[13], nl[14], nl[15]);
+                                sprintf (buffer,
+                                         "%p: %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x"
+                                         " %02x%02x%02x%02x",
+                                         nl,
+                                         nl[0], nl[1], nl[2], nl[3],
+                                         nl[4], nl[5], nl[6], nl[7],
+                                         nl[8], nl[9], nl[10], nl[11],
+                                         nl[12], nl[13], nl[14], nl[15]);
+                                
+                                DEV_MESSAGE (KERN_ERR, device, "%s",
+                                             buffer);
                                 
                                 nl += 16;
                         }
@@ -150,29 +201,34 @@
                         
                                 nl -= 10*8;     /* start some bytes before */
                                 
-                                DASD_MESSAGE (KERN_ERR, device, 
-                                                "Failed CCW (%p) (area):",
-                                                (void *)(long)cpa);
+                                DEV_MESSAGE (KERN_ERR, device, 
+                                             "Failed CCW (%p) (area):",
+                                             (void *)(long)cpa);
                                 
                                 for (i = 0; i < 20; i += 2) { 
                                         
-                                        DASD_MESSAGE (KERN_ERR, device, 
-                                                      "%p: %02x%02x%02x%02x %02x%02x%02x%02x "
-                                                      "%02x%02x%02x%02x %02x%02x%02x%02x",
-                                                      nl,
-                                                      nl[0], nl[1], nl[2], nl[3],
-                                                      nl[4], nl[5], nl[6], nl[7],
-                                                      nl[8], nl[9], nl[10], nl[11],
-                                                      nl[12], nl[13], nl[14], nl[15]);
+                                        sprintf (buffer,
+                                                 "%p: %02x%02x%02x%02x"
+                                                 " %02x%02x%02x%02x"
+                                                 " %02x%02x%02x%02x"
+                                                 " %02x%02x%02x%02x",
+                                                 nl,
+                                                 nl[0], nl[1], nl[2], nl[3],
+                                                 nl[4], nl[5], nl[6], nl[7],
+                                                 nl[8], nl[9], nl[10], nl[11],
+                                                 nl[12], nl[13], nl[14], nl[15]);
+
+                                        DEV_MESSAGE (KERN_ERR, device, "%s",
+                                                     buffer);
                                         
                                         nl += 16;
                                 }
                                 
                         } else {
                                 
-                                DASD_MESSAGE (KERN_ERR, device, 
-                                              "Failed CCW (%p) already logged",
-                                              (void *)(long)cpa);
+                                DEV_MESSAGE (KERN_ERR, device, 
+                                             "Failed CCW (%p) already logged",
+                                             (void *)(long)cpa);
                         }
                 }
                 
@@ -216,9 +272,9 @@
 	if ((  sense[0] & SNS0_CMD_REJECT       ) &&
 	    (!(sense[2] & SNS2_ENV_DATA_PRESENT))   ) {
 
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "EXAMINE 24: Command Reject detected - "
-                              "fatal error");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "EXAMINE 24: Command Reject detected - "
+                             "fatal error");
 
                 return dasd_era_fatal;
 	}
@@ -227,9 +283,9 @@
 	if ((  sense[1] & SNS1_INV_TRACK_FORMAT ) &&
             (!(sense[2] & SNS2_ENV_DATA_PRESENT))   ) {
 
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "EXAMINE 24: Invalid Track Format detected "
-                              "- fatal error");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "EXAMINE 24: Invalid Track Format detected "
+                             "- fatal error");
 
                 return dasd_era_fatal;
 	}
@@ -237,10 +293,10 @@
 	/* check for 'No Record Found' */
 	if (sense[1] & SNS1_NO_REC_FOUND) {
                 
-                DASD_MESSAGE (KERN_ERR, device,
-                              "EXAMINE 24: No Record Found detected %s",
-                              cqr == device->init_cqr ? " " :
-                              "- fatal error");
+                DEV_MESSAGE (KERN_ERR, device,
+                             "EXAMINE 24: No Record Found detected %s",
+                             cqr == device->init_cqr ? " " :
+                             "- fatal error");
 
                 return dasd_era_fatal;
 	}
@@ -274,8 +330,9 @@
 		return dasd_era_none;
 
 	case 0x01:
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "EXAMINE 32: fatal error");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "EXAMINE 32: fatal error");
+
 		return dasd_era_fatal;
 
 	default:
@@ -405,20 +462,24 @@
 
 	dasd_device_t *device = erp->device;
 
-        DASD_MESSAGE (KERN_INFO, device,
-                      "blocking request queue for %is",
-                      (int) expires);
+        DEV_MESSAGE (KERN_INFO, device,
+                     "blocking request queue for %is",
+                     (int) expires);
 
         check_then_set (&erp->status,
                         CQR_STATUS_ERROR,
                         CQR_STATUS_PENDING);
 
         /* restart queue after some time */
-        device->timer.function = dasd_3990_erp_restart_queue; 
-        device->timer.data     = (unsigned long) erp;
-        device->timer.expires  = jiffies + (expires * HZ);
-
-        add_timer(&device->timer); 
+        if (!timer_pending(&device->blocking_timer)) {
+                init_timer(&device->blocking_timer);
+                device->blocking_timer.function = dasd_3990_erp_restart_queue; 
+                device->blocking_timer.data     = (unsigned long) erp;
+                device->blocking_timer.expires  = jiffies + (expires * HZ);
+                add_timer(&device->blocking_timer); 
+        } else {
+                mod_timer(&device->blocking_timer, jiffies + (expires * HZ));
+        }
 
 } /* end dasd_3990_erp_block_queue */ 
 
@@ -453,8 +514,8 @@
         /* 'restart' the device queue */
         if (cqr->status == CQR_STATUS_PENDING) {
                 
-                DASD_MESSAGE (KERN_INFO, device, "%s",
-                              "request queue restarted by MIH");
+                DEV_MESSAGE (KERN_INFO, device, "%s",
+                             "request queue restarted by MIH");
 
                 check_then_set (&cqr->status,
                                 CQR_STATUS_PENDING,
@@ -498,9 +559,9 @@
         } else {
 
                 /* issue a message and wait for 'device ready' interrupt */
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "is offline or not installed - "
-                              "INTERVENTION REQUIRED!!");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "is offline or not installed - "
+                             "INTERVENTION REQUIRED!!");
                 
                 dasd_3990_erp_block_queue (erp,
                                            60);
@@ -538,11 +599,11 @@
 
 	if ((erp->lpm & ioinfo[irq]->opm) != 0x00) {
 
-		DASD_MESSAGE (KERN_DEBUG, device,
-                              "try alternate lpm=%x (lpum=%x / opm=%x)",
-                              erp->lpm,
-                              erp->dstat->lpum,
-                              ioinfo[irq]->opm);
+		DEV_MESSAGE (KERN_DEBUG, device,
+                             "try alternate lpm=%x (lpum=%x / opm=%x)",
+                             erp->lpm,
+                             erp->dstat->lpum,
+                             ioinfo[irq]->opm);
 
 		/* reset status to queued to handle the request again... */
 		check_then_set (&erp->status,
@@ -553,11 +614,11 @@
                 
 	} else {
          
-                DASD_MESSAGE (KERN_ERR, device,
-                              "No alternate channel path left (lpum=%x / "
-                              "opm=%x) -> permanent error",
-                              erp->dstat->lpum,
-                              ioinfo[irq]->opm);
+                DEV_MESSAGE (KERN_ERR, device,
+                             "No alternate channel path left (lpum=%x / "
+                             "opm=%x) -> permanent error",
+                             erp->dstat->lpum,
+                             ioinfo[irq]->opm);
                 
                 /* post request with permanent error */
                 check_then_set (&erp->status,
@@ -598,8 +659,8 @@
         
 	if (!dctl_cqr) {
 
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Unable to allocate DCTL-CQR");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "Unable to allocate DCTL-CQR");
                 
                 check_then_set (&erp->status,
                                 CQR_STATUS_ERROR,
@@ -620,8 +681,9 @@
         if (dasd_set_normalized_cda(ccw, 
                                     __pa (DCTL_data), dctl_cqr, erp->device)) {
                 dasd_free_request (dctl_cqr, erp->device);
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Unable to allocate DCTL-CQR");
+
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "Unable to allocate DCTL-CQR");
 
                 check_then_set (&erp->status,
                                 CQR_STATUS_ERROR,
@@ -635,7 +697,8 @@
         dctl_cqr->lpm      = LPM_ANYPATH;
         dctl_cqr->expires  = 5 * TOD_MIN;
         dctl_cqr->retries  = 2;
-	asm volatile ("STCK %0":"=m" (dctl_cqr->buildclk));
+
+	dctl_cqr->buildclk = get_clock ();
 
         dctl_cqr->status = CQR_STATUS_FILLED;
 
@@ -706,17 +769,16 @@
 
         } else {
 
-                if (sense[25] & 0x1D) {	/* state change pending */
+                if (sense[25] == 0x1D) {	/* state change pending */
                         
-                        DASD_MESSAGE (KERN_INFO, device, "%s",
-                                      "waiting for state change pending "
-                                      "int");
+                        DEV_MESSAGE (KERN_INFO, device, "%s",
+                                     "waiting for state change pending "
+                                     "int");
                         
                         dasd_3990_erp_block_queue (erp,
                                                    30);
-                        
                 } else {
-
+			DEV_MESSAGE (KERN_INFO, device, "redriving request immediately, %d retries left", erp->retries);
                         /* no state change pending - retry */
                         check_then_set (&erp->status,
                                         CQR_STATUS_ERROR,
@@ -793,98 +855,98 @@
 			case 0x00:	/* No Message */
 				break;
 			case 0x01:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Invalid Command");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Invalid Command");
 				break;
 			case 0x02:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Invalid Command "
-                                              "Sequence");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Invalid Command "
+                                             "Sequence");
 				break;
 			case 0x03:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - CCW Count less than "
-                                              "required");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - CCW Count less than "
+                                             "required");
 				break;
 			case 0x04:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Invalid Parameter");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Invalid Parameter");
 				break;
 			case 0x05:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Diagnostic of Sepecial"
-                                              " Command Violates File Mask");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Diagnostic of Sepecial"
+                                             " Command Violates File Mask");
 				break;
 			case 0x07:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Channel Returned with "
-                                              "Incorrect retry CCW");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Channel Returned with "
+                                             "Incorrect retry CCW");
 				break;
 			case 0x08:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Reset Notification");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Reset Notification");
 				break;
 			case 0x09:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Storage Path Restart");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Storage Path Restart");
 				break;
 			case 0x0A:
-                                DASD_MESSAGE (KERN_WARNING, device,
-                                              "FORMAT 0 - Channel requested "
-                                              "... %02x",
-                                              sense[8]);
+                                DEV_MESSAGE (KERN_WARNING, device,
+                                             "FORMAT 0 - Channel requested "
+                                             "... %02x",
+                                             sense[8]);
 				break;
 			case 0x0B:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Invalid Defective/"
-                                              "Alternate Track Pointer");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Invalid Defective/"
+                                             "Alternate Track Pointer");
 				break;
 			case 0x0C:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - DPS Installation "
-                                              "Check");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - DPS Installation "
+                                             "Check");
 				break;
 			case 0x0E:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Command Invalid on "
-                                              "Secondary Address");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Command Invalid on "
+                                             "Secondary Address");
 				break;
 			case 0x0F:
-                                DASD_MESSAGE (KERN_WARNING, device,
-                                              "FORMAT 0 - Status Not As "
-                                              "Required: reason %02x",
-                                              sense[8]);
+                                DEV_MESSAGE (KERN_WARNING, device,
+                                             "FORMAT 0 - Status Not As "
+                                             "Required: reason %02x",
+                                             sense[8]);
 				break;
 			default:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Reseved");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Reseved");
 			}
 		} else {
 			switch (msg_no) {
 			case 0x00:	/* No Message */
 				break;
 			case 0x01:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Device Error Source");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Device Error Source");
 				break;
 			case 0x02:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Reserved");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Reserved");
 				break;
 			case 0x03:
-                                DASD_MESSAGE (KERN_WARNING, device,
-                                              "FORMAT 0 - Device Fenced - "
-                                              "device = %02x",
-                                              sense[4]);
+                                DEV_MESSAGE (KERN_WARNING, device,
+                                             "FORMAT 0 - Device Fenced - "
+                                             "device = %02x",
+                                             sense[4]);
 				break;
 			case 0x04:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Data Pinned for "
-                                              "Device");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Data Pinned for "
+                                             "Device");
 				break;
 			default:
-                                DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                              "FORMAT 0 - Reserved");
+                                DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                             "FORMAT 0 - Reserved");
 			}
                 }
                 break;
@@ -894,348 +956,348 @@
 		case 0x00:	/* No Message */
 			break;
 		case 0x01:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Device Status 1 not as "
-                                      "expected");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Device Status 1 not as "
+                                     "expected");
 			break;
 		case 0x03:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Index missing");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Index missing");
 			break;
 		case 0x04:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Interruption cannot be reset");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Interruption cannot be reset");
 			break;
 		case 0x05:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Device did not respond to "
-                                      "selection");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Device did not respond to "
+                                     "selection");
 			break;
 		case 0x06:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Device check-2 error or Set "
-                                      "Sector is not complete");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Device check-2 error or Set "
+                                     "Sector is not complete");
 			break;
 		case 0x07:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Head address does not "
-                                      "compare");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Head address does not "
+                                     "compare");
 			break;
 		case 0x08:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Device status 1 not valid");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Device status 1 not valid");
 			break;
 		case 0x09:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Device not ready");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Device not ready");
 			break;
 		case 0x0A:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Track physical address did "
-                                      "not compare");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Track physical address did "
+                                     "not compare");
 			break;
 		case 0x0B:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Missing device address bit");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Missing device address bit");
 			break;
 		case 0x0C:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Drive motor switch is off");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Drive motor switch is off");
 			break;
 		case 0x0D:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Seek incomplete");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Seek incomplete");
 			break;
 		case 0x0E:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Cylinder address did not "
-                                      "compare");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Cylinder address did not "
+                                     "compare");
 			break;
 		case 0x0F:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Offset active cannot be "
-                                      "reset");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Offset active cannot be "
+                                     "reset");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 1 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 1 - Reserved");
 		}
                 break;		
                         
 	case 0x20:	/* Format 2 - 3990 Equipment Checks */
 		switch (msg_no) {
 		case 0x08:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 2 - 3990 check-2 error");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 2 - 3990 check-2 error");
 			break;
 		case 0x0E:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 2 - Support facility errors");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 2 - Support facility errors");
 			break;
 		case 0x0F:
-                        DASD_MESSAGE (KERN_WARNING, device,
-                                      "FORMAT 2 - Microcode detected error %02x",
-                                      sense[8]);
+                        DEV_MESSAGE (KERN_WARNING, device,
+                                     "FORMAT 2 - Microcode detected error %02x",
+                                     sense[8]);
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 2 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 2 - Reserved");
 		}
                 break;		
 
 	case 0x30:	/* Format 3 - 3990 Control Checks */
 		switch (msg_no) {
 		case 0x0F:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 3 - Allegiance terminated");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 3 - Allegiance terminated");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 3 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 3 - Reserved");
 		}
                 break;		
 
 	case 0x40:	/* Format 4 - Data Checks */
 		switch (msg_no) {
 		case 0x00:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Home address area error");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Home address area error");
 			break;
 		case 0x01:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Count area error");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Count area error");
 			break;
 		case 0x02:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Key area error");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Key area error");
 			break;
 		case 0x03:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Data area error");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Data area error");
 			break;
 		case 0x04:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - No sync byte in home address "
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - No sync byte in home address "
                                       "area");
 			break;
 		case 0x05:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - No sync byte in count address "
-                                      "area");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - No sync byte in count address "
+                                     "area");
 			break;
 		case 0x06:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - No sync byte in key area");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - No sync byte in key area");
 			break;
 		case 0x07:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - No sync byte in data area");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - No sync byte in data area");
 			break;
 		case 0x08:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Home address area error; "
-                                      "offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Home address area error; "
+                                     "offset active");
 			break;
 		case 0x09:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Count area error; offset "
-                                      "active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Count area error; offset "
+                                     "active");
 			break;
 		case 0x0A:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Key area error; offset "
-                                      "active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Key area error; offset "
+                                     "active");
 			break;
 		case 0x0B:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Data area error; "
-                                      "offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Data area error; "
+                                     "offset active");
 			break;
 		case 0x0C:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - No sync byte in home "
-                                      "address area; offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - No sync byte in home "
+                                     "address area; offset active");
 			break;
 		case 0x0D:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - No syn byte in count "
-                                      "address area; offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - No syn byte in count "
+                                     "address area; offset active");
 			break;
 		case 0x0E:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - No sync byte in key area; "
-                                      "offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - No sync byte in key area; "
+                                     "offset active");
 			break;
 		case 0x0F:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - No syn byte in data area; "
-                                      "offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - No syn byte in data area; "
+                                     "offset active");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 4 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 4 - Reserved");
 		}
                 break;		
 
 	case 0x50:	/* Format 5 - Data Check with displacement information */
 		switch (msg_no) {
 		case 0x00:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Data Check in the "
-                                      "home address area");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Data Check in the "
+                                     "home address area");
 			break;
 		case 0x01:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Data Check in the count area");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Data Check in the count area");
 			break;
 		case 0x02:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Data Check in the key area");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Data Check in the key area");
 			break;
 		case 0x03:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Data Check in the data area");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Data Check in the data area");
 			break;
 		case 0x08:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Data Check in the "
-                                      "home address area; offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Data Check in the "
+                                     "home address area; offset active");
 			break;
 		case 0x09:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Data Check in the count area; "
-                                      "offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Data Check in the count area; "
+                                     "offset active");
 			break;
 		case 0x0A:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Data Check in the key area; "
-                                      "offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Data Check in the key area; "
+                                     "offset active");
 			break;
 		case 0x0B:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Data Check in the data area; "
-                                      "offset active");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Data Check in the data area; "
+                                     "offset active");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 5 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 5 - Reserved");
 		}
                 break;		
 
 	case 0x60:	/* Format 6 - Usage Statistics/Overrun Errors */
 		switch (msg_no) {
 		case 0x00:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Overrun on channel A");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Overrun on channel A");
 			break;
 		case 0x01:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Overrun on channel B");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Overrun on channel B");
 			break;
 		case 0x02:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Overrun on channel C");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Overrun on channel C");
 			break;
 		case 0x03:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Overrun on channel D");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Overrun on channel D");
 			break;
 		case 0x04:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Overrun on channel E");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Overrun on channel E");
 			break;
 		case 0x05:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Overrun on channel F");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Overrun on channel F");
 			break;
 		case 0x06:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Overrun on channel G");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Overrun on channel G");
 			break;
 		case 0x07:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Overrun on channel H");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Overrun on channel H");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 6 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 6 - Reserved");
 		}
                 break;		
 
 	case 0x70:	/* Format 7 - Device Connection Control Checks */
 		switch (msg_no) {
 		case 0x00:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - RCC initiated by a connection "
-                                      "check alert");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - RCC initiated by a connection "
+                                     "check alert");
 			break;
 		case 0x01:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - RCC 1 sequence not "
-                                      "successful");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - RCC 1 sequence not "
+                                     "successful");
 			break;
 		case 0x02:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - RCC 1 and RCC 2 sequences not "
-                                      "successful");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - RCC 1 and RCC 2 sequences not "
+                                     "successful");
 			break;
 		case 0x03:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - Invalid tag-in during "
-                                      "selection sequence");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - Invalid tag-in during "
+                                     "selection sequence");
 			break;
 		case 0x04:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - extra RCC required");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - extra RCC required");
 			break;
 		case 0x05:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - Invalid DCC selection "
-                                      "response or timeout");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - Invalid DCC selection "
+                                     "response or timeout");
 			break;
 		case 0x06:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - Missing end operation; device "
-                                      "transfer complete");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - Missing end operation; device "
+                                     "transfer complete");
 			break;
 		case 0x07:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - Missing end operation; device "
-                                      "transfer incomplete");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - Missing end operation; device "
+                                     "transfer incomplete");
 			break;
 		case 0x08:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - Invalid tag-in for an "
-                                      "immediate command sequence");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - Invalid tag-in for an "
+                                     "immediate command sequence");
 			break;
 		case 0x09:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - Invalid tag-in for an "
-                                      "extended command sequence");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - Invalid tag-in for an "
+                                     "extended command sequence");
 			break;
 		case 0x0A:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - 3990 microcode time out when "
-                                      "stopping selection");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - 3990 microcode time out when "
+                                     "stopping selection");
 			break;
 		case 0x0B:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - No response to selection "
-                                      "after a poll interruption");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - No response to selection "
+                                     "after a poll interruption");
 			break;
 		case 0x0C:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - Permanent path error (DASD "
-                                      "controller not available)");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - Permanent path error (DASD "
+                                     "controller not available)");
 			break;
 		case 0x0D:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - DASD controller not available"
-                                      " on disconnected command chain");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - DASD controller not available"
+                                     " on disconnected command chain");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 7 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 7 - Reserved");
 		}
                 break;		
 
@@ -1243,52 +1305,52 @@
 		switch (msg_no) {
 		case 0x00:	/* No Message */
 		case 0x01:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - Error correction code "
-                                      "hardware fault");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - Error correction code "
+                                     "hardware fault");
 			break;
 		case 0x03:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - Unexpected end operation "
-                                      "response code");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - Unexpected end operation "
+                                     "response code");
 			break;
 		case 0x04:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - End operation with transfer "
-                                      "count not zero");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - End operation with transfer "
+                                     "count not zero");
 			break;
 		case 0x05:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - End operation with transfer "
-                                      "count zero");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - End operation with transfer "
+                                     "count zero");
 			break;
 		case 0x06:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - DPS checks after a system "
-                                      "reset or selective reset");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - DPS checks after a system "
+                                     "reset or selective reset");
 			break;
 		case 0x07:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - DPS cannot be filled");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - DPS cannot be filled");
 			break;
 		case 0x08:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - Short busy time-out during "
-                                      "device selection");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - Short busy time-out during "
+                                     "device selection");
 			break;
 		case 0x09:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - DASD controller failed to "
-                                      "set or reset the long busy latch");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - DASD controller failed to "
+                                     "set or reset the long busy latch");
 			break;
 		case 0x0A:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - No interruption from device "
-                                      "during a command chain");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - No interruption from device "
+                                     "during a command chain");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 8 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 8 - Reserved");
 		}
                 break;		
 
@@ -1297,94 +1359,97 @@
 		case 0x00:
 			break;	/* No Message */
 		case 0x06:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 9 - Device check-2 error");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 9 - Device check-2 error");
 			break;
 		case 0x07:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 9 - Head address did not compare");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 9 - Head address did not compare");
 			break;
 		case 0x0A:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 9 - Track physical address did "
-                                      "not compare while oriented");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 9 - Track physical address did "
+                                     "not compare while oriented");
 			break;
 		case 0x0E:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 9 - Cylinder address did not "
-                                      "compare");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 9 - Cylinder address did not "
+                                     "compare");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT 9 - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT 9 - Reserved");
 		}
                 break;		
 
 	case 0xF0:		/* Format F - Cache Storage Checks */
 		switch (msg_no) {
 		case 0x00:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Operation Terminated");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Operation Terminated");
 			break;
 		case 0x01:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Subsystem Processing Error");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Subsystem Processing Error");
 			break;
 		case 0x02:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Cache or nonvolatile storage "
-                                      "equipment failure");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Cache or nonvolatile storage "
+                                     "equipment failure");
 			break;
 		case 0x04:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Caching terminated");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Caching terminated");
 			break;
 		case 0x06:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Cache fast write access not "
-                                      "authorized");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Cache fast write access not "
+                                     "authorized");
 			break;
 		case 0x07:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Track format incorrect");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Track format incorrect");
 			break;
 		case 0x09:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Caching reinitiated");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Caching reinitiated");
 			break;
 		case 0x0A:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Nonvolatile storage "
-                                      "terminated");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Nonvolatile storage "
+                                     "terminated");
 			break;
 		case 0x0B:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Volume is suspended duplex");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Volume is suspended duplex");
 			break;
 		case 0x0C:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Subsystem status connot be "
-                                      "determined");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Subsystem status connot be "
+                                     "determined");
 			break;
 		case 0x0D:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - Caching status reset to "
-                                      "default");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - Caching status reset to "
+                                     "default");
 			break;
 		case 0x0E:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT F - DASD Fast Write inhibited");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT F - DASD Fast Write inhibited");
 			break;
 		default:
-                        DASD_MESSAGE (KERN_WARNING, device, "%s",
-                                      "FORMAT D - Reserved");
+                        DEV_MESSAGE (KERN_WARNING, device, "%s",
+                                     "FORMAT D - Reserved");
 		}
                 break;		
 
 	default:	/* unknown message format - should not happen */
-
+                DEV_MESSAGE (KERN_WARNING, device,
+                             "unknown message format %02x",
+                             msg_format);
+                
 	} /* end switch message format */
-
+        
 } /* end dasd_3990_handle_env_data */
 
 /*
@@ -1412,8 +1477,8 @@
 	/* env data present (ACTION 10 - retry should work) */
 	if (sense[2] & SNS2_ENV_DATA_PRESENT) {
 
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Command Reject - environmental data present");
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Command Reject - environmental data present");
 
 		dasd_3990_handle_env_data (erp,
                                            sense);
@@ -1422,8 +1487,8 @@
 
 	} else {
 		/* fatal error -  set status to FAILED */
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Command Reject - Fatal error");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "Command Reject - Fatal error");
 
                 erp = dasd_3990_erp_cleanup (erp,
                                              CQR_STATUS_FAILED);
@@ -1460,9 +1525,9 @@
         } else {
 
                 /* issue a message and wait for 'device ready' interrupt */
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "bus out parity error or BOPC requested by "
-                              "channel");
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "bus out parity error or BOPC requested by "
+                             "channel");
                 
                 dasd_3990_erp_block_queue (erp,
                                            60);
@@ -1495,22 +1560,22 @@
 
 	if (sense[1] & SNS1_WRITE_INHIBITED) {
 
-		DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Write inhibited path encountered");
+		DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Write inhibited path encountered");
 
 		/* vary path offline */
-		DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Path should be varied off-line. "
-                              "This is not implemented yet \n - please report "
-                              "to linux390@de.ibm.com");
+		DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "Path should be varied off-line. "
+                             "This is not implemented yet \n - please report "
+                             "to linux390@de.ibm.com");
 
 		erp = dasd_3990_erp_action_1 (erp);
 
 	} else if (sense[2] & SNS2_ENV_DATA_PRESENT) {
                 
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Equipment Check - "
-                              "environmental data present");
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Equipment Check - "
+                             "environmental data present");
                 
                 dasd_3990_handle_env_data (erp,
                                            sense);
@@ -1519,17 +1584,18 @@
                                               sense);
                 
         } else if (sense[1] & SNS1_PERM_ERR) {
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Equipment Check - retry exhausted or "
-                              "undesirable");
+
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Equipment Check - retry exhausted or "
+                             "undesirable");
                 
                 erp = dasd_3990_erp_action_1 (erp);
                 
         } else {
                 /* all other equipment checks - Action 5 */
                 /* rest is done when retries == 0 */
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Equipment check or processing error");
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Equipment check or processing error");
                 
                 erp = dasd_3990_erp_action_5 (erp);
         }
@@ -1561,9 +1627,9 @@
 	if (sense[2] & SNS2_CORRECTABLE) {	/* correctable data check */
 
 		/* issue message that the data has been corrected */
-		DASD_MESSAGE (KERN_EMERG, device, "%s",
-                              "Data recovered during retry with PCI "
-                              "fetch mode active");
+		DEV_MESSAGE (KERN_EMERG, device, "%s",
+                             "Data recovered during retry with PCI "
+                             "fetch mode active");
 
                 /* not possible to handle this situation in Linux */    
                 panic("No way to inform appliction about the possibly "
@@ -1571,26 +1637,26 @@
 
 	} else if (sense[2] & SNS2_ENV_DATA_PRESENT) {
 
-		DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Uncorrectable data check recovered secondary "
-                              "addr of duplex pair");
+		DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Uncorrectable data check recovered secondary "
+                             "addr of duplex pair");
 
 		erp = dasd_3990_erp_action_4 (erp,
 					      sense);
 
 	} else if (sense[1] & SNS1_PERM_ERR) {
 
-		DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Uncorrectable data check with internal "
-                              "retry exhausted");
+		DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Uncorrectable data check with internal "
+                             "retry exhausted");
 
 		erp = dasd_3990_erp_action_1 (erp);
 
 	} else {
 		/* all other data checks */
-		DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Uncorrectable data check with retry count "
-                              "exhausted...");
+		DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Uncorrectable data check with retry count "
+                             "exhausted...");
 
 		erp = dasd_3990_erp_action_5 (erp);
 	}
@@ -1619,9 +1685,9 @@
 
 	erp->function = dasd_3990_erp_overrun;
 
-        DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                      "Overrun - service overrun or overrun"
-                      " error requested by channel");
+        DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                     "Overrun - service overrun or overrun"
+                     " error requested by channel");
 
         erp = dasd_3990_erp_action_5 (erp);
 
@@ -1651,9 +1717,9 @@
 
 	if (sense[2] & SNS2_ENV_DATA_PRESENT) {
 
-		DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Track format error when destaging or "
-                              "staging data");
+		DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Track format error when destaging or "
+                             "staging data");
 
 		dasd_3990_handle_env_data (erp,
                                            sense);
@@ -1662,9 +1728,9 @@
 					      sense);
 
 	} else {
-		DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Invalid Track Format - Fatal error should have "
-                              "been handled within the interrupt handler");
+		DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "Invalid Track Format - Fatal error should have "
+                             "been handled within the interrupt handler");
 
                 erp= dasd_3990_erp_cleanup (erp,
                                             CQR_STATUS_FAILED);
@@ -1692,8 +1758,8 @@
 
 	dasd_device_t *device = default_erp->device;
 
-        DASD_MESSAGE (KERN_ERR, device, "%s",
-                      "End-of-Cylinder - must never happen");
+        DEV_MESSAGE (KERN_ERR, device, "%s",
+                     "End-of-Cylinder - must never happen");
 
         /* implement action 7 - BUG */
         return dasd_3990_erp_cleanup (default_erp,
@@ -1721,8 +1787,8 @@
 
 	erp->function = dasd_3990_erp_env_data;
 
-        DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                      "Environmental data present");
+        DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                     "Environmental data present");
 
         dasd_3990_handle_env_data (erp,
                                    sense);
@@ -1761,9 +1827,9 @@
 
 	dasd_device_t *device = default_erp->device;
 
-        DASD_MESSAGE (KERN_ERR, device, "%s",
-                      "No Record Found - Fatal error should "
-                      "have been handled within the interrupt handler");
+        DEV_MESSAGE (KERN_ERR, device, "%s",
+                     "No Record Found - Fatal error should "
+                     "have been handled within the interrupt handler");
 
         return dasd_3990_erp_cleanup (default_erp,
                                       CQR_STATUS_FAILED);
@@ -1789,8 +1855,8 @@
 
 	dasd_device_t *device = erp->device;
 
-        DASD_MESSAGE (KERN_ERR, device, "%s",
-                      "File Protected");
+        DEV_MESSAGE (KERN_ERR, device, "%s",
+                     "File Protected");
 
         return dasd_3990_erp_cleanup (erp,
                                       CQR_STATUS_FAILED);
@@ -1921,8 +1987,8 @@
         erp->retries  = 256;
         erp->function = dasd_3990_erp_action_10_32;
 
-	DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                      "Perform logging requested");
+	DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                     "Perform logging requested");
 
 	return erp;
 
@@ -1960,8 +2026,8 @@
 	char           *LO_data;   /* LO_eckd_data_t */
         ccw1_t         *ccw;
 
-	DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                      "Write not finished because of unexpected condition");
+	DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                     "Write not finished because of unexpected condition");
         
         default_erp->function = dasd_3990_erp_action_1B_32;
 
@@ -1975,8 +2041,8 @@
         /* for imprecise ending just do default erp */
         if (sense[1] & 0x01) {
 
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Imprecise ending is set - just retry");
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Imprecise ending is set - just retry");
 
                 return default_erp;
         } 
@@ -1987,9 +2053,9 @@
         
         if (cpa == 0) {
                 
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Unable to determine address of the CCW "
-                              "to be restarted");
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Unable to determine address of the CCW "
+                             "to be restarted");
                 
                 return dasd_3990_erp_cleanup (default_erp,
                                               CQR_STATUS_FAILED);
@@ -2004,8 +2070,8 @@
 
 	if (!erp) {
 
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Unable to allocate ERP");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "Unable to allocate ERP");
                 
                 return dasd_3990_erp_cleanup (default_erp,
                                               CQR_STATUS_FAILED);
@@ -2023,8 +2089,8 @@
         if ((sense[3]  == 0x01) &&
             (LO_data[1] & 0x01)   ){
 
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "BUG - this should not happen");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "BUG - this should not happen");
 
                 return dasd_3990_erp_cleanup (default_erp,
                                               CQR_STATUS_FAILED);
@@ -2060,8 +2126,8 @@
 	if (dasd_set_normalized_cda (ccw,
                                      __pa (DE_data), erp, device)) {
                 dasd_free_request (erp, device);
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Unable to allocate ERP");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "Unable to allocate ERP");
 
                 return dasd_3990_erp_cleanup (default_erp,
                                               CQR_STATUS_FAILED);
@@ -2076,8 +2142,8 @@
 	if (dasd_set_normalized_cda (ccw, 
                                      __pa (LO_data), erp, device)){
                 dasd_free_request (erp, device);
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Unable to allocate ERP");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "Unable to allocate ERP");
                 
                 return dasd_3990_erp_cleanup (default_erp,
                                               CQR_STATUS_FAILED);
@@ -2132,9 +2198,9 @@
 	char           *LO_data;   /* LO_eckd_data_t */
         ccw1_t         *ccw;
 
-	DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                      "Write not finished because of unexpected condition"
-                      " - follow on");
+	DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                     "Write not finished because of unexpected condition"
+                     " - follow on");
         
         /* determine the original cqr */
         cqr = previous_erp;
@@ -2146,8 +2212,8 @@
         /* for imprecise ending just do default erp */
         if (sense[1] & 0x01) {
 
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Imprecise ending is set - just retry");
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Imprecise ending is set - just retry");
 
                 check_then_set (&previous_erp->status,
                                 CQR_STATUS_ERROR,
@@ -2162,9 +2228,9 @@
         
         if (cpa == 0) {
                 
-                DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                              "Unable to determine address of the CCW "
-                              "to be restarted");
+                DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                             "Unable to determine address of the CCW "
+                             "to be restarted");
                 
                 check_then_set (&previous_erp->status,
                                 CQR_STATUS_ERROR,
@@ -2181,8 +2247,8 @@
         if ((sense[3]  == 0x01) &&
             (LO_data[1] & 0x01)   ){
 
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "BUG - this should not happen");
+                DEV_MESSAGE (KERN_ERR, device, "%s",
+                             "BUG - this should not happen");
 
                 check_then_set (&previous_erp->status,
                                 CQR_STATUS_ERROR,
@@ -2337,7 +2403,7 @@
                 switch (sense[28]) {
                 case 0x17:
                         /* issue a Diagnostic Control command with an 
-                         * Inhibit Write subcommand and controler modifier */
+                                * Inhibit Write subcommand and controler modifier */
                         erp = dasd_3990_erp_DCTL (erp,
                                                   0x20);
                         break;
@@ -2351,7 +2417,7 @@
                         break;
                         
                 default:
-                        /* should not happen - continue */
+                        ; /* should not happen - continue */
 
                 }
         }
@@ -2389,11 +2455,11 @@
                 /* set to suspended duplex state then restart */
                 dasd_device_t *device  = erp->device;
 
-                DASD_MESSAGE (KERN_ERR, device, "%s",      
-                              "Set device to suspended duplex state should be "
-                              "done!\n"
-                              "This is not implemented yet (for compound ERP)"
-                              " - please report to linux390@de.ibm.com");
+                DEV_MESSAGE (KERN_ERR, device, "%s",      
+                             "Set device to suspended duplex state should be "
+                             "done!\n"
+                             "This is not implemented yet (for compound ERP)"
+                             " - please report to linux390@de.ibm.com");
                 
         }
 
@@ -2490,10 +2556,10 @@
 		switch (sense[25]) {
 
 		case 0x00:	/* success */
-                        DASD_MESSAGE (KERN_DEBUG, device,
-                                      "ERP called for successful request %p"
-                                      " - NO ERP necessary",
-                                      erp);
+                        DEV_MESSAGE (KERN_DEBUG, device,
+                                     "ERP called for successful request %p"
+                                     " - NO ERP necessary",
+                                     erp);
                         
                         erp = dasd_3990_erp_cleanup (erp,
                                                      CQR_STATUS_DONE);
@@ -2501,9 +2567,9 @@
                         break;
                         
 		case 0x01:	/* fatal error */
-                        DASD_MESSAGE (KERN_ERR, device, "%s",
-                                      "Fatal error should have been "
-                                      "handled within the interrupt handler");
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
+                                     "Fatal error should have been "
+                                     "handled within the interrupt handler");
 
                         erp = dasd_3990_erp_cleanup (erp,
                                                      CQR_STATUS_FAILED);
@@ -2515,12 +2581,12 @@
                         break;
 
 		case 0x0F:	/* length mismatch during update write command */
-                        DASD_MESSAGE (KERN_ERR, device, "%s",
-                                      "update write command error - should not "
-                                      "happen;\n"
-                                      "Please send this message together with "
-                                      "the above sense data to linux390@de."
-                                      "ibm.com");
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
+                                     "update write command error - should not "
+                                     "happen;\n"
+                                     "Please send this message together with "
+                                     "the above sense data to linux390@de."
+                                     "ibm.com");
 
                         erp = dasd_3990_erp_cleanup (erp,
                                                      CQR_STATUS_FAILED);
@@ -2532,12 +2598,12 @@
                         break;
 
 		case 0x15:	/* next track outside defined extend */
-                        DASD_MESSAGE (KERN_ERR, device, "%s",
-                                      "next track outside defined extend - "
-                                      "should not happen;\n"
-                                      "Please send this message together with "
-                                      "the above sense data to linux390@de."
-                                      "ibm.com");
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
+                                     "next track outside defined extend - "
+                                     "should not happen;\n"
+                                     "Please send this message together with "
+                                     "the above sense data to linux390@de."
+                                     "ibm.com");
 
                         erp= dasd_3990_erp_cleanup (erp,
                                                     CQR_STATUS_FAILED);
@@ -2550,9 +2616,9 @@
                         break;
 
 		case 0x1C:	/* invalid data */
-                        DASD_MESSAGE (KERN_EMERG, device, "%s",
-                                      "Data recovered during retry with PCI "
-                                      "fetch mode active");
+                        DEV_MESSAGE (KERN_EMERG, device, "%s",
+                                     "Data recovered during retry with PCI "
+                                     "fetch mode active");
                         
                         /* not possible to handle this situation in Linux */    
                         panic("Invalid data - No way to inform appliction about "
@@ -2560,16 +2626,16 @@
 			break;
 
 		case 0x1D:	/* state-change pending */
-                        DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                                      "A State change pending condition exists "
-                                      "for the subsystem or device");
+                        DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                                     "A State change pending condition exists "
+                                     "for the subsystem or device");
 
                         erp = dasd_3990_erp_action_4 (erp,
                                                       sense);
 			break;
 
-		default:	/* all others errors - default erp  */
-                        
+		default:	
+                        ;       /* all others errors - default erp  */
 		}
 	}
 
@@ -2642,25 +2708,47 @@
 {
 
 	dasd_device_t *device = cqr->device;
+	ccw1_t *ccw;
 
 	/* allocate additional request block */
-	ccw_req_t *erp = dasd_alloc_request ((char *) &cqr->magic, 1, 0, cqr->device);
+	ccw_req_t *erp = dasd_alloc_request ((char *) &cqr->magic, 2, 0, cqr->device);
 
 	if (!erp) {
-
-                DASD_MESSAGE (KERN_ERR, device, "%s",
-                              "Unable to allocate ERP request");
+                if (cqr->retries <= 0) {
+                        DEV_MESSAGE (KERN_ERR, device, "%s",
+                                     "Unable to allocate ERP request (NO retries left)");
                 
-                check_then_set (&cqr->status,
-                                CQR_STATUS_ERROR,
-                                CQR_STATUS_FAILED);
+                        check_then_set (&cqr->status,
+                                        CQR_STATUS_ERROR,
+                                        CQR_STATUS_FAILED);
 
+                        cqr->stopclk = get_clock ();
+
+                } else {
+                        DEV_MESSAGE (KERN_ERR, device,
+                                     "Unable to allocate ERP request (%i retries left)",
+                                     cqr->retries);
+                
+                        if (!timer_pending(&device->timer)) {
+                                init_timer (&device->timer);
+                                device->timer.function = dasd_schedule_bh_timed;
+                                device->timer.data     = (unsigned long) device;
+                                device->timer.expires  = jiffies + (HZ << 3);
+                                add_timer (&device->timer);
+                        } else {
+                                mod_timer(&device->timer, jiffies + (HZ << 3));
+                        }
+                }
                 return cqr;
 	}
 
 	/* initialize request with default TIC to current ERP/CQR */
-	erp->cpaddr->cmd_code = CCW_CMD_TIC;
-	erp->cpaddr->cda      = (long)(cqr->cpaddr);
+	ccw = erp->cpaddr;
+	ccw->cmd_code = CCW_CMD_NOOP;
+	ccw->flags = CCW_FLAG_CC;
+	ccw++;
+	ccw->cmd_code = CCW_CMD_TIC;
+	ccw->cda      = (long)(cqr->cpaddr);
 	erp->function = dasd_3990_erp_add_erp;
 	erp->refers   = cqr;
 	erp->device   = cqr->device;
@@ -2738,7 +2826,7 @@
 	}
 
 	/* check sense data; byte 0-2,25,27 */
-	if (!((strncmp (cqr1->dstat->ii.sense.data,
+	if (!((memcmp (cqr1->dstat->ii.sense.data,
 			cqr2->dstat->ii.sense.data,
 			3) == 0) &&
 	      (cqr1->dstat->ii.sense.data[27] ==
@@ -2859,10 +2947,10 @@
                                 break;
                         }
                         default:
-                                DASD_MESSAGE (KERN_DEBUG, device,
-                                              "invalid subcommand modifier 0x%x "
-                                              "for Diagnostic Control Command",
-                                              sense[25]);
+                                DEV_MESSAGE (KERN_DEBUG, device,
+                                             "invalid subcommand modifier 0x%x "
+                                             "for Diagnostic Control Command",
+                                             sense[25]);
                         }
                 } 
 
@@ -2877,10 +2965,10 @@
 
 	} else {
                 /* no retry left and no additional special handling necessary */
-                DASD_MESSAGE (KERN_ERR, device,
-                              "no retries left for erp %p - "
-                              "set status to FAILED",
-                              erp);
+                DEV_MESSAGE (KERN_ERR, device,
+                             "no retries left for erp %p - "
+                             "set status to FAILED",
+                             erp);
 
 		check_then_set (&erp->status,
                                 CQR_STATUS_ERROR,
@@ -2940,7 +3028,7 @@
 
         if (erp->retries > 0) {
                 
-                char *sense = erp->dstat->ii.sense.data;
+                char *sense = erp->refers->dstat->ii.sense.data;
                 
                 /* check for special retries */
                 if (erp->function == dasd_3990_erp_action_4) {
@@ -2959,10 +3047,10 @@
                         
                 } else {
                         /* simple retry   */
-                        DASD_MESSAGE (KERN_DEBUG, device,
-                                      "%i retries left for erp %p",
-                                      erp->retries,
-                                      erp);
+                        DEV_MESSAGE (KERN_DEBUG, device,
+                                     "%i retries left for erp %p",
+                                     erp->retries,
+                                     erp);
                         
                         /* handle the request again... */
                         check_then_set (&erp->status,
@@ -3006,26 +3094,20 @@
         __u32         cpa     = cqr->dstat->cpa;    
 
 #ifdef ERP_DEBUG 
-        DASD_MESSAGE (KERN_DEBUG, device,
-                      "entering 3990 ERP for "
-                      "0x%04X on sch %d = /dev/%s ",
-                      device->devinfo.devno,
-                      device->devinfo.irq,
-                      device->name);
-
 	/* print current erp_chain */
-        DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                      "ERP chain at BEGINNING of ERP-ACTION");
+        DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                     "ERP chain at BEGINNING of ERP-ACTION");
         {
                 ccw_req_t *temp_erp = NULL;
+
                 for (temp_erp = cqr; 
                      temp_erp != NULL; 
                      temp_erp = temp_erp->refers){
 
-                        DASD_MESSAGE (KERN_DEBUG, device,
-                                      "      erp %p refers to %p",
-                                      temp_erp,
-                                      temp_erp->refers);
+                        DEV_MESSAGE (KERN_DEBUG, device,
+                                     "      erp %p refers to %p",
+                                     temp_erp,
+                                     temp_erp->refers);
                 }
         } 
 #endif /* ERP_DEBUG */
@@ -3034,10 +3116,10 @@
 	if ((cqr->dstat->cstat == 0x00                                 ) &&
 	    (cqr->dstat->dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))   ) {
 
-                DASD_MESSAGE (KERN_DEBUG, device,
-                              "ERP called for successful request %p"
-                              " - NO ERP necessary",
-                              cqr);
+                DEV_MESSAGE (KERN_DEBUG, device,
+                             "ERP called for successful request %p"
+                             " - NO ERP necessary",
+                             cqr);
                 
                 check_then_set (&cqr->status,
                                 CQR_STATUS_ERROR,
@@ -3047,10 +3129,10 @@
 	}
 	/* check if sense data are available */
 	if (!cqr->dstat->ii.sense.data) {
-		DASD_MESSAGE (KERN_DEBUG, device,
-			"ERP called witout sense data avail ..."
-			"request %p - NO ERP possible",
-			cqr);
+		DEV_MESSAGE (KERN_DEBUG, device,
+                             "ERP called witout sense data avail ..."
+                             "request %p - NO ERP possible",
+                             cqr);
 
                 check_then_set (&cqr->status,
                                 CQR_STATUS_ERROR,
@@ -3074,18 +3156,18 @@
 
 #ifdef ERP_DEBUG
 	/* print current erp_chain */
-        DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                      "ERP chain at END of ERP-ACTION");
+        DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                     "ERP chain at END of ERP-ACTION");
         {
                 ccw_req_t *temp_erp = NULL;
                 for (temp_erp = erp; 
                      temp_erp != NULL; 
                      temp_erp = temp_erp->refers) {
 
-                        DASD_MESSAGE (KERN_DEBUG, device,
-                                      "      erp %p refers to %p",
-                                      temp_erp,
-                                      temp_erp->refers);
+                        DEV_MESSAGE (KERN_DEBUG, device,
+                                     "      erp %p refers to %p",
+                                     temp_erp,
+                                     temp_erp->refers);
                 }
         }
 #endif /* ERP_DEBUG */
@@ -3098,35 +3180,32 @@
         }
 
         /* enqueue added ERP request */
-        if ((erp != cqr                      ) &&
+        if ((erp != device->queue.head ) &&
             (erp->status == CQR_STATUS_FILLED)   ){
 
                 dasd_chanq_enq_head (&device->queue,
                                      erp);
         } else {
-                if ((erp->status == CQR_STATUS_FILLED )||
-                    (erp != cqr                       )  ){
-                        /* something strange happened - log the error and throw a BUG() */
-                        DASD_MESSAGE (KERN_ERR, device, "%s",
-                                      "Problems with ERP chain!!! BUG");
-
+                if ((erp->status == CQR_STATUS_FILLED ) || (erp != device->queue.head)) {
+                        /* something strange happened - log the error and panic */
                         /* print current erp_chain */
-                        DASD_MESSAGE (KERN_DEBUG, device, "%s",
-                                      "ERP chain at END of ERP-ACTION");
+                        DEV_MESSAGE (KERN_DEBUG, device, "%s",
+                                     "ERP chain at END of ERP-ACTION");
                         {
                                 ccw_req_t *temp_erp = NULL;
                                 for (temp_erp = erp; 
                                      temp_erp != NULL; 
                                      temp_erp = temp_erp->refers) {
 
-                                        DASD_MESSAGE (KERN_DEBUG, device,
-                                                      "      erp %p (function %p) refers to %p",
-                                                      temp_erp,
-                                                      temp_erp->function,
-                                                      temp_erp->refers);
+                                        DEV_MESSAGE (KERN_DEBUG, device,
+                                                     "      erp %p (function %p)"
+                                                     " refers to %p",
+                                                     temp_erp,
+                                                     temp_erp->function,
+                                                     temp_erp->refers);
                                 }
                         }
-                        BUG();
+                        panic ("Problems with ERP chain!!! Please report to linux390@de.ibm.com");
                 }
 
         }
@@ -3136,112 +3215,6 @@
 } /* end dasd_3990_erp_action */
 
 /*
- * DASD_3990_ERP_POSTACTION
- *
- * DESCRIPTION
- *   Frees all ERPs of the current ERP Chain and set the status
- *   of the original CQR either to CQR_STATUS_DONE if ERP was successful
- *   or to CQR_STATUS_FAILED if ERP was NOT successful.
- *
- * PARAMETER
- *   erp                current erp_head
- *
- * RETURN VALUES
- *   cqr                pointer to the original CQR
- */
-ccw_req_t *
-dasd_3990_erp_postaction (ccw_req_t *erp)
-{
-
-	ccw_req_t     *cqr      = NULL, 
-                      *free_erp = NULL;
-	dasd_device_t *device   = erp->device;
-	int           success;
-
-	if (erp->refers   == NULL || 
-            erp->function == NULL   ) {
-
-		BUG ();
-	}
-
-	if (erp->status == CQR_STATUS_DONE)
-		success = 1;
-	else
-		success = 0;
-
-#ifdef ERP_DEBUG
-
-	/* print current erp_chain */
-	printk (KERN_DEBUG PRINTK_HEADER
-		"3990 ERP postaction called for erp chain:\n");
-	{
-		ccw_req_t *temp_erp = NULL;
-
-		for (temp_erp = erp; 
-                     temp_erp != NULL;
-		     temp_erp = temp_erp->refers) {
-
-			printk (KERN_DEBUG PRINTK_HEADER
-				"       erp %p refers to %p with erp function %p\n",
-				temp_erp, temp_erp->refers, temp_erp->function);
-		}
-	}
-
-#endif /* ERP_DEBUG */
-
-	/* free all ERPs - but NOT the original cqr */
-	while (erp->refers != NULL) {
-
-		free_erp = erp;
-		erp      = erp->refers;
-
-		/* remove the request from the device queue */
-		dasd_chanq_deq (&device->queue,
-                                free_erp);
-
-		/* free the finished erp request */
-		dasd_free_request (free_erp, free_erp->device);
-	}
-
-	/* save ptr to original cqr */
-	cqr = erp;
-
-	/* set corresponding status to original cqr */
-	if (success) {
-
-		check_then_set (&cqr->status, 
-                                CQR_STATUS_ERROR,
-				CQR_STATUS_DONE);
-	} else {
-
-		check_then_set (&cqr->status,
-				CQR_STATUS_ERROR, 
-                                CQR_STATUS_FAILED);
-	}
-
-#ifdef ERP_DEBUG
-	/* print current erp_chain */
-	printk (KERN_DEBUG PRINTK_HEADER
-		"3990 ERP postaction finished with remaining chain:\n");
-	{
-		ccw_req_t *temp_erp = NULL;
-
-		for (temp_erp = cqr; 
-                     temp_erp != NULL;
-		     temp_erp = temp_erp->refers) {
-
-			printk (KERN_DEBUG PRINTK_HEADER
-				" erp %p refers to %p \n", temp_erp,
-				temp_erp->refers);
-		}
-	}
-#endif /* ERP_DEBUG */
-
-	return cqr;
-
-} /* end dasd_3990_erp_postaction */
-
-/*
  * Overrides for Emacs so that we follow Linus's tabbing style.
  * Emacs will notice this stuff at the end of the file and automatically
  * adjust the settings for this buffer only.  This must remain at the end

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)