]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/s390/block/dasd_diag.c
Merge branch 'block-2.6.24' of git://git.kernel.dk/data/git/linux-2.6-block
[linux-2.6-omap-h63xx.git] / drivers / s390 / block / dasd_diag.c
index ab782bb46ac1a13978d21def078eca1b60cec77c..571320ab9e1ace333ac4c9f78c98a59379b9cc03 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/s390_ext.h>
 #include <asm/todclk.h>
 #include <asm/vtoc.h>
+#include <asm/diag.h>
 
 #include "dasd_int.h"
 #include "dasd_diag.h"
@@ -50,6 +51,7 @@ struct dasd_diag_private {
        struct dasd_diag_rw_io iob;
        struct dasd_diag_init_io iib;
        blocknum_t pt_block;
+       struct ccw_dev_id dev_id;
 };
 
 struct dasd_diag_req {
@@ -65,7 +67,7 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */
  * resulting condition code and DIAG return code. */
 static inline int dia250(void *iob, int cmd)
 {
-       register unsigned long reg0 asm ("0") = (unsigned long) iob;
+       register unsigned long reg2 asm ("2") = (unsigned long) iob;
        typedef union {
                struct dasd_diag_init_io init_io;
                struct dasd_diag_rw_io rw_io;
@@ -74,15 +76,15 @@ static inline int dia250(void *iob, int cmd)
 
        rc = 3;
        asm volatile(
-               "       diag    0,%2,0x250\n"
+               "       diag    2,%2,0x250\n"
                "0:     ipm     %0\n"
                "       srl     %0,28\n"
-               "       or      %0,1\n"
+               "       or      %0,3\n"
                "1:\n"
                EX_TABLE(0b,1b)
                : "+d" (rc), "=m" (*(addr_type *) iob)
-               : "d" (cmd), "d" (reg0), "m" (*(addr_type *) iob)
-               : "1", "cc");
+               : "d" (cmd), "d" (reg2), "m" (*(addr_type *) iob)
+               : "3", "cc");
        return rc;
 }
 
@@ -102,7 +104,7 @@ mdsk_init_io(struct dasd_device *device, unsigned int blocksize,
        iib = &private->iib;
        memset(iib, 0, sizeof (struct dasd_diag_init_io));
 
-       iib->dev_nr = _ccw_device_get_device_number(device->cdev);
+       iib->dev_nr = private->dev_id.devno;
        iib->block_size = blocksize;
        iib->offset = offset;
        iib->flaga = DASD_DIAG_FLAGA_DEFAULT;
@@ -127,7 +129,7 @@ mdsk_term_io(struct dasd_device * device)
        private = (struct dasd_diag_private *) device->private;
        iib = &private->iib;
        memset(iib, 0, sizeof (struct dasd_diag_init_io));
-       iib->dev_nr = _ccw_device_get_device_number(device->cdev);
+       iib->dev_nr = private->dev_id.devno;
        rc = dia250(iib, TERM_BIO);
        return rc;
 }
@@ -166,7 +168,7 @@ dasd_start_diag(struct dasd_ccw_req * cqr)
        private = (struct dasd_diag_private *) device->private;
        dreq = (struct dasd_diag_req *) cqr->data;
 
-       private->iob.dev_nr = _ccw_device_get_device_number(device->cdev);
+       private->iob.dev_nr = private->dev_id.devno;
        private->iob.key = 0;
        private->iob.flags = DASD_DIAG_RWFLAG_ASYNC;
        private->iob.block_count = dreq->block_count;
@@ -323,11 +325,12 @@ dasd_diag_check_device(struct dasd_device *device)
                                "memory allocation failed for private data");
                        return -ENOMEM;
                }
+               ccw_device_get_id(device->cdev, &private->dev_id);
                device->private = (void *) private;
        }
        /* Read Device Characteristics */
        rdc_data = (void *) &(private->rdc_data);
-       rdc_data->dev_nr = _ccw_device_get_device_number(device->cdev);
+       rdc_data->dev_nr = private->dev_id.devno;
        rdc_data->rdc_len = sizeof (struct dasd_diag_characteristics);
 
        rc = diag210((struct diag210 *) rdc_data);
@@ -469,14 +472,13 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req)
        struct dasd_ccw_req *cqr;
        struct dasd_diag_req *dreq;
        struct dasd_diag_bio *dbio;
-       struct bio *bio;
+       struct req_iterator iter;
        struct bio_vec *bv;
        char *dst;
        unsigned int count, datasize;
        sector_t recid, first_rec, last_rec;
        unsigned int blksize, off;
        unsigned char rw_cmd;
-       int i;
 
        if (rq_data_dir(req) == READ)
                rw_cmd = MDSK_READ_REQ;
@@ -490,13 +492,11 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req)
        last_rec = (req->sector + req->nr_sectors - 1) >> device->s2b_shift;
        /* Check struct bio and count the number of blocks for the request. */
        count = 0;
-       rq_for_each_bio(bio, req) {
-               bio_for_each_segment(bv, bio, i) {
-                       if (bv->bv_len & (blksize - 1))
-                               /* Fba can only do full blocks. */
-                               return ERR_PTR(-EINVAL);
-                       count += bv->bv_len >> (device->s2b_shift + 9);
-               }
+       rq_for_each_segment(bv, req, iter) {
+               if (bv->bv_len & (blksize - 1))
+                       /* Fba can only do full blocks. */
+                       return ERR_PTR(-EINVAL);
+               count += bv->bv_len >> (device->s2b_shift + 9);
        }
        /* Paranoia. */
        if (count != last_rec - first_rec + 1)
@@ -513,18 +513,16 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req)
        dreq->block_count = count;
        dbio = dreq->bio;
        recid = first_rec;
-       rq_for_each_bio(bio, req) {
-               bio_for_each_segment(bv, bio, i) {
-                       dst = page_address(bv->bv_page) + bv->bv_offset;
-                       for (off = 0; off < bv->bv_len; off += blksize) {
-                               memset(dbio, 0, sizeof (struct dasd_diag_bio));
-                               dbio->type = rw_cmd;
-                               dbio->block_number = recid + 1;
-                               dbio->buffer = dst;
-                               dbio++;
-                               dst += blksize;
-                               recid++;
-                       }
+       rq_for_each_segment(bv, req, iter) {
+               dst = page_address(bv->bv_page) + bv->bv_offset;
+               for (off = 0; off < bv->bv_len; off += blksize) {
+                       memset(dbio, 0, sizeof (struct dasd_diag_bio));
+                       dbio->type = rw_cmd;
+                       dbio->block_number = recid + 1;
+                       dbio->buffer = dst;
+                       dbio++;
+                       dst += blksize;
+                       recid++;
                }
        }
        cqr->retries = DIAG_MAX_RETRIES;