added my responsibility for the `cpm' port
[unix-history] / sys / scsi / sd.c
index 5cf7daf..22dce9a 100644 (file)
@@ -14,7 +14,7 @@
  *
  * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
  *
  *
  * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
  *
- *      $Id: sd.c,v 1.17 1994/01/29 10:30:39 rgrimes Exp $
+ *      $Id: sd.c,v 1.26 1994/05/26 00:23:24 jkh Exp $
  */
 
 #define SPLSD splbio
  */
 
 #define SPLSD splbio
@@ -415,14 +415,25 @@ sdstrategy(bp)
                if (bounds_check_with_label(bp, &sd->disklabel, sd->wlabel) <= 0)
                        goto done;
                /* otherwise, process transfer request */
                if (bounds_check_with_label(bp, &sd->disklabel, sd->wlabel) <= 0)
                        goto done;
                /* otherwise, process transfer request */
+       } else {
+               bp->b_pblkno = bp->b_blkno;
+               bp->b_resid = 0;
        }
        opri = SPLSD();
        dp = &sd->buf_queue;
 
        }
        opri = SPLSD();
        dp = &sd->buf_queue;
 
+       /*      
+        * Use a bounce buffer if necessary
+        */      
+#ifndef NOBOUNCE
+       if (sd->sc_link->flags & SDEV_BOUNCE)
+               vm_bounce_alloc(bp);
+#endif
+
        /*
         * Place it in the queue of disk activities for this disk
         */
        /*
         * Place it in the queue of disk activities for this disk
         */
-       disksort(dp, bp);
+       cldisksort(dp, bp, 64*1024);
 
        /*
         * Tell the device to get going on the transfer if it's
 
        /*
         * Tell the device to get going on the transfer if it's
@@ -877,7 +888,19 @@ sd_get_parms(unit, flags)
 
                sectors = sd_size(unit, flags);
                disk_parms->disksize = sectors;
 
                sectors = sd_size(unit, flags);
                disk_parms->disksize = sectors;
-               sectors /= (disk_parms->heads * disk_parms->cyls);
+               /* Check if none of these values are zero */
+               if(disk_parms->heads && disk_parms->cyls) {
+                       sectors /= (disk_parms->heads * disk_parms->cyls);
+               }
+               else {
+                       /* set it to something reasonable */
+                       disk_parms->heads = 64;
+                       disk_parms->cyls = sectors / (64 * 32);
+                       sectors = 32;
+               }
+               /* keep secsiz sane too - we may divide by it later */
+               if(disk_parms->secsiz == 0)
+                       disk_parms->secsiz = SECSIZE;
                disk_parms->sectors = sectors;  /* dubious on SCSI *//*XXX */
        }
        sd->sc_link->flags |= SDEV_MEDIA_LOADED;
                disk_parms->sectors = sectors;  /* dubious on SCSI *//*XXX */
        }
        sd->sc_link->flags |= SDEV_MEDIA_LOADED;