"update from Mike Hibler at Utah"
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 26 May 1990 06:45:07 +0000 (22:45 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 26 May 1990 06:45:07 +0000 (22:45 -0800)
SCCS-vsn: sys/hp/dev/device.h 7.2
SCCS-vsn: sys/hp/dev/grf.c 7.2
SCCS-vsn: sys/hp300/dev/grf_rb.c 7.2
SCCS-vsn: sys/hp/dev/hil.c 7.2
SCCS-vsn: sys/hp300/dev/rd.c 7.3

usr/src/sys/hp/dev/device.h
usr/src/sys/hp/dev/grf.c
usr/src/sys/hp/dev/hil.c
usr/src/sys/hp300/dev/grf_rb.c
usr/src/sys/hp300/dev/rd.c

index ecbdfce..becd27a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)device.h    7.1 (Berkeley) %G%
+ *     @(#)device.h    7.2 (Berkeley) %G%
  */
 
 struct driver {
  */
 
 struct driver {
@@ -74,12 +74,15 @@ struct hp_hw {
 #define        CT              0x2c
 
 /* These are not controllers, but may have their own HPIB address */
 #define        CT              0x2c
 
 /* These are not controllers, but may have their own HPIB address */
-#define        BITMAP          0x01
-#define        NET             0x02
-#define        COMM            0x03
-#define        FPA             0x04
-#define        MISC            0x05
-#define KEYBOARD       0x06
+#define        BITMAP          1
+#define        NET             2
+#define        FPA             4
+#define        MISC            5
+#define        KEYBOARD        6
+#define        COMMDCA         7
+#define        COMMDCM         8
+#define        COMMDCL         9
+#define        PPORT           10
 
 #ifdef KERNEL
 extern struct hp_ctlr  hp_cinit[];
 
 #ifdef KERNEL
 extern struct hp_ctlr  hp_cinit[];
index 8d405dc..756522f 100644 (file)
@@ -11,7 +11,7 @@
  *
  * from: Utah $Hdr: grf.c 1.28 89/08/14$
  *
  *
  * from: Utah $Hdr: grf.c 1.28 89/08/14$
  *
- *     @(#)grf.c       7.1 (Berkeley) %G%
+ *     @(#)grf.c       7.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -295,6 +295,9 @@ grflock(gp, block)
        register struct grf_softc *gp;
        int block;
 {
        register struct grf_softc *gp;
        int block;
 {
+       int error;
+       extern char devioc[];
+
 #ifdef DEBUG
        if (grfdebug & GDB_LOCK)
                printf("grflock(%d): dev %x flags %x lockpid %x\n",
 #ifdef DEBUG
        if (grfdebug & GDB_LOCK)
                printf("grflock(%d): dev %x flags %x lockpid %x\n",
@@ -324,6 +327,11 @@ grflock(gp, block)
                do {
                        gp->g_flags |= GF_WANTED;
                        sleep((caddr_t)&gp->g_flags, PZERO+1);
                do {
                        gp->g_flags |= GF_WANTED;
                        sleep((caddr_t)&gp->g_flags, PZERO+1);
+
+                       if (error = tsleep((caddr_t)&gp->g_flags,
+                                          (PZERO+1) | PCATCH, devioc, 0))
+                               return (error);
+
                } while (gp->g_lockp);
        }
        gp->g_lockp = u.u_procp;
                } while (gp->g_lockp);
        }
        gp->g_lockp = u.u_procp;
index 39adf9c..37ce675 100644 (file)
@@ -11,7 +11,7 @@
  *
  * from: Utah $Hdr: hil.c 1.33 89/12/22$
  *
  *
  * from: Utah $Hdr: hil.c 1.33 89/12/22$
  *
- *     @(#)hil.c       7.1 (Berkeley) %G%
+ *     @(#)hil.c       7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -52,6 +52,9 @@ int   hildebug = 0;
 #define HDB_EVENTS     0x80
 #endif
 
 #define HDB_EVENTS     0x80
 #endif
 
+/* symbolic sleep message strings */
+char hilin[] = "hilin";
+
 hilinit()
 {
        register struct hilloop *hilp = &hil0;  /* XXX */
 hilinit()
 {
        register struct hilloop *hilp = &hil0;  /* XXX */
@@ -269,7 +272,10 @@ hilread(dev, uio)
                        return(EWOULDBLOCK);
                }
                dptr->hd_flags |= HIL_ASLEEP;
                        return(EWOULDBLOCK);
                }
                dptr->hd_flags |= HIL_ASLEEP;
-               sleep((caddr_t)dptr, TTIPRI);
+               if (error = tsleep((caddr_t)dptr, TTIPRI | PCATCH, hilin, 0)) {
+                       (void) spl0();
+                       return (error);
+               }
        }
        (void) spl0();
 
        }
        (void) spl0();
 
index f9f89d4..42175c5 100644 (file)
@@ -11,7 +11,7 @@
  *
  * from: Utah $Hdr: grf_rb.c 1.10 89/04/11$
  *
  *
  * from: Utah $Hdr: grf_rb.c 1.10 89/04/11$
  *
- *     @(#)grf_rb.c    7.1 (Berkeley) %G%
+ *     @(#)grf_rb.c    7.2 (Berkeley) %G%
  */
 
 #include "grf.h"
  */
 
 #include "grf.h"
 
 #include "machine/cpu.h"
 
 
 #include "machine/cpu.h"
 
-#ifdef notyet
-static short rb_microcode[] = {
-       0x5efe, 0x8a38, 0x0000, 0x0000, 0x0f00, 0, 0, 0,
-       0x3efe, 0x8a38, 0x0000, 0x7003, 0xf706, 0, 0, 0,
-       0x1efe, 0x8a38, 0x0000, 0x0000, 0x0000, 0, 0, 0,
-       0x3efe, 0x8a38, 0x0000, 0x7003, 0xfc06, 0, 0, 0,
-       0x1efe, 0x8a38, 0x0000, 0x0000, 0x0000, 0, 0, 0,
-       0x3efe, 0x8a38, 0x0004, 0x40f7, 0xa006, 0, 0, 0,
-       0x9efe, 0x8a38, 0x0000, 0x0000, 0x0000, 0, 0, 0,
-       0x1efe, 0x8a38, 0x0000, 0x0000, 0x0000
-};
-#endif
-
 /*
  * Initialize hardware.
  * Must point g_display at a grfinfo structure describing the hardware.
 /*
  * Initialize hardware.
  * Must point g_display at a grfinfo structure describing the hardware.
@@ -70,51 +57,6 @@ rb_init(gp, addr)
        return(1);
 }
 
        return(1);
 }
 
-#ifdef notyet
-/*
- * Download the microcode to the rbox.
- */
-rb_download_microcode(regbase)
-     caddr_t regbase;
-{
-       register short *rb_microcode_ptr = rb_microcode;
-       register short *rb_cntlstore_ptr = (short *)((char *)regbase + 0xC000);
-       register int i;
-
-       /*
-        * Reset and halt transform engine
-        */
-       *((char *)regbase + 0x8002) = 0x00a0;
-       *((char *)regbase + 0x8002) = 0x0020;
-       *((char *)regbase + 0x8002) = 0x0080;
-
-       /*
-        * Select the first bank of control store.
-        */
-       *((char *)regbase + 0x8007) = 0x0;
-
-       /*
-        * Write the microcode into the control store address space.
-        */
-       for (i = 0; i < sizeof(rb_microcode) / sizeof(rb_microcode[0]); i++)
-               *rb_cntlstore_ptr++ = *rb_microcode_ptr++;
-
-       /*
-        * Start microcode execution.
-        */
-       *(short *)((char *)regbase + 0x8002) = 0x2000;
-       *(short *)((char *)regbase + 0x8002) = 0x0;
-       
-       /*
-        * wait for renaissance to finish up.
-        */
-       for (i = 0; i < 1000; i++) {
-               if (*((char *)regbase + 0x8012) < 0)
-                       continue;
-       }
-}
-#endif
-
 /*
  * Change the mode of the display.
  * Right now all we can do is grfon/grfoff.
 /*
  * Change the mode of the display.
  * Right now all we can do is grfon/grfoff.
index 523d378..4814e93 100644 (file)
@@ -11,7 +11,7 @@
  *
  * from: Utah $Hdr: rd.c 1.30 89/09/17$
  *
  *
  * from: Utah $Hdr: rd.c 1.30 89/09/17$
  *
- *     @(#)rd.c        7.2 (Berkeley) %G%
+ *     @(#)rd.c        7.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -38,19 +38,20 @@ struct      driver rddriver = {
 
 struct rd_softc {
        struct  hp_device *sc_hd;
 
 struct rd_softc {
        struct  hp_device *sc_hd;
+       int     sc_flags;
+       short   sc_type;
+       short   sc_punit;
+       char    *sc_addr;
+       int     sc_resid;
+       u_int   sc_wpms;
+       struct  rdinfo *sc_info;
+       struct  devqueue sc_dq;
        struct  rd_iocmd sc_ioc;
        struct  rd_rscmd sc_rsc;
        struct  rd_stat sc_stat;
        struct  rd_ssmcmd sc_ssmc;
        struct  rd_srcmd sc_src;
        struct  rd_clearcmd sc_clear;
        struct  rd_iocmd sc_ioc;
        struct  rd_rscmd sc_rsc;
        struct  rd_stat sc_stat;
        struct  rd_ssmcmd sc_ssmc;
        struct  rd_srcmd sc_src;
        struct  rd_clearcmd sc_clear;
-       int     sc_resid;
-       char    *sc_addr;
-       struct  rdinfo *sc_info;
-       int     sc_flags;
-       short   sc_type;
-       short   sc_punit;
-       struct  devqueue sc_dq;
 } rd_softc[NRD];
 
 /* sc_flags values */
 } rd_softc[NRD];
 
 /* sc_flags values */
@@ -373,6 +374,8 @@ struct      buf rdbuf[NRD];
 #define        RDRETRY         5
 #define RDWAITC                1       /* min time for timeout in seconds */
 
 #define        RDRETRY         5
 #define RDWAITC                1       /* min time for timeout in seconds */
 
+int rderrthresh = RDRETRY-1;   /* when to start reporting errors */
+
 rdinit(hd)
        register struct hp_device *hd;
 {
 rdinit(hd)
        register struct hp_device *hd;
 {
@@ -389,6 +392,11 @@ rdinit(hd)
        rs->sc_dq.dq_driver = &rddriver;
        rs->sc_info = &rdinfo[rs->sc_type];
        rs->sc_flags = RDF_ALIVE;
        rs->sc_dq.dq_driver = &rddriver;
        rs->sc_info = &rdinfo[rs->sc_type];
        rs->sc_flags = RDF_ALIVE;
+#ifdef DEBUG
+       /* always report errors */
+       if (rddebug & RDB_ERROR)
+               rderrthresh = 0;
+#endif
        return(1);
 }
 
        return(1);
 }
 
@@ -442,6 +450,8 @@ rdident(rs, hd)
                        name[i] = (n & 0xf) + '0';
                        n >>= 4;
                }
                        name[i] = (n & 0xf) + '0';
                        n >>= 4;
                }
+               /* use drive characteristics to calculate xfer rate */
+               rs->sc_wpms = 1000000 * (desc.d_sectsize/2) / desc.d_blocktime;
        }
 #ifdef DEBUG
        if (rddebug & RDB_IDENT) {
        }
 #ifdef DEBUG
        if (rddebug & RDB_IDENT) {
@@ -536,8 +546,12 @@ rdopen(dev, flags)
 
        if (unit >= NRD || (rs->sc_flags & RDF_ALIVE) == 0)
                return(ENXIO);
 
        if (unit >= NRD || (rs->sc_flags & RDF_ALIVE) == 0)
                return(ENXIO);
-       if (rs->sc_hd->hp_dk >= 0)
-       dk_wpms[rs->sc_hd->hp_dk] = 60 * rs->sc_info->nbpt * DEV_BSIZE / 2;
+       if (rs->sc_hd->hp_dk >= 0) {
+               /* guess at xfer rate based on 3600 rpm (60 rps) */
+               if (rs->sc_wpms == 0)
+                       rs->sc_wpms = 60 * rs->sc_info->nbpt * DEV_BSIZE / 2;
+               dk_wpms[rs->sc_hd->hp_dk] = rs->sc_wpms;
+       }
        return(0);
 }
 
        return(0);
 }
 
@@ -830,7 +844,7 @@ rderror(unit)
        struct rd_softc *rs = &rd_softc[unit];
        register struct rd_stat *sp;
        struct buf *bp;
        struct rd_softc *rs = &rd_softc[unit];
        register struct rd_stat *sp;
        struct buf *bp;
-       daddr_t bn, pbn;
+       daddr_t hwbn, pbn;
 
        if (rdstatus(rs)) {
 #ifdef DEBUG
 
        if (rdstatus(rs)) {
 #ifdef DEBUG
@@ -865,21 +879,29 @@ rderror(unit)
                timeout(rdrestart, unit, rdtimo*hz);
                return(0);
        }
                timeout(rdrestart, unit, rdtimo*hz);
                return(0);
        }
-       bp = rdtab[unit].b_actf;
+       /*
+        * Only report error if we have reached the error reporting
+        * threshhold.  By default, this will only report after the
+        * retry limit has been exceeded.
+        */
+       if (rdtab[unit].b_errcnt < rderrthresh)
+               return(1);
+
        /*
         * First conjure up the block number at which the error occured.
         * Note that not all errors report a block number, in that case
         * we just use b_blkno.
         */
        /*
         * First conjure up the block number at which the error occured.
         * Note that not all errors report a block number, in that case
         * we just use b_blkno.
         */
-       pbn = RDSTOB(rs->sc_info->nbpc *
-                    rs->sc_info->sizes[rdpart(bp->b_dev)].cyloff);
+       bp = rdtab[unit].b_actf;
+       pbn = rs->sc_info->nbpc *
+               rs->sc_info->sizes[rdpart(bp->b_dev)].cyloff;
        if ((sp->c_fef & FEF_CU) || (sp->c_fef & FEF_DR) ||
            (sp->c_ief & IEF_RRMASK)) {
        if ((sp->c_fef & FEF_CU) || (sp->c_fef & FEF_DR) ||
            (sp->c_ief & IEF_RRMASK)) {
-               bn = pbn + bp->b_blkno;
+               hwbn = RDBTOS(pbn + bp->b_blkno);
                pbn = bp->b_blkno;
        } else {
                pbn = bp->b_blkno;
        } else {
-               bn = RDSTOB(sp->c_blk);
-               pbn = bn - pbn;
+               hwbn = sp->c_blk;
+               pbn = RDSTOB(hwbn) - pbn;
        }
        /*
         * Now output a generic message suitable for badsect.
        }
        /*
         * Now output a generic message suitable for badsect.
@@ -904,7 +926,7 @@ rderror(unit)
                rdprinterr("fault", sp->c_fef, err_fault);
                rdprinterr("access", sp->c_aef, err_access);
                rdprinterr("info", sp->c_ief, err_info);
                rdprinterr("fault", sp->c_fef, err_fault);
                rdprinterr("access", sp->c_aef, err_access);
                rdprinterr("info", sp->c_ief, err_info);
-               printf("    block: %d, P1-P10: ", bn);
+               printf("    block: %d, P1-P10: ", hwbn);
                printf("%s", hexstr(*(u_int *)&sp->c_raw[0], 8));
                printf("%s", hexstr(*(u_int *)&sp->c_raw[4], 8));
                printf("%s\n", hexstr(*(u_short *)&sp->c_raw[8], 4));
                printf("%s", hexstr(*(u_int *)&sp->c_raw[0], 8));
                printf("%s", hexstr(*(u_int *)&sp->c_raw[4], 8));
                printf("%s\n", hexstr(*(u_short *)&sp->c_raw[8], 4));