Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
[pandora-kernel.git] / drivers / s390 / block / dasd_erp.c
index 58a6509..8f10000 100644 (file)
@@ -46,6 +46,8 @@ dasd_alloc_erp_request(char *magic, int cplength, int datasize,
        if (cqr == NULL)
                return ERR_PTR(-ENOMEM);
        memset(cqr, 0, sizeof(struct dasd_ccw_req));
+       INIT_LIST_HEAD(&cqr->devlist);
+       INIT_LIST_HEAD(&cqr->blocklist);
        data = (char *) cqr + ((sizeof(struct dasd_ccw_req) + 7L) & -8L);
        cqr->cpaddr = NULL;
        if (cplength > 0) {
@@ -66,7 +68,7 @@ dasd_alloc_erp_request(char *magic, int cplength, int datasize,
 }
 
 void
-dasd_free_erp_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
+dasd_free_erp_request(struct dasd_ccw_req *cqr, struct dasd_device * device)
 {
        unsigned long flags;
 
@@ -81,11 +83,11 @@ dasd_free_erp_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
  * dasd_default_erp_action just retries the current cqr
  */
 struct dasd_ccw_req *
-dasd_default_erp_action(struct dasd_ccw_req * cqr)
+dasd_default_erp_action(struct dasd_ccw_req *cqr)
 {
        struct dasd_device *device;
 
-       device = cqr->device;
+       device = cqr->startdev;
 
         /* just retry - there is nothing to save ... I got no sense data.... */
         if (cqr->retries > 0) {
@@ -93,12 +95,12 @@ dasd_default_erp_action(struct dasd_ccw_req * cqr)
                              "default ERP called (%i retries left)",
                              cqr->retries);
                cqr->lpm    = LPM_ANYPATH;
-               cqr->status = DASD_CQR_QUEUED;
+               cqr->status = DASD_CQR_FILLED;
         } else {
                 DEV_MESSAGE (KERN_WARNING, device, "%s",
                             "default ERP called (NO retry left)");
                cqr->status = DASD_CQR_FAILED;
-               cqr->stopclk = get_clock ();
+               cqr->stopclk = get_clock();
         }
         return cqr;
 }                              /* end dasd_default_erp_action */
@@ -117,15 +119,12 @@ dasd_default_erp_action(struct dasd_ccw_req * cqr)
  * RETURN VALUES
  *   cqr               pointer to the original CQR
  */
-struct dasd_ccw_req *
-dasd_default_erp_postaction(struct dasd_ccw_req * cqr)
+struct dasd_ccw_req *dasd_default_erp_postaction(struct dasd_ccw_req *cqr)
 {
-       struct dasd_device *device;
        int success;
 
        BUG_ON(cqr->refers == NULL || cqr->function == NULL);
 
-       device = cqr->device;
        success = cqr->status == DASD_CQR_DONE;
 
        /* free all ERPs - but NOT the original cqr */
@@ -133,10 +132,10 @@ dasd_default_erp_postaction(struct dasd_ccw_req * cqr)
                struct dasd_ccw_req *refers;
 
                refers = cqr->refers;
-               /* remove the request from the device queue */
-               list_del(&cqr->list);
+               /* remove the request from the block queue */
+               list_del(&cqr->blocklist);
                /* free the finished erp request */
-               dasd_free_erp_request(cqr, device);
+               dasd_free_erp_request(cqr, cqr->memdev);
                cqr = refers;
        }
 
@@ -152,99 +151,19 @@ dasd_default_erp_postaction(struct dasd_ccw_req * cqr)
 
 }                              /* end default_erp_postaction */
 
-/*
- * Print the hex dump of the memory used by a request. This includes
- * all error recovery ccws that have been chained in from of the
- * real request.
- */
-static inline void
-hex_dump_memory(struct dasd_device *device, void *data, int len)
-{
-       int *pint;
-
-       pint = (int *) data;
-       while (len > 0) {
-               DEV_MESSAGE(KERN_ERR, device, "%p: %08x %08x %08x %08x",
-                           pint, pint[0], pint[1], pint[2], pint[3]);
-               pint += 4;
-               len -= 16;
-       }
-}
-
 void
 dasd_log_sense(struct dasd_ccw_req *cqr, struct irb *irb)
 {
        struct dasd_device *device;
 
-       device = cqr->device;
+       device = cqr->startdev;
        /* dump sense data */
        if (device->discipline && device->discipline->dump_sense)
                device->discipline->dump_sense(device, cqr, irb);
 }
 
-void
-dasd_log_ccw(struct dasd_ccw_req * cqr, int caller, __u32 cpa)
-{
-       struct dasd_device *device;
-       struct dasd_ccw_req *lcqr;
-       struct ccw1 *ccw;
-       int cplength;
-
-       device = cqr->device;
-       /* log the channel program */
-       for (lcqr = cqr; lcqr != NULL; lcqr = lcqr->refers) {
-               DEV_MESSAGE(KERN_ERR, device,
-                           "(%s) ERP chain report for req: %p",
-                           caller == 0 ? "EXAMINE" : "ACTION", lcqr);
-               hex_dump_memory(device, lcqr, sizeof(struct dasd_ccw_req));
-
-               cplength = 1;
-               ccw = lcqr->cpaddr;
-               while (ccw++->flags & (CCW_FLAG_DC | CCW_FLAG_CC))
-                       cplength++;
-
-               if (cplength > 40) {    /* log only parts of the CP */
-                       DEV_MESSAGE(KERN_ERR, device, "%s",
-                                   "Start of channel program:");
-                       hex_dump_memory(device, lcqr->cpaddr,
-                                       40*sizeof(struct ccw1));
-
-                       DEV_MESSAGE(KERN_ERR, device, "%s",
-                                   "End of channel program:");
-                       hex_dump_memory(device, lcqr->cpaddr + cplength - 10,
-                                       10*sizeof(struct ccw1));
-               } else {        /* log the whole CP */
-                       DEV_MESSAGE(KERN_ERR, device, "%s",
-                                   "Channel program (complete):");
-                       hex_dump_memory(device, lcqr->cpaddr,
-                                       cplength*sizeof(struct ccw1));
-               }
-
-               if (lcqr != cqr)
-                       continue;
-
-               /*
-                * Log bytes arround failed CCW but only if we did
-                * not log the whole CP of the CCW is outside the
-                * logged CP.
-                */
-               if (cplength > 40 ||
-                   ((addr_t) cpa < (addr_t) lcqr->cpaddr &&
-                    (addr_t) cpa > (addr_t) (lcqr->cpaddr + cplength + 4))) {
-
-                       DEV_MESSAGE(KERN_ERR, device,
-                                   "Failed CCW (%p) (area):",
-                                   (void *) (long) cpa);
-                       hex_dump_memory(device, cqr->cpaddr - 10,
-                                       20*sizeof(struct ccw1));
-               }
-       }
-
-}                              /* end log_erp_chain */
-
 EXPORT_SYMBOL(dasd_default_erp_action);
 EXPORT_SYMBOL(dasd_default_erp_postaction);
 EXPORT_SYMBOL(dasd_alloc_erp_request);
 EXPORT_SYMBOL(dasd_free_erp_request);
 EXPORT_SYMBOL(dasd_log_sense);
-EXPORT_SYMBOL(dasd_log_ccw);