This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / sys / scsi / sd.c
index b543631..5cf7daf 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.13 1993/11/25 01:37:34 wollman Exp $
+ *      $Id: sd.c,v 1.17 1994/01/29 10:30:39 rgrimes Exp $
  */
 
 #define SPLSD splbio
  */
 
 #define SPLSD splbio
@@ -22,6 +22,7 @@
 #include <sd.h>
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sd.h>
 #include <sys/types.h>
 #include <sys/param.h>
+#include <sys/kernel.h>
 #include <sys/dkbad.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/dkbad.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
@@ -36,6 +37,7 @@
 #include <scsi/scsi_all.h>
 #include <scsi/scsi_disk.h>
 #include <scsi/scsiconf.h>
 #include <scsi/scsi_all.h>
 #include <scsi/scsi_disk.h>
 #include <scsi/scsiconf.h>
+#include <vm/vm.h>
 
 u_int32 sdstrats, sdqueues;
 
 
 u_int32 sdstrats, sdqueues;
 
@@ -60,6 +62,7 @@ int     Debugger();
 #define        SDOUTSTANDING   2
 #define SDQSIZE                4
 #define        SD_RETRIES      4
 #define        SDOUTSTANDING   2
 #define SDQSIZE                4
 #define        SD_RETRIES      4
+#define        MAXTRANSFER     8               /* 1 page at a time */
 
 #define MAKESDDEV(maj, unit, part)     (makedev(maj,((unit<<3)+part)))
 #define        UNITSHIFT       3
 
 #define MAKESDDEV(maj, unit, part)     (makedev(maj,((unit<<3)+part)))
 #define        UNITSHIFT       3
@@ -118,6 +121,8 @@ struct sd_data {
 
 static u_int32 next_sd_unit = 0;
 
 
 static u_int32 next_sd_unit = 0;
 
+static struct scsi_xfer sx;
+
 /*
  * The routine called by the low level scsi routine when it discovers
  * a device suitable for this driver.
 /*
  * The routine called by the low level scsi routine when it discovers
  * a device suitable for this driver.
@@ -813,7 +818,7 @@ sd_get_parms(unit, flags)
        /*
         * First check if we have it all loaded
         */
        /*
         * First check if we have it all loaded
         */
-       if (sd->flags & SDEV_MEDIA_LOADED)
+       if (sd->sc_link->flags & SDEV_MEDIA_LOADED)
                return 0;
 
        /*
                return 0;
 
        /*
@@ -904,17 +909,6 @@ sdsize(dev_t dev)
        return (int)sd->disklabel.d_partitions[part].p_size;
 }
 
        return (int)sd->disklabel.d_partitions[part].p_size;
 }
 
-
-#define SCSIDUMP 1
-#undef SCSIDUMP
-#define NOT_TRUSTED 1
-
-#ifdef SCSIDUMP
-#include <vm/vm.h>
-
-static struct scsi_xfer sx;
-#define        MAXTRANSFER 8           /* 1 page at a time */
-
 /*
  * dump all of physical memory into the partition specified, starting
  * at offset 'dumplo' into the partition.
 /*
  * dump all of physical memory into the partition specified, starting
  * at offset 'dumplo' into the partition.
@@ -931,8 +925,8 @@ sddump(dev_t dev)
        struct  scsi_rw_big cmd;
        extern  int Maxmem;
        static  int sddoingadump = 0;
        struct  scsi_rw_big cmd;
        extern  int Maxmem;
        static  int sddoingadump = 0;
-#define MAPTO CADDR1
-       extern  caddr_t MAPTO;  /* map the page we are about to write, here */
+       extern  caddr_t CADDR1; /* map the page we are about to write, here */
+       extern  struct pte *CMAP1;
        struct  scsi_xfer *xs = &sx;
        errval  retval;
        int     c;
        struct  scsi_xfer *xs = &sx;
        errval  retval;
        int     c;
@@ -948,7 +942,7 @@ sddump(dev_t dev)
        part = PARTITION(dev);  /* file system */
        /* check for acceptable drive number */
        if (unit >= NSD)
        part = PARTITION(dev);  /* file system */
        /* check for acceptable drive number */
        if (unit >= NSD)
-               return (ENXIO); /* 31 Jul 92 */
+               return (ENXIO);
 
        sd = sd_data[unit];
        if (!sd)
 
        sd = sd_data[unit];
        if (!sd)
@@ -978,14 +972,10 @@ sddump(dev_t dev)
        sddoingadump = 1;
 
        blknum = dumplo + blkoff;
        sddoingadump = 1;
 
        blknum = dumplo + blkoff;
-       /* blkcnt = initialise_me; */
        while (num > 0) {
        while (num > 0) {
-               pmap_enter(kernel_pmap,
-                   MAPTO,
-                   trunc_page(addr),
-                   VM_PROT_READ,
-                   TRUE);
-#ifndef        NOT_TRUSTED
+                *(int *)CMAP1 =
+                       PG_V | PG_KW | trunc_page(addr);
+                tlbflush();
                /*
                 *  Fill out the scsi command
                 */
                /*
                 *  Fill out the scsi command
                 */
@@ -1013,7 +1003,7 @@ sddump(dev_t dev)
                xs->resid = blkcnt * 512;
                xs->error = XS_NOERROR;
                xs->bp = 0;
                xs->resid = blkcnt * 512;
                xs->error = XS_NOERROR;
                xs->bp = 0;
-               xs->data = (u_char *) MAPTO;
+               xs->data = (u_char *) CADDR1;
                xs->datalen = blkcnt * 512;
 
                /*
                xs->datalen = blkcnt * 512;
 
                /*
@@ -1029,10 +1019,6 @@ sddump(dev_t dev)
                default:
                        return (ENXIO);         /* we said not to sleep! */
                }
                default:
                        return (ENXIO);         /* we said not to sleep! */
                }
-#else  /* NOT_TRUSTED */
-               /* lets just talk about this first... */
-               printf("sd%d: dump addr 0x%x, blk %d\n", unit, addr, blknum);
-#endif /* NOT_TRUSTED */
 
                if ((unsigned) addr % (1024 * 1024) == 0)
                        printf("%d ", num / 2048);
 
                if ((unsigned) addr % (1024 * 1024) == 0)
                        printf("%d ", num / 2048);
@@ -1047,12 +1033,3 @@ sddump(dev_t dev)
        }
        return (0);
 }
        }
        return (0);
 }
-#else  /* SCSIDUMP */
-errval
-sddump()
-{
-       printf("\nsddump()        -- not implemented\n");
-       DELAY(60000000);        /* 60 seconds */
-       return -1;
-}
-#endif /* SCSIDUMP */