split header files in 2 and rename structures for sanity
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Mon, 9 Mar 1981 08:17:13 +0000 (00:17 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Mon, 9 Mar 1981 08:17:13 +0000 (00:17 -0800)
SCCS-vsn: sys/vax/mba/mbavar.h 4.13

usr/src/sys/vax/mba/mbavar.h

index 4b586f3..b4733f1 100644 (file)
-/*     mbavar.h        4.12    81/03/03        */
+/*     mbavar.h        4.13    81/03/08        */
 
 /*
 
 /*
- * VAX Massbus adapter registers
+ * This file contains definitions related to the kernel structures
+ * for dealing with the massbus adapters.
+ *
+ * Each mba has a mba_hd structure.
+ * Each massbus device has a mba_device structure.
+ * Each massbus slave has a mba_slave structure.
+ *
+ * At boot time we prowl the structures and fill in the pointers
+ * for devices which we find.
  */
 
  */
 
-struct mba_regs
-{
-       int     mba_csr;                /* configuration register */
-       int     mba_cr;                 /* control register */
-       int     mba_sr;                 /* status register */
-       int     mba_var;                /* virtual address register */
-       int     mba_bcr;                /* byte count register */
-       int     mba_dr;
-       int     mba_pad1[250];
-       struct mba_drv {                /* per drive registers */
-               int     mbd_cs1;                /* control status */
-               int     mbd_ds;                 /* drive status */
-               int     mbd_er1;                /* error register */
-               int     mbd_mr1;                /* maintenance register */
-               int     mbd_as;                 /* attention status */
-               int     mbd_da;                 /* desired address (disks) */
-#define        mbd_fc  mbd_da                          /* frame count (tapes) */
-               int     mbd_dt;                 /* drive type */
-               int     mbd_la;                 /* look ahead (disks) */
-#define        mbd_ck  mbd_la                          /* ??? (tapes) */
-               int     mbd_sn;                 /* serial number */
-               int     mbd_of;                 /* ??? */
-#define        mbd_tc  mbd_of                          /* ??? */
-               int     mbd_fill[22];
-       } mba_drv[8];
-       struct  pte mba_map[256];       /* io space virtual map */
-       int     mba_pad2[256*5];        /* to size of a nexus */
-};
-
-/*
- * Bits in mba_cr
- */
-#define        MBAINIT         0x1             /* init mba */
-#define        MBAIE           0x4             /* enable mba interrupts */
-
-/*
- * Bits in mba_sr
- */
-#define        MBS_DTBUSY      0x80000000      /* data transfer busy */
-#define        MBS_NRCONF      0x40000000      /* no response confirmation */
-#define        MBS_CRD         0x20000000      /* corrected read data */
-#define        MBS_CBHUNG      0x00800000      /* control bus hung */
-#define        MBS_PGE         0x00080000      /* programming error */
-#define        MBS_NED         0x00040000      /* non-existant drive */
-#define        MBS_MCPE        0x00020000      /* massbus control parity error */
-#define        MBS_ATTN        0x00010000      /* attention from massbus */
-#define        MBS_SPE         0x00004000      /* silo parity error */
-#define        MBS_DTCMP       0x00002000      /* data transfer completed */
-#define        MBS_DTABT       0x00001000      /* data transfer aborted */
-#define        MBS_DLT         0x00000800      /* data late */
-#define        MBS_WCKUP       0x00000400      /* write check upper */
-#define        MBS_WCKLWR      0x00000200      /* write check lower */
-#define        MBS_MXF         0x00000100      /* miss transfer error */
-#define        MBS_MBEXC       0x00000080      /* massbus exception */
-#define        MBS_MDPE        0x00000040      /* massbus data parity error */
-#define        MBS_MAPPE       0x00000020      /* page frame map parity error */
-#define        MBS_INVMAP      0x00000010      /* invalid map */
-#define        MBS_ERRCONF     0x00000008      /* error confirmation */
-#define        MBS_RDS         0x00000004      /* read data substitute */
-#define        MBS_ISTIMO      0x00000002      /* interface sequence timeout */
-#define        MBS_RDTIMO      0x00000001      /* read data timeout */
-
-#define MBASR_BITS \
-"\20\40DTBUSY\37NRCONF\36CRD\30CBHUNG\24PGE\23NED\22MCPE\21ATTN\
-\17SPE\16DTCMP\15DTABT\14DLT\13WCKUP\12WCKLWR\11MXF\10MBEXC\7MDPE\
-\6MAPPE\5INVMAP\4ERRCONF\3RDS\2ISTIMO\1RDTIMO"
-
-#define        MBASR_HARD      (MBS_PGE|MBS_ERRCONF|MBS_ISTIMO|MBS_RDTIMO)
-
-#define MBAEBITS       (~(MBS_DTBUSY|MBS_CRD|MBS_ATTN|MBS_DTCMP))
-
-extern char    mbasr_bits[];
-
 /*
 /*
- * Commands for mbd_cs1
+ * Per-mba structure.
+ *
+ * The initialization routine uses the information in the mbdinit table
+ * to initialize the what is attached to each massbus slot information.
+ * It counts the number of devices on each mba (to see if bothering to
+ * search/seek is appropriate).
+ *
+ * During normal operation, the devices attached to the mba which wish
+ * to transfer are queued on the mh_act? links.
  */
  */
-#define        MBD_WCOM        0x30
-#define        MBD_RCOM        0x38
-#define        MBD_GO          0x1
-
-/*
- * Bits in mbd_ds.
- */
-#define        MBD_DRY         0x80            /* drive ready */
-#define        MBD_MOL         0x1000          /* medium on line */
-#define        MBD_DPR         0x100           /* drive present */
-#define        MBD_ERR         0x4000          /* error in drive */
-
-/*
- * Bits in mbd_dt
- */
-#define        MBDT_NSA        0x8000          /* not sector addressible */
-#define        MBDT_TAP        0x4000          /* is a tape */
-#define        MBDT_MOH        0x2000          /* moving head */
-#define        MBDT_7CH        0x1000          /* 7 channel */
-#define        MBDT_DRQ        0x800           /* drive request required */
-#define        MBDT_SPR        0x400           /* slave present */
-
-#define        MBDT_TYPE       0x1ff
-#define        MBDT_MASK       (MBDT_NSA|MBDT_TAP|MBDT_TYPE)
-
-/* type codes for disk drives */
-#define        MBDT_RP04       020
-#define        MBDT_RP05       021
-#define        MBDT_RP06       022
-#define        MBDT_RP07       042
-#define        MBDT_RM03       024
-#define        MBDT_RM05       027
-#define        MBDT_RM80       026
-
-/* type codes for tape drives */
-#define        MBDT_TM03       050
-#define        MBDT_TE16       051
-#define        MBDT_TU45       052
-#define        MBDT_TU77       054
-#define        MBDT_TU78       0140            /* can't handle these (yet) */
+struct mba_hd {
+       short   mh_active;              /* set if mba is active */
+       short   mh_ndrive;              /* number of devices, to avoid seeks */
+       struct  mba_regs *mh_mba;       /* virt addr of mba */
+       struct  mba_regs *mh_physmba;   /* phys addr of mba */
+       struct  mba_device *mh_mbip[8]; /* what is attached to each dev */
+       struct  mba_device *mh_actf;    /* head of queue to transfer */
+       struct  mba_device *mh_actl;    /* tail of queue to transfer */
+};
 
 /*
 
 /*
- * Each driver has an array of pointers to these structures, one for
- * each device it is willing to handle.  At bootstrap time, the
- * driver tables are filled in;
+ * Per-device structure
+ * (one for each RM/RP disk, and one for each tape formatter).
+ *
+ * This structure is used by the device driver as its argument
+ * to the massbus driver, and by the massbus driver to locate
+ * the device driver for a particular massbus slot.
+ *
+ * The device drivers hang ready buffers on this structure,
+ * and the massbus driver will start i/o on the first such buffer
+ * when appropriate.
  */
  */
-struct mba_info {
+struct mba_device {
        struct  mba_driver *mi_driver;
        struct  mba_driver *mi_driver;
-       short   mi_name;        /* two character generic name */
        short   mi_unit;        /* unit number to the system */
        short   mi_mbanum;      /* the mba it is on */
        short   mi_drive;       /* controller on mba */
        short   mi_unit;        /* unit number to the system */
        short   mi_mbanum;      /* the mba it is on */
        short   mi_drive;       /* controller on mba */
-       short   mi_slave;       /* slave to controller (TM03/TU16) */
        short   mi_dk;          /* driver number for iostat */
        short   mi_alive;       /* device exists */
        short   mi_type;        /* driver specific unit type */
        struct  buf mi_tab;     /* head of queue for this device */
        short   mi_dk;          /* driver number for iostat */
        short   mi_alive;       /* device exists */
        short   mi_type;        /* driver specific unit type */
        struct  buf mi_tab;     /* head of queue for this device */
-       struct  mba_info *mi_forw;
+       struct  mba_device *mi_forw;
 /* we could compute these every time, but hereby save time */
        struct  mba_regs *mi_mba;
        struct  mba_drv *mi_drv;
 /* we could compute these every time, but hereby save time */
        struct  mba_regs *mi_mba;
        struct  mba_drv *mi_drv;
@@ -145,38 +62,36 @@ struct     mba_info {
 };
 
 /*
 };
 
 /*
- * The initialization routine uses the information in the mbinit table
- * to initialize the drive type routines in the drivers and the
- * mbahd array summarizing which devices are hooked to which massbus slots.
+ * Tape formatter slaves are specified by
+ * the following information which is used
+ * at boot time to initialize the tape driver
+ * internal tables.
  */
  */
-struct mba_hd {
-       short   mh_active;
-       short   mh_ndrive;
-       struct  mba_regs *mh_mba;       /* virt addr of mba */
-       struct  mba_regs *mh_physmba;   /* phys addr of mba */
-       struct  mba_info *mh_mbip[8];   /* what is attached */
-       struct  mba_info *mh_actf;      /* head of queue to transfer */
-       struct  mba_info *mh_actl;      /* tail of queue to transfer */
+struct mba_slave {
+       struct  mba_driver *ms_driver;
+       short   ms_ctlr;                /* which of several formatters */
+       short   ms_unit;                /* which unit to system */
+       short   ms_slave;               /* which slave to formatter */
+       short   ms_alive;
 };
 };
-/*
- * Values for flags; normally MH_NOSEEK will be set when there is
- * only a single drive on an massbus.
- */
-#define        MH_NOSEEK       1
-#define        MH_NOSEARCH     2
 
 /*
 
 /*
- * Each massbus driver defines entries for a set of routines
- * as well as an array of types which are acceptable to it.
+ * Per device-type structure.
+ *
+ * Each massbus driver defines entries for a set of routines used
+ * by the massbus driver, as well as an array of types which are
+ * acceptable to it.
  */
 struct mba_driver {
  */
 struct mba_driver {
-       int     (*md_dkinit)();         /* setup dk info (mspw) */
+       int     (*md_attach)();         /* attach a device */
+       int     (*md_slave)();          /* attach a slave */
        int     (*md_ustart)();         /* unit start routine */
        int     (*md_start)();          /* setup a data transfer */
        int     (*md_dtint)();          /* data transfer complete */
        int     (*md_ndint)();          /* non-data transfer interrupt */
        short   *md_type;               /* array of drive type codes */
        int     (*md_ustart)();         /* unit start routine */
        int     (*md_start)();          /* setup a data transfer */
        int     (*md_dtint)();          /* data transfer complete */
        int     (*md_ndint)();          /* non-data transfer interrupt */
        short   *md_type;               /* array of drive type codes */
-       struct  mba_info **md_info;     /* backpointers to mbinit structs */
+       char    *md_dname, *md_sname;   /* device, slave names */
+       struct  mba_device **md_info;   /* backpointers to mbinit structs */
 };
 
 /*
 };
 
 /*
@@ -199,9 +114,11 @@ struct mba_driver {
  */
 #define        MBN_DONE        0               /* non-data transfer complete */
 #define        MBN_RETRY       1               /* failed; retry the operation */
  */
 #define        MBN_DONE        0               /* non-data transfer complete */
 #define        MBN_RETRY       1               /* failed; retry the operation */
+#define        MBN_SKIP        2               /* don't do anything */
+#define        MBN_CONT        3               /* operation continues */
 
 /*
 
 /*
- * Clear attention status for specified drive.
+ * Clear attention status for specified device.
  */
 #define        mbclrattn(mi)   ((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive)
 
  */
 #define        mbclrattn(mi)   ((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive)
 
@@ -212,7 +129,9 @@ struct mba_driver {
 #if NMBA > 0
 struct mba_hd mba_hd[NMBA];
 extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
 #if NMBA > 0
 struct mba_hd mba_hd[NMBA];
 extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
-extern struct  mba_info mbinit[];      /* blanks for filling mba_info */
+
+extern struct  mba_device mbdinit[];
+extern struct  mba_slave mbsinit[];
 int    nummba;
 #endif
 #endif
 int    nummba;
 #endif
 #endif