]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[IA64] Allow simulator to use bigger disks
authorPeter Chubb <peterc@gelato.unsw.edu.au>
Thu, 20 Oct 2005 02:31:19 +0000 (12:31 +1000)
committerTony Luck <tony.luck@intel.com>
Tue, 25 Oct 2005 21:36:55 +0000 (14:36 -0700)
The simscsi code at present overflows an int if it's given a large
disk image.  The attached patch increases the possible size to 128G.
While it's unlikely that anyone will want to use SKI with such a
large drive, the same framework is currently being used for various
virtualisation experiments.

Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/hp/sim/simscsi.c

index a18983a3c9347286670f47cfcc3267c521f3dc35..a3fe97531134127d060ef257fa794291dad8d545 100644 (file)
@@ -205,10 +205,11 @@ simscsi_get_disk_size (int fd)
        char buf[512];
 
        /*
-        * This is a bit kludgey: the simulator doesn't provide a direct way of determining
-        * the disk size, so we do a binary search, assuming a maximum disk size of 4GB.
+        * This is a bit kludgey: the simulator doesn't provide a
+        * direct way of determining the disk size, so we do a binary
+        * search, assuming a maximum disk size of 128GB.
         */
-       for (bit = (4UL << 30)/512; bit != 0; bit >>= 1) {
+       for (bit = (128UL << 30)/512; bit != 0; bit >>= 1) {
                req.addr = __pa(&buf);
                req.len = sizeof(buf);
                ia64_ssc(fd, 1, __pa(&req), ((sectors | bit) - 1)*512, SSC_READ);
@@ -225,8 +226,10 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
 {
        unsigned long offset;
 
-       offset = (  (sc->cmnd[2] << 24) | (sc->cmnd[3] << 16)
-                 | (sc->cmnd[4] <<  8) | (sc->cmnd[5] <<  0))*512;
+       offset = (((unsigned long)sc->cmnd[2] << 24) 
+               | ((unsigned long)sc->cmnd[3] << 16)
+               | ((unsigned long)sc->cmnd[4] <<  8) 
+               | ((unsigned long)sc->cmnd[5] <<  0))*512UL;
        if (sc->use_sg > 0)
                simscsi_sg_readwrite(sc, mode, offset);
        else